Retry, Jitter & Backoff
The exponential-backoff formula, why jitter is mandatory, and AWS's "full jitter" recommendation.
Overview
Retries: simple idea, subtle implementation
Retries are the most common cause of cascading failure. The intuition, 'if a request fails, try again,' is fine; the implementation is subtle.
A well-behaved client asks three questions before it sends a failed request again.
- Is the failure retryable? A 5xx, a 429, a 408 or a network error is. Any other 4xx is not, so return the error.
- Are there attempts left, and is there room in the retry budget? If either answer is no, return the error.
- If both answers are yes, wait with exponential backoff plus jitter, then retry. The retry must be idempotent or carry a key, so that running it twice does no harm.
> [!IMPORTANT] Retry only idempotent operations, bound the attempts, and always add jitter.
The rest of this chapter takes those rules one at a time: how many times to retry, how long to wait, why the wait must be random, which operations are safe to repeat, and how to cap retries across a whole fleet.
Key concepts
- Exponential backoff
- Full Jitter (AWS)
- Retry storm
- Idempotency
- Retry budget
- Bounded retries
Interview questions
- Why is jitter mandatory for retries?
- How do you handle retries for non-idempotent operations?
- What's a "retry budget" and when do you need one?
Sign up free to read the full topic
More SRE topics
Start free on Cariara · Coding problems · System design studio