yumでPHP5.5にZend OPcacheを追加する

yumでPHP5.5にZend OPcacheを追加する

PHP5.5からはAPCが廃止されZend OPcacheになります
というわけでyumで入れてみます

インストール

$ sudo yum --enablerepo=remi-php55 install php-pecl-zendopcache

remi-php55についてはCentOS6にPHP5.5をyumでインストール

設定ファイル

/etc/php.d/opcache.ini
/etc/php.d/opcache-default.blacklist

効果検証

さくらVPS 1Gプラン

PHP5.5のみ

$ ab -c 10 -n 1000 http://test/EC-CUBE/guide/privacy.php
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  (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        Apache/2.2.15
Server Hostname:        
Server Port:            80

Document Path:          /guide/privacy.php
Document Length:        12920 bytes

Concurrency Level:      10
Time taken for tests:   85.070 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      13333000 bytes
HTML transferred:       12920000 bytes
Requests per second:    11.75 [#/sec] (mean)
Time per request:       850.703 [ms] (mean)
Time per request:       85.070 [ms] (mean, across all concurrent requests)
Transfer rate:          153.06 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       28  170 111.3    173     453
Processing:   180  678 220.0    689    1211
Waiting:      131  613 210.3    632    1137
Total:        465  848 207.8    851    1546

Percentage of the requests served within a certain time (ms)
  50%    851
  66%    938
  75%   1002
  80%   1032
  90%   1128
  95%   1207
  98%   1300
  99%   1368
 100%   1546 (longest request)

PHP5.5+Zend OPcache

$ ab -c 10 -n 1000 http://test/EC-CUBE/guide/privacy.php
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  (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        Apache/2.2.15
Server Hostname:        
Server Port:            80

Document Path:          /guide/privacy.php
Document Length:        12920 bytes

Concurrency Level:      10
Time taken for tests:   73.430 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      13346333 bytes
HTML transferred:       12932920 bytes
Requests per second:    13.62 [#/sec] (mean)
Time per request:       734.296 [ms] (mean)
Time per request:       73.430 [ms] (mean, across all concurrent requests)
Transfer rate:          177.50 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       28  236 157.9    229     511
Processing:   120  495 173.6    503    1183
Waiting:       70  418 168.0    415    1127
Total:        323  730 192.4    727    1283

Percentage of the requests served within a certain time (ms)
  50%    727
  66%    793
  75%    847
  80%    894
  90%    991
  95%   1096
  98%   1179
  99%   1201
 100%   1283 (longest request)

有効にしただけで効果が結構出ていますね

おまけ PHP5.3.3+apc3.1.9

$ ab -c 10 -n 1000 http://test/EC-CUBE/guide/privacy.php
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  (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        Apache/2.2.15
Server Hostname:        
Server Port:            80

Document Path:          /guide/privacy.php
Document Length:        12920 bytes

Concurrency Level:      10
Time taken for tests:   70.072 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      13346333 bytes
HTML transferred:       12932920 bytes
Requests per second:    14.27 [#/sec] (mean)
Time per request:       700.718 [ms] (mean)
Time per request:       70.072 [ms] (mean, across all concurrent requests)
Transfer rate:          186.00 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       28  219 135.3    229     509
Processing:   126  477 177.4    454    1042
Waiting:       76  405 165.1    383     986
Total:        328  696 188.0    632    1330

Percentage of the requests served within a certain time (ms)
  50%    632
  66%    728
  75%    801
  80%    849
  90%    980
  95%   1096
  98%   1171
  99%   1240
 100%   1330 (longest request)

1回しかテストしてないからなんとも言えないところですがapcの方がちょっと早いのかもしれませんね〜
まだphp5.5.0なので今後に期待です