constant users per sec

Hi Guys,

So I’ve been looking at the documentation trying to find out an appropriate simulation for my use case but haven’t any luck so far. What I want is to have is truly constant user per second. I’m looking for the test to run for 10 minutes and 25 users constantly running through the simulation. A nice to have would be a ramp up time for 1 minute where Gatling injects 0 - 25 users within a minute then stays constant with 25 users till test ends.

Here is an example -

Simulation Step

  1. Login
  2. Create a task
  3. Update another task
  4. Send a message
  5. Log out

So lets say UserId001 is one of those 25 users, the test starts and UserId001 goes through step 1 through 5 in 20 seconds. i want this user to repeat the same task as another application user (may be we pull that user out of the datasource file). The same user will create a new session and continue.

What would you guys recommend?

I’ve tried constantUsersPerSec(5) during(60 seconds) and Gatling will interpret this as I have 300 (5 x 60) who will only the above mentioned solution once.
I’ve also tried rampUsers(5) over(60 seconds).

I’m using Gatling 2.1.5 with Maven plugin.

Thanks!

As per previous discussions, Gatling doesn’t have first class closed model support for now.

Still, it’s very easy to implement once you know your way around. Basically, you have to recycle your virtual users:

  • inject rampUsers(25) over(60 seconds), so you get all your users and your ramp
  • wrap your scenario in a 10 minutes during loop
  • make your scenario start with the session clean up: you have to remove all the attributes but the ones used for the outer loop
    during(10 minutes, “outerLoopIndex”) {

exec { session =>
val outerLoopIndex = session(“outerLoopIndex”).as[Int]
val outerLoopTimestamp = session(“timestamp.outerLoopIndex”).as[Long]
session.copy(attributes = Map(“outerLoopIndex” → outerLoopIndex, “timestamp.outerLoopIndex” → outerLoopTimestamp))
}
. yourRealScenario
}

Interesting. I’ll give that a shot. Thank you Stephane.

Hi can you guys plesase share the simulation scripts....