Sunday, 28 August 2011

Opensource Software Behind Facebook

In some ways Facebook is still a LAMP-based sites (like), but modified and expanded its operations by incorporating many elements and other services, and modified its approach to be like that exist today.

For example:

  • Facebook is still using PHP, but has made the compiler to, so it can be converted into native code on its web servers, thus improving performance.

  • Free use Linux, but has been optimized for its own purposes (especially in terms of networks).

  • Free use MySQL, but mainly as a key-value persistent storage, moving joins and logic to the web server because the optimization is more easily done there (in the "other side" of the memcached).

Then there are custom-written systems, such as Haystack, a highly scalable object store used to serve the photos on Facebook that much, or Scribe, logging system that can operate on a scale up.

Now let us discuss (part of) software (software) that are used up in providing the largest social networking site in the world.


Memcached is now one of the most popular software on the internet. It is a distributed memory caching system that is used up (and many other sites) as a caching layer between the web server and MySQL server (for database access is relatively slow).

Over the years, Facebook has repeatedly perform optimization software on memcached and surrounding areas (such as optimizing the buildup of tissue).

Facebook running memcached server with tens of thousands of terabytes of data cache at one point in time. This possibility is the world's largest Memcached installation.

HipHop for PHP

PHP, a scripting language, is relatively slow when compared with the code that runs natively on the server. Hiphop convert PHP into C + + code that can then be compiled to produce a better performance.

This has allowed Facebook to optimize its web servers because it relies heavily on PHP to serve content.

A small team of engineers (initially just three people) on Facebook spent 18 months developing hip-hop, and now in production.
facebook logo


Haystack is a storage system / high-performance search photos on Facebook (Lo Haystack is an object storage, so it does not save the image). He was doing heavy work, there are more than 20 billion photos uploaded on Facebook, and each stored in four different resolutions, resulting in more than 80 billion photos.

And it is not just about the ability to handle the billions of photographs, performance is also very important. As previously mentioned, Facebook serves about 1.2 million images per second, the numbers do not include images / photos are served by the CDN Facebook.


BigPipe system is a dynamic web page service developed by Facebook. Facebook uses it to serve every web page in several parts (called "pagelets") to produce optimal performance.

For example, the chat window is taken separately, the news feed is taken separately, and so on. Pagelets can be taken in parallel, so kenerja stay awake, and also allows the user to access the site properly though some parts of disabled or damaged.


Cassandra is an open source system that serves as a distributed database management. Facebook then develop it and use it to feature NoSQL Inbox Search. Besides Facebook, a number of other services also use it, such as Digg.


Scribe is a flexible logging system that is used internally by Facebook for many purposes. It was developed to handle the logging in Facebook, and automatically handle the new logging categories that appears.

Hadoop and Hive

Hadoop is an implementation map-Reduced open source that allows for the calculation of large amounts of data. Facebook uses it to analyze the data (and as we know, Facebook has a large amounts of data).

Hive developed by Facebook, and with it possible to use a SQL query against Hadoop, making it easier for non-programmers to use it.

Both Hadoop and Hive is open source and used by a large number of services such as Yahoo and Twitter.


Facebook uses several different languages for some services. PHP is used for front-end, Erlang is used for Chat, Java and C + + is also used in some places (and possibly other languages as well).

Thrift is a cross-language framework that was developed internally to bind all the different languages, thus enabling communication between these languages. This eases up for cross-language development.


Varnish is an HTTP accelerator that acts as a load balancer and cache content that can then be served as fast as lightning. Facebook uses Varnish to serve the photos and profile pictures, handling billions of requests every day. As with almost all used up, Varnish is open source.

Other things that help run smoothly Facebook

We have already mentioned some software that built the system up and assist its services properly. But the handling of that system is a complex task. Here are the things that made up to keep services running smoothly.

Gradual releases and dark launches
Facebook has a system they called Gatekeeper that enables them to run different code for a set of different users. This allows up to perform a gradual release features new fitus, A / B testing, to enable certain features only to employees of Facebook, etc..

Gatekeeper also allow Facebook to do something called "dark launches", which is to enable the elements of certain features on behind the scenes before the show (without the user's knowledge).

This serves as a real test and help expose bottlenecks and other problems before the feature is officially launched. Dark launches are usually done two weeks before the official launch.

Profiling of the live system

Facebook monitor the system carefully and also monitor the performance of each PHP function in a live production environment. Profiling PHP is done using an open source tool called XHProf.

Gradual disabling feature for added performance

If Facebook is experiencing performance problems, there are a number of levers that gradually disable the features are less important for improving the performance of the main features of Facebook.

If we look, turns up many make use of open source to build the system. Not only use, Facebook is also contributing to open source software like Linux, memcached, MySQL, Hadoop, and others.

More than that, Facebook has also made software that is developed internally by them as open source. Examples of open source projects comes from Facebook is the hip-hop, Cassandra, Thrift and Scribe.

List of open source software in which up getting involved in development can be viewed on the Facebook page's Open Source.


Post a Comment

Toggle Footer