How to Implement Chaos Experiments
Run controlled chaos experiments that inject real failures, state a hypothesis and blast radius, and stop safely, to prove resilience.
On this page
Introduction
You do not know whether your system handles a dependency failure until you make the dependency fail. A retry policy, a circuit breaker, a fallback: they are hypotheses about behaviour under stress, and code review does not prove them. Chaos engineering turns those hypotheses into experiments: inject a real failure in a controlled way, with a stated hypothesis and a bounded blast radius, and observe whether the system behaves as you claim. Done carelessly it is sabotage; done carefully it is the only way to know your resilience actually works.
Start from a Hypothesis
An experiment begins with a falsifiable hypothesis: “if the payments dependency returns errors for thirty seconds, checkout keeps serving from its fallback with an error rate under one percent”. The hypothesis names the fault injected, the expected behaviour and the observable measure that proves or disproves it.
Without a hypothesis you are just breaking things and hoping. The hypothesis also tells you what to measure and when to abort: if the error rate exceeds the threshold, the experiment has answered its question and you can stop. The experiment is a scientific test, and its value is the answer whether the system passed or failed.
# experiment record
hypothesis: payments dependency 100% error for 30s => checkout degrades to
cached prices, error rate < 1%, no user-visible 500s
fault: fault injection proxy returns 503 for payments calls
blast: one canary instance, 10% of checkout traffic, 30s
measure: checkout 5xx rate, p95 latency, fallback-hit counter
abort if: 5xx > 1% for 30s, or any unhandled panic in logs
Bound the Blast Radius
Never start with the whole fleet. Inject the fault into one instance, one shard, one percentage of traffic, or one tenant that has agreed to be the canary. The blast radius is the maximum damage the experiment can cause if the hypothesis is wrong, and it must be small enough that being wrong is survivable.
Expand the radius only after the experiment passes at the small one. If the fallback works for one instance, try a whole shard; if that passes, a region. Each step is a separate experiment with its own hypothesis, so a failure at step three does not affect production beyond that step’s bounded radius.
# progressive blast radius
step 1: 1 instance, 1% traffic, 30s -> fallback works at all?
step 2: 1 shard, 10% traffic, 2m -> holds under real load?
step 3: 1 region, 50% traffic, 5m -> recovers without cascading?
# each step is its own experiment; do not skip ahead
# abort control must be independent of the system under test
Injecting Faults
Faults fall into categories: latency (delay a dependency), errors (return failures), resource exhaustion (consume CPU, memory or connections), and state (corrupt a cache, kill a process, partition a network). Inject at a point you control: a proxy in front of a dependency, a sidecar, or an application-level switch. Injecting through a proxy is cleanest because it does not require changing application code.
The injection must be reversible. Provide an abort that restores normal behaviour immediately, and make it independent of the system under test: do not rely on the same control plane you are stressing to stop the experiment. A kill switch in the injector itself, reachable by a human, is the minimum.
# fault injected at a proxy in front of a dependency (illustrative)
type: fault-injection
target: payments-dependency
fault:
kind: http-error
status: 503
percentage: 100
duration: 30s
scope:
instances: 1
traffic: 10% # only a fraction of calls
abort:
killSwitch: true # injector-side, independent of the app
conditions:
- metric: checkout_5xx_rate
threshold: 0.01
window: 30s
Measure and Decide
The experiment is only as good as its measurement. Watch the customer-facing signals (error rate, latency) and the resilience mechanisms (fallback hit count, circuit state, retry count). If the fallback is working, the fallback-hit counter should rise while the customer-facing error rate stays flat. If it is not, the error rate rises.
Define the abort condition before starting, not during. A rising error rate beyond the threshold means the hypothesis is disproved; abort and record the failure. That negative result is valuable: it found a resilience gap in a controlled experiment rather than in a real incident.
Running in Production Safely
Chaos experiments are most valuable in production because staging rarely reproduces production’s traffic, dependencies and failure modes. But production requires extra care: announce the experiment, schedule it away from peak or known-sensitive windows, have a human watching, and keep the blast radius small.
Make the experiment visible in dashboards and logs so a responder sees “chaos experiment in progress” rather than a mysterious failure, and so alerts do not page someone for a planned event. Coordinate with the on-call team so a real incident during the experiment is not confused with it.
# production safety checklist
[ ] announced to on-call and stakeholders, with start/end time
[ ] scheduled off peak / off change-freeze
[ ] small blast radius, with an independent kill switch
[ ] dashboards tagged "chaos experiment" so alerts are not surprises
[ ] a human watching live, ready to abort
[ ] post-experiment notes: hypothesis, result, follow-ups
Learning from Failures
A failed experiment is the point. When the system did not degrade as expected, you have found a real gap between belief and behaviour, and you fix it before a real incident exploits it. Record the finding, create the follow-up work, and re-run the experiment after the fix to prove it now passes.
Over time, a library of experiments becomes a resilience test suite: each dependency failure, each resource exhaustion, each partial outage, run periodically to catch regressions. Like any test, it can rot, so revisit the experiments as the architecture changes and retire the ones that no longer apply.
# closing the loop
experiment fails -> record finding -> file follow-up -> fix the gap
-> re-run the SAME experiment -> it now passes -> keep it in the suite
# a library of experiments is a regression suite for resilience
# revisit as the architecture changes; retire obsolete experiments
Common Pitfalls and Conclusion
Do not run chaos without a hypothesis; that is just breaking things. Do not start with the whole fleet. Do not rely on the system under test to abort the experiment. Do not run during peak or unannounced. And do not treat a passing experiment as proof of total resilience; it proves one hypothesis under one set of conditions.
Chaos engineering converts resilience claims into tested behaviour: state a falsifiable hypothesis, inject a real fault within a bounded blast radius, measure the customer signals and the mechanisms, abort on a pre-defined condition, and learn from both outcomes. Run it carefully in production and a failed experiment becomes a fix, instead of a real outage.
Sources: Principles of Chaos Engineering, AWS: Fault injection service, Netflix: Chaos engineering.
FAQ
- Is chaos engineering safe to run in production?
- Yes, with a bounded blast radius, an independent kill switch, an announced and scheduled window, a human watching, and dashboard tagging so a planned experiment is not mistaken for an incident. Production is where the valuable failure modes actually occur.
- What if the experiment shows no impact?
- Either the resilience mechanism worked as hypothesised, or the fault was not actually injected or did not reach the path you meant to stress. Verify the fault took effect before concluding the system is resilient, then record the result.
Report a problem with this articleOpens a pre-filled issue on GitHub.