Use this when retries should wait longer each time.
Backoff
Backoff increases the wait between retries, such as 1, 2, 4 and 8 seconds, often with random jitter, so retries do not overload a struggling service.
1. Backoff spaces retries: exponential with jitter avoids thundering herds.
2. Respect Retry-After.
3. Cap delays.
4. Total timeout.
5. Common in API clients.
failure → wait (exponential + jitter) → retry
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
Use a controllable fixture that emits a known sequence such as 429, 503, then success and another that always returns a permanent 4xx. Record exact attempt timestamps, delay/jitter, server Retry-After handling and final deadline. Confirm the transient sequence succeeds within bounds, the permanent case does not retry, and an ambiguous write uses idempotency/read-back before another attempt.
Step 2 Common mistakes Narrow the fault
- Fixed delays instead of exponential backoff with jitter.
Step 3 Where it fails Narrow the fault
Separate error classification, retry scheduler/timer, client transport, remote service health, idempotency and final resource state. Long delays may be correct backoff, not a hung worker. A timeout after sending a write is ambiguous and cannot safely be treated like a pre-connect failure. Do not increase max attempts until the failure is confirmed transient and capacity impact is understood.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Exponential backoff: 1, 2, 4, 8 s.
- Add jitter to spread retries.
- Cap the maximum wait.
- Exponential backoff with jitter — strategy
- Retry-After honoured — server guidance
- Max delay cap — bounds
ReferenceWhy it matters1 section · depth on demand
In depth
Backoff increases the delay between retries after each failure (e.g. 1 s, 2 s, 4 s, 8 s), often with random jitter. It gives an overloaded service time to recover and prevents many clients retrying in sync.
import random, time
for attempt in range(6):
r = session.get(url, timeout=10)
if r.status_code not in (429, 502, 503, 504):
break
delay = float(r.headers.get("Retry-After", 2 ** attempt)) + random.uniform(0, 1)
time.sleep(min(delay, 60))
Retry only idempotent operations, cap the number of attempts and the maximum delay, and honour Retry-After headers.
ReferenceImportant terms & boundaries1 section · depth on demand
Mechanics
Backoff spaces retry attempts so a transient dependency has time to recover and synchronized clients do not create a retry storm. Exponential delay, jitter, server-provided Retry-After, maximum attempts and a total deadline work together. Backoff only makes sense after failure classification: authentication, validation or permanent-not-found errors generally do not become successful through waiting. Retrying non-idempotent operations can duplicate side effects.
ReferenceConfiguration & state1 section · depth on demand
Lifecycle
Centralize retry policy by dependency/operation class rather than embedding arbitrary sleeps in every script. Review limits against service quotas and user-facing deadlines, and expose settings through versioned configuration. Coordinate client backoff with queue/redelivery and circuit-breaker policies so nested retry layers do not multiply attempts. Test policy after SDK upgrades because libraries may add their own retries.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Error Handling > Backoff. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/azure/architecture/patterns/retry · confidence 94%Quick lookup tables
Error Handling → Backoff · operational reference
Context-specific ownership, verification, output and failure-boundary lookup for Error Handling → Backoff.
| Layer | Error Handling → Backoff operational reference |
|---|---|
| Runtime/ownership | Retry/backoff patterns for distributed automation · identify controller/parser, durable intent, identity and target ownership before mutation |
| Persistent intent | Versioned definition/configuration with explicit dependencies, scope and credential boundary |
| Verification | Run a fixture dependency that returns transient 429/5xx, capture attempt timestamps and Retry-After/backoff, then verify maximum attempts and total deadline. |
| Expected interpretation | Retries occur only for classified transient failures, delay increases/jitters within policy, server retry guidance is respected, total deadline is bounded, and nonretryable errors fail immediately. |
| Recovery boundary | Preserve correlation IDs + pre-state, repair first failing boundary, then verify the target independently |
Deep reference
Healthy vs suspicious evidence
Output interpretation
Capture operation/correlation ID, attempt number, classified error, status/code, chosen delay, Retry-After if present, elapsed/remaining deadline and final disposition. Logs should show why a retry happened, not just “retrying”. Aggregate metrics include retry rate and exhausted retries while preserving per-request traceability.