How to make use of all the VUs in k6

I have a use case which I want to achieve in k6. Is it possible to send 36 requests per minute by 30 users at a rate limit of not more than 1 rps. I need to make use of all the 30 users for 1 minute. Can someone give an advice on this?

Hi @joxinjose, welcome to the community forum :tada:

This seems like a good candidate for constant-arrival-rate executor.

You can have 30 preallocatedVUs, a rate of 36 and timeUnit of “1m”.

This numbers do seem strange though as it means that 6 VUs will start 2 iterations over the 1m while the others will make only 1. Which just seems like a strange request.

Can you elaborate on what this is trying to simulate? Maybe I misunderstood the question.

@mstoykov Let me make it simple. Suppose I want 10 users to make 30 requests for a minute which means I want each user to make 30 request in a minute. So in total it will be 300 requests made. Is it possible to achieve this. If yes,Can you advice me a good executor through which I can achieve this and also the rate at which I should be sending the requests.

arrival-rate per VU is not uh supported.

I would argue that if you did what I said above but set the rate 300 this is more or less what will happen.

There is a chance though that one VU will do a request more or another will do a request less.

You can do something per-vu-iterations which will make each VU make exactly certain number of iterations. But you will need to take care of the rate in the script - likely with sleep. You can see this old blog post about some ideas.

Hope this helps you!

p.s. I would argue that the arrival rate variant is sufficient. I am always really suspicious of exact numbers and phrasing like “I need exactly 12 VUs doing exactly 3 request ever 4 seconds”(as an exagerated example) as that seems like something that seems like a good idea, but likely is nothing like the real world. IMO this can be replaced with “we want 12 VUs to be able to do 3 requests in 4 seconds” and then measure that this is actually doable instead of figuring out how to script it sothat that exactly that happens.