What is the definition of a burst in Nginx limit_req setting?

What is the difference between this:

limit_req_zone $binary_remote_addr zone=flood:10m rate=30r/s;
limit_req zone=flood nodelay

and:

limit_req_zone $binary_remote_addr zone=flood:10m rate=30r/s;
limit_req zone=flood burst=5 nodelay

Documentation http://wiki.nginx.org/HttpLimitReqModule.


Solution 1:

In your case:

allow no more than 30 requests per second at an average, with bursts not exceeding 5 requests.

Reference: http://nginx.org/en/docs/http/ngx_http_limit_req_module.html

Solution 2:

As it says about burst on http://nginx.org/en/docs/http/ngx_http_limit_req_module.html

Excessive requests are delayed until their number exceeds the maximum burst size

This means in your case the first 5 requests are 'ignored' and only requests 6 and up are counted. So on request 35 the limit of 30 is reached. Then, on request 36 within the same 1 second coming from the same origin, nginx will send a 503 response instead of treating the request any further.

Solution 3:

Burst means it will be delayed for next second, if there is excess 30 request/second then nginx send 503 error code.

Burst works just like a queue