Circuit Breakers: Why Can Temporarily Rejecting Requests Protect a Service?

Circuit Breakers: Why Can Temporarily Rejecting Requests Protect a Service?

A circuit breaker is used when a dependency has repeatedly failed or timed out. The caller temporarily stops sending new requests and returns an error or a degraded response instead. This does not declare the dependency permanently broken. It creates a cooling-off period so that waiting, retries and occupied resources do not keep accumulating. Afterward, a small number of trial requests can test whether normal service has returned.

Suppose a payment-status service goes down. If an order page keeps asking it for an answer, threads and connections may be exhausted, allowing a local fault to slow the whole website. Opening the circuit lets the page say that confirmation will come later while the payment service has room to recover.

Circuit breaking is not rate limiting: rate limiting controls the speed of otherwise normal traffic, while a circuit breaker uses recent failures to decide whether calls should temporarily be refused. Nor is it retrying. A retry tries again; a circuit breaker deliberately stops trying while failure persists. Its value is not that it removes faults, but that it draws a boundary around how far they can spread.

https://learn.microsoft.com/en-us/azure/architecture/patterns/circuit-breaker


Discover more from Geoffrey Chen

Subscribe to get the latest posts sent to your email.