Locust压力测试方法
-
通过docker执行locust
docker run -p 8089:8089 -v $PWD:/mnt/locust locustio/locust -f /mnt/locust/locustfile.py
/mnt/locust
本地locust脚本目录/mnt/locust/locustfile.py
即将执行的脚本
-
Use docker image as a base image
FROM locustio/locust RUN pip3 install some-python-package
-
CI执行locust,不启用WEBUI的执行方式
locust -f locust_files/my_locust_file.py --headless -u 1000 -r 100 --run-time 1h30m --stop-timeout 99
--headless
without the web UI-u
并发用户数-r
每秒发出100用户--run-time
脚本执行时间,到时间会立刻结束--stop-timeout
脚本执行停止的时间
-
分布式执行locust
- 参考:https://docs.locust.io/en/stable/running-locust-distributed.html#running-locust-dis