php5から7.0にアップデートしたらwordpressが早くなった

php5時点でのApacheBench

$ ab -n 100 -c 20 https://helloidea.org/XXXX
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 helloidea.org (be patient).....done


Server Software:        Apache/2.4.25
Server Hostname:        helloidea.org
Server Port:            443
SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-AES128-GCM-SHA256,2048,128

Document Path:          /XXXX
Document Length:        78540 bytes

Concurrency Level:      20
Time taken for tests:   1.997 seconds
Complete requests:      100
Failed requests:        10
   (Connect: 0, Receive: 0, Length: 10, Exceptions: 0)
Total transferred:      7870988 bytes
HTML transferred:       7853988 bytes
Requests per second:    50.07 [#/sec] (mean)
Time per request:       399.423 [ms] (mean)
Time per request:       19.971 [ms] (mean, across all concurrent requests)
Transfer rate:          3848.81 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       80  301  79.0    305     444
Processing:    34   70  24.6     62     136
Waiting:        7   23  14.3     18      71
Total:        129  370  83.9    374     546

Percentage of the requests served within a certain time (ms)
  50%    374
  66%    414
  75%    422
  80%    436
  90%    458
  95%    490
  98%    542
  99%    546
 100%    546 (longest request)

php7.0変更後のApacheBench

$ ab -n 100 -c 20 https://helloidea.org/XXXX
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 helloidea.org (be patient).....done


Server Software:        Apache/2.4.25
Server Hostname:        helloidea.org
Server Port:            443
SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-AES128-GCM-SHA256,2048,128

Document Path:          /XXXX
Document Length:        84958 bytes

Concurrency Level:      20
Time taken for tests:   0.967 seconds
Complete requests:      100
Failed requests:        89
   (Connect: 0, Receive: 0, Length: 89, Exceptions: 0)
Total transferred:      8510241 bytes
HTML transferred:       8493241 bytes
Requests per second:    103.38 [#/sec] (mean)
Time per request:       193.454 [ms] (mean)
Time per request:       9.673 [ms] (mean, across all concurrent requests)
Transfer rate:          8592.00 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       58  131  49.8    120     313
Processing:    15   46  31.7     37     164
Waiting:        4   17  10.6     13      40
Total:        105  177  51.1    165     343

Percentage of the requests served within a certain time (ms)
  50%    165
  66%    191
  75%    200
  80%    205
  90%    262
  95%    297
  98%    321
  99%    343
 100%    343 (longest request)

約2倍ほど早くなりました。
キャッシュ系のプラグインを使用していましたが、もう不要かもしれないです。
もっと早く気づきたかった…

パッケージのインストール

apt install php7.0
apt install php5-mysql
apt install libapache2-mod-php7.0
apt install php7.0-gd
apt install php7.0-xml
apt install php7.0-xmlrpc
apt install php7.0-mbstring

php5からphp7.0への切り替え

a2dismod php5
a2enmod php7.0
/etc/init.d/apache2 restart

※php.iniは元々手を加えていた差分だけマージすれば良さそうです

投稿者:

コメントを残す

メールアドレスが公開されることはありません。