The idea
Repeated calls to an unhealthy dependency consume time and resources while adding pressure to the failing component. A circuit breaker temporarily rejects some calls after a defined failure pattern, then permits controlled probes to see whether service has recovered.
Design choice
Choose failure signals that reflect the dependency's health, not ordinary user mistakes. Scope the breaker so one tenant or operation does not unnecessarily disable unrelated work. Make the open state observable and define a useful fallback or an honest unavailable response.
Worked example
A recommendation call repeatedly times out. The page service opens that call's circuit and renders the main content without recommendations. Occasional probes restore the optional panel once responses are healthy again.
Before you ship
- Exclude validation errors from failure counts.
- Limit half-open probes.
- Show operators when the breaker opens.
Examples are illustrative. Adapt the checks to your own environment.