reqs/sec not correct when load testing with Python

2019-06-13 03:53发布

问题:

In my testing, both min_wait and max_wait are set to 1 second, and I set users to 100, so I expect the reqs/sec to be close to 100.

I know Locust actually need to wait server respond and then send the next request. Even though, if server respond quick, like 20ms, the outcome TPS should be close to 100, like 92 maybe.

But, in actuality it is 10, as the following picture shows:

What am I missing?

My code is below:

class UserBehavior(TaskSet):   

    @task(1)
    def list_teacher(self):
        self.client.get("/api/mgr/sq_mgr/?action=list_teacher&pagenum=1&pagesize=100")

    @task(1)
    def list_course(self):
        self.client.get("/api/mgr/sq_mgr/?action=list_course&pagenum=1&pagesize=20")


class WebsiteUser(HttpLocust):
    task_set = UserBehavior
    min_wait = 1000
    max_wait = 1000
标签: python locust