Stages with per VU iteration set to 1?

Hi all, I am performing a test where I simulate 180 “phone calls” over 10 minutes time to a system.
Phone calls have randomized duration of approx. 5 mins.
This is achieved with a sleep() between a POST and a DELETE request.
After a call is complete it should be removed from the system with an API call.

My approach was to do this ( I’m a bit new so it is possible my approach is wrong).

stages: [
        { duration: '10m', target: 180 }, // start all phone calls within 10 minutes
        { duration: '10m', target: 180 }, //ensure all phone calls wrap up.
        { duration: '2m', target: 0 }, // ramp down the users

My issue was that once a VU’s phone call was finished they would start another one and during rampdown there where active calls that were being left over. So I had every VU sleep() for a large amount of time after their part was done to ensure that each VU only performed their tasks once.

This feels a bit ‘ugly’ so I wanted to check if there is another approach to Stages for single iteration per VU?

I’m open to a Scenarios approach with ramping-vus but I would still have to use the sleep() until the end of test approach.
The reason I used stages was to be able to control the exact amount of calls that would be initiated.
Thank you in advance.

Hi @melkorinos, Welcome to the community forum :tada: !

I’m open to a Scenarios approach with ramping-vus

The stages are basically a shortcut for ramping-vus

From the configuration you provided and the text it seems that you want to:

  1. ramp up to 180 VUs(from 1) in 10minutes that will be doing
  2. an iteration around every 5 minutes
  3. do iterations for 10 minutes
  4. slowdown over 2 minutes

ensure that each VU only performed their tasks once.

Make it seem like what you want is to have 180 VUs do this iterations once, and you’re not carrying about ramping or doing this for 20 minutes.

So if it is the first one - what you are doing is probably pretty okay, although I would drop the rampdown and add gracefulShutdown instead(in ramping-vus scenario).

If what you want is truly to have 180 VUs do 1 iteration and you do not care about ramp up but you want to do them at the same time you can either use:

  1. shared-iterations with 180 VUs and 180 iterations
  2. per-vu-iterations with 180 VUs and 1 iteration each

Hope this helps you!