Context : per server config
Change the algorithm used to calculate bandwidth and transmit data. In normal mode (old mode), the module try to transmit data in packets of 1KB. That mean that if the bandwidth available is of 512B, the module will transmit 1KB, wait 2 seconds, transmit another 1KB and so one.
Seting a value with "BandWidthPulse", will change the algorithm so that the server will always wait the same amount of time between sending packets but the size of the packets will change. The value is in microseconds. For example, if you set "BandWidthPulse 1000000" (1 sec) and the bandwidth available is of 512B, the sever will transmit 512B, wait 1 second, transmit 512B and so on.
The advantage is a smother flow of data. The disadvantage is a bigger overhead of data transmited for packet header. Setting too small a value (bellow 1/5 of a sec) is not realy useful and will put more load on the system and generate more traffic for packet header.
Note also that the operating system may do some buffering on it's own and so defeat the purpose of setting small values.
This may be very useful on especialy crowded network connection : In normal mode, several seconds may happen between the sending of a full packet. This may lead to timeout or people may believe that the connection is hanging. Seting a value of 1000000 (1 sec) would guarantee that some data are sent every seconds...
Directory / VirtualServer configuration directives
- BandWidth
Syntax : BandWidth <domain|ip|all> <rate>
Default : none
Context : per directory, .htaccessLimit the bandwidth for files in this directory and sub-directories based on the remote host <domain> or <ip> address or for <all> remote hosts.
Ip addresses may now be specified in the network/mask format. (Ie: 192.168.0.0/21 )
The <rate> is in Bytes/second. A <rate> of "0" means no bandwidth limit.
Several BandWidth limits can be set for the same directory to set different limits for different hosts. In this case, the order of the "BandWidth" keywords is important as the module will take the first entry which matches the client address.
Example :
<Directory /home/www>
BandWidth ecp.fr 0
BandWidth 138.195 0
BandWidth all 1024
</Directory>This will limit the bandwith for directory /home/www and all it's subdirectories to 1024Bytes/sec, except for .ecp.fr or 138.195..where no limit is set.
- LargeFileLimit
Syntax : LargeFileLimit <filesize> <rate>
Default : none
Context : per directory, .htaccessSet a maximal <rate> (in bytes/sec) to use when transfering a file of <filesize> KBytes or more.
Several "LargeFileLimit" can be set for various files sizes to create range. The rate used for a given file size will be the one of the matching range.
A <rate> of "0" mean that there isn't any limit based on the size.
A <rate> of "-1" mean that there isn't any limit for that type of file. It's override even a BandWidth limit. I found this usefull to give priority to very small files (html pages, very small pictures) while seting limits for larger files... (users with their video files can go to hell ! :)
Example :
If the following limits are set :
LargeFileLimit 200 3072
LargeFileLimit 1024 2048That's mean that a file of less than 200KBytes won't be limited based on his size. A file with a size between 200KBytes (included) and 1023Kbytes (included) will be limited to 3072Bytes/sec and a file of 1024Kbytes or more will be limited to 2048Bytes/sec.
- MaxConnection
Syntax : MaxConnection <connections>
Default : 0 (illimited)
Context : per directory, .htaccessRestrict the number of maximum simultanous connections. If the limit is reached, new connections will be rejected. A value of 0 mean that there isn't any limits.
- MinBandWidth
Syntax : MinBandWidth <domain|ip|all> <rate>
Default : all 256
Context : per directory, .htaccessSet a minimal bandwidth to use for transfering data. This over-ride both BandWidth and LargeFileLimit rules as well as the calculated rate based on the number of connections.
The first argument is used in the same way as the first argument of BandWidth.
<rate> is in bytes per second.
A rate of "0" explicitly means to use the default minimal value (256 Bytes/sec).
A rate of "-1" means that the minimal rate is equal to the actual rate defined by BandWidth and LargeFileLimit. In fact, that means that the final rate won't depend of the number of connections but only on what was defined.
Example :
If BandWidth is set to "3072" (3KBytes/sec) and MinBandWidth is set to "1024" (1KBytes/sec) that means :
- if there is one connection, the file will be transfered at 3072 Bytes/sec.