The Wikipedia blog, “How we made editing Wikipedia twice as fast” by Ori Livneh discusses the tremendous impact of switching to the open-source Facebook Hip Hip Virtual Machine (HHVM) for PHP. The HHVM code essentially converts interpreted PHP code to x86 instructions that can run natively on the CPU. This translates to much higher performance by avoiding PHP’s usual intepreted execution where the Zend Engine transforms the PHP source code into opcodes that are intepreted by the Zend Engine. The conversion to HHVM took approximately 6 months and included extensive verification of correct behavior. Ori noted that the Wikipedia team spent a significant amount of time fixing edge cases were the PHP code acted differently when running under HHVM.
For a top 10 site that services half a billion people each month, performance is critical to Wikipedia in terms of page response time and server load. These metrics translate to user retention and infrastructure expenses such as number of machines purchased and data center heating/cooling costs.
The following graphic shows a clear decrease in page load times:

Reduction in page load time as a result of the conversion to HHVM. (Image courtesy Wikipedia)
During that same time, Wikipedia also saw a significant reduction in server CPU utilization:

Reduction in CPU load as a result of conversion to HHVM. (Image courtesy Wikipedia)
The following video goes into greater depth on the Wikipedia conversion to HHVM
For high-traffic sites, HHVM looks to be an interesting project. See the Facebook HHVM github page for more information on the Hip Hop Virtual Machine.
Leave a Reply