rampUsers over time spikes in the beginning


I’m using rampUser over time to inject users to my scenario.
The parameters used were 100K users over 250seconds. The documentation says it will ramp users linearly so I’m expecting ~400 users per second.

The result is pretty much that except for the first few seconds:
user per second spiked to ~720 for a short amount of time and then converged to ~400 for the rest of the run.

my guess for that is:
the speed at which gatling is creating new connections is slower than the expected speed (400 per sec). so in the beginning few seconds it was falling behind the schedule.
when it has created enough connections to reuse, it tried catching up by using more users per second until it’s caught up.

is there a way to tell gatling to pre-allocate connections before ramping? so that the curve will be completely flat.

right now my solution for this is something like this to slowly ramp up the desired ramp speed in a few seconds.


// duration is at least 5s. spend the first 4s ramping up the ramp speed to allow gatling to catch up
rampUsers(1 * userPerSec / 5) over(1 seconds),
rampUsers(2 * userPerSec / 5) over(1 seconds),
rampUsers(3 * userPerSec / 5) over(1 seconds),
rampUsers(4 * userPerSec / 5) over(1 seconds),
rampUsers(userCount - 2 * userPerSec ) over(rampDuration - 2 seconds)


Still this is not good enough since I can always come back with even higher user per sec number and this solution will be broken.

Any suggestions?