php[architect] logo

Want to check out an issue? Sign up to receive a special offer.

Facebook Invades DCPHP

Posted by on May 4, 2010

Facebook's HipHop for PHPThis past week, the DCPHP Developers’ Community had the privilege of hosting Scott MacVicar from Facebook. His title is “Open Source Developer Advocate” which puts him in the odd position of making good things happen within Facebook, representing them to the community, and convincing the community to get involved. Towards that goal, this presentation was the last stop of a short tour to present HipHop to PHP groups.

First off, Scott shared some amazing statistics about Facebook: It hosts more images and receives more images per day than Flickr. The entire system includes nearly four billion lines of code. The average user time on the site is 55 minutes/day. There are no joins at the database level. The system includes “tens of thousands of servers” split between a pair of hosting facilities. These servers handle 800M+ requests/day. And as fast as PHP is in terms of learning, coding, and deployment, its speed doesn’t compare to a compiled language like C, C++, or even Java.

This is where HipHop comes into play. HipHop takes your PHP and translates/transforms into C++, optimizes it like crazy, and compiles it into a binary appropriate for distribution and deployment. Depending on how you benchmark and test performance, you could see upwards of 100% performance improvement.

Of course, there are a few downsides. Since your code is transformed and compiled at deployment, some of the most dynamic aspects like eval() usage or variable-variable-variable messes simply won’t work. Even more of a potential problem, since HipHop packages your code with its own web server and doesn’t actually use the Zend Engine, you may see slightly different behavior in deployment. Scott stated Facebook’s commitment to duplicate the Zend Engine’s behavior exactly but it’s still a work in progress.

Other than the technical questions, the next big question Scott answered was:

Why would Facebook release HipHop?

His answer was two fold. First, he acknowledged how Facebook – and Mark Zuckerberg specifically – got its start based on Open Source technology. Without the LAMP stack, Facebook simply wouldn’t exist. Second was a much more practical reason: Facebook can’t do it all. They need help testing, debugging, and supporting more extensions and architectures. He identified a number of places to help and suggested exploring Facebook’s GitHub account to get started.

If you’re interested in learning more about HipHop, Scott is giving a presentation next week in the TEK·X Webcast Series and the full HipHop presentation at TEK·X in May.

Disclosure: Scott MacVicar and I traveled together on the CodeWorks tour last year, have had a number of drinks together at various conferences, and I extended the invite from the DCPHP Community.


Keith Casey currently serves as Director of Product for Clarify.io working to make APIs easier, more consistent, and help solve real world problems. Previously, as a developer evangelist at Twilio, he worked to get good technology into the hands of good people to do great things. In his spare time, he works to build and support the Austin technology community, blogs occasionally at CaseySoftware.com and is completely fascinated by monkeys. Keith is also the author of “A Practical Approach to API Design” from Leanpub.
Tags: , , , ,
 

Responses and Pingbacks

[…] the php|architect site today there’s a wrap-up from Keith Casey about the latest DC PHP User Group meeting where Scott MacVicar from Facebook presented on HipHop. […]

Leave a comment

Use the form below to leave a comment: