In this post I will explain how to calculate the number of virtual users (VU) in case we need 100 requests per second and if average response time is 3.3 seconds, but also this explanation can be used for any number of requests per second and any response time duration.
Let’s talk about the pacing first. What is pacing? Pacing is the time load testing tool takes between 2 iterations of a VU. If the transaction is finished before the pacing time expires, the load testing tool will wait for the remaining time (pacing – transaction duration) before starting the next iteration of a VU.
In our example we have average response time of 3.3 seconds. This is the same as saying that the average transaction duration is 3.3 seconds. If we put the pacing = 4s we got the following situation:
Putting the pacing to the value greater than 3.3 seconds ensures that we simulate consistent load to the system (regarding requests per second).
So, let’s calculate now. We have RPS = 100 (requests per second) and p = 4s (pacing).
Number of VU needed is:
VU = RPS * p
VU = 100 * 4
VU = 400
This means that with pacing of 4 seconds and 400 VU we can simulate 100 requests per second.
But of course, just a reminder, never start the test immediately with 400 VU. Always use a ramp-up period. So, if you need 400 VU, starting with 1 VU and adding 1 VU each second you would need 6 minutes and 39 seconds ramp-up time period.