Throttle/Throttling ELI5

Afternoon,

I’m currently performing a throttle scenario in the advanced tutorial and I’m really struggling to understand what we are doing and why.

Thank you

Apologies but I’ve spent a significant amount of time researching online and youtube and still can’t find suitable documentation/help on this.

My interpretation was each virtual user would equal 1 request. In the below code from the tutorial, instead of having an rps of 10 in 30s why can’t we just ramp up the same as virtual users.

What is the relationship between the users and RPS? Are we simulating multiple requests for less users. Thanks

	setUp(scn.inject(constantUsersPerSec(1) during (3.minutes))).protocols(httpProtocol).throttle(
		reachRps(10) in (30.seconds),
		holdFor(60.seconds),
		jumpToRps(20),
		holdFor(60.seconds)
	).maxDuration(3.minutes)

My interpretation was each virtual user would equal 1 request.

When you browse internet, do you execute only one request and close the tab?
Usually, you fetch multiple endpoints (index.html, json data, images, css, javascript files, etc.) only to visit a simple website.
So, why 1 user will (generally speaking) only execute 1 request?

What is the relationship between the users and RPS?

None, or almost none but the fact that users execute requests.

In a hypothetical configuration, you may have billions of users that won’t do anything (waiting, pausing)
So, there will be no request at all (0 rps).

In another hypothetical configuration, you may have a handful of users that loop over a single request with resources (requests in parallel)
There can be a very high requests per second rate.

throttle artificially limit the requests amount per second. (when the ratio is hit, users wait for next second)
So, the scenario of one single virtual user may take more time because of that limit.

Usually, you don’t need throttle. I personally never used it, as, for now, I only test system with open model. But, your use case may be different from mine.
For instance:

  • if you are testing a single instance of your application (for cost reduction?) but you know for sure that the load balancer will spawn other instance if your application reach a certain rps by instance, you can throttle to mimic this mechanism
  • if you have a mechanism of pre-warm your instance before you add them live, you can want to have a lot of virtual user, but ramp up the request to warm correctly your server.
  • if your server make heavy use of cache and the first requests will take longer because of that, you may want to throttle the beginning of your simulation to live warm your server before actual test (ramp up / ramp down time window in Gatling Enterprise)

Does that helps?

Cheers!

1 Like

Thanks that helps massively.

Doesn’t sound like I would need to use throttle tbh. I understood throttling from a network perspective because if I throttle to 10mb/s I might want to see how a mobile phone reacts with lower speeds for e.g. I didn’t for performance testing.

The website I am interested in testing, I just load the homepage and it makes around 200 requests.

If I inject 1 user in a test which hits the homepage does that mean that user will make all the 200 requests as well in my Gatling test or do I need to include all those requests.

This is something I struggle with because using a tool like Gatling HAR converter we remove resources such as images.

What is the best way to learn the proper way to performance testing? I’m a functional tester in manual testing and I really like Gatling as a tool.

The website I am interested in testing, I just load the homepage and it makes around 200 requests.

If I inject 1 user in a test which hits the homepage does that mean that user will make all the 200 requests as well in my Gatling test or do I need to include all those requests.

Gatling won’t do any request without you expressly wrote in your scenario.
The Gatling Recorder should have written such requests, though.

In the other hand, static resources should be served by CDN and are barely interesting to load test.

What is the best way to learn the proper way to performance testing? I’m a functional tester in manual testing and I really like Gatling as a tool.

Define what matters to your project first!
As for functional test, you write a target (specification?).
Instead of (or in addition of) checking that the result correspond to a computation, you have to check that the duration of such a computation is under a threshold even when there is a certain level of usage.

To define the “level of usage”, you can define both the current usage (from analytics) and the target usage (twice the current usage?).

Perhaps this article about different load testing strategy may help you.

Cheers!

1 Like

Great information. Thanks!

What I might try to do is read up a lot more on the fundamentals in that doc and have a bash at creating a couple of simple scenarios for the websites I want to test then I will come back here and try and review if what I am doing is “proper”

Great info. Cheers

I am resurrecting this thread as I want to see if throttling might come in handy now :slight_smile:

I need to test a service which encountered some memory outages. This service also contains other dependencies which contributed to the outage.

I can see the RPS for service one in the logs. Would this be a good time to use a throttled scenario with aim to reach that same benchmark?

So essentially I could create a load test which ramps up both apis but throttle it to maybe 3,000rps. Apologies if that doesn’t make sense.

EDIT: I think i may have found part of my answer in the last message here from Stephane https://groups.google.com/g/gatling/c/de2TtllN7fk?pli=1

Thank you