-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: therahulbhati <[email protected]>
- Loading branch information
1 parent
8110dd4
commit 991bea1
Showing
7 changed files
with
197 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: locust-master | ||
labels: | ||
name: locust-master | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: locust-master | ||
template: | ||
metadata: | ||
labels: | ||
app: locust-master | ||
spec: | ||
containers: | ||
- name: locust-master | ||
image: rahulbhati/fission-locust:4 | ||
ports: | ||
- name: loc-master-web | ||
containerPort: 8089 | ||
protocol: TCP | ||
- name: loc-master-p1 | ||
containerPort: 5557 | ||
protocol: TCP | ||
- name: loc-master-p2 | ||
containerPort: 5558 | ||
protocol: TCP | ||
env: | ||
- name: LOCUST_MODE | ||
value: master | ||
- name: TARGET_HOST | ||
value: http://router.fission/ | ||
- name: NET_TIMEOUT | ||
value: "3600" | ||
- name: CON_TIMEOUT | ||
value: "3600" | ||
- name: TASK_1 | ||
value: hello-1-15 | ||
- name: TASK_2 | ||
value: hello-2-45 | ||
- name: TASK_3 | ||
value: hello-3-75 | ||
- name: TASK_4 | ||
value: hello-4-90 | ||
- name: TASK_5 | ||
value: hello-5-120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: locust-master | ||
labels: | ||
app: locust-master | ||
spec: | ||
ports: | ||
- port: 8089 | ||
targetPort: loc-master-web | ||
protocol: TCP | ||
name: loc-master-web | ||
- port: 5557 | ||
targetPort: loc-master-p1 | ||
protocol: TCP | ||
name: loc-master-p1 | ||
- port: 5558 | ||
targetPort: loc-master-p2 | ||
protocol: TCP | ||
name: loc-master-p2 | ||
selector: | ||
app: locust-master | ||
type: LoadBalancer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
apiVersion: apps/v1 | ||
kind: "Deployment" | ||
metadata: | ||
name: locust-worker | ||
labels: | ||
name: locust-worker | ||
spec: | ||
replicas: 10 | ||
selector: | ||
matchLabels: | ||
app: locust-worker | ||
template: | ||
metadata: | ||
labels: | ||
app: locust-worker | ||
spec: | ||
containers: | ||
- name: locust-worker | ||
image: rahulbhati/fission-locust:4 | ||
env: | ||
- name: LOCUST_MODE | ||
value: worker | ||
- name: LOCUST_MASTER | ||
value: locust-master | ||
- name: TARGET_HOST | ||
value: http://router.fission/ | ||
- name: NET_TIMEOUT | ||
value: "3600" | ||
- name: CON_TIMEOUT | ||
value: "3600" | ||
- name: TASK_1 | ||
value: hello-1-15 | ||
- name: TASK_2 | ||
value: hello-2-45 | ||
- name: TASK_3 | ||
value: hello-3-75 | ||
- name: TASK_4 | ||
value: hello-4-90 | ||
- name: TASK_5 | ||
value: hello-5-120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Start with a base Python 3.7.2 image | ||
FROM python:3.7.2 | ||
|
||
# Add the external tasks directory into /tasks | ||
ADD code /code | ||
|
||
RUN pip install -r /code/requirements.txt | ||
|
||
# Expose the required Locust ports | ||
EXPOSE 5557 5558 8089 | ||
|
||
# Set script to be executable | ||
RUN chmod 755 /code/run.sh | ||
|
||
# Start Locust using LOCUS_OPTS environment variable | ||
ENTRYPOINT ["/code/run.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
certifi==2020.6.20 | ||
chardet==3.0.4 | ||
click==7.1.2 | ||
ConfigArgParse==1.2.3 | ||
Flask==1.1.2 | ||
Flask-BasicAuth==0.2.0 | ||
gevent==20.9.0 | ||
geventhttpclient==1.4.4 | ||
greenlet==0.4.17 | ||
idna==2.10 | ||
itsdangerous==1.1.0 | ||
Jinja2==2.11.2 | ||
locust==1.2.3 | ||
MarkupSafe==1.1.1 | ||
msgpack==1.0.0 | ||
psutil==5.7.2 | ||
pyzmq==19.0.2 | ||
requests==2.24.0 | ||
six==1.15.0 | ||
urllib3==1.25.10 | ||
Werkzeug==1.0.1 | ||
zope.event==4.5.0 | ||
zope.interface==5.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
LOCUST="/usr/local/bin/locust" | ||
LOCUS_OPTS="-f /code/tasks.py --host=$TARGET_HOST" | ||
LOCUST_MODE=${LOCUST_MODE:-standalone} | ||
|
||
if [[ "$LOCUST_MODE" = "master" ]]; then | ||
LOCUS_OPTS="$LOCUS_OPTS --master" | ||
elif [[ "$LOCUST_MODE" = "worker" ]]; then | ||
LOCUS_OPTS="$LOCUS_OPTS --worker --master-host=$LOCUST_MASTER" | ||
fi | ||
|
||
$LOCUST $LOCUS_OPTS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from datetime import datetime | ||
import os | ||
from locust import HttpUser, TaskSet, task, between | ||
from locust.contrib.fasthttp import FastHttpUser | ||
|
||
|
||
class FissionUser(FastHttpUser): | ||
network_timeout = float(os.environ['NET_TIMEOUT']) | ||
connection_timeout = float(os.environ['CON_TIMEOUT']) | ||
wait_time = between(1, 2) | ||
|
||
@task(33) | ||
def task1(self): | ||
self.client.get( | ||
'/fission-function/' + os.environ['TASK_1']) | ||
|
||
@task(19) | ||
def task2(self): | ||
self.client.get( | ||
'/fission-function/' + os.environ['TASK_2']) | ||
|
||
@task(19) | ||
def task3(self): | ||
self.client.get( | ||
'/fission-function/' + os.environ['TASK_3']) | ||
|
||
@task(13) | ||
def task4(self): | ||
self.client.get( | ||
'/fission-function/' + os.environ['TASK_4']) | ||
|
||
@task(13) | ||
def task5(self): | ||
self.client.get( | ||
'/fission-function/' + os.environ['TASK_5']) |