This commit is contained in:
BryantHe 2023-10-24 16:00:55 +08:00
commit 4b0ca4a68d
2 changed files with 37 additions and 0 deletions

30
docker-compose.yml Normal file
View File

@ -0,0 +1,30 @@
version: '3'
services:
master:
image: locustio/locust:latest
ports:
- "8089:8089"
volumes:
- .:/mnt/locust
working_dir: /mnt/locust
command: -f locustfile.py --master -H http://master:8089
networks:
- locust
worker:
image: locustio/locust:latest
volumes:
- .:/mnt/locust
working_dir: /mnt/locust
command: -f locustfile.py --worker --master-host master
deploy:
mode: replicated
replicas: 4
networks:
- locust
networks:
locust:
driver: bridge

7
locustfile.py Normal file
View File

@ -0,0 +1,7 @@
from locust import HttpUser, task
class HelloWorldUser(HttpUser):
@task
def hello_world(self):
self.client.get("/")