Thanks!<div><br></div><div>my question is , when client send two or more request in  one milliseconds, whatever you set rate is , the nginx will send 503 to client.because nginx limit_req&#39;s  <meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="line-height: 18px; ">precision is milliseconds.</span><br>

<br><div class="gmail_quote">On Fri, Feb 25, 2011 at 3:46 AM, Maxim Dounin <span dir="ltr">&lt;<a href="mailto:mdounin@mdounin.ru">mdounin@mdounin.ru</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Hello!<br>
<div><div></div><div class="h5"><br>
On Thu, Feb 24, 2011 at 10:26:50PM +0800, Simon Liu wrote:<br>
<br>
&gt; Thanks!<br>
&gt;<br>
&gt; this blew code is in  limit_req module:<br>
&gt;<br>
&gt; static ngx_int_t<br>
&gt; ngx_http_limit_req_lookup(ngx_http_limit_req_conf_t *lrcf, ngx_uint_t hash,<br>
&gt;     u_char *data, size_t len, ngx_uint_t *ep)<br>
&gt; {<br>
&gt; ..................................................................<br>
&gt;                 tp = ngx_timeofday();<br>
&gt;<br>
&gt;                 now = (ngx_msec_t) (tp-&gt;sec * 1000 + tp-&gt;msec);<br>
&gt;                 ms = (ngx_msec_int_t) (now - lr-&gt;last);<br>
&gt;<br>
&gt;                 excess = lr-&gt;excess - ctx-&gt;rate * ngx_abs(ms) / 1000 + 1000;<br>
&gt;<br>
&gt;                 if (excess &lt; 0) {<br>
&gt;                     excess = 0;<br>
&gt;                 }<br>
&gt;<br>
&gt;                 *ep = excess;<br>
&gt;<br>
&gt;                 if ((ngx_uint_t) excess &gt; lrcf-&gt;burst) {<br>
&gt;                     return NGX_BUSY;<br>
&gt;                 }<br>
&gt; ...............................................<br>
&gt; }<br>
&gt;<br>
&gt; in this code ,  while  two or more request in one milliseconds , excess will<br>
&gt; be greater than 0,   in addition burst is 0 in default , therefore<br>
&gt; ngx_http_limit_req_lookup<br>
&gt; will return NGX_BUSY, nginx will send 503 to client.  but  this situation is<br>
&gt; not send 503 to client. this is limit_req&#39;s bug?<br>
<br>
</div></div>ENOPARSE<br>
<br>
It is not clear what you are complaining about.<br>
<br>
Strictly speaking, with burst=0 no requests should be allowed at<br>
all.  Though it makes a little sense and nginx allows one request<br>
and rejects everything else with 503 until 1/rate seconds passes.<br>
<br>
Maxim Dounin<br>
<br>
_______________________________________________<br>
nginx-devel mailing list<br>
<a href="mailto:nginx-devel@nginx.org">nginx-devel@nginx.org</a><br>
<a href="http://nginx.org/mailman/listinfo/nginx-devel" target="_blank">http://nginx.org/mailman/listinfo/nginx-devel</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>博观约取<br><br>豆瓣:<a href="http://www.douban.com/people/mustang/" target="_blank">www.douban.com/people/mustang/</a><br><br>blog: <a href="http://www.pagefault.info" target="_blank">www.pagefault.info</a><br>

<br>twitter: <a href="http://www.twitter.com/minibobo" target="_blank">www.twitter.com/minibobo</a><br>
</div>