WhatsApp System Design
How WhatsApp delivers billions of messages a day: persistent WebSocket connections, a message queue for offline users, media storage behind a CDN, and end-to-end encryption. A classic system design interview question.
How it flows
- Mobile Client → DNS
- DNS → Load Balancer
- Load Balancer → WebSocket Server
- Load Balancer → Auth Service (Authenticate)
- WebSocket Server → Chat Service
- Chat Service → E2E Encryption
- Chat Service → Group Service
- Chat Service → Message Queue (Enqueue)
- Message Queue → Message Store
- Message Queue → Offline Queue
- Offline Queue → Push Notification (Offline Push)
- Mobile Client → Media Upload
- Media Upload → Media Encoder
- Media Encoder → Media Storage
- Media Storage → CDN
- CDN → Mobile Client
- WebSocket Server → Monitoring
- Message Store → WebSocket Server
Components
Group Service · WebSocket Server · Chat Service · Message Queue · Media Upload · Media Encoder · Media Storage · Message Store · Offline Queue · Auth Service · E2E Encryption · Mobile Client · DNS · Load Balancer · CDN · Push Notification · Monitoring