Now inviting automation leaders: publish your playbook as a skill, under your own name. Publish yours →
Automation Skills
All skills/Api idempotency retry/Backoff-jitter-formulas
Reference · Api idempotency retry

Backoff-jitter-formulas

Part of Api idempotency retry. Install the skill and your agent reads this page when it needs the depth.

Backoff, jitter, retry budgets, and deadlines - the math

Canonical source for the jitter comparison: Marc Brooker, AWS Architecture Blog, "Exponential Backoff and Jitter" (2015, updated 2023 - the update states the guidance "continues to serve as a pillar for how Amazon builds remote client libraries"). His core finding: capped exponential backoff alone "helps only a small amount" under contention - jitter, not backoff, is what reduces total client work in a retry storm.

The four strategies

Strategy Formula Trade-off
Full jitter (recommended default) sleep = random(0, min(cap, base * 2^attempt)) Lowest total client work and lowest server load; slightly more total time to completion
Decorrelated jitter sleep = min(cap, random(base, sleep_prev * 3)) More total work than full jitter, completes slightly faster
Equal jitter half the backoff fixed, other half randomized Brooker's "clear loser" among the jittered approaches - more work than full jitter and much slower
No jitter (plain exponential) sleep = base * 2^attempt Categorically the worst - so slow in total that Brooker's own comparison graph leaves it off

Why no-jitter fails at fleet scale: 1,000 clients that failed together all retry at exactly t+100ms, t+200ms, t+400ms - re-creating the overload spike that caused the failures. Full jitter spreads the same population across the whole window.

Brooker's 2019 follow-up ("Timeouts, retries and backoff with jitter", AWS Builders' Library) extends jitter to any periodic job, with one caution: apply jitter consistently per host, so an overload pattern stays diagnosable instead of looking like random noise.

A concrete documented schedule

Resend's documented client loop - a citable worked example for integrator docs:

const delay =
  Math.min(1000 * Math.pow(2, attempt), 30000) + // 1s → 2s → 4s → 8s ... cap 30s
  Math.random() * 1000; // jitter

Prefer the retry library over hand-rolled math wherever one exists - the formula is one line there, pre-debugged:

Bound both attempts and total duration (the tenacity combinator above): each attempt can look reasonable while the loop blows past the caller's own budget. Log every retry - attempt number, error, next wait; both libraries treat retry logging as a default, not an opt-in.

Retry budget: the fleet-wide cap

Per-caller attempt caps cannot prevent amplification: a fleet of 100 instances each retrying 3 times amplifies load on a struggling downstream by 300x while every instance's cap looks reasonable in isolation.

Deadline propagation

Pattern stacking

When retry is combined with other resilience patterns, the execution order matters (Resilience4j's documented order):

Retry → CircuitBreaker → RateLimiter → Bulkhead → call

Publish your skill

Copy this prompt into Claude Code, Codex or any agent. It walks you through your first skill in about 20 minutes, with you as the author.

Click to copy.