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;
}
}
}
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: 207
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