Try
↑ ↓ move↵ openesc close

Interview prep / Retries and circuit breakers

Senior · Retries and circuit breakers · System design interview question

An outage's root cause was fixed an hour ago, but clients are still seeing mostly errors and the dependency looks overloaded. How do you diagnose it and get out?

Sketch your own answer first, then compare it with the one below.

A strong answer

This pattern is a metastable failure: the trigger is gone, and a feedback loop keeps the system in overload. The usual sustaining loops are retries, queues full of requests that clients abandoned, and caches that stay cold so that every request goes to the backend.

Diagnose it from the shape of the load. Compare attempts at the dependency with new requests. A ratio well above one points to retries. Check queue delay against the client timeout, and the share of work the dependency finishes after the client has left. If delay is above the timeout, the dependency is working for nobody.

To get out, you must reduce load below capacity for long enough to drain the backlog. Shed or reject traffic at the edge, or open breakers, disable retries or tighten budgets, and restart or purge the dependency's queue so that abandoned work is dropped. Then restore traffic gradually and watch whether it holds.

To prevent it, bound queues by delay, drop by deadline, cap retries with budgets and breakers, and test overload behaviour before it happens.

The order matters: cut load first, let the backlog drain, then restore traffic. Restoring everything at once re-triggers the loop.

Sources

Learn it by running it

The retries, timeouts and circuit breakers lesson explains the mechanism behind this question, and its lab lets you change the parameters and watch the effect.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms