Design a scalable real-time chat system
System Design: Real-Time Chat (1:1 and Groups)
Design a mobile-first, globally available real-time chat system that supports both 1:1 and group messaging at large scale (target: 100 million daily active users). The system should be multi-region, with clients primarily being mobile apps that may have intermittent connectivity. Prioritize low latency and high availability.
Explicitly cover the following areas:
- API Design: Send, receive/sync, acknowledgments (acks), message ordering, and idempotency semantics.
- Features: Read receipts, typing indicators, and online presence.
- Architecture: Fan-out strategy (write vs. read; hybrid), storage tiers (hot vs. cold) and media/attachments handling, indexing and data model, replication and sharding strategy, and consistency vs. availability trade-offs.
- Delivery: Offline delivery and retries via push notifications.
- Safety: Rate limiting, spam/abuse controls, and end-to-end encryption considerations (1:1 and groups).
- Scale: Back-of-the-envelope capacity estimates for 100 million DAU.
- Operations: Monitoring, observability, and disaster recovery.
Make and explicitly state any reasonable assumptions.
AI interview prep
Core dilemma
Balancing real-time delivery guarantees (low latency, high availability, message ordering) with the challenges of intermittent mobile connectivity, global distribution, and massive user scale.
3 tradeoffs and 3 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Design a scalable real-time chat system
System Design: Real-Time Chat (1:1 and Groups)
Design a mobile-first, globally available real-time chat system that supports both 1:1 and group messaging at large scale (target: 100 million daily active users). The system should be multi-region, with clients primarily being mobile apps that may have intermittent connectivity. Prioritize low latency and high availability.
Explicitly cover the following areas:
- API Design: Send, receive/sync, acknowledgments (acks), message ordering, and idempotency semantics.
- Features: Read receipts, typing indicators, and online presence.
- Architecture: Fan-out strategy (write vs. read; hybrid), storage tiers (hot vs. cold) and media/attachments handling, indexing and data model, replication and sharding strategy, and consistency vs. availability trade-offs.
- Delivery: Offline delivery and retries via push notifications.
- Safety: Rate limiting, spam/abuse controls, and end-to-end encryption considerations (1:1 and groups).
- Scale: Back-of-the-envelope capacity estimates for 100 million DAU.
- Operations: Monitoring, observability, and disaster recovery.
Make and explicitly state any reasonable assumptions.