Trying to understanding how VUs works


As shown in the image I ran only 2 VUs but it returned “100” complete. What would that 100 be? Number of scripts run or vus? So for every 1 VU I have 50 scripts running, is that it?

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

I did answer on stackoverflow, but here it is again for posterity:

You have configured k6 to run with 2 vus for 2 minutes --vus 2 --duration 2m.

You can see this in the “summary” as “2 looping VUs for 2m0s”.

This means that you are running the constant-vus executor, the options you provided are just a shortcut for it. Arguably the “looping vus” description explains better that you have 2 VUs looping for 2 minutes.

As you can see above you also do 100 iterations- executions of the default function. And those take around 2.42s and 2min = 120s / 2.42 = 49.5. But k6 will try to finish started execution for a time (gracefulStop as mentioned in the screenshot), so it will make around 50 iterations per VU.

If you just want to do 2 iterations - add --iterations 2 or use shared-iterations executor directly, those options are the shortcut for it basically.

Hope this helps you

1 Like

so for example a i want to run 20K of the same script in this example a put it on the 20K in iteration or VUs?

For shared-iterations - yes. It’s different for the different executors. For example constant-vus will do as many iterations as it can with the vus configured in the time/duration it’s configured - it has no max iterations configuration.

1 Like