The open source dynamic scripting language PHP is widely deployed across the Web, powering countless Web sites (including the Internet.com network). Now Facebook is aiming to change the game with today’s release of a major new PHP effort called HipHop.
With HipHop, Facebook is providing a new runtime that is intended to improve PHP use in large-scale deployments. The HipHop effort, which also includes a new Web server, has already been in use by Facebook for the past six months, though the project is just being made public today.
Facebook developers say the HipHop effort isn’t an attempt to fork the PHP community, but rather, a move to help PHP scale.
“There are two different pieces to keep in mind, one is the PHP language itself, then there is the runtime that actually goes and interprets the language and runs it,” David Recordon, Facebook’s senior open programs manager, told InternetNews.com. “What we’ve done is we’ve implemented the PHP 5.2 language with a few features removed. Our plan is to keep the language the same, but what we’ve changed is the underlying runtime and the process of going and transforming the source code into C++ and then compiling it and pushing out the compiled binary.”
Facebook said the results of using HipHop have been dramatic. CPU usage on Facebook servers has dropped by an average of 50 percent as the HipHop PHP engine reduced the load on Facebook’s infrastructure.
The results have proven to be compelling enough that Facebook now uses HipHop to deliver more than 90 percent of its production server traffic.
HipHop isn’t just a new code transformation tool, either. The overall effort also includes a new Web server to deploy PHP as well. Typically, in open source deployments, PHP is served with Apache Web servers.
“In general, Apache is a great Web server, but when we were looking at how we get the next half percent or percent of performance, we didn’t need all the features that Apache offers,” Recordon said. He added, however, that he hopes an open source project will one day emerge around making HipHop work with Apache Web servers.
The idea of optimizing the PHP runtime is not a new one, with multiple solutions in the market today including eAccelerator and commercial PHP products from Zend. Zend is one of the lead commercial sponsors behind PHP.
“HipHop looks like an interesting project,” Zend CEO Andi Gutmans toldInternetNews.com. “We have been briefed by Facebook but willcertainly take a closer look now. There have been other such projects butmost have been targeting managed runtimes such as Java and .NET with variousdegrees of success. We welcome any innovation that will help PHP extend itsleadership position in Web application development.”
Gutmans added that, as is the case with all runtimes, it is important tocontinue innovating and the PHP runtime has continued to evolve over theyears.
“I think it is important to continue to fold in new ideas and innovationsinto the community-based runtime and it’ll be interesting to learn whatHipHop concepts could be relevant to the existing PHP community,” Gutmanssaid.
With some PHP runtime optimization solutions, the optimization is often a simple matter of a module load and a line change in the php.ini configuration file.
It’s not quite that easy with HipHop.
“This is not an extension to PHP — this is pretty different,” Recordon said. “Right now, the process is once you build and compile HipHop, it comes with a tool that will go through the transformation process and output the binary, and that’s what you actually use to run it.”
With HipHop, Facebook said its aim is not to split the PHP community but rather to help grow it. According to Recordon, HipHop will help to solidify PHP’s position as a great language for doing Web site development.
“There is definitely the piece in there that HipHop is designed for larger PHP deployments and not necessarily for individuals hosting their own blog or small Web site,” Recordon said. “The proof of the effect of HipHop will be over the next year as we start to make deployment tools easier, and as we start to build a successful community around it and start working with others on its future development and solving problems for companies beyond just Facebook.”