locustio / locust

Write scalable load tests in plain Python 🚗💨
https://locust.cloud
MIT License
25.06k stars 3k forks source link

Reset time (-t) when using (--reset-stats) when all locusts have hatched #1352

Closed JonasPf closed 4 years ago

JonasPf commented 4 years ago

Is your feature request related to a problem? Please describe.

I would like to run a test for a specific amount of time -t. I'm also using --reset-stats to reset the stats when all locusts have hatched. This means that the "real" time spend testing is whatever is specified in -t minus the time it took to hatch all locusts.

It's also possible for the test to complete without all locusts being hatched if I set -t too small and -c too high. This can be quite confusing when looking at the stats.

Describe the solution you'd like

If using --reset-stats I would reset the elapsed time to 0 when all locusts are hatched and start counting again.

Describe alternatives you've considered

Possibly introduce another parameter --reset-time instead of tying that behaviour to --reset-stats.

cyberw commented 4 years ago

Interesting. I think a better solution would be introducing a different time limit, one that stops the test after rampup + x time has elapsed. I cant think of a good name, but something like ”--time-at-peak-load”. Pretty far down the prio list for me, but I can see the use for it.

heyman commented 4 years ago

I'm not very keen on adding an extra command line argument for this. I can see the case for making the time limit start once all users have been hatched if --reset-stats is specified. Though I can also imagine that there are cases where one would want to be able to control the total run time...

JonasPf commented 4 years ago

As a simple workaround I can do some mental math before running a test:

ramp-up (in seconds) = clients / hatch-rate
run-time = time-after-reset + ramp-up