Design WhatsApp
Design WhatsApp: Architect a scalable, highly-available distributed system capable of sustaining 60,000 peak RPS (40% reads). Maintain p99 latency under 50ms with 99.9% availability while optimizing monthly infrastructure cost within $850/mo.
| Category & Difficulty | Real-Time & Messaging · EASY |
|---|---|
| Traffic Profile | 60,000 RPS sustained, 84,000 RPS spike (40% reads / 60% writes) |
| Latency & Availability SLA | p99 < 50 ms · 99.9% availability |
| Monthly Infra Budget | $850/month |
| Commonly Asked At | Meta, Apple, Telegram |
Scale, traffic & SLA targets
To pass in the DesignTheSystem simulator, your architecture must hold all four targets simultaneously across a 60-second load run (spiking up to 84,000 RPS):
- Connections (Every online phone): Each phone keeps one long-lived connection to a chat server.
Functional & non-functional requirements
Functional scope
- Send a message to a person or group.
- Receive messages instantly when online, and later when back online.
- See sent, delivered and read status.
Non-functional goals
- p99 latency under 50 ms at the spike.
- At least 99.9% of requests answered.
- Costs no more than $850 a month.
- Messages arrive in the order they were sent within a chat.
- No message is lost.
Core challenge: Push to an open connection
Each phone keeps a connection open. Find which server holds the receiver's connection, pass the message there through a broker, and store it until it is delivered.
What breaks first?
Each phone holds a WebSocket to one chat server. A small shared store (Redis) records which server each user is connected to. To deliver, look up the receiver's server and hand the message to it.
Key architectural trade-offs
- Messages can arrive twice after a failure, so clients drop duplicates by message id.
- Ordering is guaranteed within a chat, not across chats.
Starting architecture & how to practise
The simulator starts you with a baseline setup: Traffic Ingress → App Service Tier → Primary Database. Run the baseline under 60,000 RPS to watch exactly which component saturates first, then add caching, queues, replicas, sharding or CDN until latency, availability and cost all turn green.
Common interview questions for Design WhatsApp
What are the target SLA and scale numbers for Design WhatsApp?
Design for 60,000 RPS sustained (spiking to 84,000 RPS) with a 40% read / 60% write mix, keeping p99 latency under 50 ms, availability at or above 99.9%, and infrastructure spend within $850/month.
What is the main architectural bottleneck in Design WhatsApp?
Each phone keeps a connection open. Find which server holds the receiver's connection, pass the message there through a broker, and store it until it is delivered.
How can I verify my Design WhatsApp architecture works under load?
Open the live simulator to wire up load balancers, caches, queues, replicas, or shards and run a 60-second traffic simulation that grades latency, error rate, and monthly cost automatically.
Recommended lessons before you build
Real-time fan-out with pub/sub
Deliver one message to many connected users within a second.
Queues: accept now, work later
Move slow work off the request and keep a queue from falling behind.
Shared state every server can see
Keep fast-changing state in one shared place instead of inside each server.
Related Real-Time & Messaging problems
Push Notification Pipeline
Ingest and deliver 100,000 event notifications/sec (95% writes). Decouple ingest from delivery workers to guarantee p99 ingest latency under 300ms.
Chat App Message Broker
Deliver 80,000 messages/sec (70% message writes). Scale consumers and partitions to keep p99 latency under 120ms without unbounded lag.
Design Slack
Design Slack: Architect a scalable, highly-available distributed system capable of sustaining 60,000 peak RPS (40% reads). Maintain p99 latency under 50ms with 99.9% availability while optimizing monthly infrastructure cost within $850/mo.
Design Live Comments
Design Live Comments: Architect a scalable, highly-available distributed system capable of sustaining 60,000 peak RPS (40% reads). Maintain p99 latency under 50ms with 99.9% availability while optimizing monthly infrastructure cost within $850/mo.