Interview Prep/SRE & Reliability/Release Engineering & Reliability Patterns

How should retries be implemented safely?

IntermediateConceptRelease Engineering & Reliability Patterns
Answer
  • Retry only transient errors (timeouts, 503, connection reset), never 4xx client errors.
  • Retry only idempotent operations, or use idempotency keys for writes.
  • Use exponential backoff with jitter, a small max attempts (2 or 3), and an overall deadline.
  • Retry at one layer of the stack, not every layer.
  • Use a retry budget (for example retries at most 10% of requests) so retries cannot multiply load during an outage.
  • Respect Retry-After headers.
All SRE & Reliability questions

More on Release Engineering & Reliability Patterns