Mercurial > hg > nginx-site
comparison xml/en/docs/http/ngx_http_limit_req_module.xml @ 529:d477ae38c0bd
Clarified on what this module actually limits.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Wed, 06 Jun 2012 14:17:28 +0000 |
parents | 0e55c9a48da9 |
children | ebcb351d9eb3 |
comparison
equal
deleted
inserted
replaced
528:85bbe7a5f393 | 529:d477ae38c0bd |
---|---|
8 | 8 |
9 <section id="summary"> | 9 <section id="summary"> |
10 | 10 |
11 <para> | 11 <para> |
12 The <literal>ngx_http_limit_req_module</literal> module (0.7.21) allows | 12 The <literal>ngx_http_limit_req_module</literal> module (0.7.21) allows |
13 to limit the number | 13 to limit the request processing rate per defined key, |
14 of requests per defined key, in particular, the number of requests | 14 in particular, the processing rate of requests coming |
15 from a single IP address. | 15 from a single IP address. |
16 The limitation is done using the “leaky bucket” method. | 16 The limitation is done using the “leaky bucket” method. |
17 </para> | 17 </para> |
18 | 18 |
19 </section> | 19 </section> |
58 If the rate of requests exceeds the rate configured for a zone, | 58 If the rate of requests exceeds the rate configured for a zone, |
59 request processing is delayed such as that they are processed | 59 request processing is delayed such as that they are processed |
60 at a defined rate. | 60 at a defined rate. |
61 Excessive requests are delayed until their number exceeds the | 61 Excessive requests are delayed until their number exceeds the |
62 defined number of bursts. | 62 defined number of bursts. |
63 In this case, the request is terminated with an error | 63 When exceeded, the request is terminated with an error |
64 <http-status code="503" text="Service Temporarily Unavailable"/>. | 64 <http-status code="503" text="Service Temporarily Unavailable"/>. |
65 By default, the number of bursts is equal to zero. | 65 By default, the number of bursts is equal to zero. |
66 For example, the directives | 66 For example, the directives |
67 <example> | 67 <example> |
68 limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; | 68 limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; |
98 <context>server</context> | 98 <context>server</context> |
99 <context>location</context> | 99 <context>location</context> |
100 <appeared-in>0.8.18</appeared-in> | 100 <appeared-in>0.8.18</appeared-in> |
101 | 101 |
102 <para> | 102 <para> |
103 Sets the desired logging level for cases when the server limits | 103 Sets the desired logging level |
104 the number of requests, or delays request processing. | 104 for cases when the server refuses to process requests |
105 Delays are logged with the level one less than limits; for example, | 105 due to rate being exceeded, |
106 or delays request processing. | |
107 Delays are logged with the level one less than refusals; for example, | |
106 if “<literal>limit_req_log_level notice</literal>” is specified, | 108 if “<literal>limit_req_log_level notice</literal>” is specified, |
107 delays are logged with the <literal>info</literal> level. | 109 delays are logged with the <literal>info</literal> level. |
108 </para> | 110 </para> |
109 | 111 |
110 </directive> | 112 </directive> |
118 <default/> | 120 <default/> |
119 <context>http</context> | 121 <context>http</context> |
120 | 122 |
121 <para> | 123 <para> |
122 Sets the parameters for a zone that keeps states for various keys. | 124 Sets the parameters for a zone that keeps states for various keys. |
123 This state stores the current number of requests in particular. | 125 The state stores the current number of excessive requests in particular. |
124 The key is any non-empty value of the specified variable | 126 The key is any non-empty value of the specified variable |
125 (empty values are not accounted). | 127 (empty values are not accounted). |
126 Example usage: | 128 Example usage: |
127 <example> | 129 <example> |
128 limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; | 130 limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; |
129 </example> | 131 </example> |
130 </para> | 132 </para> |
131 | 133 |
132 <para> | 134 <para> |
133 Here, the states are kept in a 10 megabyte zone “one”, and an | 135 Here, the states are kept in a 10 megabyte zone “one”, and an |
134 average rate of requests for this zone cannot exceed | 136 average request processing rate for this zone cannot exceed |
135 1 request per second. | 137 1 request per second. |
136 </para> | 138 </para> |
137 | 139 |
138 <para> | 140 <para> |
139 An IP address of the client serves as a key. | 141 An IP address of the client serves as a key. |