Welcome! Log In Create A New Profile

Advanced

about limit_req module's implement.

Simon Liu
February 24, 2011 09:28AM
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
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

about limit_req module's implement.

Simon Liu 2382 February 24, 2011 09:28AM

Re: about limit_req module's implement.

Maxim Dounin 776 February 24, 2011 02:48PM

Re: about limit_req module's implement.

Simon Liu 811 February 24, 2011 08:24PM

Re: about limit_req module's implement.

Maxim Dounin 857 February 25, 2011 07:56AM

Re: about limit_req module's implement.

Simon Liu 1069 February 26, 2011 01:52AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 164
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready