Welcome! Log In Create A New Profile

Advanced

What makes an infinite limit_req burst zone?

Posted by Diaboliko 
What makes an infinite limit_req burst zone?
June 03, 2021 12:36PM
Looking at code of 1.20.0 stable I struggle to tell whether burst is uint, int or something else entirely. Pretending its uint, I can enter value which should reset uint to zero (4294967296) but it certainly isnt zero... One could guess that zero value might be special (but not allowed by default), but adding one to it doesn't make it a 1 either.
If its int, then theres no magic, but thats some heavy thinking.
I can just test it, theoretically, but even reaching those values will take a while. A really long while.

Context:
location1 uses request limiting based on some context info; if its exhausted (code throws error) - catch error within named location and within it proxy_pass this request to unix_domain socket which the same nginx is listening to (that seems to be stable and looses like no speed (seemingly), so it seems fine to me).

location2 uses total request throughput limiting (basically the maximum backend behind nginx can handle).

So the idea is to limit "bad" clients, but only if backend can't handle specified amount of requests per second.

The catch is - to have location2 correctly limit request load, same limit_req must be put into location one, otherwise it skips evaluation stage of nginx, effectively not increasing counter value.
To avoid throwing errors for all clients when global limit is exhausted, gigantic burst zone on global limit_req within location1 is applied. Having it set super high works. At least as far as my testing goes. So this is why Im looking for either the highest possible value for burst, or some magic number.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 146
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready