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
- Mor Harchol-Balter (2013). Performance Modeling and Design of Computer Systems.
- Martin Kleppmann (2017). Designing Data-Intensive Applications.