Web apps & software

What is exponential backoff?

Exponential backoff is a retry strategy in which a client waits longer after each failed attempt, for example 1, 2, 4, then 8 seconds, so that a struggling server is not hammered by constant repeat requests.

Why not retry immediately?

If a service fails because it is overloaded, thousands of clients retrying instantly make the overload worse. Spacing attempts out gives the server time to recover and spreads the load.

Add jitter

If every client waits exactly four seconds, they all return at the same moment. Adding a random amount to each delay breaks up that synchronized wave. Most cloud SDKs apply jitter by default.

Settings to choose

  • A maximum number of attempts, so a permanent failure eventually surfaces as an error.
  • A ceiling on the delay, such as one minute.
  • Which errors qualify: a timeout or a 503 is worth retrying, while a 400 or 401 will never succeed by repeating.
  • Whether the operation is safe to repeat; payment requests need an idempotency key first. Mobile apps use the same idea when sync fails on a weak connection.

Questions, answered

Yes. A 429 means too many requests, and a Retry-After header, when present, should be obeyed.

Often three to five for interactive requests; background jobs can use more over a longer period.

By the Stegnor team · Updated