Simulating a High-Latency Network Traffic

Latency is extremely important for web performance since every HTTP connection involves a round trip to the server and there is limited concurrency to avoid this. It can be very useful to see what a high-latency connection will look like and can highlight some problems you were not expecting. Especially useful, it can make the differences between two different implementations more pronounced.

To simulate latency use the tc (traffic control) software from the Linux command line. Adjust the delay as you see fit.

[root@box] # tc qdisc add dev eth0 root netem delay 42ms

This is using the netem module which has several features to configure packet loss, duplication, and latency. (You can find these documented in your systems manual pages of course).

To remove the latency either reboot or run the following:

[root@box] # tc qdisc del dev eth0 root
Simulating a High-Latency Network Traffic