Backend Testing
Backend Chaos Testing
Test your backend services running in Docker containers.
Docker Targets
FailSafe connects to your Docker daemon to discover and target running containers. You can specify targets by name, ID, or label selectors.
Prerequisites
- Docker Engine running and accessible
- FailSafe has access to Docker socket
- Target containers are running
# Verify Docker is accessible docker ps # Run FailSafe with Docker socket access docker run -v /var/run/docker.sock:/var/run/docker.sock failsafe/agent
Targeting Methods
By Container Name
Target specific containers by their name.
"targets": ["api-service", "postgres-db"]
By Container ID
Target by full or partial container ID.
"targets": ["abc123def456", "xyz789"]
By Label Selector
Target all containers matching label criteria.
"targets": ["app=myapp", "env=staging"]
Wildcard Patterns
Use wildcards to match multiple containers.
"targets": ["api-*", "*-service"]
Fault Types
Backend fault types simulate various infrastructure failures.
cpu_stress
CPU Stress
Consumes CPU cycles to simulate high CPU load on a container.
| Intensity | Effect |
|---|---|
| 10 | 10% CPU usage |
| 50 | 50% CPU usage |
| 100 | 100% CPU usage (all cores) |
{
"fault_type": "cpu_stress",
"targets": ["api-service"],
"duration": 60,
"max_intensity": 80
}memory_stress
Memory Stress
Allocates memory to simulate memory pressure.
| Intensity | Effect |
|---|---|
| 25 | Allocate 25% of available memory |
| 50 | Allocate 50% of available memory |
| 90 | Allocate 90% - may trigger OOM |
kill
Process Kill
Terminates container processes to simulate crashes.
| Intensity | Effect |
|---|---|
| 10 | 10% chance to kill per interval |
| 50 | 50% chance to kill per interval |
| 100 | Guaranteed kill |
network_delay
Network Delay
Adds latency to network packets using tc (traffic control).
| Intensity | Effect |
|---|---|
| 50 | 50ms added latency |
| 200 | 200ms added latency |
| 1000 | 1 second added latency |
packet_loss
Packet Loss
Drops a percentage of network packets.
| Intensity | Effect |
|---|---|
| 5 | 5% packet loss |
| 20 | 20% packet loss |
| 50 | 50% packet loss - severe degradation |