首页 > 技术文章 > locust实现压测

shsm 2018-07-06 09:11 原文

安装

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

 

推荐阅读