Retry only transient errors, use exponential backoff with jitter, cap the attempts, honor Retry-After.
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.