PHP7 vs HHVM Benchmark Series 1: Hello World

race-to-the-finish-2-of-21_650x300
What is the best platform for the fastest PHP engines?

The competition between PHP 7 and HHVM is starting to heat up. HHVM was previously the front runner, originally converting PHP code to C++ but eventually changing their strategy by instead converting to x86-64 machine code to dramatically increase a PHP site’s performance. PHP however is trying very hard to come out on top with the coming release of PHP 7. Who will win this competition, PHP 7 or HHVM?

Before we go into any comparisons on the different aspects of PHP 7 and HHVM, there is a fundamental question that needs to be answered: Which web server will give better performance to the world greatest PHP Engineers, PHP 7 or HHVM? A simple hello world script benchmark serves to answer this question quite well. Instead of testing the performance of PHP itself, the hello world test shows how fast your web server can communicate with your PHP Engine using the smallest possible load overhead. This will lay the foundation for our series of PHP 7 vs HHVM benchmark tests.

We compared 4 web servers in this test: LiteSpeed, OpenLiteSpeed, Nginx and Apache. FastCGI was used by all web servers when talking to HHVM. When communicating with PHP 7, LiteSpeed Server Application Programming Interface (LSAPI) was used with LiteSpeed and OpenLiteSpeed, PHP-FPM was used with Nginx, and both mod_PHP and PHP-FPM were used with Apache.

We also tried to adjust web server configuration as well as PHP and HHVM configurations to have each setup match one another as closely as possible before recording the benchmarks.

Unix Socket has been used for FastCGI connections instead of a TCP port since it provides better performance.

We used the AB benchmark tool to simulate 50 concurrent users and 100000 requests with HTTP KeepAlive enabled using the following command:

ab -k -c 50 -n 100000 http://192.168.0.61/hello.php

 

chart_1200x600

Capture2

Benchmark Server configuration:

Typical VPS Server in an OpenVZ container
Running CentOS 7
2 cores of Intel(R) Xeon(R) CPU E5-1620 @ 3.60GHz
4G RAM

PHP7-nightly build from Zend: PHP Version => 7.0.0-dev, Build Date => Jun 3 2015
HipHop VM 3.7.1-dev
LiteSpeed: 4.2.23
OpenLiteSpeed 1.4.8
Nginx: 1.8.0
Apache: 2.4.6

Contestants:
We’ve pit many different setups against each other for serving a small PHP hello world script. The contestants:

LiteSpeed Enterprise 4.2.23 with PHP 7
OpenLiteSpeed 1.4.8 with PHP 7
Apache 2.4.6 with PHP 7 – mod_PHP
Nginx 1.8.0 with PHP 7 – PHP-FPM
LiteSpeed Enterprise 4.2.23 with HHVM 3.7.1
OpenLiteSpeed 1.4.8 with HHVM 3.7.1
Apache 2.4.6 with PHP 7 – PHP-FPM
Nginx 1.8.0 with HHVM 3.7.1
Apache 2.4.6 with HHVM 3.7.1

Highlights and Conclusion

For a simple hello world test, PHP 7 beats HHVM, running up to 140% faster.
LiteSpeed LSAPI (including OpenLiteSpeed LSAPI) is still topping the list as the world’s fastest way to talk to PHP Engines. It is faster than mod_PHP, PHP-FPM, and HHVM FastCGI.
When using PHP 7, LiteSpeed and OpenLiteSpeed make your PHP Engine run 110% faster than Nginx and 187% faster than Apache.
When using HHVM, LiteSpeed and OpenLiteSpeed make your PHP Engine run 73% faster than Nginx and 100% faster than Apache.
OpenLiteSpeed gives you similar performance to LiteSpeed Enterprise.

For this first round of the PHP 7 vs HHVM Benchmarking series, we have measured how fast your web server performs when talking to the PHP engine. This is purely a measure of the communication speed between the web server and the PHP Engine (IPC cost) and is not indicative of the PHP Engine speed. In this regard, LiteSpeed is the standout among all included servers. For PHP Engine performance benchmarks, stay with us as the next round of benchmarking is coming soon.

If you have any feedback/comments/recommendations, we are keen to hear from you. Shoot us an email at: info@litespeedtech.com



Related Posts


Comments