How to give maximum duration for simulation???


I am new to gatling…can anybody please explain that How can I give maxDuration option for simulation…If I use maxduration simulation will be completed in that specific time…is it correct???
And what is the effect of performance by using this method…please explain with code example…


I admit, the documentation does not make it clear where the maxDuration is applied.

val scn = exec( . . . )

.maxDuration // does it go here?
.inject( … )
.maxDuration // or here?
).maxDuration // or here?


I don’t know the answer. But it would be just as easy for you to try it out and see for yourself as it would be for me to do it for you and tell you the answer.

Think of it as “teaching a man to fish.” :slight_smile:

Thnaks for your info john…I tried with different combinations…But doesn’t work…Can you please tell me your experiments…

I don’t typically use maxDuration. I have a ramp up period, a sustain period, and there is a natural ramp down as the users quit. That works fine for me. If you need maxDuration, ask yourself if you have a bug in your scenario that stops it from quitting on its own.

John…My context is can we control the total simulation time in gatling???Meaning suppose If I am doing simulation for 100 users and ramp up time 1user per second…Is it possible to control the total simulation time??I think no…But correct me If I am taking deviation.

Yes you can control total simulation time.


It is used like this:

setUp(scn.inject(rampUsers(10) over(50 seconds))).protocols(httpProtocol).maxDuration(5 minutes)

Hi Sai,

does maxDuration worked? Please some code?

Thanks in advance.


Here you will find it:

Like this:

setUp(scn.inject(rampUsers(1000) over(20 minutes))).maxDuration(10 minutes)

Doesn’t work for me

From doc version, it only supports 3.3+.