SDSystem DesignConcepts to case studies
System DesignDSA
x
0/311
Part 1: Foundations
Part 2: APIs and Communication
Part 3: Caching
Part 4: Data and Storage
Part 5: Architecture
Part 6: Distributed Systems
Part 7: Advanced Data Topics
Part 8: Operations and Security
  • Deployment Strategies Overview
  • CI/CD Pipelines
  • Rolling Deployments
  • Blue-Green Deployments
  • Canary Releases
  • Feature Flags
  • A/B Testing Infrastructure
  • Schema Migrations
  • Rollbacks and Immutable Infrastructure
  • Multi-Region and Active-Active
  • Infrastructure as Code (Terraform)
  • Auto-Scaling Policies
  • Zero-Downtime Deployment
  • Chaos Engineering
  • Shadow Traffic and Dark Launches
Part 9: Estimation and Interview Method
Part 10: Case Studies
System Design/Operations and Security/Deployment Patterns

Chaos Engineering

Break things on purpose, in a controlled way, to find weak spots before real failures do.

⏱ 12 min readIntermediateInterview FavouriteHas visualizer
SummaryConceptReal-Life ExampleWhy?Where?How It WorksStepsKey TermsPros & ConsMistakesReal WorldRead NextInterview Q&ACheat-Sheet

01Quick Summary

Chaos engineering means breaking things on purpose, in a small and controlled way, to learn how your system really behaves before a real failure teaches you the hard way.

  • The loop: define what "healthy" looks like, guess that it will stay healthy when something breaks, inject the failure, and compare.
  • Small blast radius: start with a tiny slice of traffic or a single instance, and grow only when it is safe.
  • The goal is learning: a broken guess is a win, because you found the weak spot on your own schedule.

02Concept: What is it?

Every design says "if the database fails, we switch to the replica". Chaos engineering asks: did anyone ever check? Failover scripts rot, timeouts are set wrong, and retries turn into storms. The only way to be sure is to cause the failure and watch.

Netflix made the idea famous with Chaos Monkey, a tool that randomly shut down servers in production, so engineers had to build services that survive it. Today the practice has a simple shape: an experiment with a hypothesis, a fault, a limited blast radius, and a way to stop.

The experiment loop
πŸ“1. Steady statea metric that says healthy
→↓
πŸ’­2. Hypothesisit will stay steady
→↓
πŸ’₯3. Inject a faultsmall blast radius
→↓
πŸ”Ž4. Compareheld, or broken?
→↓
πŸ› οΈ5. Fix and repeatthen widen the test
Each pass either builds confidence or finds a weakness to fix.
🧠Not random destruction
Chaos engineering is careful science, not recklessness. You pick the fault, limit the damage, watch the metrics, and have a stop button ready. If you cannot stop the test, you are not ready to run it.

03Real-Life Example

🍡The Fire Drill
A building has fire alarms, sprinklers and exit signs. Nobody trusts them because they have been installed, only because someone ran a fire drill and found that the back door was locked. A drill is planned, announced to the right people, short, and has a person with a whistle who ends it if it goes wrong. Chaos engineering is the fire drill for your software.
Fire drill
Chaos experiment
The building works normally
Steady state: success rate, latency
β€œEveryone can leave in 3 minutes”
Hypothesis: the metric stays inside its limit
Pull the alarm on one floor
Inject one fault with a small blast radius
Stopwatch and observers
Dashboards and alerts
The whistle that ends the drill
Abort condition and rollback
The locked back door
A weak spot you found
Fix the door, drill again
Fix, then run the experiment again

04Why Do We Need It?

πŸ”Find weak spots early
Learn about the missing timeout during a calm Tuesday test, not at 3 a.m. during a real outage.
πŸ§ͺCheck the safety nets
Failover, retries, circuit breakers and alerts only count if they have been seen working.
🧠Grow real understanding
Teams learn how the system really behaves, which is often not what the diagram says.
πŸ“ŸBetter on-call
Engineers who have seen a failure before handle the real one faster and with less fear.
πŸ“‰Fewer big outages
Small controlled failures replace large surprising ones.
πŸ—οΈDesign pressure
If servers can die any day, engineers build services that expect it.
You do not know if your system is resilient until you have seen it survive a failure on purpose.

05Where Do We Use It?

☁️Cloud services
Kill instances, zones or whole regions to test auto-recovery and failover.
🧩Microservices
Slow or break one service to see if callers have timeouts, fallbacks and circuit breakers.
πŸ—„οΈDatabases
Fail the primary to check that failover is quick and no data is lost.
☸️Kubernetes
Delete pods and nodes to check scheduling, health checks and disruption budgets.
🌐Networks
Add latency, packet loss or a partition between services or regions.
πŸ§‘β€πŸš’Game days
A planned session where a team runs failures together and practises the response.

06Types / Parts / How It Works

Kinds of faults to inject

FaultWhat it simulatesWhat it tests
Kill an instance or podA crash or a bad hostHealth checks, restarts, load balancing, replicas
Add latencyA slow dependency or networkTimeouts, deadlines, queue limits
Drop or block network trafficA partition or broken linkRetries, fallbacks, split-brain handling
Use up CPU, memory or diskA noisy neighbour or a leakAutoscaling, limits, alerts, back pressure
Make a dependency return errorsA failing downstream serviceCircuit breakers, bulkheads, graceful degradation
Take down a zone or regionA data centre outageMulti-region failover, capacity in the survivors
Skew the clockClock driftLeases, tokens, caches that depend on time

How big, how risky

Grow the blast radius slowly
Safest
πŸ§ͺTest environmentno real users
Careful
πŸ§‘β€πŸ’»Production, tiny slice1 instance, internal users
Confident
🌍Production, widea zone, with a watched dashboard
Move right only when the step on the left passed and the abort button works.
Low risk Medium Higher risk, more value
VisualizerRun a chaos experiment on a small servicePick a fault and a blast radius, then switch resilience features on one at a time. Watch whether the success rate stays above 99%. Try β€œSlow database” with retries only, and see a retry storm.
1. Inject this fault
2. Blast radius (share of copies affected)
3. Switch resilience features on
🌐Webusers
→↓
βš™οΈAPI3 instances
→↓
πŸ—„οΈDatabase50% slow
⚑Cache3 nodes
Green = healthy, amber = struggling, red = failing.
Success rate
0%
steady state: at least 99%
Slowest requests
5.0 s
illustrative p99
Hypothesis
BROKEN
found a weak spot
Hypothesis broken: that is the finding. Success fell below 90%, so the guardrail trips. In a real experiment an abort condition stops the test automatically and you roll the fault back.
  • 50% of database copies answer in 5 seconds.
  • No timeouts: slow calls pile up until every thread is waiting. Even requests that do not need the slow database stall.

A simplified model with fixed rules and no random numbers. Real systems behave in more ways than this, which is exactly why you run the experiment on the real thing, in small steps.

07How to Use It / Steps / Implementation

Running your first experiment

  1. 1
    Pick a steady-state metric
    Something users feel: success rate, p99 latency, orders per minute. Not CPU alone.
  2. 2
    Write the hypothesis
    For example: "If one API instance dies, the success rate stays above 99.9%."
  3. 3
    Choose the smallest fault
    One instance, one dependency, a few percent of traffic.
  4. 4
    Set abort conditions
    A clear rule such as "stop if the success rate drops below 95%", ideally automatic.
  5. 5
    Tell the right people
    On-call and support should know a test is running, so it is not mistaken for a real incident.
  6. 6
    Inject and watch
    Look at the dashboard while the fault is on. Take notes on surprises.
  7. 7
    Roll back and write it up
    End the fault, record what held and what broke, and file fixes.
  8. 8
    Repeat, then automate
    Fix the weakness, run it again, then add the experiment to a schedule or a pipeline.
πŸ’‘Tools you may meet
Chaos Monkey (Netflix), Gremlin, LitmusChaos (Kubernetes), Chaos Mesh, and AWS Fault Injection Service. They are examples, and a simple script that stops one instance is also a valid start.
⚠️Be ready before you start
You need working monitoring, alerts and a rollback. Chaos in a system you cannot observe teaches nothing and may cause a real outage.

08Key Terms to Know

TermMeaning in easy words
Chaos engineeringExperimenting on a system on purpose to build confidence it survives real failures
Steady stateThe measurable signs that the system is healthy
HypothesisA guess that the steady state will hold during the fault
Blast radiusHow much of the system or how many users a test can affect
Fault injectionCausing a failure artificially, such as killing a process or adding delay
Game dayA planned team exercise where failures are injected and the response is practised
Abort conditionA rule that stops the experiment when it does too much harm
Chaos MonkeyNetflix’s tool that randomly terminates instances
Graceful degradationServing a reduced but useful service when a part fails
ResilienceThe ability to keep working, or recover quickly, when things fail
Retry stormRetries that multiply load on a struggling service and make it worse

09Pros, Cons and Trade-offs

βœ… Pros
  • Finds hidden weaknesses before customers do
  • Proves that failover and alerts really work
  • Builds team skill and calm during incidents
  • Encourages resilient design from the start
  • Turns fear of failure into practice
⚠️ Cons
  • Can cause a real outage if done carelessly
  • Needs good monitoring and a rollback first
  • Takes time, tooling and buy-in
  • Hard to run safely on stateful or regulated systems
  • Results can be hard to turn into fixes

Trade-offs

ChoiceWe gainWe lose
Test in productionReal traffic and real settingsReal risk to users
Test in stagingSafeDifferent from production, so some weaknesses hide
Random faultsSurprises that planned tests missHarder to explain and control
Planned game daysLearning together, easy to controlLess surprise, less often
Large blast radiusReal confidenceLarger damage if wrong

10Common Problems and Mistakes

Common mistakes

  1. No steady-state metric. Without it you cannot say whether the test passed.
  2. Starting too big. Begin with one instance, not a whole region.
  3. No abort button. If you cannot end the fault fast, do not start.
  4. Nobody told. On-call wastes an hour chasing a fault you caused.
  5. Testing without monitoring. You cannot learn from what you cannot see.
  6. Treating a pass as the end. Systems and code change, so re-run experiments regularly.
  7. Not fixing findings. A list of known weaknesses with no owner is worse than no list.

Things to watch

πŸ”Retry storms
Retries without a circuit breaker can turn a slow database into a dead one.
πŸ’ΎData safety
Never test failures that could lose or corrupt real data without backups and care.
πŸ“œRules and contracts
Regulated or contract-bound systems may limit what you may break.
🧯Cleanup
Make sure every injected fault is removed, even if the tool crashes.

11Real-World Examples

🎬Netflix
Created Chaos Monkey and a family of tools (the Simian Army), and runs exercises to show it can lose a region.
☁️AWS
Offers Fault Injection Service to run experiments on your own AWS workloads.
πŸ“¦Amazon
Runs game days where teams practise failing over services and recovering.
πŸ”Google
Runs company-wide disaster recovery exercises (DiRT) that simulate large outages.
☸️Kubernetes ecosystem
LitmusChaos and Chaos Mesh inject pod, network and disk faults into clusters.
🏦Banks and payments
Use controlled failure tests to prove they meet recovery targets.
Mini case: the missing timeout
🐒Make DB slow5 s, on 50% of copies
→↓no timeout
🧡Threads pile upAPI stops answering
→↓abort
πŸ› οΈFix1 s timeout and breaker
A one-line change in a test found what a real outage would have.

12Related Topics to Read Next

Handling Failures→

The techniques that chaos tests are meant to prove.

Circuit Breaker→

Stops a retry storm that a slow dependency can start.

Bulkhead→

Keeps one failing part from sinking the others.

Timeouts and Deadlines→

The first thing most experiments find missing.

Health Checks→

How a failed instance is noticed and removed.

Failover→

Switching to a backup, tested by killing the primary.

Incident Management and Postmortems→

What to do when a test, or the real thing, goes wrong.

13Interview Questions with Short Answers

14Quick Revision Cheat-Sheet

  • βœ”Idea: break things on purpose, in a small controlled way, to learn.
  • βœ”Loop: steady state, hypothesis, inject, compare, fix.
  • βœ”Blast radius: start tiny, widen only after success.
  • βœ”Always have: monitoring, abort condition, rollback, and a heads-up to on-call.
  • βœ”Faults: kill, latency, network drop, resource exhaustion, dependency errors, region loss.
  • βœ”Classic find: missing timeouts and retry storms.
  • βœ”A broken hypothesis: is a win, because you found it on your own schedule.
  • βœ”One line: β€œThe fire drill for your software.”
← Previous
Zero-Downtime Deployment
Next β†’
Shadow Traffic and Dark Launches