limit_req_zone limit by location/proxy

Justin Deltener jdeltener at
Wed Nov 13 15:09:55 UTC 2013

Aha, that is the lightbulb moment.

So if we're talking actual rate..which makes sense how would you setup a
scenario with the following requirements.

You can have whatever rate you want as long as you don't exceed 5 proxy
requests in the same second. I don't care if 5 come within 5ms of each
other.. Hitting 6 total proxy requests in 1 second would kill the request.
It seems we can't really specify that without increasing the rate which in
turn could allow a sustained session with high rates to still have a ton of
requests come in to kill the server.

We're attempting to account for 301 redirects which spawn requests much
faster than normal human requests. I realize we could add a get param to
the url to excuse it from the limit, but that seems a bit out there..

I also don't quite understand how long a burst rate can be sustained. It
seems one could set the default rate to 1/m and set the burst to whatever
you like..

Does that make sense?

On Wed, Nov 13, 2013 at 7:40 AM, Maxim Dounin <mdounin at> wrote:

> Hello!
> On Wed, Nov 13, 2013 at 07:17:36AM -0600, Justin Deltener wrote:
> [...]
> > current requests..which is what i'm attempting to do) Using a burst of
> 6, i
> > would expect a request of 8 in one second would have 4 at full speed, 2
> > delayed and 2 dropped but it seems that's where i'm horribly wrong. You
> > said "As long as rate is set to 4r/s, it's enough to do two requests with
> > less than 250ms between them to trigger "delaying request message". I'm
> > confused, why would 4r/s not allow 4 requests per second at full speed??
> > Isn't that the entire point.
> Two request with 100ms between them means that requests are coming
> at a 10 requests per second rate.  That is, second request have to
> be delayed.
> Note that specifying rate of 4 r/s doesn't imply 1-second
> measurement granularity.  Much like 60 km/h speed limit doesn't
> imply that you have to drive for an hour before you'll reach a
> limit.
> --
> Maxim Dounin
> _______________________________________________
> nginx mailing list
> nginx at


Justin Deltener

Nerd Curator | Alpha Omega Battle Squadron

Toll Free: 1-877-216-5446 x3921

Local: 701-253-5906 x3921 <>

Guiding Principle
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list