From 9dc0db4cfc4f6f3c18a030754e26c55954e2ed55 Mon Sep 17 00:00:00 2001 From: Somefive Date: Fri, 24 Mar 2023 18:04:18 +0800 Subject: [PATCH] Feat: add qps for load test client (#5733) Signed-off-by: Somefive --- hack/load-test/README.md | 6 +++++- hack/load-test/deploy.sh | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/hack/load-test/README.md b/hack/load-test/README.md index dc85dc049..18682495d 100644 --- a/hack/load-test/README.md +++ b/hack/load-test/README.md @@ -41,6 +41,10 @@ Set `CLUSTER=3` will inject the `CLUSTER` variable to the app template. You can > To make multicluster load testing environment, you can set up multiple k3d instances and register them in the control plane. +#### QPS + +By default, there is no rate limit for the client. If you want to set the QPS for each worker, you can use `QPS=2`. + ### Cleanup -Run `SHARD=3 WORKER=4 BEGIN=0 SIZE=1000 bash cleanup.sh` to delete `app-0` to `app-999` from namespace `load-test-0` to `load-test-2` in 4 threads. \ No newline at end of file +Run `SHARD=3 WORKER=4 BEGIN=0 SIZE=1000 bash cleanup.sh` to delete `app-0` to `app-999` from namespace `load-test-0` to `load-test-2` in 4 threads. diff --git a/hack/load-test/deploy.sh b/hack/load-test/deploy.sh index 3dcd6db29..1837987b4 100644 --- a/hack/load-test/deploy.sh +++ b/hack/load-test/deploy.sh @@ -5,6 +5,7 @@ SIZE=${SIZE:-1000} WORKER=${WORKER:-6} VERSION=${VERSION:-1} CLUSTER=${CLUSTER:-4} +QPS=${QPS:-1} SHARD=${SHARD:-3} @@ -12,6 +13,8 @@ TEMPLATE=${TEMPLATE:-"light"} END=$(expr $BEGIN + $SIZE - 1) +waitTime=$(expr 1000 / $QPS)e-3 + run() { for i in $(seq $1 $3 $2); do sid=$(expr $i % $SHARD) @@ -24,6 +27,7 @@ run() { sed 's/CLUSTER/'$c'/g' | \ kubectl apply -f - echo "worker $4: apply app $i to $sid" + sleep $waitTime done echo "worker $4: done" } @@ -32,4 +36,4 @@ for i in $(seq 1 $WORKER); do run $(expr $BEGIN + $i - 1) $END $WORKER $i & done -wait \ No newline at end of file +wait