Retries, backoff and retry storms
Retry transient failures without multiplying load and turning a blip into an outage.
15 min readWhen a retry helps
Many failures are transient: a dropped packet, a failover in progress, an instance that just restarted. Retrying such a request usually succeeds and the user never notices. But retries are only safe for idempotent operations, and only useful for transient errors. Retrying a 400 Bad Request or a validation error just repeats the failure, so retry on timeouts, connection errors, 503 and 429, not on client errors.
Exponential backoff with jitter
Retrying immediately hammers a dependency at the exact moment it is struggling. Exponential backoff waits longer after each failure: 100 ms, 200 ms, 400 ms, 800 ms, capped at a few seconds. Jitter randomises each wait so that thousands of clients that failed at the same instant do not retry at the same instant. Full jitter, sleep = random(0, min(cap, base x 2^attempt)), spreads retries evenly and is a good default.
Retry storms and amplification
Retries multiply across layers. If the edge, the API and the service client each make 1 attempt plus 3 retries, one user request can become 4 x 4 x 4 = 64 calls to the database when it is already failing. A dependency at 100% capacity that starts failing then receives several times its normal load and can never recover, even after the original cause is gone. This is a metastable failure: the retries themselves sustain the outage.
Keeping retries bounded
Limit retries so they cannot become the load. The goal is that retries rescue the occasional unlucky request but disappear as a share of load when the dependency is genuinely down.
- Retry at one layer only, usually the one closest to the failing call
- Use a retry budget: retries may add at most about 10% to normal request volume
- Cap attempts at 2 or 3 and respect the overall deadline
- Honour Retry-After headers and 429 responses from the server
Key takeaways
- Retry only idempotent operations, and only on transient errors
- Use exponential backoff with full jitter to spread retries out
- Retries multiply across layers; retry at one layer only
- A retry budget stops retries from turning a blip into a metastable outage
Sign in to track lessons and earn badges.