Categories
Magento

HIPHOP.. THE FUTURE OF MAGENTO (AND PHP IN GENERAL) IS (ALMOST) HERE

HHVM (HipHop Virtual Machine) is a Facebook invention that solved a major issue at Facebook that is, how to get a system written in PHP and continuously developed in PHP, to run in a manner that would accommodate 1 billion + users.  PHP is great for rapid development however, as any Magento store owner knows, large applications need Enterprise levels of hardware and optimised software stacks to run correctly.  Scale this up to millions of users and you need a LOT of hardware to keep things running smoothly.  So Facebook initially came up with HipHop.. a compiler that took PHP code and translated this to C++.  However, even this was not enough and over a 3 year period they build HHVM.  This works along the same lines as a Java Virtual Machine. There is a JIT (just in time) compiler that takes php and translates this directly into machine friendly byte code when required. This leads to a drastic increase in  speed in PHP processing time. More importantly (and somewhat impressively) Facebook have made HHVM freely available.

This is by no means a finished product (version 2.4.0 goes live as I type this).  The developers claim a 98%  compatibility with traditional Zend php engine. Even WordPress requires a few tweaks to make it compatible.  More importantly for us and our customers Magento required quite a bit of work.  Enter Daniel Sloof a rather talented coder who took up the challenge to make HHVM work with Magento and he has just about done it.

We have been working on this for some time and in the spirit of dogfooding, our main Magento powered website at Dx3webs.com and this blog are both running 100% on HHVM.  So far there has been no compromise on functionality though we had to re-write a few of our themes custom functions.

As for speed.. (magespeedtest.com)

  • Nginx + HHVM siege test against random pages : 100 users for 240 seconds = 38.45 transactions per second @ 2.08 seconds each
  • Nginx + php-fpm siege test against random pages : 100 users for 240 seconds = 22.12 transactions per second @ 3.96 secs each

Our site is not very challenging for benchmarks like this due to the limited product count however, this is almost double the transaction per second!

Our next step is to get this integrated into our hosting options as we already have our design agency partners asking for this.  One of the initial benefits will be utilizing the drastically improved indexing time.  Already in early tests we are seeing stores with 100 000+ product showing a 5x increase in the speed of a full re-index.

One thing is for certain we are convinced that this is the future of php.  No developer can ignore the drastic increases in speed that this VM provides.