{"id":3119,"date":"2015-07-16T13:33:56","date_gmt":"2015-07-16T17:33:56","guid":{"rendered":"http:\/\/blog.litespeedtech.com\/?p=3119"},"modified":"2015-07-16T13:33:56","modified_gmt":"2015-07-16T17:33:56","slug":"php7-vs-hhvm-benchmark-series-1-hello-world","status":"publish","type":"post","link":"https:\/\/lswp.store\/index.php\/2015\/07\/16\/php7-vs-hhvm-benchmark-series-1-hello-world\/","title":{"rendered":"PHP7 vs HHVM Benchmark Series 1: Hello World"},"content":{"rendered":"<p><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-3151\" src=\"http:\/\/blog.litespeedtech.com\/wp-content\/uploads\/2015\/07\/race-to-the-finish-2-of-21_650x300.png\" alt=\"race-to-the-finish-2-of-21_650x300\" width=\"650\" height=\"300\" srcset=\"https:\/\/lswp.store\/wp-content\/uploads\/2015\/07\/race-to-the-finish-2-of-21_650x300.png 650w, https:\/\/lswp.store\/wp-content\/uploads\/2015\/07\/race-to-the-finish-2-of-21_650x300-300x138.png 300w, https:\/\/lswp.store\/wp-content\/uploads\/2015\/07\/race-to-the-finish-2-of-21_650x300-600x277.png 600w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><br \/>\n<strong>What is the best platform for the fastest PHP engines?<\/strong><\/p>\n<p>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\u2019s 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?<br \/>\n<!--more--><\/p>\n<p>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.<\/p>\n<p>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.<\/p>\n<p>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.<\/p>\n<p>Unix Socket has been used for FastCGI connections instead of a TCP port since it provides better performance.<\/p>\n<p>We used the AB benchmark tool to simulate 50 concurrent users and 100000 requests with HTTP KeepAlive enabled using the following command:<\/p>\n<p><code> ab -k -c 50 -n 100000 http:\/\/192.168.0.61\/hello.php<\/code><\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-3149\" src=\"http:\/\/blog.litespeedtech.com\/wp-content\/uploads\/2015\/07\/chart_1200x600.png\" alt=\"chart_1200x600\" width=\"1200\" height=\"600\" srcset=\"https:\/\/lswp.store\/wp-content\/uploads\/2015\/07\/chart_1200x600.png 1200w, https:\/\/lswp.store\/wp-content\/uploads\/2015\/07\/chart_1200x600-300x150.png 300w, https:\/\/lswp.store\/wp-content\/uploads\/2015\/07\/chart_1200x600-1024x512.png 1024w, https:\/\/lswp.store\/wp-content\/uploads\/2015\/07\/chart_1200x600-768x384.png 768w, https:\/\/lswp.store\/wp-content\/uploads\/2015\/07\/chart_1200x600-600x300.png 600w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-3129\" src=\"http:\/\/blog.litespeedtech.com\/wp-content\/uploads\/2015\/07\/Capture2.png\" alt=\"Capture2\" width=\"788\" height=\"496\" srcset=\"https:\/\/lswp.store\/wp-content\/uploads\/2015\/07\/Capture2.png 788w, https:\/\/lswp.store\/wp-content\/uploads\/2015\/07\/Capture2-300x189.png 300w, https:\/\/lswp.store\/wp-content\/uploads\/2015\/07\/Capture2-768x483.png 768w, https:\/\/lswp.store\/wp-content\/uploads\/2015\/07\/Capture2-600x378.png 600w\" sizes=\"(max-width: 788px) 100vw, 788px\" \/><\/p>\n<p><strong>Benchmark Server configuration:<\/strong><\/p>\n<p>Typical VPS Server in an OpenVZ container<br \/>\nRunning CentOS 7<br \/>\n2 cores of Intel(R) Xeon(R) CPU E5-1620 @ 3.60GHz<br \/>\n4G RAM<\/p>\n<p>PHP7-nightly build from Zend: PHP Version =&gt; 7.0.0-dev, Build Date =&gt; Jun 3 2015<br \/>\nHipHop VM 3.7.1-dev<br \/>\nLiteSpeed: 4.2.23<br \/>\nOpenLiteSpeed 1.4.8<br \/>\nNginx: 1.8.0<br \/>\nApache: 2.4.6<\/p>\n<p><strong>Contestants:<\/strong><br \/>\nWe\u2019ve pit many different setups against each other for serving a small PHP hello world script. The contestants:<\/p>\n<p>LiteSpeed Enterprise 4.2.23 with PHP 7<br \/>\nOpenLiteSpeed 1.4.8 with PHP 7<br \/>\nApache 2.4.6 with PHP 7 &#8211; mod_PHP<br \/>\nNginx 1.8.0 with PHP 7 &#8211; PHP-FPM<br \/>\nLiteSpeed Enterprise 4.2.23 with HHVM 3.7.1<br \/>\nOpenLiteSpeed 1.4.8 with HHVM 3.7.1<br \/>\nApache 2.4.6 with PHP 7 &#8211; PHP-FPM<br \/>\nNginx 1.8.0 with HHVM 3.7.1<br \/>\nApache 2.4.6 with HHVM 3.7.1<\/p>\n<p><strong>Highlights and Conclusion<\/strong><\/p>\n<p>For a simple hello world test, PHP 7 beats HHVM, running up to 140% faster.<br \/>\nLiteSpeed LSAPI (including OpenLiteSpeed LSAPI) is still topping the list as the world&#8217;s fastest way to talk to PHP Engines. It is faster than mod_PHP, PHP-FPM, and HHVM FastCGI.<br \/>\nWhen using PHP 7, LiteSpeed and OpenLiteSpeed make your PHP Engine run 110% faster than Nginx and 187% faster than Apache.<br \/>\nWhen using HHVM, LiteSpeed and OpenLiteSpeed make your PHP Engine run 73% faster than Nginx and 100% faster than Apache.<br \/>\nOpenLiteSpeed gives you similar performance to LiteSpeed Enterprise.<\/p>\n<p>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.<\/p>\n<p>If you have any feedback\/comments\/recommendations, we are keen to hear from you. Shoot us an email at: info@litespeedtech.com<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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\u2019s performance. PHP however [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3151,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[16,27,29,20],"tags":[37,128,196,220,222,228],"class_list":["post-3119","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-benchmarks","category-web-server","category-openlitespeed","category-performance","tag-apache-compatible","tag-hhvm","tag-nginx","tag-php","tag-php-7","tag-php7-vs-hhvm"],"jetpack_featured_media_url":"https:\/\/lswp.store\/wp-content\/uploads\/2015\/07\/race-to-the-finish-2-of-21_650x300.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts\/3119","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/comments?post=3119"}],"version-history":[{"count":0,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/posts\/3119\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/media\/3151"}],"wp:attachment":[{"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/media?parent=3119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/categories?post=3119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lswp.store\/index.php\/wp-json\/wp\/v2\/tags?post=3119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}