Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Chaos Engineering

Principles

  1. Build a hypothesis about steady-state behavior
  2. Vary real-world events (server failure, network latency, resource exhaustion)
  3. Run experiments in production (or staging)
  4. Automate experiments to run continuously
  5. Minimize blast radius (start small, expand gradually)

Steady State Hypothesis

"Under normal conditions, our API serves 1000 rps with p99 < 200ms 
and error rate < 0.1%."

If this holds during chaos experiment → system is resilient.
If this breaks → found a weakness to fix.

Common Experiments

ExperimentToolWhat It Tests
Kill a serverChaos MonkeyFailover, redundancy
Add network latencyTC, ToxiproxyTimeouts, retries
Fill diskdd, chaos-meshAlerting, cleanup
CPU stressstress-ngAutoscaling, throttling
DNS failureBlock DNSFallback, caching
Dependency failureMock serverCircuit breakers

Tools

ToolPlatformApproach
Chaos MonkeyAWSRandom instance termination
LitmusKubernetesCRD-based experiments
chaos-meshKubernetesPod/network/IO chaos
GremlinMulti-cloudSaaS chaos platform
ToxiproxyNetworkProxy with fault injection

Game Days

Scheduled chaos experiments with the full team:

  1. Plan: Define experiment, expected outcome, rollback plan
  2. Execute: Run experiment while team observes
  3. Observe: Monitor dashboards, alerts, response time
  4. Discuss: What worked, what didn’t, what to improve
  5. Action items: Fix weaknesses found

Blast Radius Control

  • Start in staging, graduate to production
  • Start with single instance, expand gradually
  • Use feature flags to control experiments
  • Have automated rollback
  • Time-box experiments
  • Exclude critical paths initially

Interview Questions

Q: What is chaos engineering? A: Intentionally injecting failures into systems to find weaknesses before they cause real outages. The goal is to build confidence in the system’s ability to handle turbulent conditions. Netflix pioneered this with Chaos Monkey.

Q: How do you safely run chaos experiments in production? A: (1) Define steady-state metrics, (2) start with smallest blast radius, (3) have automated rollback, (4) time-box the experiment, (5) exclude critical paths initially, (6) run during low-traffic periods, (7) have the team watching dashboards.

Q: What is a Game Day? A: A scheduled chaos engineering exercise where the team practices responding to failures. Similar to fire drills. The team runs chaos experiments, observes system behavior, and identifies improvement opportunities. Builds muscle memory for incident response.

References