Software → System Design
Retry
Repeating an operation after a transient failure, usually with limits, backoff, and idempotency safeguards.
Where it fits
Retries are used in APIs, queues, databases, network calls, and distributed systems whenever failures may be temporary. They make systems more resilient, but they can also amplify load if designed poorly.
Mental model
A retry says: “This failed, but it might work if tried again.” Safe retry design asks: how often, for how long, with what delay, and what happens if the first attempt actually succeeded but the response was lost?
Example
A client may retry a payment API request after a timeout. Without API idempotency, the retry could create a duplicate charge. With an idempotency key, repeated attempts map to the same logical operation.
Common techniques
Use bounded retries, exponential backoff, jitter, deadlines, circuit breakers, idempotency keys, and clear retryable versus non-retryable error classes.
Common mistakes
- Retrying forever.
- Retrying non-idempotent operations without safeguards.
- Allowing retries to create a thundering herd during an outage.
Related concepts
API idempotency, circuit breaker, backpressure, timeout, message queue, and distributed systems.