Hello guys! Finally I had some free time to post on this blog
. Today you can read my interview to Eugene Fooksman, a software developer at WhatsApp. As always I hope you will like it!

WhatsApp Eugene?
Paolo – Hello Eugene. Welcome to my blog! Would you like to briefly introduce yourself to our readers?
Eugene - Hello, thanks for inviting me. My name is Eugene Fooksman, I live in Silicon Valley, California, and I’m currently a software developer for the server group at WhatsApp, the company providing multi-platform mobile messaging service.
Paolo - Can you tell us something more about your experience with Erlang? When did you start with it? Why?
Eugene - I started using Erlang only here, at WhatsApp. My previous expertise and long time affection was C++, I used it for many years and, naturally, considered it to be the king of programming languages, as many C++ programmers do.
WhatsApp server is almost completely implemented in Erlang, so I had to learn it when I came here, with certain reluctancy at first, I must admit. But it took no more than about a week to completely fall in love with it.
Paolo - As an Erlang developer, what do you think about this coding language? Do you like it or is it just a part of your work?
Eugene - I like it a lot. Functional nature is a bit hard to accept for a person with object oriented mindset, but once you go over that line – the simplicity of many basic routine things never stops to amaze.
For instance, tail recursion being embedded in the very core and syntax of the language not only compensates for the lack of standard loops, but also totally changes the way you think of anything iterative in your code and provides very reach coding capabilities.
Another such example is pattern matching – very powerful way for processing heterogeneous values returned by the called code. It’s very disappointing for me now to not be able to do it in other languages.
Of course I’m not even talking about the real high-level advantages of Erlang as a perfect platform for concurrent programming and handling multi-user environment, like communication servers. Parallelism, transparency of remote vs local processes, and set of very well defined behaviors (which are essentially implementations of fundamental server concepts and patterns like generic sever, event manager, state machine etc.) – all of this makes writing server systems quite easy and elegant.
Paolo - In your opinion what are the fundamental things an Erlang developer should focus on in order to improve his coding efficiency?
Eugene - I would defi
nitely start with deep understanding of OTP principles and concepts. Supervision models can be a little tricky, but it’s worth spending time and effort figuring it out.
nitely start with deep understanding of OTP principles and concepts. Supervision models can be a little tricky, but it’s worth spending time and effort figuring it out.
OTP has excessive set of tools and patterns, and it’s important to understand which ones are better for specific tasks. For instance, gen_server and gen_fsm can be two competing approaches for the same system. Another important thing is coding discipline and cleanness – something to always be utilized with languages without strong typisation, like Erlang.
Paolo - You are currently working at Whatsapp, can you describe in a nutshell the company?
Eugene - WhatsApp is a small big company.
We deliver billions of messages between millions of users, but at the same time we have only about 35 people working here, only about 20 of them are engineers, which include small mobile teams creating and maintaining client applications for 6 different smartphone platforms, and a server group, making sure all those messages are delivered. With the great team and very concentrated focus on our product – it’s a lot of fun to be here and help creating such a cool service.
Paolo - How long has Whatsapp been using Erlang? Did the company switch from a different language or did you decided to start the project in Erlang from the beginning?
Eugene - WhatsApp server has started from ejabberd – famous open source Jabber server written in Erlang. It was originally chosen because of a group of reasons, including openness, great reviews by developers, ease of start and the promise of Erlang’s long term suitability for large communication system. We started from ejabberd and made just few extensions and changes to get WhatsApp service up and running.
We have spent next few years re-writing and modifying quite a few parts of ejabberd, including switching from XMPP to internally developed protocol, restructuring the code base and redesigning some core components, and making lots of important modifications to Erlang VM to optimize server performance.
Paolo - According to this tweet, on December 2012 Whatsapp hit a new record: 7B msgs inbound, 11B msgs outbound = 18 billion total messages in one day. Do you think erlang helped to achieve such a wonderful results?
Eugene - We are delivering more than 7 billion message every day. It’s a big number, although it is not unheard of among internet and communication giants. Our great achievement is that we manage it with really small server footprint. And the consensus in our team is that it is largely because of Erlang. We’re managing to serve huge amount of connections from single front-end server (this is from last year’s Erlang Factory: https://twitter.com/igorclark/status/185871819427954688). I’m not sure these numbers can be easily matched with other technologies.
Paolo - Do you think you could achieve the same results with other languages? In your opinion, could the final result compete with the Erlang implementation in terms of time and lines of code?
Eugene - Yes, this volume of messages can be (and has been) achieved with other languages, but Erlang definitely makes it very easy, elegant and manageable by small team.
Paolo - As an experienced Erlang developer, what would you like to see in the future Erlang releases? Do you think there is still something missing in this language? Something that could potentially help spreading Erlang to all the developers out there?
Eugene - The are few things that could make writing code just a little easier. For instance, some concept of early returns from within functions and scopes. Also, assumed default values for ‘case’ and ‘if’ statements. Another thing is VM-level implementation of priority messaging for gen_server. Also we hope some of performance improvements to VM we’ve developed at WhatsApp can be adopted and used in future releases.
