Inject users in stages

Hi,

I want to inject virtual users like this:

This is possible ?
I tried with this setup but it works halfway:
incrementUsersPerSec(1)
.times(5)
.eachLevelLasting(10)
.separatedByRampsLasting(5)
.startingFrom(10)
Thank you for your answer !

AG

Hi @ArthurG,

Did you read the different options in Open Model Injection?

If I understand your schema, you want a ramp of users per second, then stay, then a ramp down.

So, if your scenario is called scn:


int rampUpDuration = 5;
int flatDuration = 60;
int rampDownDuration = 2;
int maxUsersPerSecond = 10;

scn.injectOpen(
    rampUsersPerSec(0).to(maxUsersPerSecond).during(rampUpDuration),
    constantUsersPerSec(maxUsersPerSecond).during(flatDuration),
    rampUsersPerSec(maxUsersPerSecond).to(0).during(rampDownDuration)
  )

Does it help?

Cheers!

You are very kind to help me
Ok sorry I got my image wrong. This is the style of curve I would like to get for my active users:
image

I tried with the functions you suggested with different values, like this:

private val rampUpDuration = 5;
private val flatDuration = 10;
private val step1 = 1;
private val step2 = 2;
private val step3 = 3;

rampUsersPerSec(0).to(step1).during(rampUpDuration),
constantUsersPerSec(step1).during(flatDuration),
rampUsersPerSec(step1).to(step2).during(rampUpDuration),
constantUsersPerSec(step2).during(flatDuration),
rampUsersPerSec(step2).to(step3).during(rampUpDuration)

But the resulting curve is as follows:

Thanks in advance for your help.

@ArthurG You’re confusing arrival rate, active users and concurrent users. You should read the documentation about injection profiles: Gatling - Injection.