DevPrep

All topics › Networking & APIs

Timeouts, retries and exponential backoff: how not to take the server down?

Senior PRO

The gist

Retries cure transient failures, but a naive retry — immediately, unbounded, for any error — turns a partial server outage into a full one: millions of clients in lockstep finish off an overloaded backend (a retry storm). A correct retry fires only on transient errors, only for requests that are safe to repeat, with exponential delay and jitter, an attempt limit and respect for cancellation.

The rest of this answer, with code and interview follow-ups, is in the DevPrep app.

Read the full answer in DevPrep

Practice this before your interview

DevPrep turns these answers into one-minute challenges: what does this code print, find the bug, mock interviews. One challenge a day.

Get DevPrep on the App Store