Site icon David Yin's Blog

PHP Benchmark on HHVM, Nginx Web Server

The test is almost same as I did before on php 5.5, php5.4 and php5.3, or php-fpm. It is running on the HHVM and Nginx.

The installation of Ubuntu 14.04, Nginx, MariaDB, HHVM is posted yesterday.

Using default HHVM settings. The HHVM is version 3.5.0, Nginx is v1.6.2.

--------------------------------------
|        PHP BENCHMARK SCRIPT        |
--------------------------------------
Start : 2015-02-12 00:03:25
Server : mysite.com@192.168.0.115
PHP version : 5.6.99-hhvm
Platform : Linux
--------------------------------------
test_ifelse               : 1.541 sec.
test_math                 : 0.935 sec.
test_stringmanipulation   : 1.153 sec.
test_loops                : 2.262 sec.
--------------------------------------
Total time:               : 5.891 sec.

It took more time than any other php version. I am confused and try to repeat the test, by refreshing the page.
The first ten times, are all around 5.8 seconds. Lower 5.788, higher 6.162. The eleventh gave me a shot, it is only 1.44 seconds. I kept refresh the page and saw similar results, around 1.4 seconds.

--------------------------------------
|        PHP BENCHMARK SCRIPT        |
--------------------------------------
Start : 2015-02-12 00:09:28
Server : mysite.com@192.168.0.115
PHP version : 5.6.99-hhvm
Platform : Linux
--------------------------------------
test_ifelse               : 0.065 sec.
test_math                 : 0.469 sec.
test_stringmanipulation   : 0.811 sec.
test_loops                : 0.093 sec.
--------------------------------------
Total time:               : 1.438 sec.

It is so fast.

I did a research and found the reason of first slow ten is for warmup.  It can be changed to zero.

OK, modify the /etc/hhvm/server.ini , add following in the end.

hhvm.jit_profile_interp_requests = 0

Restart HHVM and done.
The HHVM will do the JIT from the first run.

Exit mobile version