In February, Facebook acquired the company WhatsApp for $19 billion. WhatsApp serves over 465 million users and there are over 40 billion messages sent in and 19 billion messages sent out every day. Although the company has scaled drastically, they have maintained an uptime of 99%. How have they managed these feats? As WhatsApp engineer, Rick Reed mentioned at Erlang Factory, Erlang is their “secret sauce,” and that has put the language in the spotlight.
Erlang is an open source programming language designed for writing scalable, fault-tolerant, concurrent, distributed, non-stop, soft real-time applications. The language is used in telecoms, banking, chat and more. Although Erlang supports a variety of industries, it is considered an “exotic”, “niche”, and “rare” language.
Joe Armstrong, Robert Virding and Mike Williams invented Erlang while working in the Ericsson Computer Science Laboratory. The first version was released in 1986 but it remained proprietary until 1998 when it was released open source.
“I think Erlang was web scale even before the web was invented. The focus was no down time and high availability, ensuring that when you pick up your phone, you will hear that tone on the other end, no matter what,” said Francesco Cesarini, the founder and Technical Director of Erlang Solutions. Erlang Solutions provides support for the Erlang language and is an active player in the community. The company hosts multiple conferences around the word, including Erlang Factory, which was held March 6th and 7th in San Francisco.
Every year, the Factory attendance steadily increases; around 80% of the attendees are returning and 20% are new. A few hundred people attended last week’s Erlang Factory, which set a new record. The technologies ranged from messaging applications like Whisper and WhatsApp to gaming companies like MachineZone, and Basho, provider of distributed database software. The attendees were visibly excited, especially at the heavily anticipated talks given by WhatsApp engineers Rick Reed and Anton Lavrik.
“I think the acquisition of WhatsApp by Facebook is going to make a lot of people open their eyes,” said Mike Williams, co-inventor of Erlang. “What kind of effect that’s going to have, I don’t know, but certainly not negative.” Williams compared the WhatsApp hype to the attention Erlang garnered in 2008 when Joe Armstrong published the first edition of Programming Erlang: Software for a Concurrent World.
“WhatsApp has highlighted the business side of running Erlang. They’ve got 6 engineers managing the server side network. It’s no news to those of us who have been working on [Erlang] but I think it’s a perfect case study of how you get a much higher productivity and lower maintenance costs when using a technology like Erlang OTP,” said Cesarini.
This emphasizes a major issue with Erlang: it’s not heavily marketed. Until Erlang Solutions was founded in 2004, there were few efforts made to promote the language. Many of the companies that use Erlang refrain from discussing it for competitive reasons.
“There’s a lot of people who don’t want Erlang used widely because their competitors will jump on the bandwagon and they’ll be losing a large competitive advantage. A lot of Fortune 500 companies are very traditional in the way of working, they’re using open source but they’re not endorsing it. They’re focused on building value for their shareholders,” said Cesarini.
Erlang is a component of Ericsson, which has about a 35 percent global market share in the wireless network infrastructure. Every time your phone gets assigned an IP address, there’s a 35-40 percent chance it’s Erlang equipment that’s giving you the address. However, Ericsson does not necessarily benefit from sharing this fact, and does not evangelize the use of Erlang. Erlang also supports CouchDB, which is a database used by numerous companies including Cloudant, a DBaaS that was recently acquired by IBM. Basho’s Riak is an open source distributed database that is supported by Erlang and is widely used by companies like GILT, Braintree and major organizations like Britain’s National Health Service. However, the companies using CouchDB and Riak don’t have to know Erlang to use the databases, which leaves Erlang as the “secret sauce” in many company infrastructures.
Another issue facing Erlang is the syntax. Functional programming is gaining popularity due to the multi-core revolution, but it still remains new territory for many developers. Those who are interested in functional programming and its benefits of concurrency are often deterred by Erlang’s syntax.
“I was working on making [Ruby on Rails] concurrent so it could use the full force of the machine. It was really, really hard,” said Jose´ Valim, Ruby on Rails core programmer and creator of Elixir. “At that point, I started to explore and see what’s out there. When I started to look at languages like Erlang, Clojure and Haskell, I realized it was a huge shift. I felt Erlang was missing some things that I really like, like being able to meta-program or having a polymorphic dispatch mechanism, and that’s what led to Elixir.”
Elixir is a functional, meta-programming aware language built on top of the Erlang VM. Valim wrote the first commit for Elixir in 2011 but it wasn’t until January 2012 that he released version 0.5.
“Elixir reduces the barrier to entry for people from a Ruby background, which is a sizable community and it allows you to do things you can’t do with Ruby. It’s still very early days, but the two languages are very complimentary. It’s addressing the needs of a wider user base and as a result, it increases the number of available libraries and the tool chain associated with it,” said Cesarini.
Cesarini, Williams and Virding are all enthusiastic about Elixir because it is bringing new people in to the Erlang community. However, there are some members of the community that are less than excited about Elixir. “I think it’s the Stockholm Syndrome, pun intended,” said Yurii Rashkovskii, CTO of bex.io and Elixir core contributor. “It’s a sense of belonging and they’ve been protecting their own thing for years and years.”
Elixir’s new syntax, tools, semantics and culture may cause growing pains amongst the community, but Valim is dedicated to keeping it united. Unless another virtual machine is developed, both Erlang and Elixir will continue to revolve around Erlang VM. The creators of Erlang and Elixir hope that this will grow the community as well as the libraries and other resources within it.
Erlang’s expanding community and capabilities give the language a promising future. Cesarini feels Erlang will be a key player in the Internet of Things. Its built-in distribution will allow developers to build and create ad hoc mesh networks where connectivity is otherwise unstable. Cesarini and Virding would also like to see Erlang in outer space.
“Joe Armstrong, the inventor of Erlang, used to work for the Swedish Space Agency and he wrote around 90% of the Viking satellite, the first satellite Sweden ever sent up into space and indeed that satellite was in service for a long time, it never failed,” said Cesarini. “Today, you’ve got the Parallella Board from Adapteva, which has dual core processors. It consumes 5 watts of energy and costs $100. That’s the type of hardware platform you’ll see when you’re running Erlang on the moon. Erlang will act as the orchestration layer. I don’t think we’re that far away from it.”