The retry that made it worse
Retries turn a brief failure into a sustained one. Jitter, budgets, and backoff are not optional extras.
A service gets slow. Clients time out. Clients retry. Now the service has twice the load it was already failing to handle. This is the shape of most self-inflicted outages.
Retries are correct. Naive retries are an amplifier.
the three failures#
No backoff. Immediate retry means the retry arrives while the original condition still holds. You have doubled the request rate and changed nothing else.
No jitter. Exponential backoff without randomisation synchronises clients. Everyone fails at once, everyone waits 1s, everyone retries at once. You have built a metronome that hammers a struggling service on the beat.
No budget. Each layer retries three times. Four layers deep, one user action becomes eighty-one requests. Nobody wrote "81"; it emerged from the composition.
what correct looks like#
def call_with_retry(fn, attempts=3, base=0.1, cap=2.0):
for i in range(attempts):
try:
return fn()
except Retryable:
if i == attempts - 1:
raise
# full jitter: sleep uniformly in [0, min(cap, base * 2^i)]
delay = random.uniform(0, min(cap, base * (2 ** i)))
time.sleep(delay)Full jitter — sleeping a random amount in [0, backoff] rather than backoff ± noise — spreads retries more evenly than any of the alternatives. It is a one-line change with a disproportionate effect.
retry budgets beat retry counts#
A count says "try three times." A budget says "retries may be at most 10% of my outgoing requests." Under normal conditions the budget never binds. Under a partial outage it caps amplification at 1.1×, not 3×.
class Budget:
def __init__(self, ratio=0.1):
self.ratio, self.calls, self.retries = ratio, 0, 0
def allow(self):
return self.retries < max(10, self.calls * self.ratio)Ten free retries so a low-traffic service is not starved, then a proportional cap. This single mechanism removes the entire class of "retry storm" outage.
retry only what is retryable#
| Response | Retry? | Why |
|---|---|---|
| Connection refused | yes | never reached the handler |
| 503, 429 | yes, honour Retry-After | server is asking |
| 500 | carefully | may have partially applied |
| Timeout on a write | only if idempotent | it may have succeeded |
| 400, 404, 422 | no | it will fail identically |
| 401, 403 | no | retrying will not grant permission |
The timeout row is the one that bites. A write that times out has an unknown outcome. Retrying without an idempotency key is how you get duplicate charges.
the layer rule#
Retry at exactly one layer. Pick the one with the most context — usually the service client, not the HTTP library and not the caller above it — and make every other layer pass failures through untouched.
Two layers retrying is a multiplication you did not intend. Grep your stack for default retry settings; most HTTP clients and SDKs have them on, and most teams do not know it.
and know when to stop entirely#
A circuit breaker is a retry policy that has learned. After enough consecutive failures, stop calling and fail fast for a cooling-off period, then let one request through to test the water.
The failure mode you are avoiding is the one where your retries are the reason the dependency cannot recover. A service under a retry storm never gets the quiet moment it needs to drain its own queue.
Retries help when failures are independent. When failures are correlated — and in distributed systems they usually are — retries are load.
— Dom, November 4, 2026