The Desi Architect
Notes / Docker Sandboxes / Circuit Breaker & Thread Bulkhead Isolation
Docker Sandboxes · Tier 3: Reliability & Messaging · Lab 43

Circuit Breaker & Thread Bulkhead Isolation

Make a payment partner fail, then go slow, and measure what reaches it. Without protection every call lands on a partner that is already struggling. With a circuit breaker most calls never leave your service. With a bulkhead only three are ever in flight, however many callers you have.

Time35 minutes
StackPython 3Ports 18095
MemoryAbout 60 MB
Before thisLab 12Timeouts, Retries, Exponential Bac
Verified runWindows, Mac, LinuxBash and PowerShell
  1. 1PrepareWhat you will learn
  2. 2PredictGuess before you run
  3. 3RunStep by step
  4. 4ObserveWhat you should see
  5. 5Break itChange one thing
  6. 6Clean upLeave nothing running
On this page
  1. 00 / What You Will Learn
  2. 01 / Why It Matters
  3. 02 / What We Are Building
  4. 03 / Words You Need
  5. 04 / Predict First
  6. 05 / Step by Step
  7. 06 / What You Should See
  8. 07 / Look Inside
  9. 08 / Break It, Fix It
  10. 09 / In Real Projects
  11. 10 / Interview Corner
  12. 11 / Clean Up

00 /What You Will Learn

By the end you will be able to
  • Explain the three states of a circuit breaker: CLOSED, OPEN, HALF_OPEN.
  • Show with the partner's own counters how many calls a breaker keeps away.
  • Explain a bulkhead and show the partner never exceeds the limit.
  • Explain why a slow dependency is worse than a dead one, and why timeouts matter.
  • Say what a fallback is allowed to do for a payment.

Before you start

Finish Lab 12 (Timeouts, Retries and Backoff) first. You should know what a timeout and a retry storm are. Docker Desktop and Python 3 are needed.