Locust never gets past 10 req/s, despite the server being much quicker than that
See original GitHub issueI’ve got a very simple locustfile, running against a very simple local server, and locust tells me it can do 10req/s, while ab tells me it can do 600+.
My locustfile:
class MyTasks(TaskSet):
@task
def read_root(self):
self.client.get("/")
class MyUser(HttpLocust):
host = "http://localhost:8080"
task_set = MyTasks
My server is a very simple flask app, running locally under CherryPy, and returning a fixed string value.
If I run this with locust -c 10 -r 10 -n 1000 --no-web -f locustfile.py
(1000 requests with 10 users, all hatched immediately) I end up with:
--------------------------------------------------------------------------------------------------------------------------------------------
GET / 1000 0(0.00%) 5 2 12 | 6 9.90
--------------------------------------------------------------------------------------------------------------------------------------------
Total 1000 0(0.00%) 9.90
Percentage of the requests completed within given times
Name # reqs 50% 66% 75% 80% 90% 95% 98% 99% 100%
--------------------------------------------------------------------------------------------------------------------------------------------
GET / 1000 6 6 6 6 6 7 7 8 12
--------------------------------------------------------------------------------------------------------------------------------------------
It hovers around 10, but doesn’t pass 10 requests per second at any point. Each request only takes 6ms avg, suggesting each user could do at least 100/s, so 10 users -> at least 1,000 max from locust itself. That should definitely make my server the bottleneck.
Unfortunately though, my server can do way more than 10 requests/s. If I use ab
instead, running:
ab -n 1000 -c 10 http://localhost:8080/
(1000 requests, with 10 threads)
I get :
Concurrency Level: 10
Time taken for tests: 1.647 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 138000 bytes
HTML transferred: 6000 bytes
Requests per second: 607.24 [#/sec] (mean)
Time per request: 16.468 [ms] (mean)
Time per request: 1.647 [ms] (mean, across all concurrent requests)
Transfer rate: 81.84 [Kbytes/sec] received
About 600 requests per second, much more in line with what I’d expect.
Why does Locust say I can only do 10 requests per second, when I can safely do 600? Am I missing something obvious in my configuration, or is ab doing something enormously different from locust that causes this effect? Seems like it should be easy to reproduce the same basic result in this case with both tools.
Issue Analytics
- State:
- Created 9 years ago
- Comments:11 (4 by maintainers)
Top GitHub Comments
You need to adjust the default wait times. http://docs.locust.io/en/latest/writing-a-locustfile.html#the-min-wait-and-max-wait-attributes
@shaikshakeel did you check the documentation?