how to keep steady number of users


I am new to Gatling, I already have my scenario set up, which lasts about 40 sec per user. I need a simulation with steady number of users for specific period of time:

Ramp up to 100 users in 1 min, keep 100 users for 10 min, ramp down

Ramp up to 2500 users in 10 min, keep 2500 users for 2 hours min, ramp down

I tried to use constantUsersPerSec but unable to keep active users steady.

I do not want to use throttle, since this will keep RPS steady and not number of users.

Can anybody help with this? Or am I misunderstanding how injecting users works?

Thank You


Step No. 5:
Example 1 in Step 6:

Hi CyberNinja, thank you for helping me on this, after reading provided example and some more about gatling, I believe I have a different use case.

I actually need to keep my TPS steady, not users. I have posted another question in this group, since this topic is different.!topic/gatling/ZIULVgs62aA

Please help me on that one too.
Thank You

It’s the same. Keeping the number of users constant with fixed pacing for the desired duration would allow you to simulate the desired constant TPS.

Little’s law.