tc做网络延迟、丢包模拟
在生产环境上经常需要模拟一下应用间异地调用的场景,或者模拟一下协议栈优化在丢包的情况下是否有效果。可以使用netem来做。具体的直接看看的介绍就行。 Examples Emulating wide area network delays This is the simplest example, it just adds a fixed amount of delay to all packets going out of the local Ethernet. Real wide area networks show variability so it is possible to add random variation. tc qdisc change dev eth0 root netem delay 100ms 10msThis causes the added delay to be 100ms ± 10ms. Network delay variation isn’t purely random, so to emulate that there is a correlation value as well. tc qdisc change dev eth0 root netem delay 100ms 10ms 25%This causes the added delay to be 100ms ± 10ms with the next random element depending 25% on the last one. This isn’t true statistical correlation, but an approximation. Delay distribution ...