How to ramp with a normal distribution


What’s the best way to improve gatling DSL in order to add a “normal distribution” ramp?

What I want to achieve:
I want to simulate at best my N users, and they will request my service at a specific time during the day.

  • ALL my N users will request my service between 5AM and 7AM
  • most of them will request it at about 6AM
  • few of them will request it at 5AM or 7AM

So I think the best way was to simulate a normal distribution:

Where am I stuck?

  • I’m trying to test it in a real life before forking the lib (after that, if it works, send a pull request to improve the lib)
  • I’m digging onto the DSL, and I reached UserNumber which is a private class of Predef. I can’t manage to improve the DSL without this UserNumber class. (As i’m not a Scala Guru, I might be stuck in some stupid error)

Thanks for any help

For the moment we have an alternative by chaining ramps:

scn.inject(ramp(5000 users).over(30 minutes), ramp(5000 users).over(20 minutes), ramp(5000 users).over(10 minutes), ramp(5000 users).over(20 minutes), ramp(5000 users).over(30 minutes))

But I wanted to do better :slight_smile:

I am not sure I really understand the sequence …

What would you want to be ideally able to write ?

Sorry, I didn’t read the original email :-/

First, are you sure that the distribution you want follows a normal law? Wouldn’t an approximation of Heavyside do the job? (see an exemple here :

If you want to implement the normal law, it won’t be very difficult, the injection API has been done so that it’s very easy to extend it. Too understand it, the best would be for you to have a look at this part of the code :

Once you have a class that extends InjectionStep and encapsulate your injection distribution, you just need to pass an instance to scn.inject(…).

Pull requests are welcome :slight_smile:


Hi, thanks for your quick response.

After reading your blog post, yes I think it will suit my needs.

I saw that class before, but my google research show me some “strange” results with square distribution ( I didn’t dig enough to find that the implementation has a kind of "S" form. And the doc inside gatling didn’t help me much, maybe you could add this blog link into the javadoc (Yeah, it could be seen as advertising, but the post is usefull in this case no?)

Fo the API, I was again looking in the wrong direction, instead of focusing on scn.inject params, I was lookin into the dsl methods (Predef). What I understand now is that I could create a class:

case class MyInjection(users: Int, duration: FiniteDuration) extends InjectionStep{…}

and use scn.inject(MyInjection(1000, someDuration)) :slight_smile:



The documentation is indeed very sparse … we are in the process of writing a new one and some graphs will be included in it.

For the class, “MyInjection”, that’s exactly it.