Number of threads used to send requests


I would like to understand better… When I do something like:


What “users(10000)” exactly means in terms of number of threads? Does it mean that 10000 requests will be sent over a number X of threads. If so, is there a way to specify X?

Number of underlying threads is an implementation detail.
Basically, it’s a factor of your number of cores on your machine.

Current set up my my 8 core machines uses 35 threads.

Adding more threads won’t make it faster.

Ok. Not talking about how it will be implemented internally. The idea of my scenario is to simulate a number of concurrent users, each one sending N messages to my server through a REST call. So, for example, I would like to have 3 concurrent users: The first one will do 1000 calls over 10 seconds, the second one 2000 calls over 30 seconds, and the third one 400 calls over 60 seconds. It’s that possible to implement using gatling?

“3 concurrent users”
Is this a requirement? What do you mean by “user”? A virtual user is basically a virtual human with a browser, and requests go one after the other (for example, you have to the response that contains the cookie before you can proceed with the next request where you send this cookie).

There’s a good chance you actually want 3 different populations, not concurrent users.

Just have 3 scenarios of 1 request each, and inject them with a ramp.

val scn1 = scenario(“1”).exec(request(“rest1”)…)
val scn2 = scenario(“2”).exec(request(“rest2”)…)

val scn3 = scenario(“3”).exec(request(“rest3”)…)

setUp(scn1.inject(rampUsers(1000) over 10),
scn2.inject(rampUsers(2000) over 30),
scn3.inject(rampUsers(400) over 60))


You can write that like this :

val scenario1 = scenario(“Scenario1”).exec(http(“Query1”).get("/")…)
val scenario2 = …
val scenario3 = …

setUp(scenario1.inject(rampUsers(1000).over(10 seconds)),
scenario1.inject(rampUsers(2000).over(20 seconds)),
scenario1.inject(rampUsers(3000).over(30 seconds)) )