Curriculum · Module 10, Design Walkthroughs
Design a chat system
Hold persistent connections on gateway servers and order messages with sequence numbers. Acknowledgements, resends and duplicate checks give delivery, and offline inboxes and presence fill the gaps.
What each topic covers
- Chat needs open connections, a clear order, and delivery that survives a lost packet, a dead server and a phone that is off.
- Size the connections and the message rate, then define the send call, the connection protocol and the stores.
- Send messages through four gateways with loss, crashes and offline users, and compare showing on arrival with holding for order.
- A resend fixes a lost message and breaks the order. A sequence number puts it right, at the price of a wait.
- Gateways hold the open connections. A routing table says which gateway holds which user, and a crashed gateway sends its users back to reconnect.
- Receipts are messages about messages. The offline inbox is the same sequence read later. Presence is a heartbeat that expires.
- Three quick checks on order, duplicates and offline delivery, with the sources behind the lesson.
Topics
Practise this lesson
8 interview questions on chat system, with worked answers and sources.
Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms