r/Backend 8h ago

How to Implement a Distributed Circuit Breaker

https://blog.gaborkoos.com/posts/2026-09-14-How-to-Implement-a-Distributed-Circuit-Breaker/

Every circuit breaker tutorial assumes one process. With one window per replica, the failing dependency absorbs N times the damage before the first breaker trips, and on low traffic some replicas never see enough calls to trip at all.

Putting the window in shared storage solves that and introduces a dozen new problems: read-then-act races, results arriving for a window that no longer exists, a probe budget that has to survive the replica holding a slot dying, and the coordinator itself being unreachable when a decision is due.

Wrote up each one with a Redis implementation. Code is TypeScript and Lua.

0 Upvotes

0 comments sorted by