2 REST API GET requests executing only after every request with 10 users is completed

Hi Team,
I’m new to Gatling.

I have REST APIs as below. If I execute this, would 10 users execute 1st GET request and then execute 2nd GET request. Or will they execute concurrently? I want to execute 10 users for PERF_1 and after getting all responses, I want to start PERF_2. Is it possible, or I should have 2 files for it. When will the pause work, Is it after execution of 10 users for PERF_1 and then pause, or for every GET request it pauses?

object Search {
val search = exec(http(“PERF_1”)
.get("/suggestions?search=Cancel")
).pause(duration = 2)

.exec(http(“PERF_2”)
.get("/suggestions?search=Cancel&domain=BC")
).pause(duration = 2)
}
val scn = scenario(“Performance Tests”)
.exec(Search.search)

setUp(scn.inject(atOnceUsers(10)))
.protocols(httpProtocol)

Thanks,
Vasudha

Hi,

I’m not sure what you really want to achieve with such tests…

I like the allegory that a Simulation is like a theater play.
The setUp is the definition of the entrance of the different actors.
A scenario is the script of one actor.

So, in your sample code. You defined a play that begins with 10 actors on stage at the very beginning.
Each actor plays the same script:

  • Declaim the first tirade "PERF_1"
  • Once the tirade declaimed (ie receiving a response from server), wait for 2 seconds
  • Declaim the second tirade "PERF_2"
  • Once the tirade declaimed (receiving the second response), wait for 2 seconds
  • Exit from stage

Perhaps do you want to see what sequential scenarios may help in your use case:

A play, where 10 actors play the same script, then exit from stage. When everybody is outside the stage, the 2nd chapter may begin.

Hope it helps!
Cheers!

Hi,
On a whole I have 15 APIs from which we want to take response time. All the APIs are independent from each other. I wanted to know, how the API will respond when 10 users are executing it at the same time, which is parallelly. Also I wanted to know I have 10 users, will all the 10 users execute my PERF1 get request. Or if only 1 user is allowed to execute 1 get request, what will the other users execute? Is there a possibility that 2 or more users execute the same get request at the same time?

I’m so sorry if my question isn’t meaningful. I want to know how each of my GET request works when 10, 100, 10000 users are using at the same time. If I write all the GET requests in a single file, everything is starting to execute concurrently.

15 APIS from which we want to take response time

That is the purpose of having a meaningful name for the request. You will be able to see the response time only for this request.
I do think that is generally more meaningful to have a lot of users doing a lot of different stuff at the same time (as a real server will suffer under a real load with real users)
And this, even if you want to focus your result on a specific request (to know which request is more prone to consume your time).

All the APIs are independent from each other.

Are you sure about that?
Are you positive that:

  • the requests are not served by the same webserver? (what will be the behavior of a request when another one takes all the available resources?)
  • do not share any information (a db connection pool perhaps?)
  • are not served by the same service ? the same network ? the same CPU ? the same… whatever (bandwidth usage, load balancer configuration, proxy configuration, etc.)

Is there a possibility that 2 or more users execute the same get request at the same time?

To be honest, I did not check personally how things work under the hood but I don’t think that all the different electrons are sent at the very same nanosecond on the RJ45 cable.
Troll aside, Gatling is indeed designed to manage lots of users at the same time. Usual limitation is more hardware inclined than gatling itself. Here some limitations possibles (not exhaustive):

  • no more than maximum connections possible on a single network card (65535 different ports, less if some are already opened or the user cannot open the system reserved ports)
  • RAM limitation if you have a lot of different value in session for each alive user (OutOfMemoryError)
  • Thread starvation if you have less than 4 CPU cores.

But I repeat: the requests will be as parallel as physically possible. Otherwise Gatling won’t have meaningful results and no reason to be created in first place.

I hope this is more clear!
Cheers!

They are not independent. They are from the same db and the same application.
I think I have understood the concept clearly.

Thank you