HHVM vs PHP 7 Performance Showdown (WordPress, Nginx)

What is HHVM?

In case you have not heard about it till now, let me tell you a few things about it in brief, before we go into the HHVM vs PHP 7 tests

HHVM is an abbreviation for HipHop Virtual Machine. It was created by Facebook in 2010, with the first public version released in 2011. The main reason behind its creation was to save the server resources and to provide a faster web experience. It does so with the help of a Just in Time (JIT) compiler, which takes PHP code and complies it into Machine code on the fly.

Advantages of HHVM

  • Performance boost: one of the major advantages that HHVM brings to the table is a considerable performance boost, thanks mainly due to the JIT compiler.
  • Facebook: What makes the HHVM community and support great and dependable is the fact it is being backed by Facebook. As Facebook uses HHVM itself as well, it works hard to optimize it as much as it can.
  • Hack: The ability to statically code, using HHVM internally developer language hack further increases the speed of compilation.

Disadvantages of HHVM

  • Custom extensions: You can add out-of-the-box custom extensions. You will have to convert the extensions for HHVM first before adding them
  • Facebook: Yes this is one of the advantages of HHVM, but what if Facebook decides not to go back to it one fine day? This would mean that HHVM would lose the great Development and Support community that they have.
  • WordPress Plugins and Themes: Another big disadvantage for HHVm is that it does not support all the WordPress plugins and themes out of the box. You might have to hack some of them to work properly with HHVM.
  • Supports high-end machines: HHVM is not supported for any 32-bit machines. Along with this HHVM also takes a lot of memory as compared to PHP 7 which puts constraints on the server selection. HHVM, ideally does not work well with smaller servers (<2 GB ram).

Let’s get down to the performance test between HHVM and PHP 7

HHVM vs PHP 7

Test site details

  • The latest available WordPress version at the time when the article was written was WordPress 4.4.2
  • 1000 blog posts on the site
  • TwentySixteen default theme
  • 150 users
  • Around 500 comments

Server Details

TEST 1: Loadstorm test

We tested the same WordPress site for HHVM and PHP 7 on the same server on the load Performance benchmark test at loadstorm.com. The test was conducted for upto 10 concurrent users for a duration of 10 minutes.

PHP 7

loadstorm-php7-test

HHVM

loadstorm-hhvm-test

Comparing the two tests, we can see that even though HHVM was slow to start off with and got a huge spike in the response time, after the first minute or so it caught up and even made ground to PHP 7 as it emerged the clear winner in this test.

loadstorm-compare-hhvm-php7

 We can see that the average response time for HHVM is far less than that for PHP 7, even with having such a high Peak Response Time. Its performance during the initial part of the test was slow due to the fact that it caches the pages initially which can cause a temporary performance drop, but after that the performance picks up incredibly.

loadstorm-hhvm-php7-bar

TEST 2 : WebPageSpeed test

This is a simple web page speed test loading test performed at http://www.webpagetest.org/

PHP 7

WebPagetest Test Result-php7-uizen

HHVM

WebPagetest Test Result -hhvm-uizen.com

In this test, both PHP 7 and HHVM sites fared almost equally, with the latter’s site loading slightly faster than the PHP 7 WordPress site.

hhvm-php7-php5.6-load-time-bar

TEST 3: WP Performance Tester Plugin

For the third and final test, we used the “WP Performance Tester” plugin, which is a Performance benchmark testing WordPress plugin

WP-performance-test-hhvm-v-php7

In this test we found that the PHP 7 WordPress site had the edge and performed better, as we can see from the total Execution time taken by the PHP 7 site was less than than that for the HHVM site and it also executed more queries per second.

wp-performance-hhvm-php7-bar

The Verdict

From our tests, we found that though PHP 7 has caught up a lot against HHVM, from PHP 5.6, the HHVM WordPress site still performed better for a high number of concurrent requests on the server. This is because it takes less CPU resources and thus gives a better response time than PHP 7.

That being said PHP 7’s performance was almost at the same level as HHVM for the Site load time test. PHP 7 also performed better in terms of the number of queries executed per second.

In my opinion, it comes down to what your requirements are. If you have a multi-core server that can handle HHVM without crashing or have a site that might have a large number of concurrent hits, then it would perform better for you. If you are looking for a stable WordPress platform for the future, that performs better than PHP 5, then you should go for PHP 7. I won’t be surprised if PHP 7 catches up to HHVM or even surpasses its performance in the coming days

16 Replies to “HHVM vs PHP 7 Performance Showdown (WordPress, Nginx)”

  1. I am also all in for PHP7, but in real test HHVM is still best option for most existing project as PHP7 compatibility is still an issue. Bunch of essential plugin did not worked out-of-the box in PHP7 for me.

    1. Hi Kingsley

      Even I had the same problem. HHVM takes up a lot of memory and when ever the site used to get about 5-10 concurrent users, HHVM used to crash. Tried a lot of things to solve the issue, but finally cleaned the whole server and installed everything from scratch again, which removed the issue.

    2. If you use NGINX as your webserver you can install HHVM with a backfall on PHP7.1 You also could setup monit to monitor and start HHVM if it shuts down itself.

  2. Running php 7.1 and happy with the results. With no caching 7 does as well as hhvm way ahead of 5.4 performance boost worth the uprade

  3. I found that PHP7 is more better in performance and yet stable in WordPress environment. The good thing is that PHP7 gives us almost equal performance rate like HHVM. I am in favor of PHP7 because its first response time is better than HHVM.

Leave a Reply

Your email address will not be published. Required fields are marked *