A design pattern that prevents a system from repeatedly trying to perform an operation that's likely to fail, helping it recover gracefully.
Downstream services (like databases or APIs) can become slow or unavailable. Continuously retrying failed requests can overwhelm these services and spread failure. The circuit breaker stops this cascade by "breaking" the flow temporarily when too many failures occur.
Use it when calling unreliable external services or when you want to contain failures and keep your system responsive under partial outages.
You need to know
States: Closed, Open, Half-Open – The circuit starts closed (calls pass through). After failures exceed a threshold, it goes open (calls are blocked). After a timeout, it goes half-open to test if recovery is possible.
Prevents cascading failure – By cutting off repeated failed calls, it reduces load on failing systems and protects upstream services.
Needs monitoring and tuning – Set failure thresholds, timeout durations, and retry intervals carefully to avoid false positives or delayed recovery.
Like posts like this?
Every week, you'll get a new system design concept, broken down like this one.
Free subscribers also get a little bonus:
🎁 The System Design Interview Preparation Cheat Sheet
If you're into visuals, paid subscribers unlock:
→ My Excalidraw system design template – so you have somewhere to start
→ My Excalidraw component library – used in the diagram of this issue
No pressure though. Your support helps me keep writing, and I appreciate it more than you know ❤️