We just released a WordPress container with HHVM and PHP-FPM as a fallback. The container can be used to test and experiment with HHVM and a base to run PHP apps. This container is in addition to the normal WordPress container, and the recently released preview WordPress micro container.

For new users Flockport containers are based on the open source LXC project and you can Get Started on our Documentation page. Here is a quick screencast of the WordPress container in action.

So what's HHVM?

HHVM is the new much talked up PHP stack by Facebook. HHVM is an open-source virtual machine designed for executing PHP programs and uses a just-in-time (JIT) compilation approach to try to achieve superior performance.

Currently the project is in rapid development to gain 100% compatibility with PHP apps and improve performance.

Faster PHP?

Early reports are promising. The benchmarks suggest its significantly faster than stock PHP. For apps like WordPress some users and popular hosts like WP Engine report 3x to 5x speed improvements with HHVM compared to stock PHP.

Benchmarks do not always indicate real world performance and there are some caveats that early adopters need to be aware of though.

PHP Compatibility

HHVM is not yet compatible with all PHP workloads. WordPress for instance is 100 percent compatible from version 4.0, but that does not include the ecosystem of plugins and themes, and short of a registry there is no way to know compatibility without experimenting.

Similarly a lot other projects like Drupal, Typo3 etc are on the way to becoming HHVM compatible.

HHVM Caveats

HHVM is in active development and there have been reports of memory leaks. This means long running php processes can result in the HHVM process bloating, consuming ridiculous amounts of ram and crashing. The good news is the HHVM developers are extremely responsive and are working hard to iron out all issues.

My tests on HHVM version 3.4 has been stable so far and the process has been alive for 48 hours with around 380MB RAM usage but this is not a real world scenario with loads and spikes.

The work around is to use a cron job or a process manager like Supervisord to periodically restart the HHVM process every couple of hours.

HHVM is memory intensive and works best with dynamic workloads. Also HHVM uses threads unlike php-fpm which uses worker processes. So in top or htop you will see a single HHVM process as opposed to the multiple php-fpm processes.

HHVM and PHP-FPM

PHP-FPM with Nginx is reasonably fast. With PHP 5.4 APC offered significant performance improvements. PHP 5.5 ships with Zend Opcache, which in benchmarks shows better performance than APC. There is also PHPNG in the works which in benchmarks show much faster performance than PHP 5.4 or PHP 5.5 but still slower than HHVM.

HHVM initially had an internal server that was a bit difficult to work with, but now works in FastCGI mode so those using php-fpm with Nginx can simply direct the socket or tcp port to HHVM FastCGI.

Installing HHVM is fairly straight forward. The HHVM project provides official binaries for Ubuntu, Debian and Mint. There are unoffical binaries for CentOS. Fedora and Amazon Linux. This problem is easily solved by installing HHVM in an LXC container of a supported distribution.

The performance improvements hhvm bring is to the execution of php code, so dynamic sites stand to benefit the most. If you are serving mainly static pages from a cache then hhvm won't really help you. But for logged in users and ecommerce stores for instance where full page caching is not a possibility, hhvm can deliver improved performance with reduced latency.