Number of Execution differs

Hi Team,

We are using gatling for performance testing and we are using below code to execute a scenario with two request one after the other.

val scn = scenario(“Test”).during(maxDuration minute)
{
exec(request1).pause(1) .
exec(request2) .pause(1)
}

Note: request1 and request2 are two different rest API invocation. There is no dependency of request1 and request2.

For some reason, during execution I can see request2 is having more number of processed requests as below.

Could you please clarify this behavior?

Regards
Senthil

Most likely because request1 has caching headers.

Hi Stéphane,

Thank you for prompt reply
Below are the response headers and we are having max cache of 60 sec…

access-control-allow-origin: *
cache-control: public, max-age=60
Content-Type: text/javascript
Vary: Accept-Encoding

Transfer-Encoding: chunked

Is this slowing the response ? and will Gatling cache it for 60 sec(meaning no request will be sent to real API backend)?

Regards
Senthil

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control

Cache-Control header causes the user-agent to not request the resource and use the cached version until expiration.

Gatling behaves exactly as instructed.
I might want to reconsider your test design and revisit why you’re making the same virtual users loop instead of creating new ones.

Hi Stéphane,

I am configuring the Scenario and Simulation run like below, If the below approach is not correct, Could you please let me correct the scenario?

//Scenario Definition
val scn = scenario(“Test”).during(maxDuration minute)
{
exec(request1).pause(1) .
exec(request2) .pause(1)
}

//Load Scenario (Simulation)
setUp(scn.inject(
constantUsersPerSec(userCount) during (rampUserDuration seconds)).throttle(
reachRps(rps) in (rampRPSDuration seconds),
holdFor(testDuration minute)
)).protocols(httpConf).maxDuration(maxDuration minute)

Regards
Senthil

Hi Senthil,

The issue is with your during(maxDuration minute) after the scenario("Test")

This instructs the scenario to loop during the specified amount of time for the current virtual user.

Hi Sbr,

I have added duration in Scenario definition because If I remove the duration my test is closing once all the users are done even before reaching the max duration.

For example, I want to run test for 2 hours with 60rps, then what should be the virtual user configuration? Kindly guide to setup the scenario correctly.

In the below Test, Test finished in 1min 30 sec (Approx) even before the max duration(10 mins) reached.
Number of users configured was 100(total)

Regards
Senthil