locust实现压测

安装

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=压测网址

 

posted @ 2018-07-06 09:11  奢华使命  阅读(862)  评论(0)    收藏  举报