【php】php5.6とphp7.0をwordpressで比較してみた
はじめに
php5.6からphp7.0にしたらどれくらい速くなるのかというのを試してみただけ
環境としてはローカルPCにvagrantでcentos6.7、php5.6、mysql5.6、apache2.2.15をインストールして
最新バージョンのwordpressをいれてダミーデータを登録してapache benchでレスポンスを比較
また、apache、mysqlのチューニングは一切なしで
環境の構築についてはこちらのとおり
【vagrant】開発環境をサクッと作るときの手順メモ - とりあえずphpとか
【wordpress】wordpress検証用環境を作ったので構築手順メモ - とりあえずphpとか
結果
apache benchコマンド
$ ab -n 100 -c 20 http://192.168.33.10/
php5.6
Requests per second: 1.96 [#/sec] (mean) Time per request: 10220.889 [ms] (mean) Time per request: 511.044 [ms] (mean, across all concurrent requests)
php7.0
Requests per second: 6.17 [#/sec] (mean) Time per request: 3242.168 [ms] (mean) Time per request: 162.108 [ms] (mean, across all concurrent requests)
「Requests per second」を見ると1秒間に捌けるリクエスト数が3倍になってる。。。
検証用アプリも自前で用意してもう少し色々調べた方がいいとは思うが、wordpressに70記事くらい登録した状態でもこれだけの差が出たのでかなり速くなったと思って良い気がする
以上です
apache bench 全結果
php5.6
$ ab -n 100 -c 20 http://192.168.33.10/
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 192.168.33.10 (be patient).....done
Server Software: Apache/2.2.15
Server Hostname: 192.168.33.10
Server Port: 80
Document Path: /
Document Length: 72219 bytes
Concurrency Level: 20
Time taken for tests: 51.104 seconds
Complete requests: 100
Failed requests: 0
Total transferred: 7245700 bytes
HTML transferred: 7221900 bytes
Requests per second: 1.96 [#/sec] (mean)
Time per request: 10220.889 [ms] (mean)
Time per request: 511.044 [ms] (mean, across all concurrent requests)
Transfer rate: 138.46 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 4 17.2 0 101
Processing: 1860 9649 3442.2 10069 15742
Waiting: 891 5848 2199.6 5802 11823
Total: 1860 9653 3442.9 10069 15742
Percentage of the requests served within a certain time (ms)
50% 10069
66% 11226
75% 12287
80% 12555
90% 13802
95% 14827
98% 15437
99% 15742
100% 15742 (longest request)php7.0
$ ab -n 100 -c 20 http://192.168.33.10/
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 192.168.33.10 (be patient).....done
Server Software: Apache/2.2.15
Server Hostname: 192.168.33.10
Server Port: 80
Document Path: /
Document Length: 72219 bytes
Concurrency Level: 20
Time taken for tests: 16.211 seconds
Complete requests: 100
Failed requests: 0
Total transferred: 7245700 bytes
HTML transferred: 7221900 bytes
Requests per second: 6.17 [#/sec] (mean)
Time per request: 3242.168 [ms] (mean)
Time per request: 162.108 [ms] (mean, across all concurrent requests)
Transfer rate: 436.49 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.4 0 2
Processing: 599 3078 1347.5 2913 6638
Waiting: 394 2430 1161.5 2152 5876
Total: 600 3079 1347.4 2914 6638
Percentage of the requests served within a certain time (ms)
50% 2914
66% 3405
75% 3639
80% 3781
90% 5241
95% 6026
98% 6501
99% 6638
100% 6638 (longest request)