limit_req_zone and limit_req: rate too strict

Bruno Prémont bruno.premont at restena.lu
Fri Apr 6 13:24:52 UTC 2012


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?

Thanks,
Bruno



More information about the nginx mailing list