Understanding pacing & forever loop in simulation

Hi,
I’ve been trying out different workloads to understand how Gatling user & load patterns form

I’ve been using the below code

val httpProtocol = http

val userScn = scenario(“users”)
.forever(
pace(1)
.exec(http(“getUsers”)
.get(“https://reqres.in/api/users?page=2”))
)

setUp(
userScn.inject(
constantConcurrentUsers(3).during(20)
).protocols(httpProtocol)
).maxDuration(20)

My understanding here is that I should get 3 users executing the request every 1 second for 20 seconds max, so in total, I should get 60 requests
But I’m getting only 3 requests triggered overall

is my understanding wrong here?
if so, pls explain how it works

Thanks
Sujin Sam

Hi,

You are absolutely right.
There are ~60 requests tried… but a user will cache its previous request as the endpoint you’re calling has a Cache-Control header.

So, for each user, when created, has an empty cache.
First request: no cache, so when the virtual user perform the request, it actually calls the server (3 users, so 3 requests)
For next requests, the cache is present, so the virtual user perform the request by getting the response from the cache.

Cheers!

I forgot to mention disableCaching in your protocol definition if you want to see your ~60 requests.

Cheers!

Ah, forgot about that, Thanks Sebastien
Was plucking my head for 2hrs :slight_smile: