[edit] limit_req

Syntax: limit_req zone = name [ burst = number ] [ nodelay ]
Default:
Context: http
server
location
Reference: limit_req


The directive specifies the zone (zone) and the maximum possible bursts of requests (burst). If the rate exceeds the demands outlined in the zone, the request is delayed, so that queries are processed at a given speed. Excess requests are delayed while their number does not exceed a specified number of bursts. If the number of waiting requests exceed burst, the request is completed with the code 503 "Service Temporarily Unavailable". By default, the burst is zero.

For example, the directive

limit_req_zone  $binary_remote_addr  zone=one:10m   rate=1r/s;
 
    server {
        location /search/ {
            limit_req   zone=one  burst=5;
        }

allows a user no more than 1 request per second on average, with bursts of no more than 5 requests.

If delaying excess requests within a burst is not necessary, you should use the option nodelay:

            limit_req   zone=one  burst=5  nodelay;

Module: HttpLimitReqModule