Definition
What it is
A retry is a bet on transience. It works for network blips, cold-start latency, rate-limit windows, lock contention. It fails for logic errors, permission denials, malformed payloads — cases where the next attempt will fail identically. The engineer's job is to distinguish the two before wiring a retry.
Why it matters
A single request to a healthy service has a 99.9% success rate. If a user journey chains 20 calls, the compounded success rate is 0.999^20 = 98%. Add a retry and the compounded rate rises to 99.96%. Retries are the cheapest resilience mechanism available.
Retry vs retry with backoff vs circuit breaker
Aspect | Retry | Retry with backoff | Circuit breaker |
|---|---|---|---|
Spacing | Immediate | Exponential + jitter | Stops entirely |
Protects target | No | Yes | Yes |
Protects caller | No | Yes | Yes |
Best for | Rare blips | Transient failures | Known-outage |
The retry loop
graph LR
A[Attempt] --> B{Success?}
B -->|Yes| Done
B -->|No| C{Retries left?}
C -->|No| Fail
C -->|Yes| W[Wait backoff]
W --> A
style Done fill:#E8F5E9
style Fail fill:#FFEBEE
How to retry well
Retries that help
Only transient errors
Network timeouts, 5xx, 429. Never 4xx client errors; the next attempt will fail identically.
Exponential backoff
Attempt n waits base * 2^n. Without backoff, a retry is a mini-DDoS.
Add jitter
Random ±20% on the wait. Without jitter, all clients retry simultaneously.
Honor Retry-After
If the server says wait 30s, wait 30s. Ignoring it is how rate limits become bans.
Cap the budget
3-5 attempts max, and a total time budget. Infinite retries are infinite outages.
Common failures
Origin
The only truly reliable way to handle transient failures is to retry with exponential backoff.
— Marc Brooker, *Exponential Backoff and Jitter*, AWS Architecture Blog, 2015
Evidence
FAQ
- How many retries?
3-5 attempts with exponential backoff. More than that is usually a design smell.
- How long should the backoff be?
Base 100-500ms, doubling each attempt, with jitter. Cap at 30s.
- What is idempotency?
The property that repeating the operation has the same effect.
PUTis idempotent;POSTis not, unless it uses an idempotency key.- Retry vs circuit breaker?
A retry reattempts; a circuit breaker stops after N failures to protect the target. Use both.
Connections
- circuit-breaker
- backoff
- exponential-backoff
- idempotent
- failover
● broader ● narrower ● related
Broader
reliabilitydistributed-systems
Related
- Circuit breaker
backoffexponential-backoff- Idempotent
- Failover
Used in the garden
Sources
Brooker, M. (2015). Exponential Backoff and Jitter. https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/
Google SRE (2016). Site Reliability Engineering, Chapter 22. https://sre.google/sre-book/addressing-cascading-failures/
Fielding, R., Nottingham, M. & Reschke, J. (2022). RFC 9110. https://www.rfc-editor.org/rfc/rfc9110
Etymology
Origin: borrowed
re(prefix): Latin, "again"try(verb): from Old French trier, "to sift, to pick"
Semantic network
● broader ● narrower ● related
Broader
reliabilitydistributed-systems
Related
- Circuit breaker
backoffexponential-backoff- Idempotent
- Failover
Used in the garden
Sources
Brooker, M. (2015). Exponential Backoff and Jitter. https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/
Google SRE (2016). Site Reliability Engineering, Chapter 22. https://sre.google/sre-book/addressing-cascading-failures/
Fielding, R., Nottingham, M. & Reschke, J. (2022). RFC 9110. https://www.rfc-editor.org/rfc/rfc9110