Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
PidFile = /tmp/
Server {
Port = 8080
SourceRoot = /var/www/customer/site
# DefaultDocument = index.php
AdminServer {
Port = 8088
ThreadCount = 1
Password =
Eval {
Jit = true
Log {
NoSilencer = true
Header = true
Level = Verbose
UseLogFile = true
AlwaysLogUnhandledExceptions = true
RuntimeErrorReportingLevel = 8191
File = /var/log/hhvm/error.log
Access {
* {
File = /var/log/hhvm/access.log
Format = %h %l %u %t \"%r\" %>s %b
VirtualHost {
* {
Prefix = customer.local
ServerVariables {
MAGE_RUN_CODE = customer_de
PHP_SELF = /de/index.php
SCRIPT_NAME = /de/index.php
RewriteRules {
dirindex {
pattern = ^/(de|fr)/(.*)
to = $1/index.php/$2
qsa = true
conditions {
* {
pattern = \.(css|js|jpg|png|gif)$
negate = true
StaticFile {
FilesMatch {
* {
pattern = .*\.(dll|exe)
headers {
* = Content-Disposition: attachment
Extensions {
woff = application/x-font-woff
js = text/javascript
css = text/css
gif = image/gif
html = text/html
jpe = image/jpeg
jpeg = image/jpeg
jpg = image/jpeg
png = image/png
tif = image/tiff
tiff = image/tiff
txt = text/plain
hhvm --user vagrant -c /var/www/customer/hhvm.hdf --mode daemon
# to analyze
# find /var/www/customer/site -name '*.php' -o -name '*.phtml' > /tmp/customer_files.txt
# find /var/www/customer/site -name '*.php' > /tmp/customer_files.txt
# hhvm --hphp -t analyze --gen-stats=1 --keep-tempdir=1 --input-list /tmp/customer_files.txt --output-dir=/tmp/hphp

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:[de|fr]/index.php to map automatically different languages.

Magento Cache activated. MySQL database slightly optimized via

  • 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 for compiling and installing hiphop

But change the hiphop source in function get_hiphop_source() to the special Magento hiphop source.

Optionally: You can remove all the last lines after ## Success in the script

Official FB "How to" compile:

Prebuild packages will not work with Magento.

HHVM config.hdf

Options for the config.hdf file:

Please see the to this gist attached file hhvm.hdf.

Buggy is the PHP_SELF and SCRIPT_NAME which will not be properly set therefore hardcoded. Also the rewrite rules can be more optimized.

Magento Errors

I'm not quite sure if that is still a problem with SimpleXML or with buggy Magento code.


  • File site/app/code/core/Mage/Core/Block/Template/Facade.php every: $key = (string)$key;


  • There are also some errors in the site/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php on line 441 but 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.

Performance Test

Multiple shift-reloads in the FF 23 browser in two tabs. Times are approximate.

Request Type HHVM MAMP MAMP-APC [1]
CMS Page 450ms 2.5s 820ms
Category View [2] 980ms 4.6s 3.5s
Product View [3] 500ms-1s 4.7s 3.1s
Add to basket [4] 1.2-2.9s 8.8s 5.5s
List basket [5] 2.1s 6.9s 3.8s
List basket [6] 1s 5.5s 2.9s
Checkout Onepage [7] 690ms 4.47s
Onepage SaveBilling 236ms 2.3s
Onepage SaveShipping 251ms 2.4s
Onepage SavePayment 486ms 3.28s
Onepage success 562ms 3.25s
  1. MAMP-APC runs with PHP 5.4.16
  2. containing 8 products
  3. configurable product with two options and one customer rating
  4. POST to cart with redirect to product view and listing cart content
  5. First call of the basket page
  6. Reloads
  7. Initial load of the page checkout/onepage after that normal checkout process

ab -n 20 -c 5

In both tests: PHP 5.4.16

Product View
Concurrency Level 5 5
Time taken for tests 23.229s 7.334s
Complete requests 20 20
Failed requests 0 0
Write errors 0 0
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

Category View
Concurrency Level 5 5
Time taken for tests 36.298 13.682s
Complete requests 20 20
Failed requests 0 0
Write errors 0 0
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 for fixing HHVM errors related to Magento!

That would be one future for PHP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment