Use Bandwidth Mod in Apache to limit the total Bandwidth
Environment:
CentOS release 5.6 + Apache 2.2.22
Mod_bw v0.92
Http://ivn.cl/files/source/mod_bw-0.92.tgz
Mod_bw v0.92 documentation
Http://legacy.ivn.cl/files/txt/mod_bw-0.92.txt
Download and install:
# Wget http://ivn.cl/files/source/mod_bw-0.92.tgz
# Tar zxvf mod_bw-0.92.tgz
#/Data/apps/httpd2.2.22/bin/apxs-c-I-a mod_b1_c
Configure VirtualHost
<VirtualHost *: 80>
DocumentRoot/data/webapps/www.domain.com
ServerName www.domain.com
<Location/>
SetEnvIfNoCase User-Agent "Googlebot" google
Order allow, deny
Allow from all
Deny from env = google
</Location>
BandWidthModule On
ForceBandWidthModule On
BandWidth all 131072
</VirtualHost>
The <Location/> *** </Location> segment is used to reject the use of Googlebot.
If the link address is not exposed, Google crawls the file for unknown reasons.
Of course, you can write it in robots.txt, but it doesn't take effect quickly.
The following two concepts (case sensitive ):
Bps (bits per second) bit/second is generally used for transmission rate
Bps (bytes per second) bytes/second is generally used for display speed
1 Byte = 8 * 1bit (1 Byte = 8 characters)
What we usually talk about is 2 m bandwidth and 10 M bandwidth, which generally refers to 10 Mbit (10 Mbps)
The unit of BandWidth in the official document: BandWidth [From] [bytes/s]
Therefore, if you want to limit the total bandwidth of a VM to 1 Mbps, then:
BandWidth all 131072
// (1024*1024) bps/8 = 131072 Bps
From JOM_CH