Retries only on idempotent calls, with backoff and jitter
Retry a synchronous call only when repeating it is safe, and spread retries out so they don't pile onto a struggling dependency.
HighChecked by hand
- Applies to:
- Services with synchronous dependencies
- Rule id:
- resilience.retry-only-idempotent
Why it matters
A retry turns one request into several. On a call that isn't idempotent, a timeout followed by a retry can create two orders or two payments, because the first attempt may have succeeded. On a dependency that is already slow, synchronized retries from every caller multiply its load exactly when it can least take it.
How to apply it
- Retry only reads and writes that are idempotent by design (PUT/DELETE semantics, or POST with an idempotency key the server deduplicates).
- Use exponential backoff with jitter, and cap attempts: about one retry on user-facing paths, a few on background work.
- Retry at one layer only (client library or service mesh, not both), and never on 4xx business errors.
- Keep a retry budget (for example, at most 10% extra traffic) so retries can't amplify an outage.
Example
checkout → payments uses POST /payments with an Idempotency-Key header, a 300 ms timeout, one retry after 100–200 ms of jittered backoff, and no retry on 402 Payment Required.
References
Checklists with this rule
Related agent skill: resilience-patterns