Design a Chat System like Google Chat
Quick Overview
Design a real-time messaging system. Cover message delivery guarantees, presence indicators, group conversations, message search and history, and handling millions of concurrent connections via WebSockets.
0
Design a real-time messaging system. Cover message delivery guarantees, presence indicators, group conversations, message search and history, and handling millions of concurrent connections via WebSockets.
This is a Google system design onsite question grounded in products like Google Chat inside Workspace. The interviewer checks how you hold millions of WebSocket connections, guarantee delivery and ordering, fan out to groups, and support presence and search over history.
What the Interviewer Expects
- Define delivery guarantees, such as at least once with client-side dedup
- Design a connection gateway layer for millions of WebSocket sessions
- Explain message routing and fan-out for group conversations
- Choose storage for message history and a separate index for search
- Handle presence and typing indicators without overloading the system
- Address reconnects, offline delivery, and per-conversation ordering
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How do you route a message to a recipient connected to a different gateway server?
- How do you handle fan-out for a room with 100,000 members?
- How do you sync history when a user reconnects after a week offline?
- How would you support end-to-end encryption, and what does it break?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
- Functional Requirements:
- Real-time messaging with delivery guarantees (at least once).
- Presence indicators to show if users are online, offline, or typing.
- Support for group conversa...
Capacity Estimation
Assuming Google Chat targets 50 million active users:
- Active Users: 50 million.
- Messages per User per Day: Average of 20 messages.
- Total Messages per Day: 50M users * 20 messages = 1...