Feeds

Facebook HipHop serves 70% more traffic on same hardware

PHP to C++ Diddy

  • alert
  • submit to reddit

5 things you didn’t know about cloud backup

When Facebook moved its servers to HipHop for PHP – the code transformer it built to convert PHP into optimized C++ – the company's average CPU usage dropped by 50 per cent. And after six months of additional engineering, the tool was about 1.8 times faster.

Now, after another six months, the company says, it has improved performance another 1.7 times. But this is more than just self-congratulation. The project is open source, and it has been open since Facebook first switched its servers to HipHop in February 2010.

Unlike Google, you see, Facebook has been known to promptly open-source some of the most important pieces of its back-end infrastructure.

With a Wednesday blog post, Facebook research scientist Xin Qi charts HipHop's relative throughput improvement over the last six months:

Facebook Hip Hop performance improvement

The end result, he says, is that HipHop can handle about 70 per cent more traffic on the same hardware infrastructure.

After transforming PHP into C++, HipHop compiles the code and builds binary files with the GNU C++ compiler, aka g++. The idea is that you can still code with high-level PHP, but then get the performance of C++ – though it does give up certain "rarely used" PHP features.

According to Qi, Facebook and the open source community have juiced the tool in several different ways. HipHop uses a version of the Alternative PHP Cache (APC), and engineers have stripped most of the serialization and unserialization operations. "Semantically, an object is serialized and unserialized when it is stored into and fetched from APC. However, serialization and unserialization are costly operations, commonly dominating the cost of APC data fetching itself," Qi says.

"Thus, we reworked the APC implementation in HipHop, getting rid of almost all the serialization/unserialization operations, while keeping the semantics equivalent to before."

But some serialization is still required, and this has been fine tuned. "Objects still need to be serialized or JSON-encoded in order to transfer them over the wire. To make things faster, we optimized various aspects of these operations, including UTF8/UTF16 conversions, object property accesses, number parsing, and so forth."

Facebook has also reduced the size of the binary code, improved memory allocation, and made several changes to the compiler. "Several phases in the compiler, including parsing, optimization, and code generation, are now parallelized. Hyves contributed changes to the generated C++ code to make it compile faster without losing any run-time efficiency," Qi says.

His crew can build a more than 1GB binary in about 15 minutes (after stripping out debug information). "Although faster compilation does not directly contribute to run-time efficiency," Qi says "it helps make the deployment process better."

The likes of Drupal, MediaWiki, and WordPress are now using HipHop. No one is using BigTable or the Second Coming of the Google File System. Except for Google. ®

Secure remote control for conventional and virtual desktops

More from The Register

next story
BBC: We're going to slip CODING into kids' TV
Pureed-carrot-in-ice cream C++ surprise
China: You, Microsoft. Office-Windows 'compatibility'. You have 20 days to explain
Told to cough up more details as antitrust probe goes deeper
Windows 7 settles as Windows XP use finally starts to slip … a bit
And at the back of the field, Windows 8.1 is sprinting away from Windows 8
Linux turns 23 and Linus Torvalds celebrates as only he can
No, not with swearing, but by controlling the release cycle
Scratched PC-dispatch patch patched, hatched in batch rematch
Windows security update fixed after triggering blue screens (and screams) of death
prev story

Whitepapers

Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
Endpoint data privacy in the cloud is easier than you think
Innovations in encryption and storage resolve issues of data privacy and key requirements for companies to look for in a solution.
Why cloud backup?
Combining the latest advancements in disk-based backup with secure, integrated, cloud technologies offer organizations fast and assured recovery of their critical enterprise data.
Consolidation: The Foundation for IT Business Transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.
High Performance for All
While HPC is not new, it has traditionally been seen as a specialist area – is it now geared up to meet more mainstream requirements?