Follow us
Breaking
Tech Services

The history of Erlang as WhatsApp and Cisco keep it alive

Ericsson engineers created Erlang in 1986 to handle high-speed telecommunications requirements. The language enables massive concurrency, allowing WhatsApp to manage over 2 million concurrent processes on a single node while maintaining high efficiency.

Share

Ericsson’s Telecommunications Requirements

Ericsson engineers Joe Armstrong, Robert Virding, and Mike Williams created Erlang in 1986 to meet the requirements of high-speed phone networks. They developed the language on a DEC Vax 11/750 with a 3.125 MHz CPU clock speed. Mike Williams defined the problem domain by the need for systems that perform actions within specific timeframes and control hardware. These software systems must handle large, distributed environments with complex functionality and provide fault tolerance for both hardware failures and software errors. The design requires systems to stay in continuous operation over many years and allow software reconfiguration without stopping the system. In 1998, Ericsson decided to ban all use of Erlang, which led the developers to open source the language. Shortly after, most of the original team quit to start their own company, Bluetail. The "Let it crash" philosophy, popularized by Joe Armstrong, suggests that a program should only express its happy path and signal failure if something goes wrong. This allows a program to fail neatly, as errors are isolated to individual processes. The Ericsson AXD301, an asynchronous transfer mode product, handles encoding and routing data at up to 160 Gbit/s using 2 million lines of Erlang code. This system achieved nine nines of reliability, meaning it experienced only 31.6 milliseconds of total downtime over an entire year. An 11-node version reached 99.9999999% reliability, though documentation for these specific figures remains limited.

The BEAM Virtual Machine and Concurrency

The BEAM virtual machine manages scheduling and memory for Erlang processes. These processes act as tiny, independent units; for instance, one process requires only 236 bytes and spawns in 3 microseconds. This is a significant difference compared to operating system processes, as the iPhone 6 is roughly 65,536 times faster than the Vax 11/750 used during Erlang’s development. Because Erlang uses immutable data, the language eliminates the need for synchronization tools like mutexes, semaphores, or locks. Instead, processes communicate via mailboxes using the actor model. This approach ensures that if one process fails, a supervisor process restarts it according to a predefined strategy, such as the "one_for_one" restart strategy. Erlang provides behaviors like gen_server, gen_event, gen_fsm, supervisor, application, and release. These behaviors permit programmers to write sequential code. The development of Erlang evolved from a Prolog implementation to the JAM (Joe’s Abstract Machine) and finally to the BEAM compiler in 1993, while projects like the Jericho compiler and the High-Performance Erlang (HiPE) group worked to increase execution speed by translating code into machine code. The language is functional, meaning it uses recursion and pattern matching instead of classes, objects, loops, or traditional if statements. The newer language Elixir provides an alternate syntax and additional features, such as the pipe operator, which allows developers to chain different functions together without repeatedly reassigning new variables. The syntax of Erlang remains weird to many programmers, which keeps the language on the fringes of the coding community. You probably already know that most languages struggle with concurrency, but Erlang treats it as a fundamental principle.

Specification Erlang/Telecom Detail
AXD301 Throughput 160 Gbit/s
AXD301 Reliability Nine nines
Vax 11/750 Clock Speed 3.125 MHz
WhatsApp CPU Usage (2.2M connections) 37.9%

WhatsApp and Global Scale

WhatsApp employs about 50 engineers to serve 900 million users. The company uses Erlang and FreeBSD to manage its messaging infrastructure. When Facebook acquired the startup for $19 billion, the company had 35 engineers and 450 million users. In 2012, WhatsApp managed 2,277,845 TCP connections on one server with 37.9% CPU usage while employing only 30 people. Software engineer Jamshid Mahdavi joined WhatsApp two years after the startup began. The company focuses on minimalistic problem solving to maintain high-scale infrastructure. The recruitment strategy involves hiring the best and brightest engineers and expecting them to learn Erlang within their first week. This approach differs from Facebook, which rebuilt its Chat app to better fit its existing infrastructure after initially building it in Erlang. WhatsApp engineers use persistent TCP connections to facilitate bidirectional communication, allowing the server to push messages instantly. Because each connection maps to at least one process, WhatsApp ran more than 2 million processes concurrently on a single node. The Ericsson AXD301 handles encoding and routing data at up to 160 Gbit/s using 2 million lines of Erlang code, which achieved nine nines of reliability through its complex, distributed architecture. Nine nines of reliability means that over the course of a year, there was only 31.6 milliseconds of downtime. While companies like Google and Mozilla use Go and Rust, and Facebook uses Haskell for its anti-spam system, WhatsApp relies on Erlang to handle its massive concurrency needs. How can a team of fifty maintain such massive scale?

Share

Technewsdaily

Senior tech writer covering AI, gadgets and cybersecurity. Breaking down the news that matters, every day.