comparison xml/en/docs/http/ngx_http_limit_req_module.xml @ 966:95c3c3bbf1ce

Text review.
author Egor Nikitin <yegor.nikitin@gmail.com>
date Wed, 14 Aug 2013 12:03:41 +0400
parents 6087d3fa6919
children ac131944d349
comparison
equal deleted inserted replaced
965:fadccc156188 966:95c3c3bbf1ce
13 rev="3"> 13 rev="3">
14 14
15 <section id="summary"> 15 <section id="summary">
16 16
17 <para> 17 <para>
18 The <literal>ngx_http_limit_req_module</literal> module (0.7.21) allows 18 The <literal>ngx_http_limit_req_module</literal> module (0.7.21) is used
19 to limit the request processing rate per defined key, 19 to limit the request processing rate per a defined key,
20 in particular, the processing rate of requests coming 20 in particular, the processing rate of requests coming
21 from a single IP address. 21 from a single IP address.
22 The limitation is done using the “leaky bucket” method. 22 The limitation is done using the “leaky bucket” method.
23 </para> 23 </para>
24 24
58 <context>http</context> 58 <context>http</context>
59 <context>server</context> 59 <context>server</context>
60 <context>location</context> 60 <context>location</context>
61 61
62 <para> 62 <para>
63 Sets a shared memory zone 63 Sets the shared memory zone
64 and the maximum burst size of requests. 64 and the maximum burst size of requests.
65 If the rate of requests exceeds the rate configured for a zone, 65 If the requests rate exceeds the rate configured for a zone,
66 their processing is delayed such that requests are processed 66 their processing is delayed such that requests are processed
67 at a defined rate. 67 at a defined rate.
68 Excessive requests are delayed until their number exceeds the 68 Excessive requests are delayed until their number exceeds the
69 maximum burst size 69 maximum burst size
70 in which case the request is terminated with an error 70 in which case the request is terminated with an error
107 <appeared-in>0.8.18</appeared-in> 107 <appeared-in>0.8.18</appeared-in>
108 108
109 <para> 109 <para>
110 Sets the desired logging level 110 Sets the desired logging level
111 for cases when the server refuses to process requests 111 for cases when the server refuses to process requests
112 due to rate being exceeded, 112 due to rate exceeding,
113 or delays request processing. 113 or delays request processing.
114 Delays are logged with the level one less than refusals; for example, 114 Logging level for delays is one point less than for refusals; for example,
115 if “<literal>limit_req_log_level notice</literal>” is specified, 115 if “<literal>limit_req_log_level notice</literal>” is specified,
116 delays are logged with the <literal>info</literal> level. 116 delays are logged with the <literal>info</literal> level.
117 </para> 117 </para>
118 118
119 </directive> 119 </directive>
126 <context>server</context> 126 <context>server</context>
127 <context>location</context> 127 <context>location</context>
128 <appeared-in>1.3.15</appeared-in> 128 <appeared-in>1.3.15</appeared-in>
129 129
130 <para> 130 <para>
131 Sets status code to be used when requests are rejected. 131 Sets the status code to return in response to rejected requests.
132 </para> 132 </para>
133 133
134 </directive> 134 </directive>
135 135
136 136
141 <literal>rate</literal>=<value>rate</value></syntax> 141 <literal>rate</literal>=<value>rate</value></syntax>
142 <default/> 142 <default/>
143 <context>http</context> 143 <context>http</context>
144 144
145 <para> 145 <para>
146 Sets parameters of a shared memory zone 146 Sets parameters for a shared memory zone
147 that keeps states for various keys. 147 that will keep states for various keys.
148 The state stores the current number of excessive requests in particular. 148 In particular, the state stores the current number of excessive requests.
149 The key is any non-empty value of the specified variable 149 The key is any non-empty value of the specified variable
150 (empty values are not accounted). 150 (empty values are not accounted).
151 Example usage: 151 Usage example:
152 <example> 152 <example>
153 limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; 153 limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
154 </example> 154 </example>
155 </para> 155 </para>
156 156
159 average request processing rate for this zone cannot exceed 159 average request processing rate for this zone cannot exceed
160 1 request per second. 160 1 request per second.
161 </para> 161 </para>
162 162
163 <para> 163 <para>
164 An IP address of the client serves as a key. 164 A client IP address serves as a key.
165 Note that instead of <var>$remote_addr</var>, the 165 Note that instead of <var>$remote_addr</var>, the
166 <var>$binary_remote_addr</var> variable is used here, 166 <var>$binary_remote_addr</var> variable is used here,
167 allowing to lower the size of a state down to 64 bytes. 167 that allows to decrease the state size down to 64 bytes.
168 One megabyte zone can keep about 16 thousand 64-byte states. 168 One megabyte zone can keep about 16 thousand 64-byte states.
169 If the storage for a zone is exhausted, the server will return error 169 If the zone storage is exhausted, the server will return the
170 <http-status code="503" text="Service Temporarily Unavailable"/> 170 <http-status code="503" text="Service Temporarily Unavailable"/>
171 to all further requests. 171 error to all further requests.
172 </para> 172 </para>
173 173
174 <para> 174 <para>
175 The rate is specified in requests per second (r/s). 175 The rate is specified in requests per second (r/s).
176 If a rate of less than one request per second is desired, 176 If a rate of less than one request per second is desired,