Exponential backoff with jitter, without the guesswork
Backoff is the difference between a client that recovers and a client that keeps a struggling service down. The idea is simple — wait longer after each failure — but the details decide whether a thousand clients retry in lockstep or spread out across the delay window.
The four parameters
An exponential backoff policy has a base delay, a multiplier, a maximum delay and a jitter strategy. With a base of 200 ms and a multiplier of two, the sequence is 200, 400, 800, 1,600 and so on until the cap. The cap matters because without it the fifth retry of a long outage waits minutes and the request is effectively dead while still holding client state.
| Attempt | Delay without jitter | Full jitter range | Equal jitter range |
|---|---|---|---|
| 1 | 200 ms | 0–200 ms | 100–200 ms |
| 2 | 400 ms | 0–400 ms | 200–400 ms |
| 3 | 800 ms | 0–800 ms | 400–800 ms |
| 4 | 1,600 ms | 0–1,600 ms | 800–1,600 ms |
Why jitter is not optional
Without jitter, every client that failed at the same moment retries at the same moment. The result is a synchronised pulse that hits the recovering service exactly when it can least afford it. Full jitter picks a uniform random delay between zero and the computed backoff, which spreads load but occasionally retries immediately. Equal jitter takes half the delay plus a random half, trading a little spread for a guaranteed minimum wait.
Respecting the server
If the response carries Retry-After, use it as a floor rather than inventing a delay. A server that says five seconds knows more about its recovery than the client does, and ignoring it creates exactly the load the server is trying to shed. When both a computed backoff and Retry-After exist, wait for the larger of the two.
Bounding the whole request
Backoff parameters are per attempt; you also need a deadline for the logical request. A common structure is a two-second deadline with a 600 ms attempt timeout, so the third attempt cannot start after the budget is spent. Without a total deadline, retries extend the lifetime of doomed requests and consume connections that healthy requests need.
Finally, make the policy visible. Log the attempt number and the chosen delay, and count retries as a metric. A rising retry rate is an early warning of dependency trouble, and it is invisible if the only signal is the final success or failure.
Choosing numbers you can defend
The base delay should be long enough to let a transient condition clear and short enough that the total wall-clock time stays inside the caller's patience. For an interactive request, a base of 100 to 250 milliseconds is common; for a background job, one to two seconds is reasonable because nobody is waiting on the screen. The multiplier of two is conventional because it grows quickly without exploding; a multiplier of three reaches the cap in fewer attempts but leaves less room for a lucky recovery.
The cap should reflect the longest outage you are willing to ride out. If the cap is sixty seconds and the outage lasts two minutes, most clients will have given up by the second attempt, which is fine as long as the failure is reported rather than hidden. What matters is that the cap, the attempt limit and the total deadline agree with each other rather than each being tuned in isolation.
- Set the total deadline first, then derive the attempt count from it.
- Prefer 100–250 ms base for user-facing calls.
- Log the chosen delay so the behaviour can be verified in production.
Open the calculators and put these numbers to work on your own API.
Open API BenchFrequently asked questions
Should the first retry be immediate?
Usually not. Many failures are transient congestion, and an immediate retry adds load at the worst moment. A base delay of 100 to 200 ms with jitter is a safer default.
What is decorrelated jitter?
A variant where each delay is chosen between the base and three times the previous delay, capped. It spreads retries more aggressively than full jitter and is popular in database clients.
Does backoff apply to 429 only?
No. It applies to any transient failure — 429, 503, 504, connection resets and timeouts — but not to 400, 401, 403 or 404, where retrying the same request cannot succeed.
Sources
Related guides
- Capacity planning with Little's LawTurn a target request rate and three latency percentiles into the concurrency, threads and instances an API actually needs.
- Tail latency: why P95 and P99 decide your timeoutAverages hide the requests that hurt. How to read percentiles, calculate what they cost, and set timeouts that do not cut off healthy traffic.
- Retry storms: how a 1% error becomes 300% loadRetries are new traffic. Calculate the amplification, recognise the cliff, and design retry budgets that fail politely.
- REST vs GraphQL: measuring the payload differenceOver-fetching, under-fetching and query text all show up in the bytes. A practical way to compare the transfer volume of both designs.