AdvancedSystem-Design
45 min
Design a Real-Time Chat System
RealtimeMessagingStorageNetworking
Advertisement
Interview Question
Design a web/mobile chat system with 1:1 and group chats, typing indicators, presence, read receipts, and offline support.
Key Points to Cover
- Transport: WebSockets/HTTP2, fan-out, connection gateways
- Data model: conversations, messages, membership, ACLs
- Ordering/delivery: IDs, vector clocks/lamport, exactly-once effects via idempotency
- Scaling: sharding by user/conversation, partitions, backpressure
- Mobile/offline: sync, conflict resolution, compaction
- Moderation/security: E2EE vs server-side features trade-offs
Evaluation Rubric
Real-time transport and fan-out plan25% weight
Sound schema and delivery semantics25% weight
Sharding, load, and backpressure25% weight
Offline, presence, and receipts25% weight
Hints
- 💡Consider gateway layer (e.g., Envoy) for millions of sockets.
Potential Follow-up Questions
- ❓How would you support E2EE?
- ❓How do you handle message edits/deletes?
Advertisement