Consistent TPS for multiple requests in same scenario

Hi there,

I have one requirement that every request should run in consistent TPS for a whole test.
Below is my code snippet:

  val updateLineItemScenarioFromV3: ScenarioBuilder = scenario("Update Line Item Scenario")
      .feed(Feeder.tlv4_1EntDetailsV3UptLineChkDate)
        .exec(session => {
          session.set("accessToken", MessagePasser.getMessage(1))
        })
        .exec(session => {
          val endDate = s"2025-10-10T23:59:59Z"
          session.setAll(Map(
            "endDate" -> endDate,
          ))
        })
        .exec(UpdateLineEndDate).exec(flushHttpCache)
        }

And my injection profile:

 UpdateEntitlement.updateLineItemScenarioFromV3.inject(constantUsersPerSec(10).during(1 minutes)).throttle(reachRps(10) in (0 seconds),holdFor(1 minutes))

When I execute for 1 minute, I got my requirement of consistently 10 requests per second.

Now, I have to get date from the “getEntitlementById” API and pass it to the “UpdateLineEndDate” API. So, adding one more request in my scenario.

  val updateLineItemScenarioFromV3: ScenarioBuilder = scenario("Update Line Item Scenario")
      .feed(Feeder.tlv4_1EntDetailsV3UptLineChkDate)
        .exec(session => {
          session.set("accessToken", MessagePasser.getMessage(1))
        })
        .exec(getEntitlementById)
        .exec(session => {
          val endDate = s"${updateLineEndDate}T23:59:59Z"
          session.setAll(Map(
            "updatedEndDate"-> updateLineEndDate,
            "endDate" -> endDate,
          ))
        })
        .exec(UpdateLineEndDate).exec(flushHttpCache)
        }

And my injection profile:

 UpdateEntitlement.updateLineItemScenarioFromV3.inject(constantUsersPerSec(20).during(1 minutes)).throttle(reachRps(20) in (0 seconds),holdFor(1 minutes))

When I re-executed for 1 minute, I observed consistently 20 requests per second.

I also want consistent tps for each API’s:
getEntitlementById - 10 TPS
UpdateLineEndDate - 10 TPS
But for the individual API’s , it got dispread.


I am not sure about the execution behind the scenes. So, please provide me some resolution to reach consistent TPS in each API’s.

Thank You in advance!

There is no problem with the load test results.

The graphs have a time resolution of 1s for your duration. If a request occurs at t-1ms, it is counted in one bucket, and if it occurs at t+1ms, it is counted in the next bucket.

With a low amount of RPS (10 RPS), it doesn’t take much for a request to switch to the next bucket, which is reflected in the results.

1 Like

Hi, @Samir

Thanks for the information. But is there any way to make “getEntitlementById” and “UpdateLineEndDate” requests(both come under the same scenario) with 10 RPS each in a single second(bucket)?

Hi,

Here some link to help you: Gatling Simulation scripting reference

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.