Prerequisites
What it is
Exponential backoff retries failed work after increasing delays, often with jitter to avoid synchronized retry storms.
Why it matters
Many failures are temporary. Retrying immediately can overload the recovering dependency and make the incident worse. Backoff gives systems breathing room.
How it works
After each failure, wait longer before trying again: 1 second, 2 seconds, 4 seconds, 8 seconds, up to a cap. Jitter adds randomness to spread retries out.
# config: base=1s, cap=30s, max_attempts=5
function call_with_retry(operation):
for attempt in 1..max_attempts:
try:
return operation()
except transient_error:
if attempt == max_attempts:
raise # give up, move to DLQ
delay = min(cap, base * 2^(attempt - 1))
jitter = random(0, delay / 2) # "full jitter"
sleep(delay + jitter)
Without jitter, many clients retry at the exact same intervals, creating synchronized spikes. Jitter spreads them out so the recovering system sees a smooth ramp instead of a thundering herd.
When to use it
Use it for network calls, webhooks, queues, uploads, payment provider calls, and eventually consistent background work.
Tradeoffs / failure modes
Retries require idempotency. Too many retries waste capacity; too few reduce reliability. Permanent errors should not be retried.
Tiny example
A webhook delivery fails with 503, then retries after 2s, 5s, 12s, and 30s before moving to a dead-letter queue.
Related guides and systems
See Webhooks, Job Queues, Payment Processing, File Upload Pipeline, GitHub, Gmail, and Slack.
Seen in deeper dives
Capability
File Upload Pipeline
Chunked and resumable uploads, server-side processing, and CDN delivery at scale
Capability
Job Queues & Background Workers
Async task processing with retries, dead-letter queues, and priority scheduling
Capability
Payment Processing
Idempotent charges, webhook reconciliation, and PCI compliance for online payments
Capability
Webhooks
Reliable event delivery to external systems with retry, HMAC verification, and monitoring
Case Study
GitHub
The world's largest code hosting platform powered by Git at scale
Case Study
Gmail
The world's largest email service with AI-powered organization and search
Case Study
Slack
Channel-based messaging for the enterprise workplace
Related concepts
Circuit Breaker
Stop calling an unhealthy dependency before failures cascade through the system.
Backpressure
Slow producers down when consumers cannot keep up.
Message Queue
Buffer work between producers and consumers so systems can absorb spikes and retry safely.