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-Afterheaders.
More on Release Engineering & Reliability Patterns
Why are releases the biggest source of incidents, and what does SRE do about it?BeginnerWhat is a canary release?BeginnerWhat is progressive delivery?IntermediateShow an Argo Rollouts canary with a Prometheus analysis.AdvancedBlue-green vs canary: when do you choose each?IntermediateWhat are feature flags and how do they improve reliability?Beginner