Can I send in parallel requests for one step?

Hi

I have a script where this is one step, this is being done sequentially here. How do I change that and make it do it in parallel with x number of simultaneous requests?

 .repeat(100){
     exec(http("Get it 100 times")
    .get("/status")
    .check(status.is(200)))}
}

Thank you!

You can’t make one part of a scenario break into multiple users while the parts before and after are single-user. Your Gatling scenario defines what each user will do. It is no more complicated than that.

To get more complicated, you have to use programming logic and thread-safe variables. For example, only the first user does the first few steps, and all the rest skip it because of a flag that says that it has already been done. Then they all rendezvous together and all do the middle part, and then when all is said and done, only one user does the last part.

That is to say, Gatling makes it POSSIBLE to do things like that, but you have to code it yourself.

Thanks for the reply. I guess it is as simple as an if statement to check if the flag is set before the next user comes by.

Sadly, not quite. You must use a thread-safe variable and check and set the variable atomically. Otherwise, you run into race conditions and ill-behaved code. But it’s typical thread-safe programming. Any resource on that will tell you how to do it.

Ok, thank you. Need to do some reading on this. If you have any recommended resources, it would be much appreciated.

I do not. I would have to Google. :slight_smile:

:slight_smile: