From 72a67febac73e2688bce8695b37cb24efaeda91b Mon Sep 17 00:00:00 2001 From: santhh Date: Mon, 30 Jul 2018 08:29:10 -0400 Subject: [PATCH 1/7] Locust 0.8 Upgrade --- docker-image/Dockerfile | 8 +++-- docker-image/default.profraw | Bin 0 -> 2056 bytes docker-image/licenses/licenses.txt | 14 ++++---- docker-image/locust-tasks/default.profraw | Bin 0 -> 2056 bytes docker-image/locust-tasks/requirements.txt | 12 +++---- docker-image/locust-tasks/run.sh | 2 +- docker-image/locust-tasks/tasks.py | 32 ++++++------------ .../locust-master-controller.yaml | 4 +-- .../locust-worker-controller.yaml | 6 ++-- 9 files changed, 36 insertions(+), 42 deletions(-) create mode 100644 docker-image/default.profraw create mode 100644 docker-image/locust-tasks/default.profraw mode change 100644 => 100755 docker-image/locust-tasks/run.sh mode change 100644 => 100755 docker-image/locust-tasks/tasks.py diff --git a/docker-image/Dockerfile b/docker-image/Dockerfile index f0db361..e6ad070 100644 --- a/docker-image/Dockerfile +++ b/docker-image/Dockerfile @@ -14,7 +14,7 @@ # Start with a base Python 2.7.8 image -FROM python:2.7.8 +FROM python:2.7-alpine MAINTAINER Sandeep Parikh @@ -25,7 +25,11 @@ ADD licenses /licenses ADD locust-tasks /locust-tasks # Install the required dependencies via pip -RUN pip install -r /locust-tasks/requirements.txt +RUN apk --no-cache add --virtual=.build-dep \ + build-base \ + && apk --no-cache add bash libzmq \ + && pip install -r /locust-tasks/requirements.txt \ + && apk del .build-dep # Expose the required Locust ports EXPOSE 5557 5558 8089 diff --git a/docker-image/default.profraw b/docker-image/default.profraw new file mode 100644 index 0000000000000000000000000000000000000000..03d566ee470d00c8cd072701c43e4545cede9d19 GIT binary patch literal 2056 zcmZoHO3N=Q$obF000E*9&gk1%vh`Y``yYcIc?2~?X zBw^|TDj@10su&nJp$rNAP)Qfx%9x2uTxNXHWMFszHFs7es(NOq`nUgfDsbF-`YlkU zmdhO|_5-Tkqzb$G2d*U|hI41nn}0b0Y=Xd6h`O0L)Ytw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}gBC$kS8W08_*UoF(M%O)kaLF<%Kr;Ao^ Ut4mXTfz8_RS#=C|F3wW}0Mzvqc>n+a literal 0 HcmV?d00001 diff --git a/docker-image/locust-tasks/requirements.txt b/docker-image/locust-tasks/requirements.txt index 3684955..9a01342 100644 --- a/docker-image/locust-tasks/requirements.txt +++ b/docker-image/locust-tasks/requirements.txt @@ -1,11 +1,11 @@ Flask==0.10.1 -gevent==1.0.1 -greenlet==0.4.5 +gevent==1.2.2 +greenlet==0.4.10 itsdangerous==0.24 Jinja2==2.7.3 -locustio==0.7.2 +locustio==0.8.1 MarkupSafe==0.23 -msgpack-python==0.4.6 -pyzmq==14.5.0 -requests==2.6.2 +msgpack-python==0.4.2 +pyzmq==16.0.2 +requests==2.9.1 Werkzeug==0.10.4 diff --git a/docker-image/locust-tasks/run.sh b/docker-image/locust-tasks/run.sh old mode 100644 new mode 100755 index ba5f684..cd676ec --- a/docker-image/locust-tasks/run.sh +++ b/docker-image/locust-tasks/run.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Copyright 2015 Google Inc. All rights reserved. # diff --git a/docker-image/locust-tasks/tasks.py b/docker-image/locust-tasks/tasks.py old mode 100644 new mode 100755 index 6e6fc55..740d1a8 --- a/docker-image/locust-tasks/tasks.py +++ b/docker-image/locust-tasks/tasks.py @@ -15,28 +15,18 @@ # limitations under the License. -import uuid - -from datetime import datetime from locust import HttpLocust, TaskSet, task - -class MetricsTaskSet(TaskSet): - _deviceid = None - +class UserBehavior(TaskSet): def on_start(self): - self._deviceid = str(uuid.uuid4()) - + """ on_start is called when a Locust start before any task is scheduled """ + self.index() @task(1) - def login(self): - self.client.post( - '/login', {"deviceid": self._deviceid}) - - @task(999) - def post_metrics(self): - self.client.post( - "/metrics", {"deviceid": self._deviceid, "timestamp": datetime.now()}) - - -class MetricsLocust(HttpLocust): - task_set = MetricsTaskSet \ No newline at end of file + def index(self): + self.client.get("/jpa/v1/customers") + +class WebsiteUser(HttpLocust): + task_set = UserBehavior + min_wait = 5000 + max_wait = 9000 + \ No newline at end of file diff --git a/kubernetes-config/locust-master-controller.yaml b/kubernetes-config/locust-master-controller.yaml index 231e730..0e43157 100644 --- a/kubernetes-config/locust-master-controller.yaml +++ b/kubernetes-config/locust-master-controller.yaml @@ -33,12 +33,12 @@ spec: spec: containers: - name: locust - image: gcr.io/cloud-solutions-images/locust-tasks:latest + image: gcr.io/scotia-tokenization/locust-tasks:latest env: - name: LOCUST_MODE value: master - name: TARGET_HOST - value: http://workload-simulation-webapp.appspot.com + value: http://104.155.150.104 ports: - name: loc-master-web containerPort: 8089 diff --git a/kubernetes-config/locust-worker-controller.yaml b/kubernetes-config/locust-worker-controller.yaml index 236eae5..896157e 100644 --- a/kubernetes-config/locust-worker-controller.yaml +++ b/kubernetes-config/locust-worker-controller.yaml @@ -21,7 +21,7 @@ metadata: name: locust role: worker spec: - replicas: 10 + replicas: 1 selector: name: locust role: worker @@ -33,11 +33,11 @@ spec: spec: containers: - name: locust - image: gcr.io/cloud-solutions-images/locust-tasks:latest + image: gcr.io/scotia-tokenization/locust-tasks:latest env: - name: LOCUST_MODE value: worker - name: LOCUST_MASTER value: locust-master - name: TARGET_HOST - value: http://workload-simulation-webapp.appspot.com + value: http://104.155.150.104 From 5d473fa063c32b5413f4786d3977419652c88b88 Mon Sep 17 00:00:00 2001 From: Masud Hasan Date: Mon, 30 Jul 2018 10:21:47 -0400 Subject: [PATCH 2/7] changing to bash --- docker-image/locust-tasks/run.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-image/locust-tasks/run.sh b/docker-image/locust-tasks/run.sh index cd676ec..5190374 100755 --- a/docker-image/locust-tasks/run.sh +++ b/docker-image/locust-tasks/run.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Copyright 2015 Google Inc. All rights reserved. # @@ -27,4 +27,4 @@ fi echo "$LOCUST $LOCUS_OPTS" -$LOCUST $LOCUS_OPTS \ No newline at end of file +$LOCUST $LOCUS_OPTS From f01c62e44bb34e3d6694db6ab7d93388294dab55 Mon Sep 17 00:00:00 2001 From: Masud Hasan Date: Mon, 30 Jul 2018 10:22:30 -0400 Subject: [PATCH 3/7] Rolling back task.py for merge --- docker-image/locust-tasks/tasks.py | 33 ++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/docker-image/locust-tasks/tasks.py b/docker-image/locust-tasks/tasks.py index 740d1a8..78d2f69 100755 --- a/docker-image/locust-tasks/tasks.py +++ b/docker-image/locust-tasks/tasks.py @@ -15,18 +15,29 @@ # limitations under the License. +import uuid + +from datetime import datetime from locust import HttpLocust, TaskSet, task -class UserBehavior(TaskSet): + +class MetricsTaskSet(TaskSet): + _deviceid = None + def on_start(self): - """ on_start is called when a Locust start before any task is scheduled """ - self.index() + self._deviceid = str(uuid.uuid4()) + @task(1) - def index(self): - self.client.get("/jpa/v1/customers") - -class WebsiteUser(HttpLocust): - task_set = UserBehavior - min_wait = 5000 - max_wait = 9000 - \ No newline at end of file + def login(self): + self.client.post( + '/login', {"deviceid": self._deviceid}) + + @task(999) + def post_metrics(self): + self.client.post( + "/metrics", {"deviceid": self._deviceid, "timestamp": datetime.now()}) + + +class MetricsLocust(HttpLocust): + task_set = MetricsTaskSet + From 67f342d72284f0640c03353df21847517a5464f1 Mon Sep 17 00:00:00 2001 From: Masud Hasan Date: Mon, 30 Jul 2018 10:26:48 -0400 Subject: [PATCH 4/7] rolling back master controller --- kubernetes-config/locust-master-controller.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kubernetes-config/locust-master-controller.yaml b/kubernetes-config/locust-master-controller.yaml index 0e43157..231e730 100644 --- a/kubernetes-config/locust-master-controller.yaml +++ b/kubernetes-config/locust-master-controller.yaml @@ -33,12 +33,12 @@ spec: spec: containers: - name: locust - image: gcr.io/scotia-tokenization/locust-tasks:latest + image: gcr.io/cloud-solutions-images/locust-tasks:latest env: - name: LOCUST_MODE value: master - name: TARGET_HOST - value: http://104.155.150.104 + value: http://workload-simulation-webapp.appspot.com ports: - name: loc-master-web containerPort: 8089 From f41e90c30d8d53a8ee5ca913069d799c280c0e99 Mon Sep 17 00:00:00 2001 From: Masud Hasan Date: Mon, 30 Jul 2018 10:29:12 -0400 Subject: [PATCH 5/7] rolling back controller --- kubernetes-config/locust-worker-controller.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kubernetes-config/locust-worker-controller.yaml b/kubernetes-config/locust-worker-controller.yaml index 896157e..236eae5 100644 --- a/kubernetes-config/locust-worker-controller.yaml +++ b/kubernetes-config/locust-worker-controller.yaml @@ -21,7 +21,7 @@ metadata: name: locust role: worker spec: - replicas: 1 + replicas: 10 selector: name: locust role: worker @@ -33,11 +33,11 @@ spec: spec: containers: - name: locust - image: gcr.io/scotia-tokenization/locust-tasks:latest + image: gcr.io/cloud-solutions-images/locust-tasks:latest env: - name: LOCUST_MODE value: worker - name: LOCUST_MASTER value: locust-master - name: TARGET_HOST - value: http://104.155.150.104 + value: http://workload-simulation-webapp.appspot.com From 313b96c99e56fa5bc9c581327b15977b12088ef7 Mon Sep 17 00:00:00 2001 From: Masud Hasan Date: Mon, 30 Jul 2018 10:30:46 -0400 Subject: [PATCH 6/7] rolling back run.sh From 7e593ba9f9ffcf69443a671572104dd72f44520d Mon Sep 17 00:00:00 2001 From: Masud Hasan Date: Mon, 30 Jul 2018 10:31:20 -0400 Subject: [PATCH 7/7] Update tasks.py --- docker-image/locust-tasks/tasks.py | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-image/locust-tasks/tasks.py b/docker-image/locust-tasks/tasks.py index 78d2f69..8f14cfe 100755 --- a/docker-image/locust-tasks/tasks.py +++ b/docker-image/locust-tasks/tasks.py @@ -40,4 +40,3 @@ def post_metrics(self): class MetricsLocust(HttpLocust): task_set = MetricsTaskSet -