Understanding active users with constantConcurrentUsers

The document states:

constantConcurrentUsers(nbUsers) during(duration): Inject so that number of concurrent users in the system is constant

What exactly does it mean by ‘constant’ here.
I have the following setup

setUp(getCasesScenario
.inject(
rampConcurrentUsers(0) to 500 during 60 seconds,
constantConcurrentUsers(500) during 180 seconds,
rampConcurrentUsers(500) to 1000 during 60 seconds, constantConcurrentUsers(1000) during 1800 seconds,

)

My expectations are, the users are ramped up from 0 to 500 in 1 minute => maintains 500 users load for 3 minutes => rampup to 1000 users in next minute => maintain the constant load of 1000 concurrent users for next 30 minutes.
Am I missing something here??
Because the graph of active-users for this is showing a different constant concurrent load(around 1500 instead of 1000)
However, the console output is displaying 1000 active users constantly

I noticed something odd, though. When I increase the server resources, the same test setup is showing active users around 1700-2000 depending on the resources. Is there a way to understand/solve this??

Hi Yashwanth,

I will try to guess with you what happened.

The graph of active-users (what you provided) shows the amount of active users during a second (base unit of Gatling).
We can be sure that during a whole second, there are more than your “1000” different active users.
If you increase the server resources, the amount increase as well. So, depending on the server resources, there are more active users in a single users.

I guess that happens because your scenario is likely to be run in less than a second and to keep the constant amount of users, Gatling creates another active user.

If I guessed correctly, your scenario duration is around 0.75 seconds with a “normal” server and around 0.5 seconds with an “increased” server.

Great to hear a quick reply, Sébastien :slight_smile:

I understand that with server resources, the active users at any point also increases.

But what do constant concurrent users mean? If I’m specifying the test to maintain the constant user load of 1000 users at any point, shouldn’t the constant users be maintained at 1000 irrespective of backend resources? However, the console shows the active user count 1000 at the time corresponding to the Graph. What does this mean?? I’m freshly adopting to the Gatling tool. Please, correct me if I missed something.
My requirement here is, irrespective of the server resources, maintain the constant user load of 1000 at any point.

Also, can you please elaborate on this point:
If I guessed correctly, your scenario duration is around 0.75 seconds with a “normal” server and around 0.5 seconds with an “increased” server.
Even with varied resources, my setup is intact and my scenario makes one http request. What do you mean by “duration”. Here is the scenario.

val getCasesScenario: ScenarioBuilder = scenario(s"SCN:GetCaseDXv2") |>
(sc => (if (repeats > 0) sc.repeat(repeats) _ else sc.during(duration) _) {
pause(2 seconds)
exec(http(s"GET /cases/$caseId $label")
.get(url_service)
.headers(requestHeader)
.check(status is 200)
.check(regex(“status”))
)
})

here repeats=1, that means the duration is not honored. Or, do you mean the response time of each request by ‘duration’ ??

But what do constant concurrent users mean? If I’m specifying the test to maintain the constant user load of 1000 users at any point, shouldn’t the constant users be maintained at 1000 irrespective of backend resources? However, the console shows the active user count 1000 at the time corresponding to the Graph. What does this mean?? I’m freshly adopting to the Gatling tool. Please, correct me if I missed something.
My requirement here is, irrespective of the server resources, maintain the constant user load of 1000 at any point.

Your assumption is quite good “constant concurrent users” means that Gatling will create a new user as soon as a user is destroyed (at the end of their scenario).

The graph, on the other side, displays the number of active users during a second.

As I guessed, your scenario is pretty short (only one request), so it can run in less than a second.

Just to be clear: a scenario is the steps that a single user will perform during their life.
So, as your scenario is pretty short (only one request), the user life will be.

With your simulation configuration, you are requesting Gatling to create new users as soon as they die.
Direct implication: at any time, there exist nbUsers users, but during a second, we can see more active users.

To picture that. Imagine a queue to the post office. If every time you look at it, it may contain the same count of people, people come and go as they are served. So during a period, the total amount of people in the queue will be larger than the queue itself.
constantConcurrentUsers is here the queue length
the graph shows the different people in the queue during a period

Is that more clear?

Thanks Sébastien. I understand it better now.