Skip to main content
Primitives/Primitive #22
PRIMITIVE #22Core Distributed Systems Component

Circuit Breaker, Bulkhead & Fault Tolerance Patterns

AWS Production Mapping:AuroraElastiCacheAPI Gateway

1. What It Is & Why It Exists

The Core Problem: Microservice Cascading Outages

In microservice architectures, services depend on dozens of downstream microservices and third-party APIs. When a single downstream service experiences degraded performance (e.g., database lock contention, 10s10\text{s} query latency):

  1. Thread Pool Exhaustion: Upstream callers block waiting for responses. Worker threads in Tomcat, Node.js, or Go event loops saturate.
  2. Cascading Domino Failure: As upstream services run out of threads, they fail health checks and reject traffic from their callers. A failure in an ancillary recommendation service cascades to collapse the entire e-commerce checkout platform.
  3. Self-Inflicted DDoS on Recovery: When the degraded service attempts to recover, millions of queued retries instantly hammer it back down (Retry Storm).
Interactive Architecture Diagram
Synthesizing vector architecture diagram...

2. Core Resilience Patterns

Interactive Architecture Diagram
Synthesizing vector architecture diagram...

3. Circuit Breaker State Machine & Mechanics

Interactive Architecture Diagram
Synthesizing vector architecture diagram...

Sliding Window Mathematical Formulation

Using a sliding window of N=100N = 100 requests or time duration T=10sT = 10\text{s}: FailureRate=∑i=1W(HTTP 5xx+Timeouts)Total Requests in Window×100\text{FailureRate} = \frac{\sum_{i=1}^{W} (\text{HTTP 5xx} + \text{Timeouts})}{\text{Total Requests in Window}} \times 100 If FailureRate≥Threshold (e.g., 50%)∧Total Requests≥MinVolume (e.g., 20)\text{FailureRate} \ge \text{Threshold (e.g., } 50\%) \land \text{Total Requests} \ge \text{MinVolume (e.g., } 20), transition state: State=OPEN\text{State} = \text{OPEN}


4. Bulkhead Pattern: Thread Pool & Semaphore Isolation

Interactive Architecture Diagram
Synthesizing vector architecture diagram...

Part 2: Production Deep-Dive Locked1 Coin = 24 Hours

Unlock Complete Architecture & Production Runbooks

Your Balance:40 Coins

You have explored the free architectural preview (~50%). Spend 1 Coin to unlock the remaining 5 production deep-dive sections for a full 24 hours.

Sections Included in This 24-Hour Pass:
5. Exponential Backoff with Full Jitter
6. Deadline & Context Propagation
7. Critical Edge Cases & Distributed Failure Modes
8. AWS Reference Architecture
9. Interview Delivery Framework
Keeps page unlocked for exactly 24 hoursSpend coins to fund LLM & compute infrastructure