The Definitive PHP 7.0 & HHVM Benchmark
By Mark Gavalda, Updated: April 18, 2016
It’s a great day for all of us who use PHP every day and that doesn’t just include developers (and web hosting companies) but end users as well. It will speed up the most popular web development language in the coming weeks and months which means faster websites and web services for everyone!
We’re addicted to optimizing the load times of websites and we’ve released numerous guides on the topic previously, take a look at A Beginner’s Guide to Website Speed Optimization, Best Free Website Performance Testing Tools, and more.
To see how much of an improvement we can expect from this new PHP interpreter we put the public release version of PHP 7.0 to test and compared a couple of popular software suites’ performance using PHP 5.6.16, PHP 7.0 and HHVM 3.10.1 on a bare metal server (so virtualization doesn’t interfere with the results). Tested software includes WordPress 4.3.1, Drupal 8, Magento 2.0 CE, OctoberCMS build 309, PyroCMS v3 beta2, and Flarum v0.1.0-beta.4.
Long story short, HHVM wins hands down.
The bare metal machine we used for the following benchmarks has an Intel Xeon E5-2630v3 processor (8 CPU cores and 16 threads), 64 GB RAM and 2 x 4 TB SAS 7200 rpm HGST disks in RAID 0.
We used MariaDB 10.1.9 for the MySQL server and Nginx 1.9.7 for the web server.
Updated article on December 9, 2015, after WP4.4 was released. We used dummy content from wptest.io and benchmarked the home page for a minute with 15 concurrent users. WordPress’s was the only test where we could use HHVM’s Repo Authoritative mode without having to make time consuming modifications to the software in question. It adds some extra speed but it may not be something everyone can take advantage of because of the extra deployment steps required to make it work.
WordPress 4.4 HHVM RepoAuthoritative benchmark result: 358.33 trans/sec
WordPress 4.4 HHVM benchmark result: 335.13 trans/sec
WordPress 4.4 PHP 7.0 benchmark result: 287.92 trans/sec
WordPress 4.4 PHP 7.0 without opcache benchmark result: 84.87 trans/sec
We used dummy content from wptest.io and benchmarked the home page for a minute with 15 concurrent users.
WordPress 4.3.1 HHVM RepoAuthoritative benchmark result: 375.48 trans/sec
WordPress 4.3.1 HHVM benchmark result: 357.69 trans/sec
WordPress 4.3.1 PHP 7.0 benchmark result: 306.24 trans/sec
WordPress 4.3.1 PHP 5.6.16 benchmark result: 106.45 trans/sec
Standard installation with the devel module’s 50 posts sample data. Benchmarked the home page for a minute with 15 concurrent users. This was the most interesting result of all, we deleted the Drupal installation completely after getting these results and installed again, set it up same as before and re-did all the test. Almost exactly the same results!
Drupal 8 HHVM benchmark result: 1739.28 trans/sec
Drupal 8 PHP 7.0 benchmark result: 917.10 trans/sec
Drupal 8 PHP 5.6.16 benchmark result: 794.20 trans/sec
Magento 2.0 Community Edition
Standard install with the official sample data package. Magento’s internal caches were turned on otherwise it’s a miserable 5 transactions/second… Benchmarked the home page for a minute with 15 concurrent users.
Magento HHVM benchmark result: 192.19 trans/sec
Magento PHP 7.0 benchmark result: 183.87 trans/sec
Magento PHP 5.6.16 benchmark result: 113.34 trans/sec
A Laravel based CMS system that’s popular in itself plus gave us the opportunity to test the underlying Laravel framework as well! We chose the Vanilla theme during installation which has a user system, a blog and a forum. Benchmarked the home page for a minute with 15 concurrent users.
OctoberCMS HHVM benchmark result: 583.07 trans/sec
OctoberCMS PHP 7.0 benchmark result: 407.89 trans/sec
OctoberCMS PHP 5.6.16 benchmark result: 248.19 trans/sec
PyroCMS v3 beta2
Another Laravel based content management system. We used the default setup and added a blog post and tested that “single page” for a minute with 15 concurrent users.
PyroCMS HHVM benchmark result: 177.39 trans/sec
PyroCMS PHP 7.0 benchmark result: 145.95 trans/sec
PyroCMS PHP 5.6.16 benchmark result: 75.17 trans/sec
We installed the default Laravel package and tested its “welcome screen” without any database connections. Don’t forget that OctoberCMS above is built on Laravel as well so it looks like as soon as you add some other stuff to the tests as well HHVM takes back the lead. We’ve run the tests for a minute with 10 concurrent users. When we used php artisan optimize –force and php artisan config:cache results were 1.5x better than the ones below.
Laravel 5.1.11 HHVM benchmark result: 1128.41 trans/sec
Laravel 5.1.11 PHP 7.0 benchmark result: 1363.24 trans/sec
Laravel 5.1.11 PHP 7.0 without opcache benchmark result: 245.60 trans/sec
Delightfully simple forum software. Flarum is the combined successor of esoTalk and FluxBB. It uses a mix of Laravel’s, the Zend Frameworks and Symfony components (among others of course) and it’s an up and coming software suite in the PHP world so we thought it’d be interesting to include it.
That’s all, folks! The results are pretty self-explanatory. If you want us to include another framework or app, let us know! Comments are welcome.
A quick note: if you use Debian/Ubuntu chances are you’re using Ondřej Surý‘s PHP packages. He maintains his repositories in his free time and accepts donations. If you feel like he’s helped you in the past, buy him a beer! His bitcoin address is 15WRQCrVHWUdcn3sbT7PF6u2FJGfbb8GW5
Featured image via Digital Ocean.