Try
↑ ↓ move↵ openesc close

Interview prep / Queues as buffers

Senior · Queues as buffers · System design interview question

A downstream outage ends, and the queue in front of it takes hours to recover even though capacity is back. What could be going on, and what do you change?

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

A strong answer

Likely causes are a large backlog drained at a rate only slightly above the arrival rate, retries that add load while the service is struggling, and stale messages that are processed although nobody wants the result any more.

The drain time of a backlog is its size divided by the spare capacity, which is the consumer speed minus the arrival rate. If spare capacity is small, recovery is slow. Near full load that stretch gets very long.

Fixes include temporary extra consumers, expiring messages older than a deadline, retries with backoff and a cap, and priorities so fresh work does not wait behind old work. Recovery capacity needs planning in advance, just as steady-state capacity does.

Sources

Learn it by running it

The queues as buffers 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