aws
Famous Companies
advanced
Encrypted messaging at global scale

WhatsApp Messaging System

WhatsApp / Meta

WhatsApp delivers billions of messages daily to 2B+ users with end-to-end encryption and sub-second delivery. The architecture centers on persistent WebSocket connections managed by a connection service, with an intelligent message router that handles online delivery instantly and queues messages for offline recipients. Designed for teams building encrypted messaging platforms that prioritize delivery reliability and end-to-end privacy at scale.

Data Flow

WebSocket API
Connection Manager
Message Router
Presence Service
Offline Queue
Active Sessions
Messages Store
Media Storage

Share this architecture with your network

Service Breakdown (8 services)

Compute3 services
Connection Manager
  • Runs containerized microservices at scale
  • Auto-scales based on CPU and memory utilization
  • Supports rolling deployments and health checks
Message Router
  • Runs containerized microservices at scale
  • Auto-scales based on CPU and memory utilization
  • Supports rolling deployments and health checks
Presence Service
  • Runs containerized microservices at scale
  • Auto-scales based on CPU and memory utilization
  • Supports rolling deployments and health checks
Storage1 service
Media Storage
  • Stores objects with eleven 9s of durability
  • Supports lifecycle policies for cost optimization
  • Serves as a data lake foundation
Networking1 service
WebSocket API
  • Routes and throttles incoming API requests
  • Enforces authentication and rate limiting
  • Provides a unified entry point for microservices
Messaging1 service
Offline Queue
  • Decouples services with reliable message queuing
  • Supports standard and FIFO delivery modes
  • Scales automatically with message volume
Data2 services
Active Sessions
  • Caches hot data in-memory for sub-ms latency
  • Supports Redis and Memcached engines
  • Reduces database load with intelligent caching
Messages Store
  • Provides single-digit millisecond reads and writes
  • Scales throughput automatically with demand
  • Supports global tables for multi-region access

Scaling Strategy

Connection managers scale horizontally with each instance handling thousands of WebSocket connections. The message router uses ElastiCache to look up which connection manager holds each recipient's session. Offline messages queue in SQS with per-user ordering, and DynamoDB stores message history with TTL-based expiry. Media uploads go directly to S3 with pre-signed URLs to avoid bottlenecking the message path.

Related Architectures