Cloud & Data Centers

Chaos Engineering: Breaking Things on Purpose

Run controlled failure experiments safely to learn how your system really behaves under stress.

Key takeaways

  • A chaos experiment tests a stated belief about how your system behaves when something fails.
  • Define normal behavior in measurable terms first, so you can tell whether the experiment disturbed it.
  • Keep the blast radius small, set abort conditions and be able to undo the fault immediately.
  • Begin in test environments and tabletop exercises, and move to production only with monitoring and approval.
  • The value comes from fixing what you find and checking that the fix holds.

Chaos engineering is the practice of deliberately introducing failures into a system, under controlled conditions, to find weaknesses before they cause real outages. You might shut down a server, slow a network link or block access to a dependency, then check whether users notice. The aim is to learn something specific, with a plan to stop the moment things go wrong.

Despite the name, good chaos work is orderly. It starts with a prediction, limits the damage that's possible and ends with fixes. It applies only to systems you own or are explicitly authorized to test.

Why break things deliberately

Distributed systems fail in combinations that are hard to predict from diagrams. A timeout might be set to a minute when it should be two seconds. A retry loop might multiply traffic to a struggling service. A standby might lack a firewall rule. A dashboard might depend on the very system that's down.

You'll discover these eventually. The question is whether you find them on a quiet weekday afternoon with the right people watching, or during a real incident at night.

Netflix made the idea widely known with a tool called Chaos Monkey, which randomly terminated production instances so engineers had to build services that tolerated it. The field has since broadened to many kinds of faults and more careful experiment design.

The experiment, step by step

An experiment reads like a small piece of science.

  1. Define steady state. Choose measures of healthy service, such as successful checkouts per minute or error ratio.
  2. State a hypothesis. "If one of three web servers stops, error ratio stays below 1 percent."
  3. Choose the fault and its scope.
  4. Set abort conditions and name who can stop it.
  5. Run it and observe.
  6. Compare results with the prediction.
  7. Fix and repeat.
The chaos experiment loop
Fix Repair the weakness you found. Observe Watch signals and stop if limits are hit. Measure normal Pick signals that reflect users. Predict Say what should happen and why. Inject a fault Small, reversible and announced. 1 2 3 4 5 Measure normal Pick signals that reflect users. 1 Predict Say what should happen and why. 2 Inject a fault Small, reversible and announced. 3 Observe Watch signals and stop if limits are hit. 4 Fix Repair the weakness you found. 5

If the prediction holds, you've gained evidence. If it doesn't, you've found a problem at a time of your choosing.

How it differs from other testing

Ordinary tests check that code does what it should with known inputs. Load tests check how much traffic a system handles. Chaos experiments ask how the whole running system, including its configuration, monitoring and people, copes when conditions turn hostile.

It's also distinct from security testing. A penetration test looks for ways an attacker could get in, and needs its own written authorization and scope. Chaos engineering is about availability and resilience against faults.

The approaches combine well. Running a fault while a realistic load is applied often reveals problems that neither shows alone, because a spare server that copes with light traffic may buckle at the peak.

Choosing your first experiment

Pick something modest, likely and recoverable. Good candidates come from past incidents, from assumptions people state with confidence and from parts nobody has touched in a long time.

Ask the team, "What do we think happens if this fails?" Disagreement is a useful sign. So is the phrase "it should fail over." Rank ideas by how likely the fault is and how much it would hurt, and start where the expected result is good but unproven.

Stopping one of several identical web servers in a test environment is a typical first step. It exercises health checks, capacity and alerting, and restarting the server undoes it.

Kinds of faults to try

Start with failures that really happen.

  • A process or server stops.
  • A whole availability zone becomes unreachable.
  • Network delay or packet loss rises.
  • A dependency returns errors or responds very slowly.
  • DNS lookups fail.
  • A disk fills up.
  • CPU or memory runs short.
  • A certificate or credential expires, simulated in a test environment.
  • Traffic spikes sharply.

Slowness deserves special attention. A dead dependency is often detected quickly. A slow one ties up connections and workers until the callers fail too.

Tools range from simple commands that stop a service, to cloud providers' fault injection services, to platforms such as Chaos Mesh or Gremlin. The tool matters less than the design of the experiment.

Limiting the blast radius

Blast radius means how much can be affected if the experiment goes badly. Keep it as small as will still teach you something: one test environment, then one instance, then a small share of traffic, then more.

Widening an experiment gradually
Production, larger scope Zone or dependency faults, well rehearsed. Production, tiny slice One instance or a small share of traffic. Staging environment Realistic setup with synthetic load. Tabletop discussion Talk through the failure on paper. Production, larger scope Zone or dependency faults, well rehearsed. Production, tiny slice One instance or a small share of traffic. Staging environment Realistic setup with synthetic load. Tabletop discussion Talk through the failure on paper.

Start at the bottom and move up only when results justify it.

Abort conditions should be numbers agreed beforehand, for example "stop if error ratio passes 2 percent for one minute." Make the stop mechanism independent of the thing you're breaking, and confirm it works before the run. If you can't undo a fault quickly, don't inject it.

Avoid experiments that risk permanent data loss or safety, and don't run them during peak periods, major launches or when the team is short-handed. If your error budget is already spent, fix known problems first.

Prerequisites

Chaos engineering presumes you can see what's happening. Without metrics, logs and alerts, breaking something tells you little and may go unnoticed until a customer complains.

You also want some resilience to test. If you already know a single database has no standby, you don't need to switch it off to learn the outage will be total. Fix obvious single points of failure first, as in high availability and failover.

Finally, get permission. Tell the people who own affected systems, support staff and anyone on call. Check your cloud provider's current rules on testing, and never inject faults into shared or third-party systems you aren't authorized to affect. An unannounced experiment looks exactly like an incident, or an attack.

Game days

A game day is a scheduled session where a team rehearses failure together. One person runs the scenario, others respond as they would for real, and someone takes notes.

Some game days test the technology. Others test people and process: Can the on-call person find the runbook? Do they have access? Does anyone know how to restore the backup? Who tells customers?

Tabletop versions, where you only talk through the steps, cost almost nothing and regularly uncover missing contacts and outdated instructions. They pair well with rehearsing a disaster recovery plan.

Keep the tone free of blame. The target is the system, including its documentation and habits.

A worked scenario

Say an online shop shows product recommendations from a separate service. The team predicts that if the service becomes slow, product pages will still load within two seconds, without recommendations.

In staging, they add five seconds of delay to its replies. Pages now take over five seconds, because the page waits for the call to finish. Under load, web workers pile up and checkout begins failing too.

The team adds a 300 millisecond timeout, a circuit breaker that stops calling a failing service for a short period, and a page layout that simply omits the empty section. They repeat the experiment, and the prediction holds. Later they run it on a small share of production traffic to confirm.

Running the session

Assign roles before you begin. One person injects the fault, another watches the signals, one has authority to abort and one records times and observations. In a small team, people can double up, but the abort role should be unambiguous.

Announce the start in the usual chat channel and say when it ends. If a real incident begins during the experiment, stop immediately and restore everything, so responders aren't chasing two causes.

Note how long detection took and whether the right alert fired. An experiment where the system survived but nobody was told a server vanished has still found something worth fixing.

Turning findings into improvements

Write down what you expected, what happened and what you'll change, with an owner and a date. Common fixes include shorter timeouts, retries with backoff and a cap, better health checks, more spare capacity, clearer alerts and updated runbooks.

Then rerun the experiment. Systems change constantly, and a protection that worked in spring may be broken by autumn. Stable experiments can be automated and run regularly, with the same abort conditions.

Common mistakes

  • Breaking things without a question. Random damage with no hypothesis produces noise and little learning.
  • Starting too big. A first experiment on a whole production region risks a real outage and the program's future.
  • No working stop button. Verify the rollback before you rely on it.
  • Findings that go nowhere. A list of weaknesses nobody schedules is wasted effort.
  • Counting experiments as success. What matters is fewer surprises and faster recovery, not how many faults you injected.

Leaders matter here. People need to know that discovering a weakness is a good result, even when it's in their own service. If findings lead to blame, teams will design experiments that can't fail.

Is it right for your team?

A small project doesn't need a fault injection platform. It can still borrow the habit: restore a backup, stop a service on a test server, or unplug the primary internet connection to see whether the backup link takes over. Each of these is a modest experiment with a clear prediction.

Larger systems with many services and real availability targets gain the most. Grow the program at the pace of your ability to observe, stop and repair.

Written for 4Internet with AI writing tools and not reviewed line by line by a person. Check anything you rely on with the maker, provider or standard concerned. Report an error.

Keep reading

All 45 articles in Cloud & Data Centers →

Latest news on this topic