When Retries Make Outages Worse
A degraded downstream dependency often shows up first as elevated p99 latency, higher time-out rates, or a small increase in 5xx server errors. When clients retry failed requests without backoff or jitter, the added load can push the dependency closer to saturation or keep it saturated for longer.
In aggregate, those retries can turn partial degradation into a broader outage across the affected request path. Retry traffic is not free recovery traffic. It consumes the same downstream capacity as the original requests.
This failure mode is a retry-induced traffic amplification loop. Errors trigger more attempts, which increase queue depth, connection pressure, and resource usage on the same dependency.
Retries become harmful when implemented without load controls such as backoff, jitter, and retry budgets. Persistent failures also need circuit breakers, while state-changing operations need idempotency controls.
This newsletter explains how safer retry policies handle transient failures without adding uncontrolled load or duplicate side effects.
Why retries exist#
In distributed systems, transient failures are unavoidable. Retries help callers absorb short-lived failures without propagating every error upstream or to the user.
A retry attempts an operation again after a failure that is likely to be temporary. These failures often clear once a packet is retransmitted, a connection is re-established, a dependency recovers capacity, or a deployment finishes replacing unhealthy instances.
Retry rule: Retry only when the failure is likely to be transient and the operation can be repeated safely. State-changing operations usually require idempotency or server-side deduplication.
Common transient failures include the following:
Network instability: Temporary packet loss, a connection reset, or a resolver issue can cause an individual request to fail. A retry after a short delay may succeed if the failure was temporary. Persistent DNS name errors, invalid records, or configuration issues usually require a fix rather than repeated attempts.
Temporary service overload: A dependency may briefly run out of CPU, memory, worker threads, or connections. A later attempt may succeed if the load drops or the queues drain.
Deployments and restarts: During a rolling update, some instances may be unavailable or slow to respond. A bounded retry may reach a healthy instance after health checks remove unhealthy instances from rotation, but the caller still needs a deadline so retries do not add pressure while capacity is reduced.
Database deadlocks: A database may abort one transaction to resolve a deadlock. Retrying can succeed if the entire transaction is restarted, preferably after a short delay or backoff. Retrying only the failed statement can be unsafe if earlier reads or writes affected the transaction’s assumptions.
Without retries, many short-lived failures would surface as user-visible errors. Retries are safest for read-only operations, transport-level failures, or operations that are explicitly idempotent. Application-level retries still need operation semantics, deadlines, and clear retry limits.
How retries amplify failure#
Retries are useful for transient failures, but a retry policy without limits, backoff, or jitter can increase load on an already saturated dependency. A slow query, a garbage-collection pause, an overloaded queue, or a failing node can surface to upstream clients as time-outs or 5xx responses.
If clients retry immediately, one request can become multiple downstream attempts. With two retries, 1,000 original requests can become up to 3,000 total attempts if the original attempts and first retries fail.
Time-out ambiguity makes this worse. A client cannot always tell whether a timed-out request never reached the server, is still running, or succeeded but lost its response. The retry may arrive while the original request is still consuming downstream resources.
This creates a feedback loop. Higher latency causes more time-outs, retries increase queue depth and resource usage, and the added load causes more time-outs.
The problem can become worse when retries happen at multiple layers, such as a client SDK, API gateway, service mesh, and application code. If each layer retries independently, attempts can multiply across the request path.
Safer retry logic prevents this amplification by using backoff, jitter, retry budgets, and deadlines to limit how much extra load retries can add while a dependency is degraded.
Designing safer retry behavior#
Safer retry logic limits how much extra load retries add to a struggling dependency. The main controls are exponential backoff, jitter, retry budgets, and caller deadlines.
Exponential backoff increases the delay between attempts, such as 100 ms, 200 ms, and 400 ms. In production, backoff should be capped by a maximum delay, maximum attempts, and the caller’s total deadline.
Backoff formula: delay = base interval × factor^retry_attempt
Remember: A backoff multiplier of 2 is common, but the retry policy should still define a maximum backoff delay and an overall request deadline.
Backoff alone is not enough. If many clients fail at the same time, they may retry on the same schedule and create synchronized spikes. Jitter adds randomness to each delay, spreading retry attempts across the backoff window while the dependency recovers.
Retry budgets cap retry volume. Over a rolling time window, a 20 percent retry budget allows at most 200 retry attempts for every 1,000 original requests. Once the budget is exhausted, the client stops retrying and returns the last error or a policy-specific failure.
A tighter retry budget reduces amplification, but it can also increase client-visible failures. The right budget depends on the dependency’s expected transient failure rate, latency target, and recovery capacity.
These controls only help when applied to the right errors. Time-outs, connection resets, 503s, and 429s may be retryable when bounded by backoff, jitter, budgets, and deadlines. Validation errors, malformed requests, and authorization failures should not be retried unless the request changes.
Status or Failure Type | Retry Guidance | Reason |
Time-out or connection reset | Conditionally | The request may not have completed, but the server may still be processing it. Retry only within a deadline and use idempotency for state-changing operations. |
429 Too Many Requests | Conditionally | Retry only after honoring |
503 Service Unavailable | Conditionally | Often indicates overload or maintenance. Retry only with backoff, jitter, a deadline, a retry budget, and any retry-after guidance. |
500 Internal Server Error | Conditionally | Could be temporary saturation or a deterministic bug. Retry only when the error class and operation semantics allow it. |
400 or 422 validation error | Usually not | The request is malformed or invalid. Retrying the same request will likely fail again. |
401 or 403 auth error | Usually not | The caller needs valid credentials or permissions. A retry is useful only after a token refresh or permission changes. |
409 Conflict | Conditionally | May require reading the latest state, resolving the conflict, or regenerating the request before retrying. |
500 responses and retry ability: A 500 status can come from temporary saturation or a deterministic bug. Retrying bug-induced failures wastes capacity, so systems should log error class and retry outcome alongside the status code.
These controls reduce retry pressure, but they do not answer when the caller should stop sending requests altogether.
When to stop retrying#
Backoff, jitter, retry budgets, and deadlines reduce retry pressure, but they still allow some calls to reach the dependency. When a downstream service remains unhealthy, continuing to send requests can waste caller resources and slow recovery.
A circuit breaker handles this phase of failure. It tracks signals such as failure rate, time-out rate, and, in some implementations, slow-call rate. When those signals exceed configured thresholds, the circuit opens.
While open, calls fail fast or use a configured fallback instead of reaching the dependency. This protects the caller from long waits and reduces traffic to the unhealthy service.
A circuit breaker usually has three states:
Closed: Requests pass through normally while the breaker monitors failure, time-out, and slow-call rates.
Open: Requests fail fast without being sent to the dependency. After a cooldown period, the breaker moves to half-open.
Half-open: A small number of probe requests are allowed through. If probes succeed, the breaker closes. If probes fail, the breaker opens again.
Half-open state design: Half-open should admit only a bounded number of probe requests. If probes fail, the breaker should reopen rather than allowing a recovering service to receive a sudden burst of traffic.
Retry budgets and circuit breakers solve different problems. Retry budgets limit extra attempts during partial degradation. Circuit breakers stop most calls when degradation appears persistent, then allow bounded probes to test recovery.
Circuit breakers also require careful tuning. Sensitive thresholds can open during brief traffic spikes or deployments and create unnecessary client-side failures. Thresholds should usually include a minimum request volume so a few failures on a low-traffic path do not open the circuit prematurely.
These patterns reduce overload risk, but retry safety also depends on data consistency. That becomes critical when retries are applied to state-changing operations.
Idempotency and safe retries#
Retries become risky when an operation changes state. The caller may not know whether a timed-out request failed before reaching the server, is still running, or succeeded but lost its response.
For example, a client sends a POST /charge request. The payment service processes the charge, but the response is lost before reaching the client. The client saw a time-out, but the server had already completed the charge. If the client retries without safeguards, the service may process the charge again and create a duplicate payment or order.
Idempotency prevents this failure mode. An operation is idempotent when repeating the same request has the same effect as executing it once. For retries, idempotency must be enforced by the server, not assumed by the caller.
A common approach is an idempotency key:
The client generates a unique key for one logical operation, not one HTTP attempt.
The server checks the key before applying the side effect.
If the key is new, the server processes the operation and stores the result.
If the key has already been completed, the server returns the stored result without applying the side effect again.
If the same key is reused with different request parameters, the server rejects the request.
The idempotency check must be atomic. Common ways to implement this include a unique constraint, a conditional write, a transaction, or a compare-and-set operation.
HTTP method semantics help, but they are not enough. GET is defined as safe and idempotent, while PUT and DELETE are idempotent at the method level. Implementation details still matter. POST is not idempotent by default and usually requires explicit server-side deduplication.
Idempotency key storage: The deduplication window must be longer than the expected retry window. If the key expires too soon, a late retry can be processed as a new operation.
The idempotency store is a correctness dependency. If it is unavailable, the service must either reject the request to preserve correctness or process without deduplication and risk duplicates. For payments, orders, and other high-consequence operations, failing closed is usually safer.
These protections reduce duplicate side effects and overload risk, but they add latency, state, storage, and tuning requirements.
Operational trade-offs#
Retry controls improve resilience, but they add latency, state, and operational complexity. Their settings should reflect the dependency’s baseline failure rate, the caller’s latency budget, and the consequence of duplicate operations.
Retries increase tail latency because each failed attempt adds delay before the next attempt. A policy that improves the eventual success rate may still violate p99 latency targets or caller deadlines.
Circuit breakers and idempotency also add state. Circuit breaker state may live in client memory, a sidecar proxy, or another runtime component. Idempotency keys require server-side storage, and their retention window creates a trade-off: longer retention reduces duplicate risk, while shorter retention reduces storage cost.
Misconfigured retry parameters: Long backoff intervals can breach latency budgets. Sensitive circuit breaker thresholds can open on normal traffic variance. Both require calibration against production baseline data.
Retrying callers should also monitor local resource pressure, because queued retries can consume worker slots, connection pools, and memory before they reach the dependency.
Track retry rate, retry success rate, retry budget exhaustion events, final-attempt failures, downstream dependency error rate, and circuit breaker state transitions. Track retry amplification factor as a derived metric. It is calculated as total attempts divided by original requests. Any value above 1.0 represents additional traffic generated by retries.
These signals show whether retries are reducing transient failures or silently adding load.
Takeaway#
Retries can improve availability when failures are brief or intermittent, but they can also amplify load when a downstream dependency is degraded. A retry policy should define which errors are retryable, how attempts are spaced, how many attempts are allowed, and how the caller’s deadline limits the retry window.
Backoff reduces retry frequency. Jitter prevents synchronized retry bursts. Retry budgets cap added load. Circuit breakers fail fast when a dependency remains unhealthy. Idempotency prevents duplicate side effects when state-changing operations are retried.
These controls should be treated as part of the service boundary contract. Each service boundary, and often each operation, needs retry parameters that match its failure patterns, latency budget, and correctness requirements.
The goal is not to retry more often, but to retry safely without delaying recovery or duplicating work.