Latency and packet loss simulation during testing in Linux applications

Source: Internet
Author: User

This is a BDP test in rhca, which is also a very common simulation of latency and packet loss. I will share it with you now.

We also use the application software to test TCP/UDP comparison. When we test the impact of BDP on TCP/IP, we all need some network latency and packet loss simulation, many commercial software can do this. In fact, the perfect Linux itself can use TC to implement this function. the netem in TC can simulate latency, packet loss, repeated packets, and out-of-order functions.

We recommend that you use TC as the intermediate router to pick up two NICs and enable the routing function for testing.

The most basic use of TC

1234 tc
qdisc show   
#
Display
tc
qdisc  add dev eth0 root ......
#
Join
tc
qdisc  change  dev eth0 root ......
#
Modify the existing qdisc, note, and add the same record. You can only use change to modify the record.
tc
qdisc del dev eth0 root 
#
Delete

 

Latency simulation in Linux

Set the latency of 3 S:

1 tc
qdisc add dev eth0 root netem delay 3000ms

A latency can be added after 3000 Ms. For example, '3000ms 3000 Ms' indicates 200 ms ± 2800 ms, and the latency range is between 3200 and.
The result is as follows:

 

Packet loss simulation in Linux

If the packet loss rate is set to 50%, iptables can simulate this, but you can run the following command:

1 tc
qdisc change dev eth0 root netem loss 50%

If we change the packet loss rate of the following 50% to 50% 80%, the packet loss rate is different from the above latency. This means the packet loss rate is between 50-80%.
Shown below

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.