Design brief
Design direct and small-group chat for one million simultaneously connected devices and 20,000 new messages per second averaging 1 KB. Five receiving devices per message implies roughly 100,000 live deliveries per second. Require durable ordered conversation history, safe sender retries, and recovery for disconnected devices. Presence and typing may be best effort. State acknowledgement and cross-region latency expectations.
Draw and explain
Use Excalidraw to label connection ownership, conversation ordering, durable messages, membership authorization, and live fanout. Draw separate send, online delivery, and reconnect flows. Mark retry identities, per-conversation ordering evidence, device progress, and the durable commit acknowledgement. Estimate connection, storage, and fanout capacity separately. Explain how adding gateways differs from scaling a hot conversation's writer.
Stress the design
A message commits, but its sender acknowledgement is lost. Meanwhile, a receiving device observes sequence 10 before sequence 9. Trace the sender retry and receiver reconnect without creating a new message or skipping the gap. Next, restart a gateway serving many devices; show the recovery source and how reconnect traffic is bounded.
Review your design
Compare one ordering authority with regional write availability and latency. Check membership on subscriptions and history reads, read-after-write behavior, and duplicate live/replay delivery. Explain how large broadcast rooms would change the design. Choose signals for commit delay, fanout lag, sequence-gap duration, connection churn, and replay pressure.
Capture assumptions, sizing, and the tradeoffs behind your diagram.
Review is your own assessment of the design.