2018年12月6日にPHP7.3がリリースされました。
それにともないKUSANAGIのPHP7環境を7.3にアップグレードする対応もリリースしております。
そこで今回はPHP7.3、PHP7.2そして2018年12月31日にセキュリティサポートを含む全てのサポートが終了してしまうPHP5.6環境に対してApache Benchを行い性能を比較してみました。
アクセスしたURLはWordPress5.0をインストールした直後のTOPページです。
実施した環境に関しては以下の通りです。PHP7.2と7.3に関してはKUSANAGIの環境ですが、PHP5.6に関しては素のCentOSで導入可能なミドルウェアに加えてPHP5.6を導入した環境です。
| バージョン | インスタンスサイズ | OS |
|---|---|---|
| PHP 7.3.0 | Microsoft Azure Standard_B2s(2vCPU 4GiBメモリ) | CentOS7(KUSANAGI) |
| PHP 7.2.12 | Microsoft Azure Standard_B2s(2vCPU 4GiBメモリ) | CentOS7(KUSANAGI) |
| PHP 5.6.39 | Microsoft Azure Standard_B2s(2vCPU 4GiBメモリ) | CentOS7 |
なお、PHP5系につきましては、現在世界で最も稼働しているPHPのバージョンということで、特にチューニングを施していないWordPressサイトにおいては、この結果と近しいものになると思われます。
下記の情報源によりますと、2018年12月11日現在ではPHP5系の世界シェアは75.2%ということです。
https://w3techs.com/technologies/details/pl-php/all/all
結果は下記の通りです。PHP5.6とKUSANAGIのPHP7.2では14倍の性能差がありますが、PHP7.2と7.3では更に1.2倍ほど性能が向上しています。
| PHPのバージョン | Requests per second |
|---|---|
| 7.3 | 144.22 |
| 7.2 | 128.18 |
| 5.6 | 9.10 |
結果詳細
それぞれの詳細結果は下記の通りです。
PHP7.3
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking php73.example.jp (be patient)
Server Software: nginx
Server Hostname: php73.example.jp
Server Port: 80
Document Path: /
Document Length: 10539 bytes
Concurrency Level: 100
Time taken for tests: 6.934 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 10908000 bytes
HTML transferred: 10539000 bytes
Requests per second: 144.22 [#/sec] (mean)
Time per request: 693.392 [ms] (mean)
Time per request: 6.934 [ms] (mean, across all concurrent requests)
Transfer rate: 1536.27 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.8 0 4
Processing: 24 667 126.8 691 971
Waiting: 19 667 126.8 691 971
Total: 24 668 126.2 691 971
Percentage of the requests served within a certain time (ms)
50% 691
66% 708
75% 719
80% 727
90% 754
95% 778
98% 822
99% 900
100% 971 (longest request)
PHP7.2
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking php72.example.jp (be patient)
Server Software: nginx
Server Hostname: php72.example.jp
Server Port: 80
Document Path: /
Document Length: 10539 bytes
Concurrency Level: 100
Time taken for tests: 7.802 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 10908000 bytes
HTML transferred: 10539000 bytes
Requests per second: 128.18 [#/sec] (mean)
Time per request: 780.176 [ms] (mean)
Time per request: 7.802 [ms] (mean, across all concurrent requests)
Transfer rate: 1365.38 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.7 0 3
Processing: 23 751 142.4 777 1121
Waiting: 19 751 142.4 776 1121
Total: 23 752 141.8 777 1121
Percentage of the requests served within a certain time (ms)
50% 777
66% 797
75% 815
80% 825
90% 849
95% 866
98% 957
99% 1009
100% 1121 (longest request)
PHP5.6
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 13.78.66.204 (be patient)
Server Software: Apache/2.4.6
Server Hostname: 13.78.66.204
Server Port: 80
Document Path: /
Document Length: 10640 bytes
Concurrency Level: 100
Time taken for tests: 109.842 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 10897000 bytes
HTML transferred: 10640000 bytes
Requests per second: 9.10 [#/sec] (mean)
Time per request: 10984.182 [ms] (mean)
Time per request: 109.842 [ms] (mean, across all concurrent requests)
Transfer rate: 96.88 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 1 11 14.8 8 61
Processing: 305 10770 2329.7 10927 17717
Waiting: 193 9646 2114.2 9683 16386
Total: 306 10781 2330.0 10931 17728
Percentage of the requests served within a certain time (ms)
50% 10931
66% 11063
75% 11151
80% 11227
90% 11677
95% 15496
98% 16532
99% 17047
100% 17728 (longest request)





