LocustIO: min_wait and max_wait not being applied

2019-08-20 09:55发布

I am playing around LocustIO. I have a single self.client.get() task with my min_wait and max_wait were set to be 1 millisecond each.

class App_User(HttpLocust):  
    ... 
    min_wait = 1  
    max_wait = 1  

I was using logging to see the response. I am expecting in console that timestamps of the task logs will be within the same second given a max_wait of 1 millisecond but it seems that the task runs every 1 second still.

Is it wrong to expect a 1000 GET responses within a 1 second load test period given 1 millisecond task wait; 1 simulated user as well?

2条回答
We Are One
2楼-- · 2019-08-20 10:27

Is it wrong to expect a 1000 GET responses within a 1 second load test period given 1 millisecond task wait; 1 simulated user as well?

Those values only apply to the time between a full task.

For example, if your GET request takes 5 seconds, for each Locust you will see something like:

  • 0.000s -- request 1 started
  • 5.000s -- request 1 completed, wait for 1 ms
  • 5.001s -- request 2 started
  • 10.001 -- request 2 completed, wait for 1 ms
  • 10.002 -- request 3 started

etc.

This is because the wait time only happens between requests. It is not saying "run ever 1 ms" but rather "wait 1 ms between every task after they complete."

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-08-20 10:38

1ms is the wait time between 2 requests. So it's likely that your server takes 1s to respond. If you want to have more requests per seconds, you should add more "App_User".

Also, your test machine may not be able to shoot requests at that high rate, my poor PC can only do less than 70. At this stage, you need a locust swarm.

Finally, one important thing to notice is that Locust is not designed to have a fixed RPS, its goal is to simulate user behavior.

查看更多
登录 后发表回答