PHP 7.0 and HHVM performance comparison
For quite some time there was no news about it, but, after a long wait, PHP 7 finally came out on December 3, 2015. We decided to test the most popular PHP-based CMS to test how they work with PHP 7.
This is a great day for everyone who regularly uses PHP - for developers, hosting companies, and even for end users. The release of the new version will give a powerful impetus to the development of this popular web development language. And ultimately it will translate into faster website and web services.
We pay a lot of attention to optimizing website loading time, and have released a number of manuals on the topic, for example: A Beginner's Guide to Website Speed Optimization , Best Free Website Performance Testing Toolsand others .
To evaluate the performance of the new PHP interpreter, we ran a number of popular products through several benchmarks using PHP 5.6.16, PHP 7.0 and HHVM 3.10.1. Tests were conducted on the bare metal so that virtualization did not affect the final result. The comparison involved:
- WordPress 4.3.1,
- Drupal 8,
- Magento 2.0 CE,
- OctoberCMS build 309,
- PyroCMS v3 beta2,
- Flarum v0.1.0-beta. 4.
Looking ahead, let's say that HHVM won. In our project, we will not abandon the HHVM-first of all policy. Since we focus on sites with high traffic, the best technologies of all available are of paramount importance to us, and this is clearly not PHP 7. Nevertheless, we will offer the new version as a backup solution, and in stages we will completely switch to it from PHP 5.6 in the coming weeks.
Server configuration used for benchmarks:
- Intel Xeon E5-2630v3 (8 processor cores and 16 threads),
- 64 GB RAM
- 2 x 4 TB SAS 7200 rpm HGST drives in RAID 0.
We also used MariaDB 10.1.9 for the MySQL server and Nginx 1.9.7 for the web server.
As the test site, the main page of the newly installed wptest.io was selected. Within a minute, 15 users simultaneously loaded this page. For WordPress, this was the only test where we could use HHVM's Repo Authoritative mode without laborious software modifications. This could increase productivity, but not everyone will do it.
- WordPress 4.4 HHVM RepoAuthoritative result: 358.33 op / sec.
- WordPress 4.4 HHVM result: 335.13 op / s
- WordPress 4.4 PHP 7.0 result: 287.92 op / sec
- WordPress 4.4 PHP 7.0 without OPcache result: 84.87 op / sec.
Here 15 users again for a minute at the same time loaded the main page wptest.io.
- WordPress 4.3.1 HHVM RepoAuthoritative result: 375.48 op / sec
- WordPress 4.3.1 HHVM result: 357.69 op / s
- WordPress 4.3.1 PHP 7.0 result: 306.24 op / s
- WordPress 4.3.1 PHP 5.6.16 result: 106.45 op / sec
As a test site, we used a freshly installed CMS in a standard configuration. 50 teasers with demo data (via the Devel module) were displayed on the main page. The page for a minute at the same time loaded 15 users.
We got such an interesting result that after testing we completely uninstalled Drupal, installed it again according to the instructions, and re-run all the tests. And got similar results!
- Drupal 8 HHVM result: 1739.28 op / sec
- Drupal 8 PHP 7.0 result: 917.10 op / s
- Drupal 8 PHP 5.6.16 result: 794.20 op / s
Magento 2.0 Community Edition
We used a standard installation with official demo data. We had to turn on the Magento internal cache, because otherwise we would get frivolous 5 op / sec. The home page was simultaneously loaded by 15 users for a minute.
- Magento HHVM result: 192.19 op / s
- Magento PHP 7.0 result: 183.87 op / sec
- Magento PHP 5.6.16 result: 113.34 op / sec.
This CMS, based on Laravel, gave us the opportunity to test the Laravel framework itself at the same time. During installation, we selected the Vanilla theme, which includes a user system, a blog, and a forum. Within a minute, 15 users simultaneously loaded the main page.
- OctoberCMS HHVM result: 583.07 op / s
- OctoberCMS PHP 7.0 result: 407.89 op / s
- OctoberCMS PHP 5.6.16 result: 248.19 op / sec.
PyroCMS v3 beta2
Another CMS based on Laravel. We used the standard installation, added one post to the blog, and this “separate page” 15 users simultaneously tested for one minute.
- PyroCMS HHVM result: 177.39 op / s
- PyroCMS PHP 7.0 result: 145.95 op / sec
- PyroCMS PHP 5.6.16 result: 75.17 op / sec.
We installed the default Laravel framework package and tested its “welcome screen” without any database connections. Don’t forget that OctoberCMS, tested above, is built on the basis of Laravel, so it looks like you are adding additional modules, and HHVM itself takes the initiative. We ran tests for one minute with 10 users at a time.
When using optimization teams
php artisan –force, the
php artisan config:cacheresults were one and a half times better than those presented below.
- Laravel 5.1.11 HHVM result: 1128.41 op / s
- Laravel 5.1.11 PHP 7.0 result: 1363.24 op / s
- Laravel 5.1.11 PHP 7.0 without OPcache result: 245.60 op / sec.
Flarum is a delightfully simple forum creation software. This is the common successor to esoTalk and FluxBB. Since it uses a combination of Laravel, Zend frameworks and Symfony components (the current set of software in the PHP world), we decided that it would be interesting to include it in the list.
But it seems that we are a little hot, and in this article for Flarum have to leave the cap - it does not work with HHVM, nor with PHP 7. On HHVM we get an error
“Fatal error: Return inside a finally block is not supported in vendor/flarum/core/src/Foundation/Application.php on line 120”, but in PHP 7 Post:
The results presented in the diagrams speak for themselves. If you want to include another framework or application in the test, let us know! Test comments are welcome.