How to hold load?

setUp(scn.inject(ramp(100 users) over (100 seconds) )).protocols(httpProtocol)

How to hold load for several minutes when all users are active?

Well, the injection API is only there to control the injection.
If you want to alter the comportment of the users, why not using the .during() element?

Is it possible to apply .during() to the whole scenario, and not to the single user?

That question is confusing me.

All users are using the same scenario, so, yes, if you use the .during() keyword in the scenario DSL, it will apply for all users.

I’m sorry. I wrote my question incorrectly. If I use .during(100) in chain descryption, and .ramp(100) in setUp it means that last user will start at 100 sec after beginning and will operate for 100sec. That’s why load will looks like:

But I try to limit all test and create load like:

all users will stop after 100 sec after beginning. So is there any way in gatling functions or need to use scala functions to parametrize worktime of every user (.during(param))
Also Is it possible to create a stepped load like:


Thanks for the sketches, I understand your problem now, but we don’t have such a functionnality in Gatling.

That’s something that you can easily implement yourself actually: just wrap your whole scenario into an asLongAs loop that would check the duration since simulation start.

For example:

val start = System.currentTimeMillis

val scn = scenario(“foo”)
.asLongAs(session => (System.currentTimeMillis - start) < 3600000) { // have users exit 1h after simulation start
… // place scenario content here



I accidentally implemented it:

I am curious to know how this function(asLongas) helps to solve and generate a load pattern like the second image of the buddy post.could you give some examples?