load-testinglocustspawningrequests-per-second

Locust - how to delay collection of RPS data until all threads have started


Scenario

locust test with gradual spawn-rate, chart looks like a 45-degree angle.

I would like to know the RPS of the system while all threads are running.

The out-of-the-box RPS value from locust will include RPS values from the beginning of the run when there were fewer threads.

  1. How can I customize my locust script to start calculating RPS from when all threads are running?
  2. Is this a reasonable load-test practice?
  3. An alternative option would be to "simulate reality" as much as possible (and in the real word there is ramp-up when the system starts up). To get a more representative RPS value, run the test longer.

Solution

  • There are many reasons why you want to pay attention to what your system can handle while new load is being added. There can be performance problems accepting the connection, for example, if you have improper or older SSL/TLS settings or libraries. In some instances having new load come up can affect users already connected to and using your system. You might even have additional server logic that happens when a new connection is accepted. In short, you should go with 3) above.

    However, enough people like to ignore or gloss over what things look like during ramp up that Locust does have a configuration option --reset-stats that will automatically reset all collected stats once all spawning has completed so it appears as if the load test started with all users connected instantaneously. That should give you what you were asking for.