Notes
The method
Chaos testing is an experiment, not random breaking. First, define steady state: what normal looks like in numbers, such as errors under one percent. Second, a hypothesis: if this fails, users can still do that. Third, inject one fault. Fourth, keep the blast radius small, with abort conditions and a way to roll back. Then observe, compare with steady state, learn, fix, and automate the experiment so it runs again.
- 1 steady state: measurable normal (errors < 1%, p95)
- 2 hypothesis: "if X fails, users still Y"
- 3 inject ONE fault
- 4 small blast radius, abort conditions, a rollback
- 5 observe, compare, learn
- 6 fix, then automate it
Kinds of fault
Faults come in a few kinds. Process faults: kill or restart a service, a container or a whole node. Network faults: added latency, lost packets, or a dependency that cannot be reached. Dependency faults: the payment provider returns errors or times out. Resource faults: CPU or memory exhausted, a full disk. And time faults: clocks out of step, expired certificates. Start with the failures your system is most likely to meet.
- process: kill or restart a service, a container, a node
- network: latency, packet loss, a dependency unreachable
- dependencies: payment API returns 500 or times out resources: CPU, memory, full disk
- time: clock skew, expired certs
Our experiment
Our experiment. Load: Locust with twenty shoppers, each signed up with its own account, searching and adding to cart for thirty seconds. Fault: stop the ShopRung process at ten seconds and start it again at fifteen. Hypothesis: errors happen only during the outage, and afterwards existing carts and logins still work. Blast radius: a local test copy, so nobody else is affected.
- load: Locust, 20 shoppers, each with its own account, searching and adding to cart
- fault: stop ShopRung at 10 s, start it again at 15 s
- hypothesis: errors only during the outage; afterwards carts and logins still work
- blast radius: local test copy
Results
The results. Three hundred and fifty requests, fifty failed, about fourteen percent, all during the five second outage: thirty seven searches and thirteen add to cart calls were refused. After the restart, users' existing tokens still worked, and carts and orders were intact, because ShopRung keeps its data in a database file. The hypothesis held. In production, the finding would be: a single instance means every restart is a full outage.
requests 350
failed 50 (14%)
search 37 status 0
add to cart 13 connection
refused
after restart:
old tokens still valid
carts and orders kept (SQLite
file) Check your checks
An honest lesson. Our first run reported only eight failures, two point six percent. The search check read the JSON body before checking the status, so when the server was down, reading the body crashed and Locust never recorded those requests at all. Checking the status first fixed it, and the second run showed the true fifty failures. Chaos experiments test your monitoring and your tests, not only the system.
with catch_response as r:
if r.json()["count"] != 2: ✗
r.failure(...)
→ server down: r.json() crashed,
the request was never recorded
first run: 8 failures, 2.6%
if r.status_code != 200: ✓
r.failure(f"status ...")
→ second run: 50 failures, 14% What users see
Also test what users see during a fault. Earlier in this track, when we took ShopRung's page offline, it showed the raw browser error text, failed to fetch. A better experience explains the problem in plain words and offers a retry. Resilient systems also use timeouts, retries with backoff, cached content, and degraded modes, such as hiding a recommendations panel when its service is down instead of failing the whole page.
- network offline → the page shows the raw text "Failed to fetch"
- better: "We can't reach the shop. Check your connection and try again." + a Retry
- also: timeouts, retries with backoff, cached pages, degraded mode (hide reviews)
Tools
Tools range from one command to full platforms. Killing a process or stopping a container is the simplest fault. Toxiproxy sits between services and adds latency, timeouts or cut connections, which works well inside automated tests. Chaos Mesh and LitmusChaos run experiments on Kubernetes. Cloud providers offer fault injection services, and Gremlin is a commercial platform.
- kill / docker stop: simplest
- Toxiproxy: latency, timeouts, cut connections between services (great in tests)
- Chaos Mesh, LitmusChaos: Kubernetes experiments
- AWS Fault Injection Service, Azure Chaos Studio
- Gremlin: commercial platform
Game days
Teams often run chaos as game days: a planned session where the whole team runs an experiment, usually on staging first, and later in production on a small share of traffic once confidence is high. Watch the dashboards and alerts: did they fire, and were they clear? Practise the runbook. Write down every surprise, and turn findings into tickets and automated tests.
- planned session, whole team
- run an experiment on staging (later: production, small %)
- watch dashboards and alerts: did they fire? were they clear?
- practise the runbook
- write down what surprised you
- turn findings into tickets
Common mistakes
Mistakes. Starting in production. No steady state or hypothesis, so nobody knows what the result means. Several faults at once, so you cannot tell which caused what. No abort switch. Trusting your test's numbers without checking the checks, as our first run showed. And collecting findings that are never fixed.
- starting in production
- no steady state or hypothesis
- several faults at once
- no abort switch
- trusting test numbers without testing the checks
- findings never fixed
Say it like this
In the interview: chaos testing is controlled experimentation. Define steady state in metrics, state a hypothesis, inject one fault, such as a killed process, latency or dependency errors, with a small blast radius and an abort condition, then compare, fix and automate. Start in staging with tools like Toxiproxy or Chaos Mesh, and check both what users see and whether alerts fired.
- "Controlled experiments: define
- steady state in metrics, state
- a hypothesis, inject one fault
- (kill, latency, dependency
- errors) with a small blast
- radius and an abort, compare, fix, automate. Start in staging, with Toxiproxy or Chaos Mesh, and check what users see and whether alerts fired."