limit_req_zone and limit_req: rate too strict

Valentin V. Bartenev ne at vbart.ru
Fri Apr 6 16:06:36 UTC 2012


On Friday 06 April 2012 17:24:52 Bruno Prémont wrote:
> Hi,
> 
> I have started using limit_req_zone + limit_req but am seeing more delayed
> log entries than I would expect.
> 
> I have the following:
> 
>   limit_req_zone $binary_remote_addr zone=one:10m rate=3r/s;
>   ...
>   server {
>     ...
>     location ~ .*\.php$ {
>         limit_req zone=one burst=10;
>         ...
>     }
> 
> 
> In the logs I see that when 2 requests happen near simultaneously from the
> same IP address (e.g. page redirect to second PHP page or single
> PHP-generated image referenced by page) the second and third request get
> delayed if they arrive too early during the same second.
> 
> 
> I would wish to limit the user to 3 requests within a 1s window though
> not setting any constraint as to spacing between those requests, how can I
> accomplish it or what changes to limit_req module would be needed to
> not have a minimum 0.33s spacing between requests for above configuration?
> 

http://nginx.org/r/limit_req

    limit_req zone=one burst=10 nodelay;


 wbr, Valentin V. Bartenev



More information about the nginx mailing list