[edit] limit_req_zone

Syntax: limit_req_zone $variable zone = name : size rate = rate
Default:
Context: http
Reference: limit_req_zone


The directive describes the area, which stores the state of the sessions. The values of the sessions is determined by the given variable. Example of usage:

limit_req_zone  $binary_remote_addr  zone=one:10m   rate=1r/s;

In this case, the session state is allocated 10MB as a zone called "one", and the average speed of queries for this zone is limited to 1 request per second.

The sessions are tracked per-user in this case, but note that instead of the variable $remote_addr, we've used the variable $binary_remote_addr, reducing the size of the state to 64 bytes. A 1 MB zone can hold approximately 16000 states of this size.

The speed is set in requests per second or requests per minute. The rate must be an integer, so if you need to specify less than one request per second, say, one request every two seconds, you would specify it as "30r/m".

[edit] References

Original Documentation


Module: HttpLimitReqModule