timeUnit settings configure the desired arrival rate, so in your case, having a
20000 and a
1s is correct.
The number of users required to achieve that rate ultimately depends on how long it takes a user to complete each iteration through the script. If an iteration takes 1 second to complete, you would require 20,000 users to achieve your desired target of 20,000 iterations/sec. However, if an iteration only takes 100 milliseconds to complete, then 2,000 users would achieve your target (as each user could complete 10 iterations/sec).
As the article you linked in the original thread states, you want to allocate enough virtual users to achieve the desired rate. Keep in mind though that each user consumes system resources on the load testing host, so you wouldn’t want to allocate 20,000 users to a scenario if 2,000 would be enough to achieve your desired load.
That is where the
maxVUs settings come into the picture. You can pre-allocate the number that should be enough based on how the application normally performs, then configure a higher maximum to allow k6 to scale up additional users if necessary.
I’d suggest running a lower volume of requests against the application initially to get a sense for how long iterations take to complete on average. The test summary provided by k6 includes an
iteration_duration metric which shows you this. Once you have this information, you can fine tune how many users need to be allocated to achieve your desired arrival rate.