Interview prompt
Problem context
Skills being evaluated
Use the sequence below to surface constraints, choose boundaries, test failure behavior, and defend trade-offs. Concrete numbers are interview assumptions, not claims about a real production system.
Clarify the decision
- Classify failures as terminal, throttled, unknown outcome, and transient; decide which layer owns the retry for each operation. Define customer deadlines and provider idempotency support.
Establish scale assumptions
- Calculate total attempts from every layer and model backlog release at recovery. A three-attempt policy at four layers can create eighty-one calls for one logical request.
Functional and non-functional requirements
- Bound attempts per logical operation, preserve idempotency, honor provider Retry-After, stop work past the customer deadline, and recover at a controlled rate.
High-level architecture
- Propagate one retry budget and absolute deadline, assign a single retry owner, use exponential backoff with full jitter, adaptive concurrency, and a circuit breaker. Move delay-tolerant operations to a durable scheduled queue.
Data model and flow
- Carry operation and attempt IDs across layers; persist unknown payment outcomes and reconcile with the provider before another mutation. Typed errors tell callers whether to retry, poll, compensate, or stop.
Consistency and transaction boundaries
- Retries are safe only with a stable idempotency key scoped to the business operation and retained through the provider’s ambiguity window. A timeout is not proof of failure.
Failure modes and recovery
- When the breaker opens, reject or durably defer rather than spinning. On recovery, release a token-limited fraction of backlog, prioritize fresh contractual work, and expire requests whose value has lapsed.
Security and privacy
- Do not expose provider internals or accept client-controlled attempt counts. Sign queued commands and protect idempotency records from cross-tenant collisions.
Observability and SLOs
- Measure attempts per operation, retry reasons, budget exhaustion, unknown outcomes, breaker state, backlog age, and recovery re-saturation. Separate original demand from retry traffic.
Capacity and cost
- Durable deferral costs storage but prevents compute and provider fees from multiplying. Size idempotency retention and delayed queues to the longest plausible outage plus investigation window.
Alternatives and trade-offs
- Hedged requests reduce tail latency for safe reads but amplify load and are dangerous for mutations. Retries improve transient success only while spare capacity exists; under saturation they must yield to admission control.
Evolution and migration
- Publish a shared retry contract, remove nested retries layer by layer, and canary with attempt telemetry. Fault-inject mixed responses and a slow recovery ramp, not only a clean outage.
What Staff and Principal candidates should emphasize
- The key is one logical-operation budget across the call graph and explicit unknown-outcome handling. Staff answers also govern clients and workers, not just one service library.
Decision trade-offs
Retry owner
Option A
Every layer retries defensively
Option B
One designated layer owns attempts
Recommendation:Designate one owner and let lower layers return typed outcomes; nested defensive retries create multiplicative traffic.
Outage handling
Option A
Keep requests in memory until recovery
Option B
Fail or durably schedule delay-tolerant work
Recommendation:Fail interactive work by deadline and durably defer only operations whose product semantics remain valuable later.
Follow-up interview questions
- 01How long must payment idempotency keys be retained?
- 02When are hedged requests appropriate?
- 03How do you prioritize old backlog versus fresh customer traffic?
- 04What should a mobile client do after receiving an unknown outcome?
Common weak answers and mistakes
- 01Giving each layer a reasonable retry count and ignoring multiplication.
- 02Retrying a timed-out payment as if it definitely failed.
- 03Using exponential backoff without jitter and synchronizing clients.
- 04Opening traffic fully as soon as provider health begins to recover.
Interviewer evaluation rubric
Suggests exponential backoff but cannot bound total attempts or handle ambiguous mutating outcomes.
Uses one retry owner, jitter, idempotency, deadlines, a breaker, and durable queues for suitable work.
Propagates budgets, honors typed provider signals, reconciles unknown outcomes, expires stale work, and ramps recovery.
Defines a cross-client and cross-team retry contract with economic limits and validates dynamic stability through recovery experiments.