Exit if User per sec reached certain rate?

Hi, wish you all a new year of health and wealth.

During my load test, as some problems may happen such as response time degradation which could lead to user’s connection being longer than usual. For example, usually my load test will need only 12-20 Users active at the same time, but due to response time degradation, this rate may increase to 25-30 Users at the same time. At this point the test should be automatically stopped as it serves no more purposes (at least for my case).
I knew the existence of existHereIfFailed, however I am not sure about the rate property to implement that to my script. If there is a way, please share with me :slight_smile:

Hi,

This feature, named Run Stop Criteria, is only available in Gatling Enterprise, see Run Stop Criteria | Gatling Features.

1 Like

Below scenario ramps up the users 0 through 20 users during the first 5minutes
And it runs with 20 users for 30 minutes. Irrespective of the time taken by the APIs
setUp(
ScenarioName.inject(
rampUsersPerSec(0) to(20) during(5 minutes),
constantUsersPerSec(20) during(30 minutes)
)

).protocols(httpConfig)

existHereIfFailed - will trigger is nothing to do with number of users. If there is any request fails if you want to exit you can use condition when you define a Scenario. Hope this helps.

For more information you can use refer this doc - Gatling injection scripting reference