#Core Resilience Patterns
Core Resilience Patterns
Circuit Breaker
Monitors calls to a service and "trips" (opens the circuit) when failures exceed a threshold, preventing cascading failures. After a timeout, it allows limited requests to test recovery before closing again.
Retry
Automatically retries failed requests, often with exponential backoff (waiting longer between each retry) and jitter (randomized delays to avoid thundering herd problems).
Timeout
Sets a maximum wait time for any operation. Without timeouts, slow dependencies can exhaust thread pools and bring down the whole system.
Bulkhead
Isolates components into separate resource pools (like compartments in a ship's hull) so a failure in one doesn't drain resources from others. For example, giving different services separate connection pools. Aka. Error Boundary
Fallback
Defines an alternative behavior when a call fails: returning cached data, a default value, or a degraded but functional response instead of an error.
Rate Limiting & Throttling
Controls how many requests a service accepts per time window, protecting it from overload, either self-imposed or enforced on callers.
Stability Patterns
Idempotency
Designing operations so they can be safely retried without side effects (e.g., using idempotency keys for payments).
Cache-Aside (Read-Through Cache)
Serving responses from cache when the origin is slow or unavailable, reducing dependency on downstream services.
Health Checks & Readiness Probes
Exposing endpoints that load balancers and orchestrators (like Kubernetes) use to route traffic away from unhealthy instances.
Graceful Degradation
Continuing to serve core functionality even when non-critical services fail (e.g., showing a product page without recommendations if the recommendation service is down).
Observability Patterns
Dead Letter Queue (DLQ)
Failed messages in async systems are routed to a DLQ for inspection and reprocessing rather than being silently dropped.
Saga Pattern
Managing distributed transactions across microservices with compensating transactions to undo partial work on failure.