Skip to content

Retry

A retry is the act of reattempting a failed operation, usually with a delay, under the assumption that the failure is transient and will not recur on the next attempt.

Definition

What it is

A retry is a bet on transience. It works for network blips, cold-start latency, rate-limit windows, lock contention. It fails for logic errors, permission denials, malformed payloads — cases where the next attempt will fail identically. The engineer's job is to distinguish the two before wiring a retry.

Why it matters

A single request to a healthy service has a 99.9% success rate. If a user journey chains 20 calls, the compounded success rate is 0.999^20 = 98%. Add a retry and the compounded rate rises to 99.96%. Retries are the cheapest resilience mechanism available.

Retry vs retry with backoff vs circuit breaker

Aspect

Retry

Retry with backoff

Circuit breaker

Spacing

Immediate

Exponential + jitter

Stops entirely

Protects target

No

Yes

Yes

Protects caller

No

Yes

Yes

Best for

Rare blips

Transient failures

Known-outage

The retry loop

graph LR
  A[Attempt] --> B{Success?}
  B -->|Yes| Done
  B -->|No| C{Retries left?}
  C -->|No| Fail
  C -->|Yes| W[Wait backoff]
  W --> A
  style Done fill:#E8F5E9
  style Fail fill:#FFEBEE

How to retry well

Retries that help

  1. Only transient errors

    Network timeouts, 5xx, 429. Never 4xx client errors; the next attempt will fail identically.

  2. Exponential backoff

    Attempt n waits base * 2^n. Without backoff, a retry is a mini-DDoS.

  3. Add jitter

    Random ±20% on the wait. Without jitter, all clients retry simultaneously.

  4. Honor Retry-After

    If the server says wait 30s, wait 30s. Ignoring it is how rate limits become bans.

  5. Cap the budget

    3-5 attempts max, and a total time budget. Infinite retries are infinite outages.

Common failures

Origin

The only truly reliable way to handle transient failures is to retry with exponential backoff.

— Marc Brooker, *Exponential Backoff and Jitter*, AWS Architecture Blog, 2015
1999 · RFC 2616 define Retry-After
2015 · AWS publica el paper sobre exponential backoff + jitter
2020 · service meshes (Istio, Linkerd) incluyen retry policies
2024 · retry policies son estándar en SDKs de nube

Evidence

FAQ

How many retries?

3-5 attempts with exponential backoff. More than that is usually a design smell.

How long should the backoff be?

Base 100-500ms, doubling each attempt, with jitter. Cap at 30s.

What is idempotency?

The property that repeating the operation has the same effect. PUT is idempotent; POST is not, unless it uses an idempotency key.

Retry vs circuit breaker?

A retry reattempts; a circuit breaker stops after N failures to protect the target. Use both.

Connections

RetryreliabilitdistributeCircuit brbackoffexponentiaIdempotentFailover

● broader ● narrower ● related

Broader

  • reliability
  • distributed-systems

Related

Used in the garden

Sources

Etymology

Origin: borrowed

  • re (prefix): Latin, "again"
  • try (verb): from Old French trier, "to sift, to pick"

Semantic network

RetryreliabilitdistributeCircuit brbackoffexponentiaIdempotentFailover

● broader ● narrower ● related

Broader

  • reliability
  • distributed-systems

Related

Used in the garden

Sources