Exponential Backoff

Also known as: retry with backoff, backoff with jitter.

Waiting longer after each failed attempt, usually doubling the delay and adding randomness, so retries relieve a struggling service instead of piling on.

Synthetic dataExamples on this page use synthetic data created for illustration.

Definition

Exponential backoff is a retry strategy in which the wait before each new attempt grows, typically doubling up to a cap. Adding random jitter keeps many clients from retrying at the same instant, so retries ease pressure on a struggling service instead of adding to it.

In plain terms

If a service is overloaded and every client retries immediately, the retries arrive together and make the overload worse. Doubling the wait gives the service room to recover. Randomness (jitter) spreads the retries so that clients do not all come back on the same second. A cap keeps the wait bounded, and a maximum number of attempts keeps a hopeless task from running for ever.

Retrying is only safe for operations that can be repeated without harm, so backoff goes together with Idempotency. If the server sends a Retry-After value, use that.

Example

Base wait 1 second, doubling, capped at 30 seconds, with “full jitter” (a random wait between zero and the nominal value).

RetryNominal waitWith full jitter, the wait is between
11 s0 and 1 s
22 s0 and 2 s
34 s0 and 4 s
48 s0 and 8 s
516 s0 and 16 s
630 s (cap)0 and 30 s

Without jitter the six waits add up to 1 + 2 + 4 + 8 + 16 + 30 = 61 seconds.

Common misunderstandings

  • “Retry until it works.” Set a maximum number of attempts, then stop and report; some failures are not temporary.
  • “Doubling alone is enough.” If every client doubles on the same schedule they still collide; jitter is what breaks the pattern.
  • “Retries are free.” Each costs the other side something, and repeating an operation that is not idempotent can create duplicates.

References

  1. Marc Brooker. Exponential Backoff And Jitter . AWS Architecture Blog, 2015.
  2. Marc Brooker. Timeouts, retries and backoff with jitter . Amazon Builders' Library.