about limit_req module's implement.

Simon Liu simohayha.bobo at gmail.com
Thu Feb 24 17:26:50 MSK 2011


Thanks!

this blew code is in  limit_req module:

static ngx_int_t
ngx_http_limit_req_lookup(ngx_http_limit_req_conf_t *lrcf, ngx_uint_t hash,
    u_char *data, size_t len, ngx_uint_t *ep)
{
..................................................................
                tp = ngx_timeofday();

                now = (ngx_msec_t) (tp->sec * 1000 + tp->msec);
                ms = (ngx_msec_int_t) (now - lr->last);

                excess = lr->excess - ctx->rate * ngx_abs(ms) / 1000 + 1000;

                if (excess < 0) {
                    excess = 0;
                }

                *ep = excess;

                if ((ngx_uint_t) excess > lrcf->burst) {
                    return NGX_BUSY;
                }
...............................................
}

in this code ,  while  two or more request in one milliseconds , excess will
be greater than 0,   in addition burst is 0 in default , therefore
ngx_http_limit_req_lookup
will return NGX_BUSY, nginx will send 503 to client.  but  this situation is
not send 503 to client. this is limit_req's bug?

-- 
博观约取

豆瓣:www.douban.com/people/mustang/

blog: www.pagefault.info

twitter: www.twitter.com/minibobo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx-devel/attachments/20110224/947389a9/attachment.html>


More information about the nginx-devel mailing list