LeetDesign
← All problems
Hard

Design a Chat Message Store

Persist every message of a global chat app. Twenty thousand quorum-acked writes a second inside a 100ms budget — the problem where the write path is the whole design.

Design the storage backbone of a chat app: sends persist a message, opens fetch recent history, and the conversation list shows what's unread. Realtime delivery (sockets, push) is out of scope — this is the system of record underneath it.

The defining stream is sends: tens of thousands per second at the New Year's Eve peak, every one irreplaceable, every one acknowledged to a person watching a spinner. No acked message may be lost, which means multi-copy quorum writes — and the quorum tax lands inside a 100ms send budget. Reads are gentler: mostly the hot tail of active conversations, which a short-TTL cache may serve as long as nobody is shown a two-second-old lie about what arrived.