參考:python
http://www.oschina.net/p/locust shell
http://qiita.com/CkReal/items/cb53518f2d504950c09c post
---------------------------------------.net
1)安裝locust命令行
命令行執行code
pip install locustio
2)準備代碼ip
task.pyget
from locust import HttpLocust, TaskSet, task class WebsiteTasks(TaskSet): def on_start(self): self.client.post("/login", { "username": "yourname", "password": "yourpass" }) @task def index(self): self.client.get("/") @task def about(self): self.client.get("/account/new") class WebsiteUser(HttpLocust): task_set = WebsiteTasks min_wait = 5000 max_wait = 15000
3)開啓服務it
命令行執行pip
locust -f task.py -H http://127.0.0.1:80
4)打開管理界面
並配置,模擬人數 每秒請求數
結果以下