Welcome! Log In Create A New Profile


Re: switch to ms resolution for rate limiting

Maxim Dounin
November 29, 2022 10:44PM

On Mon, Nov 28, 2022 at 06:40:33AM +0100, Jérôme Loyet wrote:

> Hello,
> I'm using rate limiting within the stream module. While it works great
> for long connections it does not work on request smaller than the rate
> limite size for 1 second. I set up a 1gbps rate limit (limit_rate
> 125m) and request smaller than 125M or not limited. This is a normal
> behavioir as the rate limiting is done with a second precision. This
> patch change second precision to millisecond precision. From my first
> tests (still on going) it seems to works better.
> What guys do you think about this patch ?

A while ago a similar patch was considered for both stream and
http, though there is an open question on how to handle
long-running requests on 32-bit platforms (where ngx_msec_t will
overflow after ~48 days). With the naive approach, which is also
seen in your patch, all traffic on a such connection is likely to
completely stop after the overflow, which does not seem to be a
good outcome.

Maxim Dounin
nginx-devel mailing list -- nginx-devel@nginx.org
To unsubscribe send an email to nginx-devel-leave@nginx.org
Subject Author Views Posted

switch to ms resolution for rate limiting

Jérôme Loyet 237 November 28, 2022 12:42AM

Re: switch to ms resolution for rate limiting

Maxim Dounin 51 November 29, 2022 10:44PM

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

Online Users

Guests: 190
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