Exercise · Communication

WhatsApp — Chat at Planet Scale

Whiteboard exercise. Try the problem cold, then reveal the rubric to self-score.

Out of 10 points45 min whiteboardReference solution →
01

Prompt

Design WhatsApp. 2B users, ~100B messages/day, end-to-end encrypted, works on flaky mobile networks, ~1-sec delivery when both online.

Time budget: 45 min whiteboard. Draw architecture, estimate numbers, discuss tradeoffs.

02

Hints (progressive — click to reveal)

Hint 1

E2E encryption changes storage design — server stores ciphertext blobs, not message content. Can't search server-side.

Hint 2

Offline queue: recipient offline = message held at server, delivered on reconnect.

Hint 3

Per-user mailbox sharding is the core partitioning choice.

03

Rubric — 10 points

  • +1 BoE: 100B/day → ~1.2M msgs/sec avg, peaks ~3M/sec; ~10KB avg (text); ~1MB (media)
  • +2 E2E encryption via Signal protocol (X3DH + Double Ratchet); server never sees plaintext
  • +2 Per-user mailbox sharded by user_id; messages held until ack from recipient's device
  • +1 Persistent WebSocket (or XMPP) per device for push; reconnect replay on window
  • +1 Media separately in S3-like blob store, referenced by metadata; expire after recipient fetches
  • +1 Delivery receipts + read receipts as explicit events; privacy settings gate
  • +1 Group chat: server broadcasts to all members' queues; each is encrypted per-recipient (Sender Keys)
  • +1 Addresses cold-start: first-time device auth + key exchange; backup encrypted with user-held key

Self-score: tally the points you would have mentioned unprompted. 7+ is interview-ready on this problem.

04

Red flags (things that tank the interview)

  • Stores messages in RDBMS with billion-row table
  • Proposes server-side search of chat history (breaks E2E)
  • Doesn't mention E2E at all
  • Ignores offline delivery (assumes both parties always online)
  • Group chats via single 'group message' row (doesn't scale or re-encrypt per recipient)