Erlang is a general-purpose concurrent, garbage-collected programming language and runtime system. It stays strong while building concurrency programs. Erlang provides language-level features for creating and managing processes with the aim of simplifying concurrent programming. It has large application in many chat service well known now such as Whatsapp and initial version of Facebook chat.
Previously we have written an article Use of Erlang in WhatsApp. In this post, we will talk about the story about use of Erlang in Facebook chat. The initial version of Facebook chat is developed by Adam D'Angelo, an early Facebook employee.
While Adam was in college he made a prototype of a chat website with Erlang because it seemed like the ideal language for the task and also it was a chance to have fun learning a new language according to him.
Later Rebekah Cox , Ari Steinberg and Adam worked on the initial Facebook chat prototype as part of a hackathon project in early 2007. Some of the Erlang code were pulled from his personal project while in college. When they decided to make it an official project and productionalize the server code, the team decided to stick with Erlang and took over the code from there.
The rationale was something like:
- They already have a working prototype to start from.
- Erlang is good at holding a ton of open connections, which is the hardest part of a chat service.
- Erlang is easy to learn, even though very few engineers already know it.
The last point, lack of expertise, is a real weakness of the language, but it was outweighed by other factors at the time. Ultimately it contributed to Facebook's decision to move the service to C++, though even with the knowledge that it would eventually be rewritten, It was the right choice to use Erlang for the initial version because of the limited resources they had at the time. It was probably also the right choice for WhatsApp for the same reason.
You can read Ben Maurer's answer to When did Facebook switch away from using Erlang for Facebook Chat? for more details about why Facebook later switched.
Thank for a great piece. There's this one thing that is not clear to me. Have they switched to C++ or haven't they? I mean there's an intention, obviously, but seems like they are only talking about it and not giving up the work with Erlang. Am I right?
Also, not only Facebook but Amazon, What'sUp and Delicious and more have or had Erlang projects.