Joe Armstrong had fault tolerance in mind when he designed and implemented the Erlang programming language in 1986, and he was subsequently the chief software architect of the project which produced Erlang/OTP, a development environment for building distributed real-time high-availability systems. More recently Joe wrote Programming Erlang: Software for a Concurrent World. He currently works for Ericsson AB where he uses Erlang to build highly fault-tolerant switching systems.
DDJ: Joe, what's unique about Erlang as a language? Why do we need a language like it?
JA: Erlang is a concurrent functional programming language. Basically there are two models of concurrency:
- Shared state concurrency
- Message passing concurrency
Virtually all language use shared state concurrency. This is very difficult and leads to terrible problems when you handle failure and scale up the system.
Erlang uses pure message passing concurrency. Very few languages do this. Making things scalable and fault-tolerant is relatively easy.
Erlang is built on the ideas of:
- Share nothing. (Process cannot share data in any way. Actually, this is not 100% true; there are some small exceptions.)
- Pure message passing. (Copy all data you need in the messages, no dangling pointers.)
- Crash detection and recovery. (Things will crash, so the best thing to do is let them crash and recover afterwards.)
Erlang processes are very lightweight (lighter than threads) and the Erlang system supports hundreds of thousands of processes.
It was designed to build highly fault-tolerant systems. Ericsson has managed to achieve nine 9's reliability [99.9999999%] using Erlang in a product called the AXD301. [Editor's Note: According to Philip Wadler, the AXD301 has 1.7 million lines of Erlang, making it the largest functional program ever written.]
DDJ: So are programmers really using Erlang in the real world, or is it solely of academic interest?
JA: Absolutely. Commercial use is far greater than academic. It was developed at the Ericsson Computer Science Lab for building fault-tolerant systems. It's used by Ericsson in a number of products.
Outside of Ericsson, Erlang is used by a number of start-ups for building high-performance servers. Most notably ejabberd which is a jabber server. This is probably the best featured and fastest free jabber server on the market, it's being used as a back-end in a lot of products.
Some pretty fast-moving startups in the financial world have latched onto Erlang; for example, the Swedish www.kreditor.se. Erlang gives them a great commercial advantage over their competitors.
DDJ: It seems that, what with multi-core processors and the like, we're rapidly approaching the day of commodity parallelization. When you designed Erlang in the 1980s, did you ever expect parallel systems would be a commodity, or did you see it as primarily a language for high-performance computing only?
JA: It was never a language for high-performance computing. It was a language for building fault-tolerant distributed systems. Ericsson has always used parallel hardware in its switching products -- right from the AXE in the mid 1970s. There is a "school" of parallel programming inside Ericsson. Erlang is the third language in a progression of languages: PLEX -> Eri-Pascal -> Erlang.
The Erlang philosophy was always to build system with lots of cheap processors and allow them to fail. We don't prevent failure; we live with it and recover when failures occur. That's what Erlang was designed to do. That's why there is "no shared state". Shared state and failure are ill-suited bed-fellows.
Today multi-cores are really like "distributed system on a chip" with very high-speed message passing. Since we have share-nothing and concurrency, Erlang programs map beautifully onto multi-cores. Ericsson is shipping products on dual-cores that run virtually twice as fast as the uni-cores with only tiny changes to the code.
DDJ: In addition to your book Programming Erlang, can you point readers to websites where they can find out more about this most interesting programming language?
JA: Yes, there is the Open Source Erlang site at www.erlang.org which, among other things, includes the full source code of the current Erlang system. Then there is the Erlang community site at www.trapexit.org.