Retry Transient Network Failures With Exponential Backoff and Jitter
Last updated: November 29, 2026
Quick Overview
Write a helper that retries an operation on transient failures, such as HTTP 503 or 429 from an Azure service, using capped exponential backoff with jitter and honoring a server-provided Retry-After value.
Microsoft
November 29, 20260
0
0 solved
Write a helper that retries an operation on transient failures, such as HTTP 503 or 429 from an Azure service, using capped exponential backoff with jitter and honoring a server-provided Retry-After value.
Every Microsoft cloud client library includes retry logic, and poor retries can turn a short outage into a retry storm. The interviewer checks that the candidate retries only transient errors, bounds attempts and delay, adds jitter to avoid synchronized clients, and respects server throttling hints.
What the Interviewer Expects
- Retries only errors known to be transient
- Uses exponential backoff with a cap and a maximum attempt count
- Adds jitter and explains why
- Honors Retry-After when the server provides it
- Makes sleep and randomness injectable for testing
Key Topics to Cover
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
- Which HTTP status codes would you treat as retryable, and is a POST safe to retry?
- How does a circuit breaker complement retries?
- What happens when every layer of a call stack retries three times?
- How would you add an overall deadline instead of a fixed attempt count?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
call_with_retry(op)runsop; on aTransientErrorit waits and retries, up tomax_attemptstotal attempts, then re-raises.- Non-transient errors (bad request, auth failure) are raised immedi...
High-Level Design
Exponential backoff gives a struggling service room to recover. Jitter matters because thousands of clients that failed at the same moment would otherwise retry at the same moments too, creating s...