Huffington Post Engineering and Erlang

Why is Erlang important? To put it simply, the world of CPU computing and the impact to the applications that run on them has changed, somewhat drastically.
This post was published on the now-closed HuffPost Contributor platform. Contributors control their own work and posted freely to our site. If you need to flag this entry as abusive, send us an email.

On September 14th, The Huffington Post will be sponsoring the Erlang Factory Lite conference in New York, and on October 4 the Chicago Erlang Factory Lite conference, where I will be a presenter. Erlang Factory Lite is a one-day conference focused on the Erlang programming language. As the multi-core revolution is changing the software world, Erlang started receiving serious attention because of its unique, scalable and intuitive approach to concurrency. This event brings together the growing community that uses Erlang in order to showcase the language and its application to today's growing distributed environments. Here at the Huffington Post, we have been fairly active with Erlang for over a year now and the experience and results have been nothing short of incredible. My talk at the conference will be about our use of Erlang, SockJS and RabbitMQ to power a real-time architecture for our commenting system on Huffpost Live and our soon to be released Activity Stream project codenamed "Fiji."

For those not familiar with Erlang, Erlang is an open source programming language designed specifically for writing scalable, fault-tolerant, concurrent, distributed, non-stop, soft real-time applications. It has seen a steady adoption in both large-scale industrial software development and in small agile teams in startups. It is used for highly available systems and can provide uptime of up to five nines. It is designed for massive concurrency and its design makes it an ideal candidate for scalability on multicore architectures (as you will see below).

So, why is this important? To put it simply, the world of CPU computing and the impact to the applications that run on them has changed, somewhat drastically. Just under 10 years ago, CPUs would continue to get faster and faster as the upgrade cycle from Intel and AMD continued, so your applications would easily benefit from the constant CPU speed increases. Upgrading from a 2.3Ghz CPU to a 3.04Ghz CPU was a simple and standard process of deploying your apps on better hardware. However, as Herb Sutter notes in his article, "The Free Lunch Is Over" and we can no longer count on raw CPU muscle alone.

If you look at Herb's CPU chart, it clearly indicates a dramatic shift around 2005. CPUs no longer continued to increase in speed and their speeds went relatively flat. He notes that to circumvent this problem, three approaches will be taken by chip vendors (we will focus on one) and those are Cache, Hyper-Threading and Multi-Core. Our focus is on multi-core, which is the concept of running multiple CPUs on a single chip. This fundamentally changes how we think and write software applications, as they will no longer get faster with CPU upgrades, since the speeds have leveled off. So how do engineers writing applications solve this problem? As Herb notes in his article, "But if you want your application to benefit from the continued exponential throughput advances in new processors, it will need to be a well-written concurrent (usually multithreaded) application. And that's easier said than done, because not all problems are inherently parallelizable and because concurrent programming is hard."

This is where Erlang comes in for us. As I mentioned earlier, the whole premise of Erlang's design is making use of concurrency on the hardware. Erlang allows us to leverage an extremely powerful language to get the scale we need for a site that receives as much traffic as we do. Erlang is very "core aware" and has built in mechanics to know how to properly "schedule" work on as many core as the system has available. By simply adding more cores to a server, you are automatically giving Erlang more "slots" to schedule work into. Erlang is completely aware of the hardware it is running on and how to best leverage it for concurrency without requiring any modifications to the application.

This is a pretty powerful concept and why Erlang has seen tremendous growth recently for a language that has been around for nearly 27 years. It is also a big reason that we chose it as a critical piece of our technology stack. For something as concurrent and real-time as a commenting platform or an activity stream, we want to leverage technology that will allow us to easily go from say 100,000 to 200,000 users on a single server with little to no effort. Granted, for companies out there like WhatsApp, they have managed to get over 2 million connections on a single box as seen here in their post 1 million is so 2011, which is a great testament to the power of Erlang.

Our main use for Erlang has been in the real-time commenting system for HuffPost Live and for our upcoming activity stream project ("Fiji"). My talk at Erlang Factory Lite will go into the architecture and future of our Erlang real-time platform that powers these products we call internally "outbreak." Leveraging frameworks and technologies such as SockJS and RabbitMQ, we have been able to accomplish some very exciting and impressive results with Erlang. Erlang has been an important part of the Huffpost platform and will continue to play a key role for us in the future as well.

If you are interested in attending Erlang Factory Lite NY please click here and be sure to follow the team on twitter @erlangfactory

If you are interested in attending Erlang Factory Lite Chicago please click here

Popular in the Community

Close

What's Hot