Chaos engineering and game days
Break your system on purpose, a little at a time and with a stop button, so you find its weak spots before a real outage does.
Updated since you finished it. We changed this lesson after you marked it done. Your progress is kept.
What broke
Slack has an internal tool called Confabulator. Engineers use it to change configuration, including during incidents. In one bad incident, it did not work, and the team had to deploy the change by hand. 1
The tool had an emergency mode. When Slack itself was down, emergency mode skipped the check that needed Slack. On paper, that was the fallback. 1
So the team rebuilt the failure on purpose, in a planned exercise. They cut Confabulator off from Slack and tried a change that did nothing. The error came back. 1
The cause was small. Both modes posted a notice of each change to a Slack channel. That post had no timeout. With Slack down, the post hung. The whole request then hit its own time limit before the change was made. So even emergency mode could never finish a change while Slack was down. 1
Slack then improved its deploy tools and checked the timeout and retry settings of its critical systems. 1 A real incident showed the symptom. A planned exercise reproduced it safely and found the cause.
The idea in simple words
Chaos engineering is "the discipline of experimenting on a system in order to build confidence in the system's capability to withstand turbulent conditions in production." 2
In plain words: you cause a small, real failure on purpose. Tools call this fault injection. You watch whether users still get what they need. If they do, your confidence grows. If they do not, you found a weak spot while you were ready for it.
A game day is the team version. You plan a failure, everyone who would respond takes part, and you review what happened afterwards.
The key idea. Every timeout, failover and fallback is a guess until it has run. A chaos experiment runs it on purpose: small, watched, with a stop button, at a time you pick.
How it works
Where it came from
Netflix built Chaos Monkey for its move to the AWS cloud. It "randomly disables our production instances", to check that Netflix survives that common failure. 3 Netflix ran it during business days, "with engineers standing by". 3 Today the tool still randomly ends virtual machines and containers. Its idea: if engineers see failures often, they build services that survive them. 5
In April 2011, AWS had a large outage in US-East. Netflix kept running, with more errors and latency than usual. But leaving the bad zone took manual work by many teams. Chaos Monkey killed single services, but Netflix did not simulate a whole zone going down. 4
Engineers started to talk about a "Chaos Gorilla" for that. 4 By July 2011, Netflix described a whole Simian Army, some of it still only planned. Latency Monkey adds delays between services. Chaos Gorilla would simulate the loss of a whole availability zone. 3
The principles
The site principlesofchaos.org describes an experiment in four steps: 2
- Define the steady state: a measurable output that shows normal behaviour.
- Guess that this steady state will continue in a control group and in an experimental group.
- Add real-world events, such as servers that crash or network links that are cut.
- Try to prove the guess wrong, by looking for a difference between the two groups.
It then gives five advanced principles: 2
- Build a hypothesis around steady state behaviour. Measure the system's outputs, such as throughput or errors, not its internal attributes.
- Vary real-world events. Pick events by impact or by how often they happen. Include non-failures, like a traffic spike.
- Run experiments in production. Real traffic is "the only way to reliably capture the request path".
- Automate experiments to run continuously. Manual runs do not last.
- Minimise blast radius. Some short-term harm is allowed, but the chaos engineer must keep it small and contained.
An experiment is not a test
A test checks a behaviour you already know, and it passes or fails. An experiment asks a question about the whole system under real conditions. The principles say chaos "verifies that the system does work, rather than trying to validate how it works." 2
AWS asks you to do both. Keep your normal resilience tests, and add chaos experiments to find what you did not know. 6 Once an experiment passes, AWS suggests keeping it as an automated regression test in your pipeline. 6
Run one experiment safely
Step through an example experiment on a checkout service. Use Next and Back, or the ← and → keys.
- First, measure normal. Checkout's p99 latency is about 300 ms. The hypothesis: if the ratings service gets slow, the 1 s timeout and the circuit breaker keep checkout's p99 under 1.5 s. The dashed line at 1.5 s is the stop line.
- Add 3 seconds of delay to ratings calls, but only for 1% of users. They are the experiment group. Everyone else is the control group, so you can compare the two.
- The experiment group's p99 climbs toward about 3.3 s and passes 1.5 s. The hypothesis is wrong. An alarm on that metric is the stop condition, so the tool ends the experiment without waiting for a person.
- The delay is removed and the 1% group is back to normal within a minute. Only 1% of users saw slow pages, for a few minutes, while the team watched.
- The finding: the ratings client used a 10 s default timeout, not the 1 s in the design doc, so a 3 s call never timed out and the breaker never opened. Fix the config, then run the same experiment again.
- Measure normal first. AWS gives an example: a payments system that handles 300 transactions a second, with 99% success and a 500 ms round trip. 6 Use the metrics from Observability, SLOs and error budgets.
- Write the hypothesis. AWS's template: "If {specific fault} occurs, the {workload name} workload will {describe mitigating controls} to maintain {business or technical metric impact}." 6
- Start outside production. AWS recommends trying each fault in a non-production environment first. There you also check that your stop conditions fire. 6 Slack runs every exercise in dev first. Then it decides whether to go on to production. It seriously considers stopping if automatic repair did not work, did not work perfectly or was slow. Most of all, it considers stopping if customers would see more than a short, minor rise in latency. 1
- Keep the blast radius small. In production, use a control group and an experiment group, as in a canary release. 6 A feature flag can pick the 1%.
- Set a stop condition. In AWS Fault Injection Service (FIS), a stop condition is a CloudWatch alarm. If it fires, FIS stops the experiment, and you cannot resume it. 8
- Pick the time and the people. AWS suggests off-peak hours for your first production runs. 6 Netflix ran Chaos Monkey on business days, with engineers standing by. 3 Pick a quiet time of day when the team is at work and watching. Slack picks a well-announced time, with the experts in one room or video call. 1 Tell support and operations teams, and give them a way to report trouble. 6
- Restore, record, repeat. Bring the system back to a known-good state. Save dashboards and notes with the time and conditions. 6
Here is an FIS stop condition, linked to an alarm you created: 8
{
"stopConditions": [
{
"source": "aws:cloudwatch:alarm",
"value": "arn:aws:cloudwatch:eu-west-1:123456789012:alarm:checkout-p99-high"
}
]
}What to inject, and with what
Start with the failures your design claims to survive. AWS lists: lost instances, a database failover, CPU and memory stress, added latency, dropped packets and DNS failures. To test a fallback, block a third-party provider for seconds or hours. 6 Slack's Confabulator exercise shows that a config tool can be a weak spot too. 1
Gremlin groups its faults into three kinds. Resource faults use up CPU, memory or disk. State faults shut down hosts, kill processes or move the clock ("Time Travel"). Network faults add latency, drop packets or block traffic. 9
Tools at a high level: 6
- Chaos Monkey ends instances at random. It needs Spinnaker. 5
- AWS FIS is a managed service with stop conditions built in.
- Chaos Mesh and Litmus are open-source tools. FIS can run their faults too, for example on a Kubernetes pod. Gremlin is commercial.
Any tool should track the experiment's state, log what it does and undo it. AWS discourages home-made scripts that cannot do these. 6 Gremlin's agent undoes its faults if it loses its connection. But a shutdown or a killed process cannot be rolled back. 9
Game days
A game day tests people and processes, not only machines. AWS says to involve the same teams who would handle a real event. Business decision makers should take part too. 7
Google's yearly test is called DiRT. It breaks live systems, and it also keeps key people and leaders from helping. 10 The incident response lesson mentioned it; here is what it found. In one test, exactly one person found the emergency phone bridge. In the next drill, more than 100 people found it, but the bridge held only 40 callers. 10
Give the game day clear roles. Slack has one or two hosts who write a detailed plan, with exact commands and a hypothesis. 1 Google's DiRT has a technical team, a coordination team and a command center ready to undo a test. 10
Run the scenario, and then watch. Slack's advice is to hold back and let the system heal itself. 1 Use the incident process you would use for real. End with a blameless review. Slack asks: 1
- How long did it take to detect and to resolve?
- Did any users notice? Did any humans have to step in?
- Was any documentation wrong? Were any dashboards out of date?
What you learn
- Wrong runbooks. Tom Limoncelli wrote a fictionalized account of a DiRT drill. A restore command needed new parameters, and the restore area had become too small. 10 Fix runbooks on the spot.
- Missing alerts. AWS says experiments should check that alerts fire and teams get notified. 6 See Alerting and on-call.
- Fallbacks that fail. Like Confabulator's emergency mode. 1 Test the timeouts, breakers and fallbacks from Circuit breakers and bulkheads this way.
- Hidden dependencies. In one DiRT test, teams moved services to their own workstations. The test had also cut off their office, so those moves failed. Login systems failed in unexpected ways too. 10
- Retries that amplify. Watch the load on the failing service during the test. See Backoff, jitter and retry budgets.
When not to do it
- You cannot see the effect. Slack lists its logs, metrics and alerts before each exercise. 1 Without them, you cannot tell when to stop. Add traces and dashboards first.
- You cannot undo it. AWS asks for a rollback plan for every experiment. 6 Have a way back, as in disaster recovery.
- You already know it will break. "If you know that the workload will fail, do not run the experiment." 6 At Google, services can "prefail" a test and skip it. 10 Fix the weak spot first.
Trade-offs
| Option | Finds real problems? | Risk to users | Use it when |
|---|---|---|---|
| Tabletop walk-through | Partly. It finds gaps in docs and plans. | No Nothing breaks. | Before any real fault, and for a new team. |
| Staging experiment | Partly. Staging may not match production. | No | First run of every new fault. |
| Production, 1% of traffic | Yes Real traffic, real config. | Small, if stop conditions work. | Staging passed and you can see and undo. |
| Automated, continuous | Yes , and it catches new regressions. | Small, every day. | The experiment passes reliably. |
| Company-wide game day | Yes , including people and processes. | Can be large. Google says DiRT has caused outages. 10 | Smaller tests already pass. |
At work: how a senior uses this
- Ask of every fallback: "When did this last run?" If nobody knows, plan an experiment.
- Write the hypothesis and the stop condition before the fault. Get one other engineer to review it.
- Start with one instance in staging. Then 1% in production, at a quiet time when people are at work and watching.
- Pick faults from your past postmortems. AWS suggests the same. 6
- Turn every finding into a tracked action item with an owner, then rerun the experiment.
- After a pass, add the experiment to the pipeline so it keeps passing.
With AI
What to ask the agent
"Here is our service's dependency list and the timeouts in our config. For each dependency, suggest one chaos experiment: the fault, the steady-state metric, the hypothesis and a stop condition."
"Write an AWS FIS experiment template that adds 3 seconds of latency to 1% of tasks in the checkout ECS service for 10 minutes. Use the CloudWatch alarm checkout-p99-high as the stop condition."
"Draft a game day plan for losing our primary database: roles, timeline, the exact commands, what we watch, when we abort, and the debrief questions."
What to check yourself
- Targets. Check the selected resources. A wrong tag or filter can hit all instances, not 1%.
- The stop condition. Make the alarm fire in staging before you trust it.
- The undo. Know how to stop the fault by hand, and whether it can be undone at all.
- Action names. Check every fault name against the tool's docs. An agent can invent ones that do not exist.
- People. Tell support and on-call before you start, not after.
Check yourself
Your progress is saved only in this browser. Export it to keep it safe.
You have finished 5 lessons. Your progress lives only in this browser. Export a copy so you don’t lose it.
Go deeper
Show 10 sources and related lessons
- Richard Crowley, “Disasterpiece Theater: Slack’s process for approachable Chaos Engineering”, Slack Engineering (1 August 2019) (opens in a new tab)
How Slack plans and runs failure exercises, the questions it asks afterwards, and three real findings. - Principles of Chaos Engineering (principlesofchaos.org, last updated March 2019) (opens in a new tab)
The one-page definition, the four steps of an experiment and the five advanced principles. - Yury Izrailevsky and Ariel Tseitlin, “The Netflix Simian Army”, The Netflix Tech Blog (19 July 2011), Wayback Machine copy (opens in a new tab)
Why Netflix built Chaos Monkey, and the other "monkeys" it planned, from Latency Monkey to Chaos Gorilla. - Adrian Cockcroft, Cory Hicks and Greg Orzell, “Lessons Netflix Learned from the AWS Outage”, The Netflix Tech Blog (29 April 2011), Wayback Machine copy (opens in a new tab)
How Netflix got through the April 2011 AWS outage, what was still manual, and the first idea of Chaos Gorilla. - Netflix/chaosmonkey, README (GitHub) (opens in a new tab)
What Chaos Monkey does today and why. It needs Spinnaker to run. - AWS Well-Architected Framework, Reliability Pillar, “REL12-BP04 Test resiliency using chaos engineering” (opens in a new tab)
A step-by-step method with a hypothesis template, stop conditions, faults to try and a list of tools. - AWS Well-Architected Framework, Reliability Pillar, “REL12-BP05 Conduct game days regularly” (opens in a new tab)
How to prepare, run and review a game day, with common mistakes. - AWS Fault Injection Service User Guide, “Stop conditions for AWS FIS” (opens in a new tab)
How an alarm stops an experiment, with the JSON to set it up. - Gremlin Docs, “Experiments” (Fault Injection) (opens in a new tab)
The resource, state and network faults one commercial tool offers, and how its agent undoes them. - Kripa Krishnan, “Weathering the Unexpected”, ACM Queue vol. 10 no. 9 (2012), Wayback Machine copy (opens in a new tab)
How Google runs DiRT, its yearly disaster test, with many real findings. Includes Tom Limoncelli's sidebar from the point of view of an engineer being tested.
Related: Incident response and postmortems · Circuit breakers, bulkheads and fallbacks · Load shedding and graceful degradation · Disaster recovery and backups · Observability, SLOs and error budgets · Safe deploys and config changes · Feature flags and entitlements · Runbooks and reducing toil · Distributed tracing in practice