danny
danny

Reputation: 3266

Gatling doesn't send specified number of requests per seconds

I am testing my API with below gatling3 code

setUp(scn.inject(constantUsersPerSec(300) during (10 minutes))).throttle(
reachRps(300) in (10 seconds),
holdFor(5 minutes),
reachRps(500) in (10 seconds),
holdFor(5 minutes)
).protocols(httpProtocol)

what I am expecting is in first 5 minutes, gatling sends 300 requests per seconds and in the next 5 minutes, gatling sends 500 requests per seconds. However the test report shows that gatling sends 300 requests per seconds in all the 10 minutes.

enter image description here

why does this happen?

Upvotes: 1

Views: 4983

Answers (2)

Brett Reinhard
Brett Reinhard

Reputation: 382

What you'll want to do is something similar to this:

setUp(scn.inject(constantUsersPerSec(500) during (10 minutes))).throttle(
reachRps(300) in (10 seconds),
holdFor(5 minutes),
reachRps(500) in (10 seconds),
holdFor(5 minutes)
).protocols(httpProtocol)

The throttle will be the upper limit your test, so if you have a constant users per second of 500, but throttle it for 300, it will stay throttled to 300, but then once you increase the throttle to 500, you should see the rps rise to that threshold, given constantUsersPerSec(500) gives you enough traffic to get you to that point.

Upvotes: 2

Thiago Virgilio
Thiago Virgilio

Reputation: 1

I think the period showed in your graph is the initial period of the test, where to 12:21 from ~12:31 is reached 300 rps. after that, the gatling will hold for 5 minutes and then make 500 rps by more 10 seconds. You waited 10s + 5 min + 10s + 5min?

Upvotes: 0

Related Questions