Skip to content
Explore Mocktalk AI
Technical & strategy

System Design Interview for Beginners: Explain Your Decisions with a Worked Example

A system design interview is difficult to practice if your answer becomes a list of technologies. A database, queue, and cache do not explain which promises the system makes or how it behaves when requests collide.

Start with one small problem and follow it all the way through. This original exercise designs a workshop reservation service. The assumptions and traffic numbers below are hypothetical practice inputs, not production recommendations or descriptions of Mocktalk AI's architecture.

Clarify what “reserve a place” means

Ask whether a user can reserve multiple seats, whether payment is involved, and whether a reservation is immediately confirmed. For this exercise, agree on these rules:

  • A signed-in user may hold one active reservation per workshop.
  • Workshops have fixed capacity; confirmed reservations must not exceed it.
  • Users can cancel, releasing the seat.
  • Payment, waitlists, and temporary holds are out of scope.
  • A displayed availability count may be slightly stale, but confirmation must respect capacity.

That last distinction matters. A stale page can be disappointing; a confirmation for a seat that does not exist breaks the service's central promise.

Use scale estimates to ask better questions

Assume 10,000 users might visit during a release and each makes five availability requests over ten minutes. That is about 83 read requests per second on average. It says nothing about a burst in the first second, so ask how concentrated arrivals are expected to be.

Do not conclude that this average proves a particular database will be sufficient. Use it to establish a starting design and identify what needs load testing. A popular workshop can create contention even when total traffic is modest.

Describe a simple starting design

Use a web client, a stateless application service, and a relational database as the initial design. The application authenticates requests and checks ownership. The database stores workshops, reservations, and request-deduplication records.

RecordImportant fields or constraints
WorkshopID, capacity, reserved count, scheduled time
ReservationID, user ID, workshop ID, status; uniqueness for an active user/workshop pair
Request recordUser ID, idempotency key, request fingerprint, stored outcome; unique user/key pair

A database-specific partial unique index can enforce uniqueness for active reservations; another valid design uses a separate active-reservation table. State which approach you assume rather than hand-waving the constraint.

Propose three operations: read workshop availability, create a reservation, and cancel a reservation. A successful create returns the reservation identifier. A sold-out response must not create a reservation.

Walk through the last available seat

Two users try to reserve the final seat. A naive implementation reads “one available,” creates both reservations, then updates the count. Separate reads and writes can allow both requests to act on the same old state.

For this exercise, use a database transaction and lock the workshop row before checking capacity. Check for an existing active reservation, verify that reserved count is below capacity, insert the reservation, increment the count, and commit. Competing writers for that workshop wait for the lock and recheck the committed state.

Use a consistent lock order across creation and cancellation to reduce deadlock risk. The transaction can still fail or be chosen as a deadlock victim, so define how the application reports or safely retries that outcome. Do not claim a lock makes every operation failure-free.

Cancellation must change an active reservation to cancelled and decrement the count in the same transaction. Repeating a cancellation should not release a second seat. Restrict the status transition so only the first successful cancellation changes the count.

Explain what happens when the response is lost

A reservation can commit even if the client never receives the response. Retrying a create request without a stable request identity can cause duplicate effects.

Have the client reuse an idempotency key for retries of the same logical request. Scope it to the authenticated user, bind it to the request contents, and store its outcome atomically with the reservation. Reject reuse of the key with different contents. Concurrent requests with the same key need a database-enforced uniqueness rule and a defined wait or retry path.

AWS's idempotency guidance describes tokens as a way to recognize repeated requests and avoid duplicate effects. That principle does not mean a network delivers a message exactly once. Define the key-retention period; deduplication cannot be assumed forever after a record expires.

Add complexity only for a specific problem

A cache could reduce repeated availability reads, but it should not decide whether a seat is confirmed. The database transaction remains authoritative. A queue could help send confirmation emails, but an email failure should not undo an already committed reservation.

If reliable notifications are required, write an outbox event in the reservation transaction and process it asynchronously. Consumers must handle duplicate delivery. Do not promise exactly-once email simply because an outbox exists.

If contention around one workshop becomes a bottleneck, measure lock waits and failed requests before proposing partitioning. Splitting a capacity constraint across independent writers makes the invariant harder to maintain; it is not a free scaling upgrade.

Finish with tests and remaining questions

Name tests that target the promise:

  1. Two users compete for one seat; only one is confirmed.
  2. A successful response is lost; retrying the same request does not reserve again.
  3. Cancellation is repeated; capacity is released once.
  4. A transaction fails before commit; reservation and count remain consistent.
  5. An unauthorized user tries to cancel someone else's reservation; the request is denied.

Monitor failed reservations, request latency, lock contention, and divergence between counts and active records. A reconciliation check can detect a bug; it does not replace correct transaction logic.

A bounded design exercise: meeting-room booking

Use a fictional booking service with one important requirement: two users must not successfully reserve the same room for overlapping times. Start with that invariant before discussing scale.

Define the core records and the operation that creates a reservation. Explain how concurrent requests are checked and committed so that an overlap cannot slip between separate validation and write steps. The exact database mechanism depends on the design; simply checking availability in the browser is insufficient.

Next, consider a client retry after a timeout. The user may not know whether the first request succeeded. Explain how a request identifier or another deduplication strategy can avoid creating an unintended second reservation. Then discuss cancellation and notification failures separately from the booking itself.

A useful follow-up is whether a failed email should undo a successful reservation. Explain your consistency choice and recovery path. This small exercise tests correctness, retries, and boundaries without requiring a memorized architecture for a massive global system.

Use a design handoff to expose missing assumptions

After explaining a design, ask a practice partner to describe how a single request moves through it. Do not correct them immediately. Their retelling can reveal a missing relationship that your own explanation silently supplied. This is especially useful when your diagram contains familiar component names but no clear ownership of the important state.

For the booking example, ask the listener to trace two people requesting the last place. Which component decides whether a place remains available? Where is the reservation recorded? What does the second caller see? If the listener cannot answer from your explanation, add the missing responsibility rather than drawing another service.

Now introduce a fictional operational constraint: the service that sends confirmation messages is unavailable. Explain whether the reservation can still succeed, how the caller learns its status and what happens to the message later. Separate the booking decision from the notification. Do not claim that a queue guarantees delivery without discussing failures and the behavior you expect.

Keep a design handoff note with four entries:

  • The requirement the design must preserve.
  • The state transition that enforces it.
  • The failure path you have explained.
  • The implementation assumption that needs validation.

Repeat the walkthrough after changing one requirement. A useful revision updates the affected state or interface; it does not simply add more infrastructure. The system design practice-tool guide explains how to evaluate whiteboard and conversation workflows separately from the technical validity of your design.

FAQ

Do I need to name specific infrastructure products?

Only when the choice helps explain a constraint. First establish required behavior, then discuss how the chosen technology supplies it.

Is a cache required?

Not in every starting design. Explain the read pressure it would address and the stale-data behavior before adding one.

What if I do not know the database's locking details?

State the assumption and the part you would verify. Do not pretend every database provides identical transaction behavior.

Rehearse the reasoning

Use the software engineer preparation page and backend interview questions for related practice. In a mock interview, explain one failure path aloud before introducing another component.