WhatsApp Architecture

Billions of messages a day with a famously small engineering team.

On the roadmap:Software Architect · step 5: Learn from the giants

Overview

WhatsApp relies on Erlang's lightweight processes to hold millions of persistent connections per server, with a store-and-forward model for message delivery.

Architecture highlights

  • Erlang/BEAM for massive concurrency
  • Persistent connections over a custom XMPP-derived protocol
  • Store-and-forward delivery with acknowledgements
  • End-to-end encryption using the Signal protocol

Architecture diagram

Key components

  • Chat servers

    Hold long-lived client connections

  • Message queue / store

    Holds messages for offline recipients

  • Presence service

    Tracks online status and delivery receipts

  • Media storage + CDN

    Stores and serves images, video and voice notes

Challenges and trade-offs

  • Connection density

    Millions of sockets per host need cheap per-connection memory.

  • Offline delivery

    Messages must be persisted until the recipient reconnects.

  • Encryption at scale

    Key exchange and group fan-out must remain fast.

Study: WhatsApp

Learn how WhatsApp is built from the people who explain it. Watch first for the picture, then read for the detail.