Write a Reusable Retry Policy With Exponential Backoff and Full Jitter

Last updated: November 29, 2026

Quick Overview

Implement a retry helper for calls to a shipping label service that retries only retryable failures, waits with capped exponential backoff plus jitter between attempts, and gives up after a fixed number of tries.

Amazon
Software Engineering Fundamentals
Software Engineer
Amazon
November 29, 2026
Software Engineer
Technical Screen
Software Engineering Fundamentals
Easy

0

0

0 solved


Implement a retry helper for calls to a shipping label service that retries only retryable failures, waits with capped exponential backoff plus jitter between attempts, and gives up after a fixed number of tries.

Amazon services call each other constantly and the AWS SDKs bake in backoff with jitter, so engineers are expected to know why naive retries cause retry storms. The interviewer checks retry classification, jitter, attempt limits, and testability.

What the Interviewer Expects
  • Retries only errors that are safe to retry
  • Uses exponential backoff with a cap
  • Adds full jitter to spread retries from many clients
  • Re-raises the final error instead of swallowing it
  • Injects sleep and randomness for deterministic tests
Key Topics to Cover
exponential backoff
jitter
retry storms
idempotency
testability
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • Why can retries at every layer of a call stack multiply load, and how do you prevent it?
  • How would a retry budget or token bucket limit retries during an outage?
  • When is it unsafe to retry a POST?
  • How would you honor a Retry-After header?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements
  • Retry on throttling, 5xx, and timeouts; never on validation errors.
  • At most max_attempts total calls.
  • Delay before retry nn is random in [0,min⁡(cap,base⋅2n)][0, \min(cap, base \cdot 2^n)].
  • Deterministic in t...
High-Level Design

A RetryPolicy object holds configuration plus injected sleep and rng functions. call loops over attempts, returns on success, sleeps a jittered delay on a retryable error, and re-raises on the...


Submit Your Answer
Markdown supported