Retry Policy Generator
Base delay, multiplier and failure rate in; the delay of every attempt, the chance of eventual success, the worst-case latency and working code out.
Up from 92.0% with no retries, if failures are independent. Worst case 8.30 s; expected 1.33 s.
- Wait before attempt 2
- 0 ms – 500 ms (mean 250 ms)
- Wait before attempt 3
- 0 ms – 1.00 s (mean 500 ms)
- Wait before attempt 4
- 0 ms – 2.00 s (mean 1.00 s)
- Total waiting, worst case
- 3.50 s
- Total waiting, expected
- 24 ms
- Expected attempts per request
- 1.087
- Extra calls per successful request
- 0.087
- Load multiplier on the provider
- 1.09×
- Expected end-to-end time
- 1.33 s
- Worst-case end-to-end time
- 8.30 s
- Failure rate after retries
- <0.1%
- Attempts that fit in the deadline
- 4 of 4
A retry policy is two decisions that pull against each other: how much extra latency you will spend to turn a transient failure into a success, and how much extra load you will put on a service that is already failing. Everything above is those two numbers made explicit. The success probability climbs steeply for the first two retries and then barely moves; the worst-case latency keeps climbing the whole time. That is why four attempts is a common answer and ten is almost never one.
Jitter is not an optimisation
Without it, every client that failed during the same second retries during the same second, then again together, then again — the thundering herd that turns a brief overload into a sustained one. Full jitter spreads the same requests across the whole window and costs you, on average, half the delay you had budgeted. There is essentially no situation in which not jittering is the better choice.
Retry the things that retrying can fix
429, 500, 502, 503, 504 and connection failures are worth retrying. A 400 will be a 400 every time, and a 401 will be a 401 until someone fixes the key; retrying either just multiplies a bug by four. The generated code has that list at the top so you can argue with it, and it honours Retry-After, which is the server telling you the answer this whole page is estimating.