Resilience Patterns

shield

Fault Tolerance Patterns

Circuit Breaker

Prevents cascading failures by failing fast with automatic recovery detection through open, closed, and half-open states.

Key Features
  • State management (open/closed/half-open)
  • Configurable failure threshold
  • Timeout configuration
  • Metrics and monitoring
Use Cases
  • Microservice API calls
  • Database connection failures
  • External API integration
  • Payment gateway calls
Retry Pattern

Handles transient failures with exponential backoff, jitter, and configurable maximum attempts for resilience.

Key Features
  • Configurable retry attempts
  • Exponential backoff strategy
  • Jitter to prevent thundering herd
  • Idempotency checks
Use Cases
  • Network request failures
  • Database query timeouts
  • Message delivery retry
  • File upload operations
Bulkhead Pattern

Isolates resources to limit blast radius and partition failures using thread pools and connection pools.

Key Features
  • Thread pool isolation
  • Connection pool partitioning
  • Circuit breaker per partition
  • Resource limit enforcement
Use Cases
  • Connection pool separation
  • Thread pool isolation
  • Multi-tenant resource isolation
  • Service boundary enforcement
speed

Rate & Load Control

Rate Limiting

Controls request rate using token bucket, sliding window, or fixed window algorithms to prevent system abuse.

Key Features
  • Per-user/IP rate limits
  • Burst handling capability
  • Distributed rate limiting
  • Configurable time windows
Use Cases
  • API throttling
  • Login attempt limiting
  • Resource protection
  • DDoS prevention
Timeout Pattern

Sets response time limits to prevent indefinite waits and enable fail-fast behavior across the system.

Key Features
  • Connection timeout
  • Read timeout configuration
  • Overall request timeout
  • Cascading timeout prevention
Use Cases
  • HTTP request timeouts
  • Database query limits
  • RPC call timeouts
  • Cache lookup limits
Load Leveling

Smooths traffic spikes using queue-based buffering to decouple producers from consumers with backpressure handling.

Key Features
  • Queue-based buffering
  • Asynchronous processing
  • Backpressure handling
  • Traffic spike absorption
Use Cases
  • Message queue systems
  • Task queue processing
  • Batch job processing
  • Write operation buffering
healing

Degradation & Recovery

Fallback Pattern

Provides alternative responses on failure with degraded functionality, cached data, or default values.

Key Features
  • Static fallback responses
  • Cached data serving
  • Default value provision
  • Simplified response mode
Use Cases
  • Cache fallback on DB failure
  • Static content serving
  • Reduced feature mode
  • Error page display
Health Check

Monitors service availability with readiness vs liveness probes for graceful degradation and load balancer decisions.

Key Features
  • Periodic health checks
  • Dependency health validation
  • Deep vs shallow checks
  • Liveness and readiness probes
Use Cases
  • Kubernetes liveness probes
  • Load balancer health checks
  • Service discovery updates
  • Auto-scaling triggers
Backpressure

Flow control mechanism preventing system overwhelming through request limiting, queue bounds, and consumer-driven feedback.

Key Features
  • Request rate limiting
  • Queue size bounds
  • Feedback loop mechanism
  • Load shedding capability
Use Cases
  • Reactive streams (RxJS)
  • TCP flow control
  • Message queue throttling
  • Async processing pipelines