mod_throttle
mod_throttle limits outgoing bandwidth usage
All rates are in bytes/sec. The magazines are filled up in fixed intervals (compile time constant; defaults to 200ms).
io.throttle (action)
set the outgoing throttle limits for current connection
io.throttle (rate, burst);
- rate
- bytes/sec limit
- burst
- optional, defaults to 2*rate
burst
is the initial and maximum value for the magazine
; doing IO drains the magazine
, which fills up again over time with the specified rate
.
io.throttle_pool (action)
adds the current connection to a throttle pool for outgoing limits
io.throttle_pool rate;
- rate
- bytes/sec limit
all connections in the same pool are limited as whole. Each io.throttle_pool
action creates its own pool.
Example
Using the same pool in more than one place:
setup {
module_load "mod_throttle";
}
downloadLimit = {
io.throttle_pool 1mbyte;
}
# now use it wherever you need it...
downloadLimit;
io.throttle_ip (action)
adds the current connection to an IP-based throttle pool for outgoing limits
io.throttle_ip rate;
- rate
- bytes/sec limit
all connections from the same IP address in the same pool are limited as whole. Each io.throttle_ip
action creates its own pool.
Example
Using the same pool in more than one place:
setup {
module_load "mod_throttle";
}
downloadLimit = {
io.throttle_ip 200kbyte;
}
# now use it wherever you need it...
downloadLimit;