How do you simulate latency and packet loss to test application behavior?
IntermediateScenarioPerformance, MTU, Latency & Tools
Answer
Situation read → Chaos testing at the network layer.
What I'd do →
- Use
tc netem:sudo tc qdisc add dev eth0 root netem delay 100ms 20ms loss 1% - Verify with
pingandtc qdisc show dev eth0 - Remove with
sudo tc qdisc del dev eth0 root - Use toxiproxy or Chaos Mesh for containers and Kubernetes
- Run tests against timeouts and retry settings
Why → Applications that look fine on a LAN often fail under 100 ms RTT or 1% loss.
Interview tip → Say you test timeouts, not only throughput.
More on Performance, MTU, Latency & Tools
Latency, bandwidth and throughput: what is the difference and why does it matter?BeginnerWhen do you use ping, traceroute and mtr?BeginnerWhat is MTU and what is the usual value?BeginnerHow do you check what is listening on a port and who is connected?BeginnerHow do you measure where time goes in a slow HTTP request?BeginnerWhat does tcpdump do and what are the first filters you use?Beginner