pattern

Circuit Breaker

A proxy that stops calling a failing dependency after a failure threshold, failing fast instead, and periodically tests whether it has recovered.

resiliencefailurecascading-failure

Three states. Closed: calls pass through, failures are counted. Open: the failure threshold was crossed, so calls fail immediately without touching the dependency. Half-open: after a cooldown, a small number of trial calls are allowed; success closes the breaker, failure reopens it.

The purpose is not to protect the caller from errors — it will get errors either way — but to stop the caller from holding threads and connections open waiting on something that is not going to answer, which is how one failing service takes down the four services in front of it.

Fail fast is only half the pattern. What you fail fast to matters: a cached value, a degraded response, a queued write. A breaker that only converts slow errors into fast errors has improved the outage, not prevented it.