awesome-everything RU
↑ Back to the climb

Backend Architecture

Idempotency and retries: multiple-choice review

Crux Multiple-choice synthesis across the idempotency + retries unit — keys, the four-state machine, jittered backoff, outbox/inbox, concurrency races, and production failure modes.
Your altitude — climbing toward senior
ZeroJuniorMiddleSenior
You are at senior altitude — in orbit
◷ 13 min

Six questions that cut across the whole unit. None is a definition to recite — each is a decision you make under load, where the wrong call is a double charge, a lost event, or a self-inflicted outage.

Goal

Confirm you can connect the moving parts the lessons built toward: the idempotency key, the server-side state machine, jittered retries, the outbox + inbox composition, and the concurrency races that turn a tidy design into a duplicate side effect.

Quiz

A mobile client fires a POST /charge, the response is lost, and it retries. On the retry it generates a fresh UUID for the Idempotency-Key header. What is the consequence and why?

Quiz

A request arrives with Idempotency-Key K1. The server finds a row for K1 with status=in_progress. Why return 409 immediately instead of blocking until the first request finishes?

Quiz

A service returns 503 with Retry-After: 30 during an outage. Across the fleet, which client behaviour keeps the recovering service alive?

Quiz

A team must publish an 'order.created' event to Kafka whenever an order row commits to Postgres. Why is the outbox pattern correct where 'write Postgres then publish Kafka' is not?

Quiz

Two requests carrying the same idempotency key reach the server within a millisecond of each other. The handler does SELECT-then-INSERT into the idempotency_keys table. What happens, and what is the fix?

Quiz

A payment API uses Redis alone (async fsync, SETNX) as its idempotency store. A node crashes a millisecond after a SETNX, losing that key. What is the production-grade reading of this design?

Recap

The unit is one chain: the client retries with one key per operation; the server resolves that key to new / in-flight (409) / replay / mismatch (422) and stores the result atomically with ON CONFLICT; retries use full jitter, honour Retry-After, and live under a fleet retry budget; the outbox + at-least-once relay + inbox dedup turn the impossible dual-write into effectively-once; and the durable store must survive a crash, because losing a key is how a tidy design becomes a double charge. Every production failure in the unit — Stripe 2017, Knight Capital, AWS S3, GitHub 2018 — is at-least-once without idempotent consumers, or retries without jitter.

Continue the climb ↑Idempotency and retries: free-recall review
shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources3
expand
  1. 01
  2. 02
  3. 03

Trademarks belong to their respective owners. Editorial reference only.