How to run a WhatsApp-style chat design in a 45-minute interview: persistent connections, persist-before-ack delivery, ordering, group fan-out, presence and E2EE.
Published September 21, 2026
This lesson is the interview version of a chat system design: what to ask, what to draw, which deep dives to expect. The full reference design is the case study Design WhatsApp in this chapter.
A messaging system has one job that sounds simple: get a message from one phone to another fast, in order, exactly as sent, even if the recipient is offline for a week. The difficulty is doing it for billions of users over unreliable mobile networks, with delivery and read receipts, and with servers that can't read the content (end-to-end encryption).
Say which properties matter most: low latency, no message loss, per-conversation ordering, and privacy.
Phone A ββ persistent connection βββΆ Gateway / Chat server 1 ββ
β "who holds B's connection?"
Session registry (userId β server)
β
Phone B βββ persistent connection ββ Gateway / Chat server 2 ββ
β
Message store (per-conversation, append-only, until delivered/acked)
β
Push service (APNs/FCM) for offline recipients
userId β which server holds their connection, stored in a fast replicated key-value store.The write pattern is massive, append-only, and read "latest first per conversation". A wide-column store (Cassandra-style) fits: partition key = conversation ID, clustering key = message sequence/time. Writes are cheap appends, and reading recent history is one partition scan. With the relay model, messages are deleted after all recipients ack, which keeps storage bounded.
For a group of N members, the server stores the message once and fans out delivery to each member's connection or pending queue. With groups capped at a few hundred, fan-out on write is fine. That's also why group sizes are capped. For huge broadcast channels you'd switch to fan-out on read (members pull from the channel's log).
"Online / last seen" is updated by heartbeats: the connection itself, or a ping every ~30 s. A user is considered offline after missing a few. Broadcasting every status change to every contact is enormously chatty, so presence is sent only to users currently viewing that chat, and updates are batched. It's acceptable for presence to be slightly stale.
With the Signal protocol, each device has key pairs, and senders encrypt with keys only the recipient's devices hold. The server stores and forwards ciphertext it cannot read. Design consequences: the server can't search or moderate content, and multi-device support means encrypting per device. Mention it as a constraint the architecture must respect, not something to design cryptographically in the interview.
Images and videos don't travel through the chat pipeline. The sender uploads the (encrypted) file to blob storage behind a CDN and sends a small message containing the reference and the key. That keeps chat servers handling only small messages.
Q: A chat server with 500,000 connections crashes. What happens? A: Those clients detect the dropped connection and reconnect, with jittered exponential backoff so they don't stampede, through the load balancer to other servers. The session registry updates to their new servers. No messages are lost, because messages are persisted before being acked, and anything not yet delivered is still in pending queues and is fetched on reconnect.
Q: How do read receipts work in a group? A: Each member's client sends a small read acknowledgement for the latest message it displayed. The server tracks the highest-read sequence per member and aggregates it for the sender ("read by 12 of 40"). Receipts are batched and low priority, because they're far more numerous than messages.
Q: How do you support the same account on a phone and a laptop? A: Treat each device as a separate endpoint with its own connection and keys. A message to a user is delivered, and encrypted, once per device, and each device acks independently. The session registry maps a user to several connections.
Q: How would you estimate the number of chat servers? A: Start from concurrent connections. Say 500 million concurrently online, and a well-tuned server holding ~500k idle connections: that's on the order of 1,000 servers, plus headroom for failover and peaks. Then check message throughput (~1β2 million/s spread across them) as a second constraint.