HHVM @ Debian + Nginx

A dziś sobie potestuje HHVM, czyli HipHop Virtual Machine. Zobaczymy co z tego wyjdzie :).
Ale teraz czas na instalacje. HHVM jest dostępne na wiele systemów w postaci paczek, które dostępne są pod adresem https://github.com/facebook/hhvm/wiki/Prebuilt%20Packages%20for%20HHVM.
Mnie interesuje paczka dla Debian-a, więc:
wget -O - http://dl.hhvm.com/conf/hhvm.gpg.key | apt-key add - echo deb http://dl.hhvm.com/debian wheezy main | tee /etc/apt/sources.list.d/hhvm.list apt-get update apt-get install hhvm
Mamy już HHVM w systemie czas na zgranie tego z nginx.
location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include /etc/nginx/fastcgi_params; }
W moim przypadku HHVM lata na porcie 9000. W zasadzie to wszystko. Trzeba potestować.
Troszkę info o wydajności http://ma.ttias.be/hhvm-versus-php-fpm-5-4-and-5-5-performance-comparison/
I moje testy:
HHVM:
$ ab -c 1 -n 100 https://www.8px.pl/ This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking www.8px.pl (be patient).....done Server Software: nginx Server Hostname: www.8px.pl Server Port: 443 SSL/TLS Protocol: TLSv1/SSLv3,ECDHE-RSA-AES256-GCM-SHA384,2048,256 Document Path: / Document Length: 61377 bytes Concurrency Level: 1 Time taken for tests: 4.597 seconds Complete requests: 100 Failed requests: 0 Write errors: 0 Total transferred: 6172900 bytes HTML transferred: 6137700 bytes Requests per second: 21.75 [#/sec] (mean) Time per request: 45.973 [ms] (mean) Time per request: 45.973 [ms] (mean, across all concurrent requests) Transfer rate: 1311.25 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 3 4 0.8 4 8 Processing: 33 42 14.4 39 164 Waiting: 31 40 14.4 38 162 Total: 37 46 14.4 43 168 Percentage of the requests served within a certain time (ms) 50% 43 66% 46 75% 47 80% 47 90% 53 95% 61 98% 95 99% 168 100% 168 (longest request)
PHP5-FPM
$ ab -c 1 -n 100 https://www.8px.pl/ This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking www.8px.pl (be patient).....done Server Software: nginx Server Hostname: www.8px.pl Server Port: 443 SSL/TLS Protocol: TLSv1/SSLv3,ECDHE-RSA-AES256-GCM-SHA384,2048,256 Document Path: / Document Length: 61377 bytes Concurrency Level: 1 Time taken for tests: 4.336 seconds Complete requests: 100 Failed requests: 0 Write errors: 0 Total transferred: 6170300 bytes HTML transferred: 6137700 bytes Requests per second: 23.06 [#/sec] (mean) Time per request: 43.359 [ms] (mean) Time per request: 43.359 [ms] (mean, across all concurrent requests) Transfer rate: 1389.72 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 3 5 1.0 4 7 Processing: 32 39 5.2 37 62 Waiting: 31 37 5.0 36 59 Total: 36 43 5.5 42 68 Percentage of the requests served within a certain time (ms) 50% 42 66% 45 75% 47 80% 48 90% 50 95% 52 98% 60 99% 68 100% 68 (longest request)
Hm.. PHP5-FPM wydaje się być o ułamki szybszy w moim przypadku.
A oto muzyczka dla lepszej zabawy