advanced
Fault tolerance
Continue operating through partial failures using timeouts, retries, circuit breakers, bulkheads, and fallback modes.
Fault tolerance keeps the system useful when components fail. Patterns include timeouts, bounded retries with jitter, circuit breakers, bulkheads limiting blast radius, idempotent handlers, and fallback responses. Design for partial failure — networks partition and disks fail routinely at scale.
Retries must be safe and capped. Breakers stop hammering unhealthy dependencies. Bulkheads dedicate thread pools or connection limits per dependency.
On interviews: add a circuit breaker to your diagram for an external API, explain retry policy, and describe a safe fallback UX.
Common pitfalls: infinite retries on 500 errors; shared thread pool exhausted by one slow dependency; fallback that violates business rules silently.
The trade-off is flexibility versus complexity—know when the simpler path is enough.
Checklist:
- Set timeouts on all external calls.
- Retry only idempotent operations with caps.
- Use circuit breakers and bulkheads.
- Define user-visible fallback behavior.