Chapter 14: Data and failure

Retry and backoff

Also called Jitter, Retry storm

Trying a failed call again, and waiting longer each time. Backoff is the growing wait. Jitter is making each wait random, so that clients which failed together don't all come back together. Without those, retries can keep a struggling server down.

Ask an agent to make something robust and you get a retry loop, often with a fixed delay, at every level. It looks responsible and passes tests. Under a real failure, every client turns one request into several at exactly the moment the server can't cope. Ask for a limit, backoff and jitter, and only on what is safe to repeat.

Say it to your agent

“Retry only on 429, 503 and network errors, at most 3 times, with full jitter: wait a random time from 0 up to min(10s, 200ms x 2^attempt). Honour Retry-After. Don't retry 4xx errors or a POST with no idempotency key. Retry here only, not in the layers above or below.”

The workshop

Name a word, or describe what you mean in everyday language.