Facebook Rolls Their Own PHP: What HipHop Means

Share via Twitter Share via Facebook Share via Linkedin Share via Reddit

It is marginally interesting that Facebook continues to open source its technology. Anybody surprised by the fact that Facebook is producing software, however, simply hasn’t been paying attention. Facebook is, and always has been, a software company. Ask Savio.

The four hundred million-ish people Facebook provides with social networking functionality are a byproduct of their software, not the reverse. The sooner that vendors realize this, the better, because Facebook will be the least of their problems.

Take HipHop for PHP. That’s a disaster for Zend, right? Hardly. Compiled dynamic languages are, in technical terms, old hat. Advocates of runtimes like the JVM or .NET have been touting the advantages of managed, compiled equivalents to their interpreted counterparts for years. As Haiping Zhao, the author of HipHop, acknowledged:

Even compiling PHP isn’t a new idea, open source projects like Roadsend and phc compile PHP to C, Quercus compiles PHP to Java, and Phalanger compiles PHP to .Net.

Compile your dynamic language, we’re told, and it will be more secure. More manageable. More performant. More better.

What they leave out is that it will be more harder, too.

To contend that a better performing PHP – even one that offers, as HipHop reportedly does, a 50% improvement on CPU usage – will negatively impact usage of the non-compiled alternative misses the point of PHP, which has little to do with performance. PHP has never been the first choice for high scale environments; it is, in many respects, why caching systems from memcached to WP-Supercache exist, and have evolved so quickly. PHP owes its ascension and current ubiquity to a variety of factors, accessibility included, but its staying power is as much a function of the ecosystem as the technology. Which is the problem all of the compiled dynamic language alternatives contend with.

They’re like the parent language, but they’re not the parent language. Run into trouble? Unlike PHP, where you’re guaranteed that Google will turn up someone who’s had and addressed the exact problem that you have, it’s possible – probable, even – that on the compiled alternative, you’re the first to run into it. Translation: good luck with that, because you’re on your own.

Even if we assumed, counterfactually, that HipHop was a perfect translation of PHP, how many of the traditional PHP users do you imagine would even notice a 50% reduction in their CPU usage? How about a 50X improvement? How many do you think even know what their current CPU usage is, versus those that heard, at some point, from someone, their website runs on something called “WordPad? TextPress? you know, that thing?”

My guess is the percentage of users who would notice a 50% bump are a fraction of those who wouldn’t, and not a big fraction at that.

Which is not to say that the technology is uninteresting, my instinctive mistrust of code generation functionality aside. First, because Zend has clearly carved itself out a nice business optimizing PHP performance for those who do care, and would notice a 50% reduction in CPU usage. And more importantly because those that do care about CPU usage are likely, like Facebook, to care quite a lot. As they should, when they’re serving 400 billion PHP-based page views…a month. Fifty percent less CPU on that workload means a lot less dollars, and lord knows how much less carbon emitted. It also means more resources for other compute tasks. Fifty percent better performance is transformative, in other words, if you’re the type of customer that measures performance in the first place.

Which leaves an obvious question: that type of customer, the type that would find fifty percent better performance interesting, tends to be relatively well capitalized and therefore predisposed to commercial support. But who will offer commercial services around Facebook’s HipHop?

Not Facebook, presumably. While they are every inch a software company in my book, they are absolutely not a sofware company involved in licensing, selling and supporting software. They’ve got four hundred million-ish other distractions, remember. Which leaves who? Savio’s quick to identify the problems for potential third party support, saying:

However, without control of the project and the project’s copyright and trademark, it’s difficult to monetize usage.

While those are issues indeed, I think the evidence suggests that these impediments are no obstacle to commercial opportunity.

Percona doesn’t control MySQL’s copyright or trademark, yet is a going commercial concern. Likewise CentOS, whose commercial ecosystem leverages Red Hat’s product while sidestepping the cited trademark concerns. As does Oracle, on a larger and more explicit scale. Even in the dynamic language space we have an example of a similar economic model playing out successfully: ActiveState’s primary revenue derives from sales of QA’d and supported runtimes for the likes of Perl and TCL.

History indicates, then, that HipHop could easily be supported, on a for profit basis, by a third party. Who might the logical candidate be? Well, why not Zend? They know the runtime as well or better than any other third party, leaving them presumably well positioned to understand how the code can – and can’t – be translated to C++. They have existing support agreements in place with many of the potential HipHop users. So what if they didn’t author the project? The market is littered with companies supporting products written by others.

Which is not to say Zend will support the project, of course – I haven’t spoken to them yet on the subject. Merely that they could, and should in my view at least consider it, depending on the current quality of the PHP==>C++ conversion.

Even if it is no threat to Zend, however, HipHop should be a warning shot across the bows of a great many software vendors. HipHop, by design, is aimed at a narrow, if high margin, section of the market in question. As a vendor, I’m not losing sleep over open source projects like HipHop which are really attractive only to the top 1% or so of customers. No, my concern would be the potential release of something that’s relevant to, say, 50% of the market. What if Facebook open-sourced Project Titan, for example?

Customers, more than ever before, are going to be your competitors. Prepare accordingly.

Disclosure: Zend is a RedMonk customer, Facebook is not.

One comment

  1. Excellent assessment of HipHop’s impact. I certainly have no interest in compiling my PHP code every time a change is made.

Comments are closed.