Design Simulation | running 100 users for 1 hr duration

Hi All,

Could any one please guide me, how can I design a scenario for a particular set of users to run for particular duration.

for example: I have 100 users which will ramp up 1 users in every 2 seconds and once all the 100 users ramped up in the system, it will keep on hitting the system for 1 hr duration. So ideally in 200 seconds all 100 users will be ramped up and then for next 1 hr there will be steady state.

Can anyone please guide me on this.


There’s two ways to do it.

The first gives you a ramp down time that mirrors the ramp up time. In your scenario, you include a loop (.during(time)) where the duration is the sustain period plus the ramp up period. In your case, you want a 200 second ramp time and a 3600 second sustainment period, so you would set the loop to .during(3800)

The alternative, if you want no ramp-down period, is to calculate when you want the users to exit. You would do that by calculating the end time only once, and use that from then on. Lazy Vals are perfect for that:

lazy val end_time = System.nanoTime() + ( Test.rampUpTime + Test.duration ) * NANOS_PER_SECOND

.doWhile( session => System.nanoTime() < end_time ) { … }

From there, you just need a simple injection model:

rampUsers( N ) during ( Test.rampUpTime ),
nothingFor( Test.duration )