Chaos engineering is the discipline of experimenting on a system to build confidence in its capability to withstand turbulent conditions in production. Unlike traditional testing, chaos engineering proactively uncovers unknown weaknesses before they manifest as customer-impacting incidents.
Every chaos experiment follows a structured hypothesis-driven approach:
| Step | Description |
|---|---|
| Steady State | Define measurable "normal" behavior for your system |
| Hypothesis | Predict that the steady state will remain during the experiment |
| Introduce Variables | Inject realistic failures (latency, crashes, resource exhaustion) |
| Test Hypothesis | Compare measured behavior against your predicted steady state |
| Learn | Document deviations and drive improvements |
Safety is the first concern. The toolkit implements progressive blast radius:
injector.kill_switch() halts all injection instantlyfrom src.blast_radius import create_progressive_experiment
limiter = create_progressive_experiment(
initial_pct=5.0,
max_pct=30.0,
step_pct=5.0,
step_interval_seconds=300,
abort_at_error_rate=0.05,
)Before breaking anything, define what "healthy" looks like. The steady-state checker evaluates system health across multiple dimensions:
from src.steady_state import SteadyStateChecker, HealthCheck
checker = SteadyStateChecker()
checker.add_check(HealthCheck(
name="api-p99-latency",
check_fn=lambda: get_p99_latency(),
expected_value=200.0,
tolerance_pct=50.0,
critical=True,
))1. Always define your hypothesis first
2. Start small and expand progressively
3. Maintain a kill switch at all times
4. Exclude sensitive traffic (VIP users, critical paths)
5. Set maximum durations for every injection
6. Monitor continuously throughout the experiment
7. Never rely on humans to notice problems — automate abort criteria
Chaos engineering transforms reliability from a reactive firefight into a proactive, data-driven practice. Every experiment builds institutional knowledge about how your system behaves under stress.
A well-designed chaos experiment has four components: a clear hypothesis, controlled injection, safety boundaries, and post-experiment verification. This chapter walks through the experiment catalog included in the toolkit.
Every experiment YAML combines hypothesis, scope, injection, safety, and verification sections. See the actual files in experiments/ for the full schema.
Terminates a random pod to validate load balancer health checks, pod anti-affinity, and restart policies. Requires minimum 3 replicas to proceed.
experiment:
name: "pod-failure-random-kill"
scope:
target_service: "api-gateway"
max_pods_affected: 1
injection:
type: pod_kill
grace_period_seconds: 30Adds 500ms network latency between services to test timeout handling and circuit breakers. Uses progressive blast radius starting at 10%.
experiment:
name: "network-latency-injection"
injection:
type: network_latency
latency_ms: 500
jitter_ms: 100
duration_seconds: 300
scope:
initial_pct: 10
max_pct: 30Simulates a complete downstream service blackhole. Validates queue-and-retry patterns, graceful degradation, and data durability.
experiment:
name: "dependency-complete-failure"
injection:
type: network_blackhole
duration_seconds: 180
safety:
pre_conditions:
- check: "payment_queue_healthy"| Scenario | Experiment Type | Risk Level |
|---|---|---|
| Validate redundancy | Pod Failure | Low |
| Test circuit breakers | Latency Injection | Medium |
| Verify graceful degradation | Dependency Failure | High |
| Resource exhaustion | Memory/CPU injection | Medium |
| Network partition | Network blackhole | High |
Always start with low-risk experiments in staging before moving to production. Document every finding in the experiment proposal template.
Get the full Chaos Engineering Toolkit and unlock everything.
Get the complete guide with every chapter unlocked, including code samples, diagrams, and best practices.
Access all interactive tools with complete data, all workload profiles, and the full scenario library.
Downloadable source code, configuration files, and working examples from every chapter.
Free updates for life. Every new chapter, tool, and improvement included.