Talking tech since 2003

Facebook is a very large and complex content driven website. Like many other large websites, resource management is key to Facebook. Not only does it keep down CPU load and memory usage on their vast array of servers, but it is also used to ensure a fast load for every user that browses the website. Due to Facebook being the size that it is, there are billions of page loads every month. Both from the users perspective, but also behind the scenes from AJAX loads to make the site more user appealing. This enormous amount of load means that they have to use a programming language that is not only easy to write and debug, but is also superior at ensuring the resources of the server that it is executed on is maintained to a standard.

So what programming language does Facebook use? Facebook uses one of the most popular choices amongst web developers: PHP. This simple yet powerful language is not only easy to write but also easy to maintain and debug. Unfortunately, when a website becomes as large as Facebook, there is millions on top of millions of lines of code to execute, so overtime performance is lost. Facebook over the years has made many contributions to the PHP project in order to try and boost overall performance, but it still did not meet their needs.

For two years a small group of engineers at Facebook have been working on a project to help increase the performance of PHP in order to make it an even greater platform for development and expandability. The project which is known as “HipHop for PHP” is said to have “… reduced the CPU usage on our Web servers on average by about fifty percent, depending on the page.” This achievement means Facebook is able to output the content of web pages at an even greater pace while also maintaining a level of resource usage that would require less servers to be used.

Facebook has been able to achieve this level of performance by changing how the PHP code is interpreted:

HipHop for PHP isn’t technically a compiler itself. Rather it is a source code transformer. HipHop programmatically transforms your PHP source code into highly optimized C++ and then uses g++ to compile it. HipHop executes the source code in a semantically equivalent manner and sacrifices some rarely used features — such as eval() — in exchange for improved performance.

Facebook will be making available HipHop for PHP at 7:30pm Pacific time as an open source project on github released under the PHP License. For the official announcement and to obtain HipHop for PHP when it becomes available, swing over to the Facebook Developer Blog entry on HipHop for PHP. This is a very exciting move for people who maintain PHP based websites, so be sure to check it out.

You've successfully subscribed to BestTechie
Welcome back! You've successfully signed in.
Great! You've successfully signed up.
Your link has expired
Success! Your account is fully activated, you now have access to all content.