From a1a5e8bf9b538087621fe9f08d8a96f6d66d611a Mon Sep 17 00:00:00 2001 From: Prashant Shahi Date: Tue, 11 Jul 2023 10:59:53 +0530 Subject: [PATCH 1/2] =?UTF-8?q?chore:=20=F0=9F=94=A7=20upgrade=20distribut?= =?UTF-8?q?ed=20locust=20to=201.2.3=20and=20updated=20related=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Prashant Shahi --- deploy/README.md | 2 +- sample-apps/hotrod/hotrod-install.sh | 2 +- sample-apps/hotrod/hotrod-template.yaml | 22 +++++++++++----------- sample-apps/hotrod/hotrod.yaml | 22 +++++++++++----------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/deploy/README.md b/deploy/README.md index f226c79d4c..55c3b6e8d4 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -66,7 +66,7 @@ To generate load: ```sh kubectl -n sample-application run strzal --image=djbingham/curl \ --restart='OnFailure' -i --tty --rm --command -- curl -X POST -F \ -'locust_count=6' -F 'hatch_rate=2' http://locust-master:8089/swarm +'user_count=6' -F 'spawn_rate=2' http://locust-master:8089/swarm ``` To stop load: diff --git a/sample-apps/hotrod/hotrod-install.sh b/sample-apps/hotrod/hotrod-install.sh index 197f18d76e..b7ba4f6caa 100755 --- a/sample-apps/hotrod/hotrod-install.sh +++ b/sample-apps/hotrod/hotrod-install.sh @@ -16,7 +16,7 @@ fi # Locust's docker image if [[ -z $LOCUST_IMAGE ]]; then LOCUST_REPO="${LOCUST_REPO:-signoz/locust}" - LOCUST_TAG="${LOCUST_TAG:-0.8.1-py3.6}" + LOCUST_TAG="${LOCUST_TAG:-1.2.3}" LOCUST_IMAGE="${LOCUST_REPO}:${LOCUST_TAG}" fi diff --git a/sample-apps/hotrod/hotrod-template.yaml b/sample-apps/hotrod/hotrod-template.yaml index f2d432ca4d..472cbe4d52 100644 --- a/sample-apps/hotrod/hotrod-template.yaml +++ b/sample-apps/hotrod/hotrod-template.yaml @@ -11,8 +11,10 @@ metadata: name: scripts-cm data: locustfile.py: | - from locust import HttpLocust, TaskSet, task - class UserTasks(TaskSet): + from locust import HttpUser, task, between + class UserTasks(HttpUser): + wait_time = between(5, 15) + @task def rachel(self): self.client.get("/dispatch?customer=123&nonse=0.6308392664170006") @@ -25,8 +27,6 @@ data: @task def coffee(self): self.client.get("/dispatch?customer=567&nonse=0.0022220379420636593") - class WebsiteUser(HttpLocust): - task_set = UserTasks --- apiVersion: apps/v1 kind: Deployment @@ -155,13 +155,13 @@ metadata: annotations: deployment.kubernetes.io/revision: "1" labels: - role: locust-slave - name: locust-slave + role: locust-worker + name: locust-worker spec: replicas: 1 selector: matchLabels: - role: locust-slave + role: locust-worker strategy: rollingUpdate: maxSurge: 1 @@ -170,12 +170,12 @@ spec: template: metadata: labels: - role: locust-slave + role: locust-worker spec: containers: - image: ${LOCUST_IMAGE} imagePullPolicy: IfNotPresent - name: locust-slave + name: locust-worker env: - name: ATTACKED_HOST valueFrom: @@ -183,8 +183,8 @@ spec: name: locust-cm key: ATTACKED_HOST - name: LOCUST_MODE - value: SLAVE - - name: LOCUST_MASTER + value: WORKER + - name: LOCUST_MASTER_HOST value: locust-master volumeMounts: - mountPath: /locust diff --git a/sample-apps/hotrod/hotrod.yaml b/sample-apps/hotrod/hotrod.yaml index 0793ec3d95..2dbbaec654 100644 --- a/sample-apps/hotrod/hotrod.yaml +++ b/sample-apps/hotrod/hotrod.yaml @@ -11,8 +11,10 @@ metadata: name: scripts-cm data: locustfile.py: | - from locust import HttpLocust, TaskSet, task - class UserTasks(TaskSet): + from locust import HttpUser, task, between + class UserTasks(HttpUser): + wait_time = between(5, 15) + @task def rachel(self): self.client.get("/dispatch?customer=123&nonse=0.6308392664170006") @@ -25,8 +27,6 @@ data: @task def coffee(self): self.client.get("/dispatch?customer=567&nonse=0.0022220379420636593") - class WebsiteUser(HttpLocust): - task_set = UserTasks --- apiVersion: apps/v1 kind: Deployment @@ -155,13 +155,13 @@ metadata: annotations: deployment.kubernetes.io/revision: "1" labels: - role: locust-slave - name: locust-slave + role: locust-worker + name: locust-worker spec: replicas: 1 selector: matchLabels: - role: locust-slave + role: locust-worker strategy: rollingUpdate: maxSurge: 1 @@ -170,12 +170,12 @@ spec: template: metadata: labels: - role: locust-slave + role: locust-worker spec: containers: - image: signoz/locust:1.2.3 imagePullPolicy: IfNotPresent - name: locust-slave + name: locust-worker env: - name: ATTACKED_HOST valueFrom: @@ -183,8 +183,8 @@ spec: name: locust-cm key: ATTACKED_HOST - name: LOCUST_MODE - value: SLAVE - - name: LOCUST_MASTER + value: WORKER + - name: LOCUST_MASTER_HOST value: locust-master volumeMounts: - mountPath: /locust From 44416df5dcc6e12e9a0ae1752ca6f6820e05dc53 Mon Sep 17 00:00:00 2001 From: Prashant Shahi Date: Tue, 11 Jul 2023 12:30:49 +0530 Subject: [PATCH 2/2] =?UTF-8?q?chore(hotrod):=20=F0=9F=94=A7=20update=20RE?= =?UTF-8?q?ADME=20docs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Prashant Shahi --- sample-apps/hotrod/README.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/sample-apps/hotrod/README.md b/sample-apps/hotrod/README.md index 1907c23dfc..b9638281a0 100644 --- a/sample-apps/hotrod/README.md +++ b/sample-apps/hotrod/README.md @@ -5,7 +5,7 @@ Follow the steps in this section to install a sample application named HotR.O.D, ```console kubectl create ns sample-application -kubectl -n sample-application apply -f https://github.com/SigNoz/signoz/raw/main/sample-apps/hotrod/hotrod.yaml +kubectl -n sample-application apply -f https://github.com/SigNoz/signoz/raw/develop/sample-apps/hotrod/hotrod.yaml ``` In case, you have installed SigNoz in namespace other than `platform` or selected Helm release name other than `my-release`, follow the steps below: @@ -15,7 +15,7 @@ export HELM_RELEASE=my-release-2 export SIGNOZ_NAMESPACE=platform-2 export HOTROD_NAMESPACE=sample-application-2 -curl -sL https://github.com/SigNoz/signoz/raw/main/sample-apps/hotrod/hotrod-install.sh | bash +curl -sL https://github.com/SigNoz/signoz/raw/develop/sample-apps/hotrod/hotrod-install.sh | bash ``` To delete sample application: @@ -23,5 +23,15 @@ To delete sample application: ```console export HOTROD_NAMESPACE=sample-application-2 -curl -sL https://github.com/SigNoz/signoz/raw/main/sample-apps/hotrod/hotrod-delete.sh | bash +curl -sL https://github.com/SigNoz/signoz/raw/develop/sample-apps/hotrod/hotrod-delete.sh | bash +``` + +For testing with local scripts, you can use the following commands: + +```console +# To install hotrod +cat hotrod-install.sh | bash + +# To delete hotrod +cat hotrod-delete.sh | bash ```