How WhatsApp Scaled to Billions of Users
2 months ago
- #System Design
- #Erlang
- WhatsApp served 900 million users with just 50 engineers, showcasing efficiency through deliberate technical choices.
- Key technologies included Erlang for concurrency, FreeBSD for networking performance, and a modified XMPP protocol for mobile efficiency.
- Erlang's actor model and lightweight processes enabled handling 2+ million concurrent connections per server.
- Supervisors in Erlang's architecture allowed for automatic recovery from crashes, ensuring high availability.
- WhatsApp used Mnesia for fast in-memory data storage and MySQL for persistent data, optimizing performance and scalability.
- FreeBSD was chosen over Linux for its superior networking stack and stability under extreme load.
- End-to-end encryption was implemented using the Signal Protocol, ensuring message security and privacy.
- Media handling was optimized by encrypting files on the client side and using CDNs for distribution.
- Multi-device support required encrypting messages separately for each device, maintaining end-to-end encryption.
- Lessons include choosing the right tools over popular ones, designing for failure, and embracing simplicity.