Chaos Engineering & Resilience Testing
Quick Chaos Steps:
- Start small: Dev → Staging → 1% prod → gradual rollout
- Define clear rollback triggers (error_rate > 5%)
- Measure blast radius, never exceed planned scope
- Document findings → runbooks → improved resilience
Critical Success Factors:
- Controlled experiments with automatic rollback
- Steady state must be measurable
- Start in non-production, graduate to production
Quick Reference Card
When to Use
- Distributed systems validation
- Disaster recovery testing
- Building confidence in fault tolerance
- Pre-production resilience verification
Failure Types to Inject
| Category |
Failures |
Tools |
| Network |
Latency, packet loss, partition |
tc, toxiproxy |
| Infrastructure |
Instance kill, disk failure, CPU |
Chaos Monkey |
| Application |
Exceptions, slow responses, leaks |
Gremlin, LitmusChaos |
| Dependencies |
Service outage, timeout |
WireMock |
Blast Radius Progression
Dev (safe) → Staging → 1% prod → 10% → 50% → 100%
↓ ↓ ↓ ↓
Learn Validate Careful Full confidence
Steady State Metrics
| Metric |
Normal |
Alert Threshold |
| Error rate |
< 0.1% |
> 1% |
| p99 latency |
< 200ms |
> 500ms |
| Throughput |
baseline |
-20% |
Chaos Experiment Structure
// Chaos experiment definition
const experiment = {
name: 'Database latency injection',
hypothesis: 'System handles 500ms DB latency gracefully',
steadyState: {
errorRate: '< 0.1%',
p99Latency: '< 300ms'
},
method: {
type: 'network-latency',
target: 'database',
delay: '500ms',
duration: '5m'
},
rollback: {
automatic: true,
trigger: 'errorRate > 5%'
}
};
Agent-Driven Chaos
// qe-chaos-engineer runs controlled experiments
await Task("Chaos Experiment", {
target: 'payment-service',
failure: 'terminate-random-instance',
blastRadius: '10%',
duration: '5m',
steadyStateHypothesis: {
metric: 'success-rate',
threshold: 0.99
},
autoRollback: true
}, "qe-chaos-engineer");
// Validates:
// - System recovers automatically
// - Error rate stays within threshold
// - No data loss
// - Alerts triggered appropriately
Agent Coordination Hints
Memory Namespace
aqe/chaos-engineering/
├── experiments/* - Experiment definitions & results
├── steady-states/* - Baseline measurements
├── runbooks/* - Generated recovery procedures
└── blast-radius/* - Impact analysis
Fleet Coordination
const chaosFleet = await FleetManager.coordinate({
strategy: 'chaos-engineering',
agents: [
'qe-chaos-engineer', // Experiment execution
'qe-performance-tester', // Baseline metrics
'qe-production-intelligence' // Production monitoring
],
topology: 'sequential'
});
Related Skills
Remember
Break things on purpose to prevent unplanned outages. Find weaknesses before users do. Define steady state, inject failures, measure impact, fix weaknesses, create runbooks. Start small, increase blast radius gradually.
With Agents: qe-chaos-engineer automates chaos experiments with blast radius control, automatic rollback, and comprehensive resilience validation. Generates runbooks from experiment results.
1---
2name: chaos-engineering-resilience
3description: "Chaos engineering principles, controlled failure injection, resilience testing, and system recovery validation. Use when testing distributed systems, building confidence in fault tolerance, or validating disaster recovery."
4category: specialized-testing
5priority: high
6tokenEstimate: 900
7agents: [qe-chaos-engineer, qe-performance-tester, qe-production-intelligence]
8implementation_status: optimized
9optimization_version: 1.0
10last_optimized: 2025-12-02
11dependencies: []
12quick_reference_card: true
13tags: [chaos, resilience, fault-injection, distributed-systems, recovery, netflix]
14metadata:
15 source: https://skillmd.com/skills/aibot88/chaos-engineering-resilience
16---
17
18# Chaos Engineering & Resilience Testing
19
20<default_to_action>
21When testing system resilience or injecting failures:
221. DEFINE steady state (normal metrics: error rate, latency, throughput)
232. HYPOTHESIZE system continues in steady state during failure
243. INJECT real-world failures (network, instance, disk, CPU)
254. OBSERVE and measure deviation from steady state
265. FIX weaknesses discovered, document runbooks, repeat
27
28**Quick Chaos Steps:**
29- Start small: Dev → Staging → 1% prod → gradual rollout
30- Define clear rollback triggers (error_rate > 5%)
31- Measure blast radius, never exceed planned scope
32- Document findings → runbooks → improved resilience
33
34**Critical Success Factors:**
35- Controlled experiments with automatic rollback
36- Steady state must be measurable
37- Start in non-production, graduate to production
38</default_to_action>
39
40## Quick Reference Card
41
42### When to Use
43- Distributed systems validation
44- Disaster recovery testing
45- Building confidence in fault tolerance
46- Pre-production resilience verification
47
48### Failure Types to Inject
49| Category | Failures | Tools |
50|----------|----------|-------|
51| **Network** | Latency, packet loss, partition | tc, toxiproxy |
52| **Infrastructure** | Instance kill, disk failure, CPU | Chaos Monkey |
53| **Application** | Exceptions, slow responses, leaks | Gremlin, LitmusChaos |
54| **Dependencies** | Service outage, timeout | WireMock |
55
56### Blast Radius Progression
57```
58Dev (safe) → Staging → 1% prod → 10% → 50% → 100%
59 ↓ ↓ ↓ ↓
60 Learn Validate Careful Full confidence
61```
62
63### Steady State Metrics
64| Metric | Normal | Alert Threshold |
65|--------|--------|-----------------|
66| Error rate | < 0.1% | > 1% |
67| p99 latency | < 200ms | > 500ms |
68| Throughput | baseline | -20% |
69
70---
71
72## Chaos Experiment Structure
73
74```typescript
75// Chaos experiment definition
76const experiment = {
77 name: 'Database latency injection',
78 hypothesis: 'System handles 500ms DB latency gracefully',
79 steadyState: {
80 errorRate: '< 0.1%',
81 p99Latency: '< 300ms'
82 },
83 method: {
84 type: 'network-latency',
85 target: 'database',
86 delay: '500ms',
87 duration: '5m'
88 },
89 rollback: {
90 automatic: true,
91 trigger: 'errorRate > 5%'
92 }
93};
94```
95
96---
97
98## Agent-Driven Chaos
99
100```typescript
101// qe-chaos-engineer runs controlled experiments
102await Task("Chaos Experiment", {
103 target: 'payment-service',
104 failure: 'terminate-random-instance',
105 blastRadius: '10%',
106 duration: '5m',
107 steadyStateHypothesis: {
108 metric: 'success-rate',
109 threshold: 0.99
110 },
111 autoRollback: true
112}, "qe-chaos-engineer");
113
114// Validates:
115// - System recovers automatically
116// - Error rate stays within threshold
117// - No data loss
118// - Alerts triggered appropriately
119```
120
121---
122
123## Agent Coordination Hints
124
125### Memory Namespace
126```
127aqe/chaos-engineering/
128├── experiments/* - Experiment definitions & results
129├── steady-states/* - Baseline measurements
130├── runbooks/* - Generated recovery procedures
131└── blast-radius/* - Impact analysis
132```
133
134### Fleet Coordination
135```typescript
136const chaosFleet = await FleetManager.coordinate({
137 strategy: 'chaos-engineering',
138 agents: [
139 'qe-chaos-engineer', // Experiment execution
140 'qe-performance-tester', // Baseline metrics
141 'qe-production-intelligence' // Production monitoring
142 ],
143 topology: 'sequential'
144});
145```
146
147---
148
149## Related Skills
150- [shift-right-testing](../shift-right-testing/) - Production testing
151- [performance-testing](../performance-testing/) - Load testing
152- [test-environment-management](../test-environment-management/) - Environment stability
153
154---
155
156## Remember
157
158**Break things on purpose to prevent unplanned outages.** Find weaknesses before users do. Define steady state, inject failures, measure impact, fix weaknesses, create runbooks. Start small, increase blast radius gradually.
159
160**With Agents:** `qe-chaos-engineer` automates chaos experiments with blast radius control, automatic rollback, and comprehensive resilience validation. Generates runbooks from experiment results.