Your dependency starts timing out. You add a retry. The error rate climbs, so you add another retry, then a fallback. By the time the incident channel fills, your service sends several times the traffic to a dependency that was already on its knees.
You have seen that sequence before. It is not bad luck. It is arithmetic.
You need all four controls, and you need them to work as one system. A timeout bounds how long one call may hold resources. A deadline bounds how long your whole call tree may work. Backoff with jitter bounds how fast your clients rejoin a recovering dependency. A circuit breaker bounds how long you keep sending work to a dependency that has already failed.
Retries do not fix a failing dependency. They borrow time for a transient failure to clear, and every layer that borrows charges interest. Timeouts, backoff, and a circuit breaker exist to cap the loan.
This post sizes that loan. It sits inside the wider sequence in how to design a highly available system, and it assumes you already know why a partial failure differs from a total one. If you need that frame first, read the hub and come back.
Why Do Retries Turn a Small Failure Into a Bigger Outage?
Retries multiply at every layer, so a struggling dependency receives the most work exactly when it can afford it least. Your user action becomes one call at the edge, then several attempts inside each service, then several more at each hop below. The attempts multiply, not add.
You can watch the arithmetic in Google's SRE book. If your database is overloaded and the backend, frontend, and JavaScript layers all issue 3 retries (4 attempts), then a single user action may create 64 attempts (4^3) on the database
(Google SRE, Addressing Cascading Failures). Your user clicked once. Your database saw sixty-four queries.
AWS publishes a larger figure for a deeper stack. Its Builders' Library warns: If each layer retries independently, the load on the database will increase 243x, making it unlikely to ever recover
(AWS Builders' Library, Timeouts, retries, and backoff with jitter). The two examples use different stack depths and attempt counts, so quote each figure as published and never blend them. The shape is the same: your layers multiply.
That multiplication is what you call a retry storm. Your dependency slows down. Your calls time out. Every client retries after the same nominal delay. The retries arrive together, your dependency slows further, and the next wave is larger. AWS calls retries selfish
for this reason: a client spends more of the server's time to raise its own chance of success.
You can see the ceiling in the Pokémon GO launch. Google's SRE workbook records that these synchronized request spikes ramped up enormously to 20× the previous global RPS peak
(Google SRE Workbook, Managing Load). The fix was not more servers. It was jitter plus a truncated exponential backoff in the client.
You cannot coordinate every client in a distributed system, so you cannot negotiate the right number of global retries. You can do two things instead. First, retry at one layer. AWS states the rule plainly: for low-cost control-plane and data-plane operations, our best practice is to retry at a single point in the stack.
Second, cap your retry volume with a budget rather than trusting each caller to behave.
If you are still deciding where the layers and failure boundaries sit, how to design a distributed system covers that structure. This post assumes your layers exist and asks how much extra work each one may create.
What Does a Timeout Actually Protect?
A timeout protects your caller's resources, not the callee's feelings. Every in-flight request holds a thread, a connection, a buffer, and a queue slot. A request with no timeout holds those resources until the connection dies, which may be never. A timeout converts an indefinite hold into a bounded one.
gRPC makes the danger explicit: By default, gRPC does not set a deadline which means it is possible for a client to end up waiting for a response effectively forever
(gRPC, Deadlines). If your client exposes no request timeout, it can wait forever. A timeout measured in minutes assumes the network eventually gives up, and under overload it does not.
You pick the value from the dependency's latency distribution, not from taste. AWS describes its own method: choose an acceptable rate of false timeouts (such as 0.1%)
, then look at the corresponding latency percentile on the downstream service (p99.9 in this example)
(AWS Builders' Library). Add padding when p99.9 sits close to p50, because a tight distribution leaves no room for a small latency bump.
A timeout you set too low creates its own outage. AWS notes the failure mode: Increased small backend latency leading to a complete outage, because all requests start being retried.
A timeout you set too high is quieter. Your threads fill, your queue grows, and the caller's own deadline expires first, so every response you finish is a response nobody wanted.
You set the timeout below the caller's remaining budget. That single rule prevents most timeout bugs. A service that takes 900 ms to answer cannot sit behind a caller that gives up at 800 ms. The callee keeps working after the caller has gone, and your capacity disappears into responses nobody reads.
The value also depends on the operation. Your read against a healthy cache and your write that crosses three regions do not deserve the same number. Group calls by latency profile, measure each group, and set a separate timeout per group. One global 30-second timeout is not a policy; it is an absence of policy.
How Do You Propagate a Deadline Through a Call Chain?
You pass the remaining budget, not the original timeout. Your edge sets one absolute deadline. Each hop reads the clock, subtracts the time already spent, and gives the next hop only what is left. A fixed per-hop timeout ignores the time already burned and lets a chain of five 1-second hops run for five seconds under a two-second promise.
You can see this built into gRPC. Automatically propagating the deadline from an incoming RPC to an outgoing one is supported by some gRPC implementations,
the docs explain, and the implementation converts the deadline to a timeout from which the already elapsed time is already deducted
(gRPC, Deadlines). The subtraction also removes clock-skew problems, because each hop works with a relative duration rather than an absolute timestamp from another machine.
Take a concrete chain. Your edge accepts a request with a 2-second deadline. The first service spends 300 ms parsing and authorizing, then calls the next service with 1.7 seconds left. That service spends 200 ms, then calls storage with 1.5 seconds left. If storage cannot answer in 1.5 seconds, it should fail, not keep working for another ten.
You must cancel children when the parent can no longer succeed. Google's SRE book puts the reason well: Sending fatal errors or timeouts up the stack and cancelling other RPCs in the call tree prevents unneeded work if the request as a whole can't be fulfilled
(Google SRE, Addressing Cascading Failures). Without cancellation, your doomed request keeps consuming capacity at every layer.
Your retries must fit inside the same budget. Envoy documents the rule with an example: if the first attempt takes 2.7 seconds of a 3-second budget, the retry (including back-off) has .3s to complete. This is by design to avoid an exponential retry/timeout explosion
(Envoy, router filter). A retry that starts after your deadline has passed is pure load with no possible success.
Sometimes you should leave the synchronous path. If you do not need the result to render a response, enqueue the work and return. Synchronous vs asynchronous communication covers that decision, and it changes your deadline math completely: an asynchronous consumer can retry for minutes because no user is waiting on the connection.
How Does Exponential Backoff With Jitter Work?
Exponential backoff grows the wait after each failure; jitter randomizes each wait so independent clients stop arriving together. Backoff alone reduces the retry rate. Jitter alone spreads retries. Both matter, because a thousand clients that back off by exactly one second still produce a one-second spike.
The common form is full jitter:
sleep = random(0, min(cap, base * 2^attempt))
base is the first delay, attempt counts from zero, and cap stops the growth. The random draw starts at zero, so some clients retry almost immediately and others wait the full interval. That distribution spreads your wave instead of shifting it.
Envoy uses this shape by default. Its documentation states that Envoy uses a fully jittered exponential back-off algorithm for retries with a default base interval of 25ms
, with the delay in the range [0, (2^N-1)B)
and a cap which defaults to 10 times the base interval (250ms)
(Envoy, router filter). Those defaults suit a proxy making one quick retry. They do not suit your client retrying a slow cross-region call, so set your own base and cap.
The cap matters more than the base. Suppose the policy uses a 100 ms base, a 2-second cap, and three retries. The maximum delays are 100 ms, 200 ms, 400 ms, and 800 ms, which sum to 1.5 seconds. Add the time of four attempts at 500 ms each and the worst case exceeds 3.5 seconds. If the deadline is 2 seconds, that retry policy cannot finish inside it. Budget the sum of waits plus attempt time, not the cap alone.
Jitter matters because failures correlate. AWS explains the mechanism: If all the failed calls back off to the same time, they cause contention or overload again when they are retried.
The retry wave is not a property of any one client. It is a property of the fleet, and only randomization breaks it.
Truncate the backoff before it outlives the caller. An uncapped exponential can push the next attempt past the deadline, past the user's patience, or past the point where the dependency has recovered and moved on. The cap is the point where waiting longer costs more than trying again.
Which Jitter Strategy Should You Choose?
Use full jitter by default. Choose equal jitter when you need a guaranteed floor between attempts, and decorrelated jitter when contention is heavy and you want successive waits to explore a wider range. All three beat no jitter, and the differences between the best two are smaller than the difference between any jittered policy and a fixed delay.
Equal jitter keeps half the backoff and randomizes the rest, roughly sleep = backoff/2 + random(0, backoff/2). It prevents very short sleeps, which helps when an immediate retry would hit the same overloaded connection. The cost is a higher average delay.
Decorrelated jitter bases the next wait on the previous one: sleep = min(cap, random(base, previous * 3)). It avoids the sawtooth pattern of independent draws and spreads clients more aggressively. It also needs state per retry chain, which makes it harder to reason about in a stateless proxy.
AWS measured all three. The no-jitter approach is the clear loser
: it not only takes more work, but also takes more time than the jittered approaches.
Among the jittered options, equal jitter is the loser
, while the choice between full and decorrelated is less clear
: full jitter uses less work, but slightly more time
(AWS Architecture Blog, Exponential Backoff and Jitter). You start with full jitter. You switch only when your own metrics show a reason.
One subtlety applies to scheduled work rather than request retries. For periodic jobs, AWS does not choose a fresh random offset on every host. It uses a consistent method that produces
a stable per-host offset, so each host keeps its place in the spread instead of re-randomizing into a new collision. You should apply the same idea to cache refresh and cron-driven fan-out: stable offsets, not fresh randomness on every tick.
What Does a Circuit Breaker Add That Retries Cannot?
A circuit breaker stops calling a dependency that is already failing, so your caller fails fast instead of spending its budget on requests that cannot succeed. A retry assumes the failure is transient. A breaker assumes the failure may persist, and it acts on that assumption before you waste more time.
You can model the state machine with three states. In the closed state, calls pass through and the breaker counts outcomes. When failures cross a threshold, the breaker opens and rejects calls immediately. After a cooldown, it moves to half-open and permits a few trial calls. If those succeed, it closes. If one fails, it opens again. Martin Fowler describes the half-open state as the point where the circuit is ready to make a real call as trial to see if the problem is fixed
(Martin Fowler, CircuitBreaker).
Netflix's Hystrix popularized the pattern for service dependencies. It trips a breaker to stop all requests to a particular service for a period of time, either manually or automatically if the error percentage for the service passes a threshold
(Hystrix wiki). The wording matters: the breaker protects your caller from the dependency, and it protects the dependency from your caller.
Fail-fast is a feature, not a surrender. When a dependency is down, a fast error frees a thread, closes a connection, and lets the caller render a degraded response. A slow timeout keeps every one of those resources occupied while the dependency digs itself deeper. The breaker converts a queue of doomed requests into a signal.
A breaker is not a fallback. It returns an error, and the caller decides what that error means. AWS warns against fallback paths that nobody tests: spending engineering resources on making the primary (non-fallback) code more reliable usually raises our odds of success more than investing in an infrequently used fallback strategy
(AWS Builders' Library, Avoiding fallback in distributed systems). A breaker that silently returns stale data is a fallback wearing a breaker's name.
You also pay a cost. AWS warns that breakers add modal behavior that is hard to test and can slow recovery, and it mitigates that risk by limiting retries locally using a token bucket
(AWS Builders' Library). Use a breaker to stop calls to a failing dependency. Use a token bucket to cap your retry volume. They solve different problems, and one does not replace the other.
How Should a Circuit Breaker Open and Close?
Count failures over a window, open above a threshold, wait a cooldown, then allow a small number of probes in half-open and close only after enough successes. You need a reason for every parameter, because a breaker with the wrong threshold is either useless or a second outage.
You can see the basic transition in Microsoft's guidance: If the number of recent failures exceeds a specified threshold within a given time period, the proxy is placed into the Open state and starts a time-out timer.
In half-open, successful probes close the breaker and reset the counter. If any request fails, the circuit breaker assumes that the fault is still present, so it reverts to the Open state
(Azure Architecture Center, Circuit Breaker pattern).
If you use Resilience4j, you get the same machine with configurable windows. It implements a finite state machine with three normal states: CLOSED, OPEN and HALF_OPEN
, stores outcomes in a count-based or time-based sliding window, rejects calls with CallNotPermittedException while open, and permits a configured number of calls in half-open (Resilience4j, CircuitBreaker). The sliding window matters: a breaker that counts only consecutive failures opens on a burst that a rate-based window would ignore.
You set a minimum call volume before the breaker may open. Without one, a service that handles three requests an hour opens after a single failure and stays open through a healthy period. Count-based and time-based windows both support a floor; use it.
The proxy splits the job in two. Envoy's circuit breaking limits connections, pending requests, active requests, and retries, and it is enabled by default with modest default values, e.g. 1024 connections per cluster
(Envoy, Circuit breaking). Error-based ejection is a separate feature called outlier detection, which removes hosts performing unlike the others
from the healthy load-balancing set. Envoy ejects a host for base_ejection_time multiplied by the number of consecutive ejections, capped by max_ejection_percent (Envoy, Outlier detection).
You can see both mechanisms in an Istio DestinationRule. Its circuit-breaking task sets maxConnections: 1 and http1MaxPendingRequests: 1, then shows that exceeding one concurrent connection and request produces 503s as the proxy opens the circuit for further requests and connections
(Istio, Circuit Breaking). The same task configures outlier detection with consecutive5xxErrors: 1 and baseEjectionTime: 3m. That configuration is a demonstration, not a production default. One 5xx ejecting a host for three minutes will eject your fleet during a normal deploy.
You need two layers. Per-host ejection handles one bad node behind a healthy service. A per-dependency breaker handles a service that is failing as a whole. The first is a load-balancing concern; the second is your caller-side policy. You need both, and you should not point one dashboard at both.
What Does a Retry Backoff Circuit Breaker Loop Look Like?
The four controls form one chain: an edge deadline, per-hop timeouts derived from the remaining budget, a breaker check before each attempt, and a retry only when budget, idempotency, and error type all allow it. Order matters: get it wrong and you build a machine that amplifies its own failures.
Start at your edge. Set one deadline for the user-facing operation, and propagate the remainder. At each hop, check the breaker before spending a connection. If it is open, fail immediately. If it is closed, make the attempt with a timeout clipped to the remaining budget. On failure, classify the error before you retry: a 4xx will fail again, a timeout might not, and a 503 with Retry-After tells you when to come back. RFC 9110 defines the header: servers send it to indicate how long the user agent ought to wait before making a follow-up request
, and on a 503 it indicates how long the service is expected to be unavailable to the client
(RFC 9110).
Then apply the budget. Google's SRE book caps attempts per request at three and adds a per-client ratio: A request will only be retried as long as this ratio is below 10%
(Google SRE, Handling Overload). AWS ships the same idea as a token bucket in its SDKs. That ratio answers how much extra traffic one client may add while the dependency is unhealthy.
You retry only idempotent operations, or operations protected by an idempotency key. A timeout does not prove the write failed. AWS states the rule directly: APIs with side effects aren't safe to retry
unless the API makes them safe (AWS Builders' Library). Azure adds the practical test: If so, it's inherently safe to retry. Otherwise, retries could cause the operation to be executed more than once, with unintended side effects
(Azure Architecture Center, Retry pattern).
You instrument the chain, not just the endpoint. Track attempts per request, the ratio of retries to first attempts, timeout rate by dependency, and breaker state changes. Alert on the retry ratio before the error rate, because a rising retry ratio is your early signal that a dependency is degrading.
You can start from a configuration like this: a 2-second edge deadline, two retries with a 100 ms base and a 1-second cap under full jitter, a breaker that opens at 50% failures over at least 20 calls in 30 seconds and permits three half-open probes, and a 10% retry ratio cap. Tune every number against your own data.
Move asynchronous work off this path. A queue consumer can retry for minutes without holding a user connection, and a dead-letter queue gives failed work a home. Queues vs streams covers the broker mechanics.
You will see the same anti-patterns in most incidents. Retrying at every layer multiplies load. Retrying a non-idempotent POST double-charges a customer. A breaker with no minimum volume opens on noise. A fallback that returns fake success hides the failure until an audit finds it.
What Does the Retry Loan Actually Cost?
You do not get reliability by trying harder. You get it by bounding how much work you will spend on a request that may already be lost.
Retries are borrowed capacity. The interest is the extra load you place on a dependency that is already struggling, and the default rate compounds at every layer. A timeout sets the term of the loan. A deadline sets the total you will pay. Backoff with jitter sets the repayment schedule. A circuit breaker stops lending to a counterparty that has stopped paying.
You delete a retry layer before you add a fallback. You cap the retry ratio before you raise the retry count. You put a deadline on the edge before you tune a per-hop timeout. You measure the retry ratio before you trust the error rate.
The wider frame sits in the system design practical guide. The four controls in this post are the part of that frame you can change this week without a migration, a new cluster, or a committee. Start there, because the cheapest availability win is the work you stop doing twice.
Related Reading
How to Design a Highly Available System: The Design Sequence
Why How to Design a Highly Available System Is a Sequence, Not a Checklist High availability is not bought by piling on
How to Design a Distributed System: Six Decisions in Order
You design a distributed system by making six decisions in order — where state lives, how many copies exist, how those
Synchronous vs Asynchronous Communication: When to Use Each
You have a call that works.