Skip to content

Commit 28f5e4a

Browse files
Add docker based benchmark instructions for ChatQnA (opea-project#859)
Signed-off-by: lvliang-intel <liang1.lv@intel.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent d55a33d commit 28f5e4a

File tree

2 files changed

+99
-9
lines changed

2 files changed

+99
-9
lines changed

ChatQnA/benchmark/performance/README.md

Lines changed: 96 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ Results will be displayed in the terminal and saved as CSV file named `1_stats.c
2929

3030
## Getting Started
3131

32+
We recommend using Kubernetes to deploy the ChatQnA service, as it offers benefits such as load balancing and improved scalability. However, you can also deploy the service using Docker if that better suits your needs. Below is a description of Kubernetes deployment and benchmarking. For instructions on deploying and benchmarking with Docker, please refer to [this section](#benchmark-with-docker).
33+
3234
### Prerequisites
3335

3436
- Install Kubernetes by following [this guide](https://github.com/opea-project/docs/blob/main/guide/installation/k8s_install/k8s_install_kubespray.md).
@@ -187,10 +189,13 @@ curl -X POST "http://${cluster_ip}:6007/v1/dataprep" \
187189

188190
###### 3.2 Run Benchmark Test
189191

190-
We copy the configuration file [benchmark.yaml](./benchmark.yaml) to `GenAIEval/evals/benchmark/benchmark.yaml` and config `test_suite_config.user_queries` and `test_suite_config.test_output_dir`.
192+
We copy the configuration file [benchmark.yaml](./benchmark.yaml) to `GenAIEval/evals/benchmark/benchmark.yaml` and config `test_suite_config.deployment_type`, `test_suite_config.service_ip`, `test_suite_config.service_port`, `test_suite_config.user_queries` and `test_suite_config.test_output_dir`.
191193

192194
```bash
193-
export USER_QUERIES="[4, 8, 16, 640]"
195+
export DEPLOYMENT_TYPE="k8s"
196+
export SERVICE_IP = None
197+
export SERVICE_PORT = None
198+
export USER_QUERIES="[640, 640, 640, 640]"
194199
export TEST_OUTPUT_DIR="/home/sdp/benchmark_output/node_1"
195200
envsubst < ./benchmark.yaml > GenAIEval/evals/benchmark/benchmark.yaml
196201
```
@@ -237,20 +242,22 @@ kubectl apply -f .
237242

238243
##### 3. Run tests
239244

240-
We copy the configuration file [benchmark.yaml](./benchmark.yaml) to `GenAIEval/evals/benchmark/benchmark.yaml` and config `test_suite_config.user_queries` and `test_suite_config.test_output_dir`.
245+
We copy the configuration file [benchmark.yaml](./benchmark.yaml) to `GenAIEval/evals/benchmark/benchmark.yaml` and config `test_suite_config.deployment_type`, `test_suite_config.service_ip`, `test_suite_config.service_port`, `test_suite_config.user_queries` and `test_suite_config.test_output_dir`.
241246

242-
```bash
243-
export USER_QUERIES="[4, 8, 16, 1280]"
247+
````bash
248+
export DEPLOYMENT_TYPE="k8s"
249+
export SERVICE_IP = None
250+
export SERVICE_PORT = None
251+
export USER_QUERIES="[1280, 1280, 1280, 1280]"
244252
export TEST_OUTPUT_DIR="/home/sdp/benchmark_output/node_2"
245253
envsubst < ./benchmark.yaml > GenAIEval/evals/benchmark/benchmark.yaml
246-
```
247254

248255
And then run the benchmark tool by:
249256

250257
```bash
251258
cd GenAIEval/evals/benchmark
252259
python benchmark.py
253-
```
260+
````
254261
255262
##### 4. Data collection
256263
@@ -286,10 +293,13 @@ kubectl apply -f .
286293

287294
##### 3. Run tests
288295

289-
We copy the configuration file [benchmark.yaml](./benchmark.yaml) to `GenAIEval/evals/benchmark/benchmark.yaml` and config `test_suite_config.user_queries` and `test_suite_config.test_output_dir`.
296+
We copy the configuration file [benchmark.yaml](./benchmark.yaml) to `GenAIEval/evals/benchmark/benchmark.yaml` and config `test_suite_config.deployment_type`, `test_suite_config.service_ip`, `test_suite_config.service_port`, `test_suite_config.user_queries` and `test_suite_config.test_output_dir`.
290297

291298
```bash
292-
export USER_QUERIES="[4, 8, 16, 2560]"
299+
export DEPLOYMENT_TYPE="k8s"
300+
export SERVICE_IP = None
301+
export SERVICE_PORT = None
302+
export USER_QUERIES="[2560, 2560, 2560, 2560]"
293303
export TEST_OUTPUT_DIR="/home/sdp/benchmark_output/node_4"
294304
envsubst < ./benchmark.yaml > GenAIEval/evals/benchmark/benchmark.yaml
295305
```
@@ -313,3 +323,80 @@ cd GenAIExamples/ChatQnA/benchmark/performance/tuned/with_rerank/single_gaudi
313323
kubectl delete -f .
314324
kubectl label nodes k8s-master k8s-worker1 k8s-worker2 k8s-worker3 node-type-
315325
```
326+
327+
## Benchmark with Docker
328+
329+
### Deploy ChatQnA service with Docker
330+
331+
In order to set up the environment correctly, you'll need to configure essential environment variables and, if applicable, proxy-related variables.
332+
333+
```bash
334+
# Example: host_ip="192.168.1.1"
335+
export host_ip="External_Public_IP"
336+
# Example: no_proxy="localhost, 127.0.0.1, 192.168.1.1"
337+
export no_proxy="Your_No_Proxy"
338+
export http_proxy="Your_HTTP_Proxy"
339+
export https_proxy="Your_HTTPs_Proxy"
340+
export HUGGINGFACEHUB_API_TOKEN="Your_Huggingface_API_Token"
341+
```
342+
343+
#### Deploy ChatQnA on Gaudi
344+
345+
```bash
346+
cd GenAIExamples/ChatQnA/docker_compose/intel/hpu/gaudi/
347+
docker compose up -d
348+
```
349+
350+
Refer to the [Gaudi Guide](../../docker_compose/intel/hpu/gaudi/README.md) to build docker images from source.
351+
352+
#### Deploy ChatQnA on Xeon
353+
354+
```bash
355+
cd GenAIExamples/ChatQnA/docker_compose/intel/cpu/xeon/
356+
docker compose up -d
357+
```
358+
359+
Refer to the [Xeon Guide](../../docker_compose/intel/cpu/xeon/README.md) for more instructions on building docker images from source.
360+
361+
#### Deploy ChatQnA on NVIDIA GPU
362+
363+
```bash
364+
cd GenAIExamples/ChatQnA/docker_compose/nvidia/gpu/
365+
docker compose up -d
366+
```
367+
368+
Refer to the [NVIDIA GPU Guide](../../docker_compose/nvidia/gpu/README.md) for more instructions on building docker images from source.
369+
370+
### Run tests
371+
372+
We copy the configuration file [benchmark.yaml](./benchmark.yaml) to `GenAIEval/evals/benchmark/benchmark.yaml` and config `test_suite_config.deployment_type`, `test_suite_config.service_ip`, `test_suite_config.service_port`, `test_suite_config.user_queries` and `test_suite_config.test_output_dir`.
373+
374+
```bash
375+
export DEPLOYMENT_TYPE="docker"
376+
export SERVICE_IP = "ChatQnA Service IP"
377+
export SERVICE_PORT = "ChatQnA Service Port"
378+
export USER_QUERIES="[640, 640, 640, 640]"
379+
export TEST_OUTPUT_DIR="/home/sdp/benchmark_output/docker"
380+
envsubst < ./benchmark.yaml > GenAIEval/evals/benchmark/benchmark.yaml
381+
```
382+
383+
And then run the benchmark tool by:
384+
385+
```bash
386+
cd GenAIEval/evals/benchmark
387+
python benchmark.py
388+
```
389+
390+
### Data collection
391+
392+
All the test results will come to this folder `/home/sdp/benchmark_output/docker` configured by the environment variable `TEST_OUTPUT_DIR` in previous steps.
393+
394+
### Clean up
395+
396+
Take gaudi as example, use the below command to clean up system.
397+
398+
```bash
399+
cd GenAIExamples/docker_compose/intel/hpu/gaudi
400+
docker compose stop && docker compose rm -f
401+
echo y | docker system prune
402+
```

ChatQnA/benchmark/performance/benchmark.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
test_suite_config: # Overall configuration settings for the test suite
55
examples: ["chatqna"] # The specific test cases being tested, e.g., chatqna, codegen, codetrans, faqgen, audioqna, visualqna
6+
deployment_type: ${DEPLOYMENT_TYPE} # Default is "k8s", can also be "docker"
7+
service_ip: ${SERVICE_IP} # Leave as None for k8s, specify for Docker
8+
service_port: ${SERVICE_PORT} # Leave as None for k8s, specify for Docker
69
concurrent_level: 5 # The concurrency level, adjustable based on requirements
710
user_queries: ${USER_QUERIES} # Number of test requests at each concurrency level
811
random_prompt: false # Use random prompts if true, fixed prompts if false

0 commit comments

Comments
 (0)