Looks like pause at the end of scenarios is not considered

one of my performance test is : There are 10 employees in a company
each one’s scenario is search (using http POST) read it for 10 sec (pause) , then repeat this for 2 min

for this i have used closed Injection with 10 constant concurrent users for 2 min duration

2 min = 2 * 60 sec . ie., 120 sec. since there is 10 sec pause . the max number of requests each user can achieve is 12 . hence the total number of requests should be < 120 . but Gatling has sent more than 2400 requests in 2 min for 10 concurrent users

please let me know what is wrong here. is pause considered when kept at the end of scenario?

in case you need code :

ScenarioBuilder scn = scenario(
				"Load Test Recommendation Query - " + testData.get(NumberOfUsersKey) + " Concurrent users")
						.feed(searchQueryFeeder).feed(getAuthTokenFeed())
						.exec(RecommendationControllerApi.getFreeTextRecommendationUsingPOST()
								.getGatlingRequest("Recommendation FreeText CU " + testData.get(NumberOfUsersKey))
								.body(StringBody(ftr))
								.header(SainapseUserManagement.authorisationHeaderName,
										"#{" + SainapseUserManagement.authorisationHeaderName + "}")
								.check(status().is(200)))
						.pause(Duration.ofSeconds(pauseInSeconds));

		this.setUp(scn.injectClosed(constantConcurrentUsers((Integer) testData.get(NumberOfUsersKey))
				.during(Duration.ofMinutes((Integer) testData.get(SimulationTimeKey))))).protocols(httpProtocol);

The run duration is based on the instant of the last response, but except that, I can assure that virtual users consider pauses whatever their location, even as the last action.

kindly elaborate on

  1. why number of total requests is > 120
  2. how can i achieve <=120 total requests

As requested here, please provide a reproducer we can run on our side.

public class ComputerDatabaseSimulation extends Simulation {

    HttpProtocolBuilder httpProtocol =
        http.baseUrl("https://computer-database.gatling.io")
            .acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
            .acceptLanguageHeader("en-US,en;q=0.5")
            .acceptEncodingHeader("gzip, deflate")
            .userAgentHeader(
                "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0"
            );

    ScenarioBuilder users = scenario("Users")
      .exec(http("home").get("/computers"))
      .pause(10);

    {
        setUp(
            users.injectClosed(constantConcurrentUsers(10).during(120))
        ).protocols(httpProtocol);
    }
}
================================================================================
---- Global Information --------------------------------------------------------
> request count                                        119 (OK=119    KO=0     )
> min response time                                    341 (OK=341    KO=-     )
> max response time                                   6845 (OK=6845   KO=-     )
> mean response time                                   568 (OK=568    KO=-     )
> std deviation                                        668 (OK=668    KO=-     )
> response time 50th percentile                        376 (OK=376    KO=-     )
> response time 75th percentile                        442 (OK=442    KO=-     )
> response time 95th percentile                       1291 (OK=1291   KO=-     )
> response time 99th percentile                       2359 (OK=2359   KO=-     )
> mean requests/sec                                  0.922 (OK=0.922  KO=-     )
---- Response Time Distribution ------------------------------------------------
> t < 800 ms                                           100 ( 84%)
> 800 ms < t < 1200 ms                                  10 (  8%)
> t > 1200 ms                                            9 (  8%)
> failed                                                 0 (  0%)
================================================================================

So the issue is on your side.
Are you sure you don’t have tons of redirects?

I will debug and get back to you. Thank you very much for your support

This indeed is my code issue…