Gatling 2.0.0 SNAPSHOT . Create "peak of activity" during the simulation

How can I create scenario, which will work continuous during 3 hours, each seconds sending on server 2 or 3 user requests and during each hour create 2-3 random “peak of activity” when 10 users will be started in 1 seconds?
I have 50 users and thinking about something like that:
setUp((scn.inject(constantRate(2-3 usersPerSec) during (10800 seconds))).protocols(httpConf))

but how to create peaks?

Thanks in advance!


Create a second population, using the same scenario, but with a different injection profile.
Use delay for the period between hiccups.
heaviside is probably better for this usage than atOnce or ramp, but that’s for you to decide.


setUp(scn.inject(constantRate(2-3 usersPerSec) during (10800 seconds)),
scn.inject(delay(20 minutes), heaviside(10), delay(20 minutes), heaviside(10), delay(20 minutes), heaviside(10))

Stéphane, thanks a lot!

But when i try Your injection, I receive
C:\Projects\Gatling\user-files\simulations\MainScenario.scala:107: not found: value constantRate
17:12:48.871 [ERROR] i.g.a.ZincCompiler$ - setUp(scn.inject(constantRate(2-3 usersPerSec) during (300 seconds)),

Also in this group i found about: Shaping the number of requests per second to match your observed/expected analytics => that’s throttling (new in 2M4).
For my case it would be better to send constant 2-3 request every second with 3 peaks of 10 requests in second during one hour.
I try find example with throttling, but without luck.

Which version do you use?

Gatling 2.0.0 Snapshot but not the latest one, it dated by February of 2014

No idea what the API was then. You should upgrade.

I’m upgrading. Stéphane, do You have any examples for throttling?
In my case I really interesting in sending requests per second, not users/


Still no luck…
I’m upgrade till latest Gatling M2.0.0.snapshot version

And now my injection looks like:
setUp(scn.inject(constantUsersPerSec(2) during (300 seconds)),
scn.inject(nothingFor(50 seconds), heavisideUsers(10), nothingFor(50 seconds), heavisideUsers(10), nothingFor(50 seconds), heavisideUsers(10))).protocols(httpConf)

But now i receive:

C:\Projects\Gatling\user-files\simulations\MainScenario.scala:110: type mismatch;
found : io.gatling.core.Predef.HeavisideBuilder
required: io.gatling.core.controller.inject.InjectionStep
21:06:28.155 [ERROR] i.g.a.ZincCompiler$ - scn.inject(nothingFor(50 seconds), heavisideUsers(10), nothingFor(50 seconds), heavisideUsers(10), nothingFor(50 seconds), heavisideUsers(10))
21:06:28.157 [ERROR] i.g.a.ZincCompiler$ - ^
21:06:28.185 [ERROR] i.g.a.ZincCompiler$ - one error found
Compilation failed

I import io.gatling.core.controller.inject.InjectionStep but it didn’t help.

Stéphane, I try Your variant with simple delay and Heaviside, but get an error, that this values didn’t exists…

Check out on the same page, heavisideUsers expects an over duration

Stéphane, thanks a lot!