How to hold load and stop it suddenly?

i mean,i am generating patterns of the style of the first image, but i would like to make patterns of the style of the second one in which i hold the load for a certain time but i don’t want to give time to the virtual users to finish their flow but i want them to finish it immediately if their holding time is reached

can someone give me examples for the way to do that?

Untitled.png

If you intend to stop the simulation right there, you can use maxDuration after the setUp to stop everything: https://gatling.io/docs/current/cheat-sheet/#simulation-configuration-time-maxDuration

If you intend to inject some users after everything was abruptly stopped. It will be a bit more involved to do because, as far as I know, there is no simple way to achieve this…

You could “cheat” with an asLongAsDuring loop that is shorter than the full duration of the simulation, with the parameter “exitASAP” set to true: https://gatling.io/docs/current/cheat-sheet/#scenario-definition-loops-asLongAsDuring

Mind that users will not all stop at the same time, because the timer will start after they are injected.

You could also use other form of loops with a global timer that is set before the simulation run. In this case, they will synchronize their stop, but it is a bit tricky to code.

I don’t intend to stop the whole simulation, I just want to stop the execution of the scenario to a specific group of users…