What's happening in our world

Blog Post
Facebook PHP Virtual Machine Released
One of the holy grails of complex PHP application development is maximizing performance. Not only does better performance mean more manageable server loads, if you're scaling large enough, there can be a number of other dramatic gains in terms of power consumption and energy costs. Few companies are more familiar with this than the social networking giant Facebook, which is coded entirely in PHP and also just happens to be the largest social networking site on the planet. With over a billion active accounts, that's nearly 20% of the entire world's population - almost nobody else is as familiar with complex and robust PHP deployments as they are.
 
When it comes to web deployments of PHP applications, most developers initially choose to write the complicated code in PHP, but as the application scales and the usage levels increase, the more complex calculations are often re-coded using a faster server-based language such as C or C++. Facebook itself did this in the past, using a custom compiler named HipHop that translated the site's PHP code into C++ for faster execution. As in many large development environments, however, this eventually grew to create separate problems, which meant a new solution was called for.
 
Thus began the development of the HipHop Virtual Machine, or HHVM as it's more commonly known. Without getting too deep into the technical specifics, the HHVM translates PHP code into a custom bytecode known as HHBC (you guessed it, Hip Hop Byte Code) which is then processed by an x64 just-in-time compiler, along with a companion bytecode interpreter when absolutely necessary. This allows Facebook's entire staff of PHP developers to work on the entire codebase together, instead of dividing up the development process into PHP and C++, which can often lead to major headaches when it comes time to reconcile.
 
Joel Pobar, a developer at Facebook, cautioned that many developers hoping to gain performance improvements from implementing HHVM may not get the results they want, saying, "Chances are [your code is] spending too much time talking to the database or spending too time talking to the memcache caching layer." In other words, your performance bottleneck isn't likely to be execution speed, as there are other more typical culprits that can be identified by using benchmarking applications. The HHVM is strongly optimized towards  very large PHP codebases with very heavy usage loads, but it may be worth investigating for your next project.
Sign up to receive updates from SourceGuardian
Try our free php source code demo
TRY SOURCEGUARDIAN FREE FOR 14 DAYS
Account Login:

login Forgotten Password?
Connect with us
Bookmark
facebook linkedin twitter rss
© Copyright 2002 - 2024 SourceGuardian Limited
Privacy Policy l Terms & Conditions l Company Info l Contact us l Sitemap l PHP Weekly News