8 quick system design interview drills
Choose a response to a failure or scaling problem before you reveal the explanation. Each drill focuses on one decision, the guarantee it protects, and the trade-off it brings. They are original practice prompts, not reported questions from a named company.
About 1 minute each · Free · No account needed
Pick your response, then reveal the reasoning
Drill 01 · about 1 minute · Retries and idempotency
The payment provider charged the customer, but your request timed out. What now?
The customer retries checkout. Pick the safest next step.
- Send a new charge with a new idempotency key.
- Keep the order pending, then query or retry the same payment using its original idempotency key.
- Treat the timeout as a failed charge and let checkout start over.
Reveal the answer and reasoning
Best response: Keep the order pending, then query or retry the same payment using its original idempotency key.
A timeout reports what the caller observed; it does not prove the provider did nothing. A stable key identifies one logical payment across retries. Keep the order pending until the provider confirms the result, then reconcile any outcome that remains uncertain.
Trade-off: The customer may wait for confirmation, but a retry is less likely to charge them twice.
- Why not “Send a new charge with a new idempotency key.” A new key can create a second logical charge.
- Why not “Treat the timeout as a failed charge and let checkout start over.” The first charge may already have succeeded, so restarting can duplicate it.
Drill 02 · about 1 minute · Queues and delivery guarantees
A consumer commits its work, then crashes before acknowledging the message.
The queue delivers the message again. How do you prevent a duplicate effect?
- Configure exactly-once delivery and assume the consumer will only run once.
- Acknowledge before doing the work so the queue cannot redeliver it.
- Give the message a stable ID and atomically record it with the state change before acknowledging.
Reveal the answer and reasoning
Best response: Give the message a stable ID and atomically record it with the state change before acknowledging.
Assume a message can be delivered more than once. Store a deduplication record in the same transaction as the consumer's durable state change, then acknowledge. If the effect is external, pass an idempotency key or use an outbox-driven retry; a broker guarantee alone cannot make an arbitrary side effect exactly once.
Trade-off: Deduplication adds retained state and cleanup work, but makes redelivery safe across the commit/acknowledgement gap.
- Why not “Configure exactly-once delivery and assume the consumer will only run once.” The consumer can still crash between its side effect and acknowledgement.
- Why not “Acknowledge before doing the work so the queue cannot redeliver it.” A crash after acknowledgement but before the durable work can lose the message's effect.
Drill 03 · about 1 minute · Worker recovery and fencing
A worker's lease expires, but the old worker is still running.
A replacement worker has taken the job. What prevents the old one from publishing late?
- Make the lease longer so it is less likely to expire during normal work.
- Give each ownership attempt a newer fencing token and reject writes from an older token.
- Assume the lease service will stop the old worker when its lease expires.
Reveal the answer and reasoning
Best response: Give each ownership attempt a newer fencing token and reject writes from an older token.
A lease lets another worker take over after a timeout, but the former owner may be paused or partitioned and later resume. A monotonically increasing fencing token lets the resource reject that stale owner's writes. Persist progress at safe boundaries and make completed steps safe to retry.
Trade-off: The destination must check ownership on writes, and each attempt needs durable progress or idempotent effects.
- Why not “Make the lease longer so it is less likely to expire during normal work.” A longer timeout reduces accidental expiry but delays recovery and does not eliminate stale owners.
- Why not “Assume the lease service will stop the old worker when its lease expires.” A lease service cannot reliably terminate a worker across a network partition.
Drill 04 · about 1 minute · Hot keys and partitioning
One account sends most of the traffic to a single database partition.
The cluster has spare capacity overall, but that partition is saturated. What do you investigate first?
- Add database nodes while keeping the same partition key and routing.
- Increase every service's database connection pool.
- Measure load by key, then consider splitting or replicating the hot key based on its read/write pattern.
Reveal the answer and reasoning
Best response: Measure load by key, then consider splitting or replicating the hot key based on its read/write pattern.
Cluster averages hide a hot key. Measure the skew first. Replicated reads can help a read-heavy key; splitting or salting can spread writes, but may require fan-in, merge work, or per-account ordering. Move an exceptional tenant only if the workload justifies the operational cost.
Trade-off: Distributing one key's load adds coordination or read/merge complexity; the right choice depends on whether reads, writes, or ordering dominate.
- Why not “Add database nodes while keeping the same partition key and routing.” More nodes do not help when the same key still routes every request to one partition.
- Why not “Increase every service's database connection pool.” More concurrent connections can increase pressure on the already saturated partition.
Drill 05 · about 1 minute · Caching and overload
A popular cache entry expires and hundreds of requests miss at once.
All those requests now try to rebuild the same value from the database. How do you protect the origin?
- Increase database capacity so it can handle the extra reads.
- Coalesce concurrent fills for the same key, stagger expirations, and bound origin work.
- Shorten the TTL so expired values are less stale.
Reveal the answer and reasoning
Best response: Coalesce concurrent fills for the same key, stagger expirations, and bound origin work.
This is a cache stampede: many misses trigger duplicate work for one value. Let one request refresh the key while concurrent callers wait for or reuse its result. Add TTL jitter or refresh a hot key before expiry, and cap origin concurrency. Serve stale data only when the freshness requirement allows it.
Trade-off: Coalescing and stale-while-revalidate add cache coordination and freshness choices; they reduce duplicate origin work during a burst.
- Why not “Increase database capacity so it can handle the extra reads.” Capacity may absorb a burst, but it does not prevent repeated work for the same key.
- Why not “Shorten the TTL so expired values are less stale.” Shorter TTLs cause more frequent misses and can make the burst problem worse.
Drill 06 · about 1 minute · Queues and backpressure
A job queue grows every hour even though every worker is busy.
What would you check before adding more workers?
- Watch queue depth; if it is high, keep adding consumers until it falls.
- Track arrival rate and oldest-message age, then check whether the downstream system can take more work.
- Retry failed messages immediately so they do not hold up the queue.
Reveal the answer and reasoning
Best response: Track arrival rate and oldest-message age, then check whether the downstream system can take more work.
Compare arrival and completion rates and track how old the oldest job is; depth alone does not show how long users wait. Add consumers only if the bottleneck can accept the extra load. Otherwise slow or reject producers, shed optional work, or make each job cheaper, then define how the backlog drains.
Trade-off: Backpressure protects downstream systems but can delay or reject work, so the product needs an explicit overload policy.
- Why not “Watch queue depth; if it is high, keep adding consumers until it falls.” Extra consumers can overload a database or dependency and grow the backlog somewhere else.
- Why not “Retry failed messages immediately so they do not hold up the queue.” Immediate retries add load precisely when the system is already falling behind.
Drill 07 · about 1 minute · Replication and durability
The primary acknowledged a write, then failed before an asynchronous replica received it.
The team promotes the replica. What guarantee can you claim?
- No acknowledged writes are lost because the replica is now primary.
- State the recovery-point objective: asynchronous replication can lose recent acknowledged writes; synchronous acknowledgement trades latency for a stronger durability promise.
- Tell every client to retry all writes against the new primary.
Reveal the answer and reasoning
Best response: State the recovery-point objective: asynchronous replication can lose recent acknowledged writes; synchronous acknowledgement trades latency for a stronger durability promise.
An asynchronous replica may lag when the primary fails. Be explicit about the acceptable recovery point objective and what an acknowledgement promises. Synchronous replication can strengthen the durability of acknowledged writes, at additional latency and availability cost. Client retries also need stable operation IDs to avoid duplicate effects.
Trade-off: A stronger replication acknowledgement costs latency and can reduce write availability when the replica or network is unavailable.
- Why not “No acknowledged writes are lost because the replica is now primary.” Promotion cannot restore a write that had not reached the replica.
- Why not “Tell every client to retry all writes against the new primary.” A retry cannot know whether the first write committed; it needs an idempotency key or state check.
Drill 08 · about 1 minute · Data migration and correctness
A backfill copies a database while users keep writing to the old one.
How do you avoid missing writes when you switch reads to the new database?
- Copy a snapshot, then immediately switch all reads to the new database.
- Start dual writes and assume both databases stay in sync.
- Capture changes during the backfill, replay them, compare critical invariants, then switch gradually with a rollback point.
Reveal the answer and reasoning
Best response: Capture changes during the backfill, replay them, compare critical invariants, then switch gradually with a rollback point.
A snapshot misses writes that arrive while it is copied. Capture changes before or during the backfill, replay until caught up, and verify counts plus business invariants. Switch reads gradually only after parity is good, keep the old path available for rollback, and retire it after the new path is proven.
Trade-off: Change capture and verification add temporary operational complexity, but they expose drift before the new database becomes authoritative.
- Why not “Copy a snapshot, then immediately switch all reads to the new database.” Writes made after the snapshot can be absent from the new database at cutover.
- Why not “Start dual writes and assume both databases stay in sync.” A partial failure can update one database but not the other; dual writes need retry, reconciliation, and a cutover plan.
Ready for a full practice round?
A short drill tests one decision. A full system design interview asks you to connect requirements, estimates, architecture, trade-offs, and recovery. Continue with the timed mock interview or choose one of the interactive system design questions.
For a longer set of follow-ups, read the system design failure scenarios guide.
Quick drill questions
- What is a system design interview drill?
- A short prompt that asks you to make one design decision or respond to a failure. Explain the invariant you need to protect, choose a mechanism, and name its cost before checking a worked explanation.
- Are these real questions from named company interviews?
- No. These are original SysGeeks practice scenarios about common distributed-systems tradeoffs. They are not claims about questions asked by a particular employer.
- Can I practise without an account?
- Yes. The drills and linked exercises are free to use without an account. Your answer choice is not sent anywhere; opening a worked answer records only which drill was revealed, if analytics are enabled.
Written by SysGeeks. These short scenarios are based on the design questions and failure modes in our linked exercises. They explain a defensible answer and its cost; other answers may fit different requirements.
Was this useful for your system design interview prep?