Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
Speeding up your webshop with a drop-in PHP
What is HHVM?
● HipHop Virtual Machine
● Created by engineers at Facebook
● Essentially a reimplementation of PHP
● Originally translated PHP to C++, now
translates PHP to bytecode
● Just-in-time compiler, turning generated
bytecode into machine code
● In some cases 5 to 10 times faster than
● PHP5 style bytecode Yes
Modified? Invalidate cache
● APC-like caching of
● Performance is quite
similar to Zend PHP
Just In Time Compiler
Compile to Native Run Bytecode
What was the problem?
● HHVM not entirely compatible with PHP
● Magento’s PHP triggering many of these
● Choosing between
○ Forking Magento to work around HHVM
○ Fixing issues within the extensive HHVM C++
Resulted in... fixing HHVM
● Already over 100 commits fixing Magento
related HHVM bugs;
○ SimpleXML (majority of bugfixes)
○ __get and __set
○ many more...
● Most of these fixes already merged back into
the official (github) repository
Activity for the HHVM project on github in June
● Still actively “Of the top involved 15 contributors, and only 9 are committed facebook employees.”
HHVM a good place for Magento
What that means for Magento...
● Community and Enterprise Editions running
● Passes near 100% of the Test Automation
● Large boost in improvement.
● Works with FastCGI, so keep most of your
current web-configuration, rewrites, etc.
Before we go to the results...
● Magento 1.9 with sample data
● Standard nginx / php-fpm / percona stack
(with PHP 5.5 opcode cache)
● Standard HHVM configuration (repo-authoritative
mode disabled, JIT enabled)
● Tool of choice: siege
Benchmarks: Response time
Average across 50 requests
Benchmarks: Transaction rate
While increasing siege concurrency until avg.
response time ~2 seconds
<insert caching solution here>?
● HHVM does not get in the way
● Dynamic content still needs to be generated
● Replaces PHP - not Varnish, Redis, FPC,
Block Cache, etc.
● As long as you are burning CPU cycles
(always), you will benefit from HHVM
● Think about speeding up indexing, order
placement, routing, etc.
What about PHPNG / PHP7?
● Better performance than PHP5.5, but still
trails behind HHVM quite significantly.
● Not production ready.
How do we know it is stable?
● Unfortunately there are no unit tests for
(core) Magento 1.x
● Brushed up the Test Automation Framework
● Automated setup of test environment using
● Nightly builds to check Magento compatibility
on HHVM to make it easier to spot
● Open-sourced very soon
What about the future?
● Facebook is committed to open source:
several employees work on it exclusively.
● HHVM tracks a number of popular
frameworks and runs their PHPUnit suites
● Magento 2 is part of that list
What is Hack?
Moving to HHVM gets even more awesome.
● Statically typed language
● Type annotations
● Built-in user attributes
Can we gradually migrate?
Store not entirely compatible with HHVM and
still want to run it.
● Problem is isolated to a (subset of) page(s):
use web-server configuration to split load.
● Problem is more widespread (incompatible
global observers, ioncube, etc):
On the topic of debugging
● HHVM comes with something called HPHPd
● CLI Based, comparable to GDB
● No (known) support for any IDEs
Latest stable release
has xdebug support!
Where can we run it?
Leading platform for merchants and dev shops
running high performance Magento apps in the
● Highly optimized Magento PaaS
● 24/7 white glove DevOps support
● Over 1 billion hours deployed on AWS