Search code examples
gatlingscala-gatling

How to set up pauses with normal distribution in Gatling


How can I set up pauses in Gatling with normal distribution with mean and standard deviation

  1. on Simulation level - which will apply to all requests
  2. override scenario level pauses with other values for specific requests

I can't exactly figure it out looking at gatling's documentation Global Pause configuration and scenario pauses


Solution

  • I think I found the answer.

    In each request you can define a pause (different pause types are available)

    exec(http("GET /")
    .get("/"))
    .pause(10,20)
    

    Above code will add random(uniform?) pause between 10 and 20 seconds

    Then in the simulation level you can define globally that you'd like to use normal distribution e.g.

        .inject(
          rampUsers(1)
            .during(1)
        )
        .pauses(normalPausesWithStdDevDuration(5))
    

    Above configuration will take pause set up on request level as a mean value and use std deviation 5s to chose final pause value