Disable PHP 7 and start HHVM
The basic settings for HHVM are now completed. Disable PHP 7 and start HHVM.
[root@ip ~]# systemctl disable php-fpm [root@ip ~]# systemctl stop php-fpm [root@ip ~]# systemctl enable hhvm [root@ip ~]# systemctl start hhvm
Load the front page in your browser. The first time will be slow because byte-code is being compiled, but the more you refresh, the faster the display load time will get. Refresh your browser about 10 times. As you do this the JIT compiler is working to improve the speed. In my environment my page load time was 16ms.
Perform a benchmark test with ab.
[root@ip ~]# ab -n 300 -c 30 http://ec2-xxx.xxx.compute.amazonaws.com/
Remember to perform the test about 7 times with an interval of 10 seconds. You will be able to see increased performance with each test. In my environment, on the 7th test the requests per second was 195.05. This is a 132% increase in performance over PHP 7.
Tuning contents | Page load time | Requests per second |
Default environment | 176ms | 11.24 |
APC | 70ms (251%) | 29.20 |
OPcache+APCu | 66ms (266%) | 30.51 |
MariaDB settings | 64ms (275%) | 31.82 |
Translation accelerator (cache) | 53ms (332%) | 39.29 |
Translation accelerator (disabled) | 36ms (488%) | 56.78 |
gzip | 35ms (502%) | ─ |
Tuned settings | 34ms (517%) | 58.47 |
event MPM+php-fpm | 33ms (537%) | 60.79 |
AWS users | 31ms (567%) | 71.76 |
PHP 5.6+OPCache+APCu | 32ms (550%) | 61.84 (550.2%) |
PHP 7+OPCache+APCu | 18ms (977.7%) | 148.08 (1250.6%) |
HHVM | 16ms (1100%) | 195.05 (1690.8%) |
With this tuning we have increased the speed 16.9x the default environment.
Next time, we will switch the web server from Apache to Nginx to get 18.2x faster.
[Previous article] [Next article]