Ngx http limit req : burst=0 cannot support more than 1000 RPS

I am using “ngx_http_limit_req” module. After going through the code I
see
that if “burst = 0” (i.e. not specified) then maximum rate limiting that
can
be offered is 1000 RPS only. I have seen this in my stress test too.
I didn’t see this in any documentation. Want to clarify if this is
really
true or I missed something?


Reasoning :

  1. Module expects uniform request arrival. Any request that breaks the
    uniformity, will get rate limited.
  2. Configured rate = 1000r/s. This means 1 request-per-ms.
  3. If more than 1 request is received in same “ms” time, then only 1
    request
    is served. All other requests are rate limited.
  4. For above configuration, if “burst=X” is configured, then “X” number
    of
    requests are served while requests more than that will get rate limited.
  5. If Configured rate = 2000r/s (i.e. 2 request-per-ms). If “burst=0”
    (i.e.
    not specified), then too it supports only 1-request-per-ms rate. If 3
    requests are received in same “ms” then only 1 is served and other 2 are
    rate limited.

Posted at Nginx Forum:

Hello!

On Wed, Apr 16, 2014 at 10:30:24AM -0400, Shrirang wrote:

  1. Configured rate = 1000r/s. This means 1 request-per-ms.
  2. If more than 1 request is received in same “ms” time, then only 1 request
    is served. All other requests are rate limited.
  3. For above configuration, if “burst=X” is configured, then “X” number of
    requests are served while requests more than that will get rate limited.
  4. If Configured rate = 2000r/s (i.e. 2 request-per-ms). If “burst=0” (i.e.
    not specified), then too it supports only 1-request-per-ms rate. If 3
    requests are received in same “ms” then only 1 is served and other 2 are
    rate limited.

Yes, the module uses time with millisecond resolution, and hence
rates higher than 1 request per millisecond won’t work without
burst specified.


Maxim D.
http://nginx.org/

On Wednesday 16 April 2014 10:30:24 Shrirang wrote:

I am using “ngx_http_limit_req” module. After going through the code I see
that if “burst = 0” (i.e. not specified) then maximum rate limiting that can
be offered is 1000 RPS only. I have seen this in my stress test too.
I didn’t see this in any documentation. Want to clarify if this is really
true or I missed something?

[…]

The real limitation can be even lower. It’s actually limited by nginx
timer granularity which under big load can be even worst than 1 ms.

wbr, Valentin V. Bartenev

Thanks a lot for quick confirmation

Posted at Nginx Forum:

Thanks for quick confirmation

Posted at Nginx Forum: