advanced
Exponential backoff
Spread retries with exponential delay and jitter so recovering services are not hit by synchronized retry waves.
Exponential backoff increases delay between retries (e.g., 100ms, 200ms, 400ms) to give recovering systems breathing room. Jitter randomizes delay so many clients do not retry simultaneously — avoiding synchronized thundering herds.
Trade-off: longer tail latency for individual requests versus cluster stability during partial outages.
On interviews: write pseudo-code for backoff with full jitter; explain thundering herd after a brief outage.
Common pitfalls: fixed retry interval; equal jitter insufficient at scale; backoff without max cap so users wait minutes.
Checklist:
- Use exponential delay with a max ceiling.
- Add random jitter per attempt.
- Cap total retry time to SLA needs.
- Combine with circuit breakers at high volume.