Welcome! Log In Create A New Profile

Advanced

Re: [MODULE] limit traffic rate for nginx

Maxim Dounin
December 17, 2010 05:32PM
Hello!

On Fri, Dec 17, 2010 at 09:17:07AM -0500, bigplum wrote:

> Hello guys:
>
> I wrote a module to limit rate by given variable rather than limit_rate
> by connection. Most code of this module is copied from limit_conn
> module. I'm confusing to write this new module or modify limit_conn
> module. The modification will be easily but a new module would be
> installed easily. So, how about this new module?
>
> https://github.com/bigplum/Nginx-limit-traffic-rate-module

Some notes:

1. You return NGX_DECLINED from body filter. It's just wrong.

2. You set r->limit_rate dynamically to do actual rate limiting.
Note that this isn't going to work well as limit_rate limits
average download rate for request and not expected to be changed
during downloading.

E.g. with 1MB/s limit per $remote_address suppose client connects
and starts downloading file1. After downloading 1G (at 1MB/s
rate, i.e. after 1024 seconds) it starts downloading file2 (while
still downloading file1). Now r->limit_rate is set to 0.5MB/s for
both requests. This is not a problem for file2 request, but file1
request will suddenly find client was already downloaded twice as
much as it should be allowed and will pause downloading for 1024
seconds.

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

[MODULE] limit traffic rate for nginx

bigplum December 17, 2010 09:17AM

Re: [MODULE] limit traffic rate for nginx

Maxim Dounin December 17, 2010 05:32PM

Re: [MODULE] limit traffic rate for nginx

bigplum December 17, 2010 08:08PM

Re: [MODULE] limit traffic rate for nginx

bigplum January 09, 2011 09:31PM

Re: [MODULE] limit traffic rate for nginx

Piotr Karbowski January 11, 2011 05:40AM

Re: [MODULE] limit traffic rate for nginx

bigplum May 31, 2013 05:37AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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