Q&A: Facebook and open source

Facebook logo

Facebook has unveiled HipHop, its latest contribution to the open source world.

HipHop takes PHP, converts it to optimised C++ and then compiles it. So what, you may ask. Doing this has slashed CPU use by some 50 per cent for loading pages, Facebook has claimed.

By releasing the HipHop code, it also shows the site's dedication to open source. And it's not just a practical consideration, but philosophical too, according to programs manager David Recordan.

We spoke to him to find out more about HipHop for enterprise and the future of open source at Facebook.

Why does Facebook like using open source?

That's more from the open source software side. We think about open source from two perspectives. One is sort of philosophical. We wouldn't have been able to go and build facebook the way that we did, with Mark [Zuckerberg] starting in his dorm room, if there wasn't open source software that came before us.

So part of it is sort of philosophical, in that we want to go and help that next generation of start-ups build on top of the technology that we create.

The other part is practical. Using HipHop as an example, we're not the only large company that really relies on PHP so we hope that we can go and grow a really strong developer community around it, and learn from how other people are using it, go and find bugs we may not necessarily find, go and find features that are useful to other companies.

You really get to that point where it's not a single company going and maintaining a single piece of software, but rather a group of companies and being able to share some of that investment.

Have you had much feedback on HipHop or the other open source projects from other web-based companies or even enterprises about getting involved in that sort of community?

There's quite a bit of interest right now. They range from companies which are smaller but have large amounts of traffic, to larger companies who are interested in trying it out, seeing how it works for them. There's even some companies interested in thinking about how they might contribute back to it.

Hive is another good example of this. Hive is a piece of infrastructure we developed for doing data analysis. So I think we run about 7,500 data analysis jobs a day, about 250 people through the company use Hive every month, and a lot of those people aren't actually on our engineering team, but rather spread out around the company.

So we built Hive on top of a technology called Apache Hadoop. Hadoop was originally developed by Yahoo and then open sourced.

That's another example of going and showing how we were able to go and build Hive on top of an existing open source technology Hadoop was released by Yahoo and then continue to go and build developer communities around both of these technologies to push them forward beyond what either Yahoo or Facebook could do individually.

What have you got planned for open source for in the near future?

[When it comes to] open source in general, you will see two types of projects from us. One [type is] the larger pieces of infrastructure, like HipHop or Hive or Tornado, which we released last fall [and] is the web server which powers FriendFeed.com.

Then there are the developer tools. Things like 320, which is the core user interface and some of the data access components of our iPhone application, [which] other iPhone developers can use. There are technologies to make using or embedding PHP easier.

Over the year you'll see a mix of infrastructure technologies and developer tools that we release as open source.

PHP is starting to get a foot-hold in the enterprise, do you think projects like yours will help?

One of the really clear messages that HipHop sends is that PHP is a great language to go and build a site like Facebook in. And I think PHP is a language that has enterprise adoption.

In a lot of senses, we're really helping to reinforce the community behind PHP and working with the development team there and really going to offer another way to think about scaling PHP depending on what type of site you're building and how you're thinking about architecting it.

In the blog post about HipHop, Facebook claimed the system could cut CPU use quite significantly. Is that specific to Facebook, or will other people get that advantage, too?

On average we're seeing about a 50 per cent reduction in our CPU usage. But that really depends on the page itself and sort of what you are doing within your PHP code.

We expect to see a range of effectiveness for HipHop, depending on the page, depending on the how complicated it is, what it does. But that's definitely something we're looking forward to finding out about from other companies as they start playing around with HipHop and see how well it works for them.