What is HHVM?

HHVM Stands for Hip Hop Virtual Machine and has been released with an Open Source License by Facebook.

HHVM is an open-source virtual machine designed for executing programs written in Hack and PHP. HHVM uses a just-in-time (JIT) compilation approach to achieve superior performance while maintaining the development flexibility that PHP provides.

HHVM runs much of the world’s existing PHPDevelopers and hosts are adopting HHVM. We are aware of minor incompatibilities (please open issues when you find them), but we can run the top 20 Github PHP frameworks out of the box. The HHVM team, along with many wonderful community members, has made it a stated, high priority goal to run all existing PHP code existing out in the wild.

From http://hhvm.com

The Process

Here at Tall Duck we’ve been looking for ways to supercharge our WordPress hosting offering and HHVM seemed interesting.

Our normal PHP server configuration consists of:

  • Ubuntu or CentOS
  • Nginx (with gzip enabled)
  • External Database Server

It’s a basic setup that gets the job done, but there is room for improvement. Before trying HHVM we were seeing page load times of around 3 seconds while under load, that’s a noticeable amount of time to wait for your page.

As you can see below, the load times were less than desirable.

Before HHVM

Before HHVM Content Type Distrobution

The plan of attack

We saw all the buzz about HHVM and decided it wouldn’t hurt to spin up a new server and give it a try. If anything it would give us a speedy new offering!

The new PHP server configuration:

  • Ubuntu 14.04 LTS
  • Nginx (with gzip enabled)
  • HHVM
  • External Database Server

It was actually quicker to setup this server than normal, HHVM is a drop in replacement for PHP and PHP-FPM and they give you an Nginx conf file to include in your site configs.

Once the server was configured a WordPress site was copied over from a standard server and the name server records were updated to the new servers IP address.

Here are the results we saw with the same load test:

After HHVM

Wow! Right around 600ms load time even with 50 active connections.

If we look at the part that PHP is responsible for handling (the text/html) can see an improvement of about 210%, that’s fantastic!

With these results we will be running select sites with HHVM to make sure the system is sustainable. Facebook uses it on their production servers so it has been tested thoroughly.

If you are interested in Managed HHVM Hosting give us a call or send an email.