Inject command for gradual ramp up and hold and then ramp down

We are trying to run a test where users ramps up and then the load is held for some duration and then user gradually ramps down.
Can someone suggest what should be the inject commands that should be used to achieve the below user simulation.

In this image x axis is time, and y axis is user count.

Hey there,

In cases like this we prefer if you try it on your own first and then post code that we can correct rather than writing it for you. This is in the basic spirit of this community. I suggest reading about the core concepts of injection here:

Would also recommend taking the Gatling Academy Modules if you’re new to Gatling: Gatling Academy - Become a load testing leader

All the best,

1 Like

Hi @GatlingPete ,
Below here are my code, I am also trying to implement the same injection model of the topic

import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
class BasicSimulation extends Simulation{
val scn  = scenario("listUser") 


By far, I have achieved the topic model, however, I cannot differentiate about users rate and active users yet, could you explain more so that I can calculate exactly the active users that I want based on time and rate ?

I would really suggest looking at the Gatling Academy module 1, to learn about open and closed injection profiles and how to set them up in Gatling. Here it looks like you’re trying to run a pretty simple load test from your graph but from your code it looks like you’re only trying to run it for 10 seconds? To get the graph you’re looking for you can go with a simpler injection profile:


If you’re looking to Ramp users before or after you can use the rampusers(X).during(X) building block in the setup.

If you’re brand new and looking to generate some simple types of tests I might also recommend checking out Gatling Enterprise Cloud and our new no-code generator which can help you get started and show you the code for some simple injection profiles and types of test.

Finally, are you trained in Scala? If not I would really suggest starting in Java as it’s a bit more accessible.

Let me know if that helps.

All the best,

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.