安装
pip install locust
实现
from locust import HttpLocust,TaskSet,task class User(TaskSet): @task def index(self): self.client.get("/") class WebsiteUser(HttpLocust): task_set = User min_wait = 3000 max_wait = 6000
访问压测监控网站
http://localhost:8089/
运行命令
locust -f 文件名 --host=压测网址