Welcome! Log In Create A New Profile


Rate Limit with multiple subrequests

Umesh Sirsiwal
May 02, 2011 07:12PM
ngx_http_write_filter module has the following code for rate limit.
if (r->limit_rate) {
limit = r->limit_rate * (ngx_time() - r->main->start_sec + 1)
- (c->sent - clcf->limit_rate_after);

Looking at the code, it seems the start_sec is overwritten for each
ngx_http_subrequest(ngx_http_request_t *r,
ngx_str_t *uri, ngx_str_t *args, ngx_http_request_t **psr,
ngx_http_post_subrequest_t *ps, ngx_uint_t flags)

tp = ngx_timeofday();
r->start_sec = tp->sec;
r->start_msec = tp->msec;

The implication is that the rate limit is off when we have multiple
subrequests. Shouldn't the above be:
sr->start_sec = tp->sec;
sr->start_msec = tp->msec;


nginx-devel mailing list
Subject Author Views Posted

Rate Limit with multiple subrequests

Umesh Sirsiwal 1797 May 02, 2011 07:12PM

Re: Rate Limit with multiple subrequests

Maxim Dounin 760 May 03, 2011 08:36AM

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

Online Users

Guests: 66
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready