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'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"><<a href="mailto:mdounin@mdounin.ru">mdounin@mdounin.ru</a>></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>
> Thanks!<br>
><br>
> this blew code is in limit_req module:<br>
><br>
> static ngx_int_t<br>
> ngx_http_limit_req_lookup(ngx_http_limit_req_conf_t *lrcf, ngx_uint_t hash,<br>
> u_char *data, size_t len, ngx_uint_t *ep)<br>
> {<br>
> ..................................................................<br>
> tp = ngx_timeofday();<br>
><br>
> now = (ngx_msec_t) (tp->sec * 1000 + tp->msec);<br>
> ms = (ngx_msec_int_t) (now - lr->last);<br>
><br>
> excess = lr->excess - ctx->rate * ngx_abs(ms) / 1000 + 1000;<br>
><br>
> if (excess < 0) {<br>
> excess = 0;<br>
> }<br>
><br>
> *ep = excess;<br>
><br>
> if ((ngx_uint_t) excess > lrcf->burst) {<br>
> return NGX_BUSY;<br>
> }<br>
> ...............................................<br>
> }<br>
><br>
> in this code , while two or more request in one milliseconds , excess will<br>
> be greater than 0, in addition burst is 0 in default , therefore<br>
> ngx_http_limit_req_lookup<br>
> will return NGX_BUSY, nginx will send 503 to client. but this situation is<br>
> not send 503 to client. this is limit_req'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>