Article title: Linux limits the bandwidth of the NIC. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Linux limits the bandwidth of the NIC, which can be used to simulate the depletion of the server bandwidth, so as to test the access performance of the server at this time.
1. install iproute
2. limit the bandwidth of the eth0 Nic to 50 kbit:
| /Sbin/tc qdisc add dev eth0 root tbf rate 50 kbit latency 50 ms burst 1000. |
3. after the bandwidth limit is 50 kbit, download a large file from wget in the MB Lan:
[Root @ localhost ~] # Wget http: // 192.168.1.7/test.zip -- 19:40:27 -- http: // 192.168.1.7/test.zip Connecting to 192.168.1.7: 80... connected. HTTP request sent, awaiting response... 200 OK Length: 23862312 (23 M) [application/zip] Saving to: 'test.zip' 37% [======>] 8,994,816 457 K/s eta 27 s |
The download speed is 457 K/s.
4. remove the bandwidth limit of the eth0 Nic:
| /Sbin/tc qdisc del dev eth0 root tbf |
5. Comparison: if the bandwidth limit is not set, download a large file from wget in the MB Lan:
[Root @ localhost ~] # Wget http: // 192.168.1.7/test.zip -- 19:44:33 -- http: // 192.168.1.7/test.zip Connecting to 192.168.1.7: 80... connected. HTTP request sent, awaiting response... 200 OK Length: 23862312 (23 M) [application/zip] Saving to: 'test.zip'
100% [==========>] 23,862,312 6.14 3.7 M/s in s
19:44:36 (6.16 MB/s)-'test.zip 'saved [23862312/23862312] |
The download speed is 6.16 MB/s.
Http://blog.s135.com/post/380.htma