Pause Functionality is not working

Hi, I am currently facing some issue that pause functionality is not working as expected. I need 975 milliseconds between two requests and I have added pause after execution of first request, but it is not pausing there and hitting second request without delay.

Below is the code snippet:

.pause(975 milliseconds)
.doIf(session => session("GetActivationOfMemberV3Status").as[Int] == 200) {
    .pause(100 milliseconds)

Are you using throttle?

What throttle do is that it:

  • disables all the pauses
  • caps your throughput. It can’t generate a throughput that’s higher than the one normally generated by your simulation once pauses are disabled.

Hi Slandelle, yes I have used stressPeakUsers and throttle for my scenario.
So, how we can achieve pause when applying throttle?

That’s not possible, these features are antinomic.

Then, is there any method to control the threshold other than throttle so that I can apply pause?

You must remodel Simulation to use Injection Profiles →

Hi Gerard, is there any sample code for my reference to set the threshold and apply pause delay? Providing some sample scenario, apply threshold of 50 TPS for 10 minutes and 100 TPS for next 5 minutes with 975 milliseconds between two requests of same scenario?

In Gatling there isn’t TPS there are Virtual Users.
Sample Scenario that make injection what you mentioned using incrementUsersPerSec below - of corse for smaller scale and level lasting time are the same but this should show you idea how to:

package pl.gemiusz;

import io.gatling.javaapi.core.ScenarioBuilder;
import io.gatling.javaapi.core.Simulation;
import io.gatling.javaapi.http.HttpProtocolBuilder;

import java.time.Duration;

import static io.gatling.javaapi.core.CoreDsl.*;
import static io.gatling.javaapi.http.HttpDsl.http;
import static io.gatling.javaapi.http.HttpDsl.status;

public class Case0004StatusCodeSimulation extends Simulation {

    HttpProtocolBuilder httpProtocol =

    ScenarioBuilder scn =

                    .startingFrom(0) // Double

Hi @GeMi ,
But we can’t run this for any fixed duration. It will end once all virtual users execute the scenario.
Our need is to run the scenario for one hour with some virtual users along with intermediate spikes(also apply delay between two requests). Is there any code snippet available with you to accomplish our requirement?

Check Gatling documentation and Maximum Duration

I’m sorry, but you’ll have to figure it out yourself - it’s easy to do but you must known how Injections are working.


ok @GeMi, I will explore it.

Thanks for the info.

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