Welcome! Log In Create A New Profile

Advanced

[MODULE] limit traffic rate for nginx

December 17, 2010 09:17AM
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

README:

Nginx directive limit_rate could limit connection's speed, and limit_conn could
limit connection number by given variable. If the client is a browser, it only
open one connection to the server. The speed will be limited to limit_rate, unless
the client is a multi-thread download tool.

The limit_traffic_rate module record connection numbers by the variable like
limit_conn module, and set limit_rate to limit_traffic_rate/cur_conn_number. So
if client is a browser, the download max rate will be limit_traffic_rate, if client
is a multi-thread tool, the total rate also be limited to limit_traffic_rate.

The limit_traffic_rate module need to use a share memory pool. Directive syntax
is same to limit_zone.

http {
limit_traffic_rate_zone rate $remote_addr 32m;

server {
location /download/ {
limit_traffic_rate rate 20k;
}
}
}
SubjectAuthorPosted

[MODULE] limit traffic rate for nginx

bigplumDecember 17, 2010 09:17AM

Re: [MODULE] limit traffic rate for nginx

Maxim DouninDecember 17, 2010 05:32PM

Re: [MODULE] limit traffic rate for nginx

bigplumDecember 17, 2010 08:08PM

Re: [MODULE] limit traffic rate for nginx

bigplumJanuary 09, 2011 09:31PM

Re: [MODULE] limit traffic rate for nginx

Piotr KarbowskiJanuary 11, 2011 05:40AM

Re: [MODULE] limit traffic rate for nginx

bigplumMay 31, 2013 05:37AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 112
Record Number of Users: 5 on December 17, 2014
Record Number of Guests: 180 on December 21, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready