TWIL #047 - WhatsApp Ran on Erlang, a Language Built for Phone Exchanges in the 1980s
When Facebook bought WhatsApp for $19 billion, its entire backend was written in a 30-year-old telecom language - and 50 engineers were supporting 450 million users with it.
- #engineering
- #software
- #history
Erlang was designed at Ericsson in the mid-1980s by Joe Armstrong, Robert Virding, and Mike Williams. Its first production use was in telephone exchange switching systems, which demanded properties that mainstream languages at the time couldn't provide: millions of concurrent connections, zero planned downtime, and the ability to update running software without restarting it.
The language was open-sourced in 1998. For most of the following decade, it remained a niche tool mostly used in telecom.
What makes it unusual:
- Lightweight processes: Erlang processes are not OS threads. The BEAM virtual machine schedules its own processes - you can run millions of them simultaneously on a single machine with a small memory footprint per process.
- Message passing: Processes share no memory and communicate only by passing messages. This eliminates an entire class of concurrency bugs (race conditions, deadlocks from shared mutable state).
- "Let it crash": Rather than defensive error handling, Erlang encourages processes to fail fast and be restarted by a supervisor. Fault trees of supervisors make the system self-healing.
- Hot code swapping: Running code can be replaced with a new version without stopping the system - a requirement when telephone exchanges couldn't be taken offline.
WhatsApp: Jan Koum and Brian Acton chose Erlang for WhatsApp's server infrastructure. By the time Facebook acquired the company in 2014 for $19 billion, WhatsApp had approximately 450 million monthly active users and was handling over 50 billion messages per day - with a team of roughly 50 engineers. That ratio (9 million users per engineer) is almost certainly the most extreme in software history.
Individual WhatsApp servers were reportedly handling 2 million concurrent TCP connections - enabled by Erlang's lightweight process model.
The AXD301 telephone switch built in Erlang by Ericsson achieved 99.9999999% availability (nine nines): approximately 31 milliseconds of unplanned downtime per year.