Running Magento Enterprise Edition with Facebook HipHop HHVM
MacBook Air (MBA) Mid 2012
Virtualbox (VB): Ubuntu 12.04.2 LTS (GNU/Linux 3.2.0-23-generic x86_64) via vagrant.
MBA with Apache 2 with mod_php Version 5.3.19 with MySQL 5.5 (MAMP)
VB with fresh pulled HHVM sources with MySQL 5.5
I ran here a big customized Magento EE 1.12 store from a big Swiss scout store. A lot of custom price rules for many different groups and some fancy discount types.
URL schema is different from the official demo store:
www.customer.ch/[de|fr]/index.php to map automatically different languages.
Magento Cache activated. MySQL database slightly optimized via mysqltuner.pl
- 5000 SKUs
- 237 categories
- 48.000 url rewrites
- 4 store views
- FPC disabled
Magento EE sources has been imported into the VM. Not via shared folders or NFS. There were previously some weird long request times with HHVM when using shared folders.
Compile and Download HipHop
You can use the install script
install-hhvm.sh for compiling and installing hiphop https://github.com/jakoch/php-hhvm.
But change the hiphop source in function
get_hiphop_source() to the special Magento hiphop https://github.com/danslo/hiphop-php source.
Optionally: You can remove all the last lines after
## Success in the script
Official FB "How to" compile: https://github.com/facebook/hiphop-php/wiki
Prebuild packages will not work with Magento.
Options for the config.hdf file: https://github.com/facebook/hiphop-php/blob/master/hphp/doc/options.compiled
Please see the to this gist attached file
Buggy is the PHP_SELF and SCRIPT_NAME which will not be properly set therefore hardcoded. Also the rewrite rules can be more optimized.
I'm not quite sure if that is still a problem with SimpleXML or with buggy Magento code.
$key = (string)$key;
- There are also some errors in the
site/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php on line 441but that results from strange code in phtml files ... 8-)
Not every category will work but 98% of them.
Not possible due to HHVM shows this error:
Notice: Undefined index: 0 in /var/www/customer-dev/site/app/code/core/Mage/Catalog/Model/Layer/Filter/Price/Algorithm.php on line 368
There is something weird in our code base, not in HHVM.
Multiple shift-reloads in the FF 23 browser in two tabs. Times are approximate.
|Request Type||HHVM||MAMP||MAMP-APC |
|Category View ||980ms||4.6s||3.5s|
|Product View ||500ms-1s||4.7s||3.1s|
|Add to basket ||1.2-2.9s||8.8s||5.5s|
|List basket ||2.1s||6.9s||3.8s|
|List basket ||1s||5.5s||2.9s|
|Checkout Onepage ||690ms||4.47s|
- MAMP-APC runs with PHP 5.4.16
- containing 8 products
- configurable product with two options and one customer rating
- POST to cart with redirect to product view and listing cart content
- First call of the basket page
- Initial load of the page checkout/onepage after that normal checkout process
ab -n 20 -c 5
In both tests: PHP 5.4.16
|Time taken for tests||23.229s||7.334s|
|Total bytes transferred||2202440||2244160|
|HTML bytes transferred||2193600||2235640|
|Requests per second||0.86 #/sec mean||2.73 #/sec mean|
|Time per request||5807.239 ms mean||1833.474 ms mean|
|Time per request (1)||1161.448 ms||366.695 ms|
|Transfer rate||92.59 Kbytes/sec received||298.83 Kbytes/sec received|
(1) mean, across all concurrent requests
|Time taken for tests||36.298||13.682s|
|Total bytes transferred||2002620||2118440|
|HTML bytes transferred||1993780||2109920|
|Requests per second||0.55 #/sec mean||1.46 #/sec mean|
|Time per request||9074.451 ms mean||3420.546 ms mean|
|Time per request (1)||1814.890 ms||684.109 ms|
|Transfer rate||53.88 Kbytes/sec received||151.20 Kbytes/sec received|
(1) mean, across all concurrent requests
Missing is a test where we rely on Redis, Percona, php-fpm + nginx.
Also missing test: The HHVM should be put behind a nginx server and even here the cache should connect to Redis.
Facebook is working hard on HHVM. A lot of commits take place every day!
Big kudos to https://twitter.com/daniel_sloof for fixing HHVM errors related to Magento!
That would be one future for PHP.