Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/qa/perf
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-08-22 18:10:52 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-08-22 18:10:52 +0300
commitb52aefb5996cdd22dc969161d414244a59046e6e (patch)
tree9b1e3fe92ababfcc3110dca0380727a593220bd4 /qa/perf
parent4fc46d75644b28789e83c95ec4d1309498bb4ba3 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa/perf')
-rw-r--r--qa/perf/ai/Dockerfile.ab7
-rw-r--r--qa/perf/ai/README.md43
-rw-r--r--qa/perf/ai/prompt.json10
3 files changed, 60 insertions, 0 deletions
diff --git a/qa/perf/ai/Dockerfile.ab b/qa/perf/ai/Dockerfile.ab
new file mode 100644
index 00000000000..72c4681ed47
--- /dev/null
+++ b/qa/perf/ai/Dockerfile.ab
@@ -0,0 +1,7 @@
+FROM alpine:3.18
+
+RUN apk add --no-cache apache2-utils
+
+COPY prompt.json .
+
+ENTRYPOINT [ "/usr/bin/ab" ]
diff --git a/qa/perf/ai/README.md b/qa/perf/ai/README.md
new file mode 100644
index 00000000000..c0fbcf09f0c
--- /dev/null
+++ b/qa/perf/ai/README.md
@@ -0,0 +1,43 @@
+# Performance testing tools for AI features
+
+## Code Suggestions
+
+These tests are based on [examples from testing of the Code Suggestions Model Gateway](https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist/-/issues/77).
+
+### Apache Bench
+
+If you're using a Mac you may already have the [Apache Bench](https://httpd.apache.org/docs/current/programs/ab.html) tool installed:
+
+```shell
+$ which ab
+/usr/sbin/ab
+```
+
+#### Build a Docker image
+
+If you don't already have Apache Bench installed, [`Dockerfile.ab`](Dockerfile.ab) allows you to build a Docker image that you can use to run it.
+
+To build the image, from the `qa/perf/ai` directory run:
+
+```shell
+docker build -t ab -f Dockerfile.ab .
+```
+
+That will create an image named `ab`. When you start a container via `docker run <image>` any arguments that follow will be passed to `ab` inside
+the container. The command in the section below assumes you have Apache Bench installed, but you can use the image you built if you
+add `docker run --rm` in front of the command. For example, instead of `ab -n 1000 ...` use `docker run --rm ab -n 1000 ...`.
+
+### Run tests
+
+WARNING:
+Be mindful of the potential impact before running a performance test. It could disrupt accessibility for other users and could be problematic for our use of third-party services. If you're unsure, consult the relevant teams (those working on the Code Suggestions feature, the [AI-powered:AI Framework](https://about.gitlab.com/handbook/product/categories/#ai-framework-group) group, the [Create:Code Creation](https://about.gitlab.com/handbook/product/categories/#code-creation-group) group, and the [`#g_code_suggestions` Slack channel (internal)](https://gitlab.slack.com/archives/C048Z2DHWGP))
+
+To run performance tests using Apache Bench, execute the following from the `qa/perf/ai` directory:
+
+```shell
+export GITLAB_PAT=<your personal access token>
+export URL=<the code suggestions endpoint to test>
+ab -n 1000 -c 20 -H "Authorization: Bearer $GITLAB_PAT" -T 'application/json' -p prompt.json $URL
+```
+
+For example, if `$URL` were `https://staging.gitlab.com/api/v4/code_suggestions/completions` that command would `POST` 1000 requests, 20 at a time, to the staging Code Suggestions completions endpoint, using the data in [`prompt.json`](prompt.json) as the prompt.
diff --git a/qa/perf/ai/prompt.json b/qa/perf/ai/prompt.json
new file mode 100644
index 00000000000..8668f71f4f5
--- /dev/null
+++ b/qa/perf/ai/prompt.json
@@ -0,0 +1,10 @@
+{
+ "prompt_version": 1,
+ "project_path": "gitlab-org/gitlab",
+ "project_id": 278964,
+ "current_file": {
+ "file_name": "test.py",
+ "content_above_cursor": "import pytest",
+ "content_below_cursor": ""
+ }
+}