Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gatling simulation with fixed number of users for specific period of time

Tags:

gatling

I have my Gatling scenario set up and now I want to configure a simulation with fixed number of users for specific period of time - number of users should initially be increased gradually to specific value and then kept there by adding new as required as users finish.

I specifically don't want to use constantUsersPerSec (which injects users at a constant rate) but something like .throttle(reachUsers(100) in rampUpTime, holdFor(10 minute)) which should inject users when required.

like image 944
Jarek Przygódzki Avatar asked Nov 08 '16 21:11

Jarek Przygódzki


People also ask

What is the difference between simulation and simulation in Gatling?

Simulation is the description of the load test written in the script. It can be written in Java, Scala, or Kotlin. Simulation scripts consist of scenarios, HTTP configurations and user loads, etc.Simulation is the parent class your tests must extend so Gatling can launch them.

Which keywords are used to specify this statement in Gatling simulations?

Various keywords are used to specify this statement in Gatling Simulations: As well as several other loops. Gatling Simulations are written using the Scala programming language but use a dedicated DSL. You must use specific DSL components like the .forEach () or .doIfOrElse () for loops and conditions instead of native if or foreach expressions.

Why are some of the parameters of a Gatling script substituted?

They are substituted, because the parameters have the same name. 7. Gatling Load Simulation Design So far all of our Gatling scripts have just been running with a single user. This is fine for debugging and script development purposes, but eventually we will want to config our scripts to run with many users.

What is the load scenario in Gatling?

The third and final part of the Gatling script is the Load Scenario. This is where we set the load profile (such as the number of virtual users, how long to run for etc.) for our Gatling test. Each of the virtual users will execute the scenario that we defined in part 2 above. Here, we are simply setting up a single user with a single iteration:


1 Answers

If it's still relevant: Gatling supports a throttle method pretty much as you outlined it. You can use the following building blocks (taken from the docs):

  • reachRps(target) in (duration): target a throughput with a ramp over a given duration.

  • jumpToRps(target): jump immediately to a given targeted throughput.

  • holdFor(duration): hold the current throughput for a given duration.

So a modified example for your use case could look something like this:

setUp(scn.inject(constantUsersPerSec(100) during(10 minutes))).throttle(
  reachRps(100) in (1 minute),
  holdFor(9 minute)
)
like image 134
Phonolog Avatar answered Nov 03 '22 00:11

Phonolog