Network Chaos Engineering
tc netem for latency/loss injection, Toxiproxy, chaos mesh network faults, testing circuit breakers and timeout behavior.
Overview
Overview Network chaos engineering deliberately injects network failures — latency, packet loss, bandwidth limits, corruption, reordering — to verify that distributed systems behave correctly under adverse conditions.
Linux tc netem (network emulator): tc qdisc add dev eth0 root netem delay 100ms 20ms distribution normal tc qdisc add dev eth0 root netem loss 1% 25% # correlated loss tc qdisc add dev eth0 root netem corrupt 0.1% tc qdisc add dev eth0 root netem duplicate 1% reorder 5% 50%
Toxiproxy (Shopify): a TCP proxy that injects network conditions at the application layer. Supports: latency, slow_close, timeout, bandwidth, slicer (chunked delivery), reset_peer. Configurable via HTTP API — ideal for integration tests. Run as a sidecar in CI/CD.
Chaos Mesh (CNCF): Kubernetes-native chaos engineering. NetworkChaos CRD supports: network partition, delay, loss, corrupt, bandwidth, duplicate. Applies faults using tc and iptables under the hood via a privileged DaemonSet. Faults can be targeted to specific pod label selectors and namespaces.
What to test: - Timeout behavior: does the service return an error within its declared timeout? Does it release resources? - Retry storms: under 50% packet loss, do retries amplify load on downstream services? - Circuit breaker activation: does the circuit open under sustained failure rates? - Graceful degradation: does the service fall back to cached data under 1000ms backend latency? - Cascading failure prevention: does a single slow service degrade the entire request path?
Key concepts
- tc netem
- Toxiproxy
- Chaos Mesh NetworkChaos
- Retry storm
- Circuit breaker
Interview questions
- How do you use tc netem to simulate a flaky network for integration testing?
Sign up free to read the full topic
More Networking topics
Start free on Cariara · Coding problems · System design studio