Skip to content
System Designer

System design interview preparation

Design a chat system

Design a chat system around durable messages, retries and reconnects. Work through the trade-offs, then build and test the chat app problem.

Play the matching problem

Start with the message promise

A chat system accepts a message, stores it and gets it to the right conversation. Ask when the sender may treat the message as sent. Acknowledging before durable storage can lose an accepted message after a crash. Waiting for every recipient to be online gives a different promise and a different delay. In the game brief below, keep the stated safety and response targets separate so one does not silently replace the other.

Give retries one stable identity

Mobile connections lose replies. A sender may retry even though the server already stored the message. Keep a stable message identity across that retry, and store the outcome with the message so the server can return the same answer. Walk through a crash after storage but before the acknowledgement reaches the phone. Merely adding a queue or a duplicate check is not an explanation of where that identity survives.

Plan for offline readers and reconnects

A connection gateway holds open connections for online devices. Durable history has a different job: it lets a device catch up after it has been away. Estimate open connections separately from messages per second and history reads. Then consider many devices reconnecting at once. A gateway failure can move pressure to history storage even when the normal message rate has not changed. State the ordering boundary, such as one conversation, before promising a global order.

Use the run and explain its limits

Build the connected paths in the matching problem and run a whole day. Predict which part fills first during extra traffic or a lost gateway. Read the debrief, change one decision and compare the result. The traffic run measures capacity, speed, cost and modeled safety. Use the problem’s correctness questions to reason about lost replies, message identity and crash recovery as well. A high traffic score does not substitute for tracing those cases.

The matching game brief

People send short messages to each other from their phones. A message must arrive once, in order, even when the phone is on a bad connection and sends it again. If the other person is offline, the message waits and a notification goes out.

Who uses it
10 million people a month
Audience in plain numbers
10,000,000 people per month
Normal peak
≈ 20,000 requests per second
Request mix
Message: 55%; Sync change: 15%; Read: 10%; Analytics event: 10%; Sign-in: 2%; Notification: 8%
Speed for 99 of 100 requests
Message: ≈ 300 ms; Sync change: ≈ 400 ms; Read: ≈ 400 ms; Sign-in: ≈ 1,000 ms
Successful requests
99.9%
Data safety
No acknowledged write may be lost.
Monthly budget
≈ $60,000
Data at rest
≈ 30 TB
Where users are
North America: 30%; Europe: 30%; Asia Pacific: 40%
Home region
North America
Waiting deadlines
Message: 900 seconds; Sync change: 900 seconds; Read: 900 seconds; Analytics event: 3,600 seconds; Sign-in: 900 seconds; Notification: 900 seconds
Fresh reads
People must see their own changes. At most 0.1% of reads may be stale in the model.
Personal reads
95% of reads are private; a shared public copy cannot answer them.

≈ marks an approximation, just as in the game. Waiting deadlines measure the age of queued work and are separate from interactive response time.

  • A message is about 1 KB (approx.).
  • A delivery receipt ("delivered", "read") counts as an event.
  • Notification speed measures provider acceptance. Device receipt is outside this traffic model; check expiry, provider outcome and retries in the correctness trace before claiming delivery guarantees.

Play the one-to-one chat problem or read the full problem and clarification answers.

Playing on systemdesigner.io needs a free Google or GitHub account. These pages, the lessons and the guides can be read without one. Figures in the game are teaching approximations.

Study the decisions

Read the full walkthrough for estimates, alternatives and failure cases.

More interview practice