HHVM vs PHP 7 Performance Showdown (WordPress, Nginx)

Posted by & filed under Comparison, PHP, Web Servers, WordPress.

coollogo_com-101181608

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 it’s creation was to save the server resources and to provide a faster web experience. It does so with the help of Just in Time (JIT) compiler, that 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 themselves as well, they work hard to optimize it as much as they 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 advantage for HHVM, but what if Facebook decides not go back it one fine day. This would mean that HHVM would loose 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 server (<2 GB ram).

Lets get down to the performance test between HHVM and PHP 7

HHVM vs PHP 7

Test site details

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

Server Details

  • Hosted on an Ubuntu 14.04 server
  • With 1GB Ram
  • 20GB SSD Disk
  • Running Nginx (No caching)
  • Dedicated VPS

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, but 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 Avg response time for HHVM is far less than that for PHP 7, even with having such a high Peak Response Time. It’s 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 later’s site loading slightly faster that 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 PHP 7 WordPress site had the edge and performed better, as we can see from the total Execution time taken by 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, but 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 which might have a large amount of concurrent hits, then it  would perform better for you. If you are looking for a stable WordPress platform for the future, which 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 it’s performance in the coming days

13 Responses to “HHVM vs PHP 7 Performance Showdown (WordPress, Nginx)”

  1. M Asif Rahman

    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.

    Reply
    • Vikrant Datta

      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.

      Reply
    • Michael Burgos

      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.

      Reply
  2. LIONEL y

    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

    Reply
  3. ATULHOST

    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.

    Reply

Leave a Reply