I need to write Gatling scenario that will mimic real users interaction. It's supposed to issue some requests occasionally, e.g. 10 per hour per user (total 20 users).
From what I see in the docs, constantUsersPerSec
accepts double but it's rounded while reachRps
in throttling deals only with seconds. So, not way to have less than 1 rps.
It is possible to write such scenario using Gatling?
Save this answer. Show activity on this post. As of Gatling 3.3, there's no real way to run scenarios sequentially. The only solution is to start the other scenarios after some delay, see nothingFor.
rampUsers injects the defined numbers of users linearly over a given time. So your use of rampUsers(20)over (120) will result in gatling starting one user every 6 seconds.
So your scenario seems like "for 2 hours, send a request every 6 minutes" or "at a constant rate of 10 users per hour during 2 hours ...".
The constantUsersPerSec
is internally rounded to int after multiplying it to the number of seconds of the duration. So the duration should be chosen with respect to the rate, so that the result is greater than 1.
In your case,
def perHour(rate : Double): Double = rate / 3600
constantUsersPerSec(perHour(10)) during(2 hours)
This would result in
10/3600 users * (2 * 60 * 60) seconds = 20 users
via injection steps
setUp(
scn.inject(
atOnceUsers(1),
nothingFor(6 minutes),
atOnceUsers(1),
nothingFor(6 minutes),
//... and so forth...
)
)
or produce the injection steps in a second method
def injections(): List[InjectionStep] = List(...)
setUp(scn.inject(injections : _*))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With