Test environment
lyolzj@localhost/usr/local/src/zendopcache-7.0.5 $ lscpu
architecture:i686
CPU Op-mode (s): 32-bit, 64-bit
Byte Order:little Endian
CPU (s): 4
On-line CPU (s) list:0-3
Thread (s) per Core:2
Core (s) per Socket:2
Socket (s): 1
Vendor Id:genuineintel
CPU Family:6
Model:37
Stepping:2
CPU mhz:1199.000
bogomips:4521.76
Virtualization:vt-x
L1D cache:32k
L1i cache:32k
L2 cache:256k
L3 cache:3072k
lyolzj@localhost/usr/local/src/zendopcache-7.0.5 $ free-m
Total used free shared buffers Cached
mem:1869 1654 215 265 4 526
-/+ buffers/cache:1123 745
swap:3320 1 3319
? ? Opcache test not installed ? ?
lyolzj@localhost ~ $ ab-n 1000-c http://localhost/wordpress/
This is apachebench, Version 2.3 < $Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus technology LTD, http://www.zeustech.net/
Licensed to the Apache software Foundation, http://www.apache.org/
Benchmarking localhost (Be patient)
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Finished requests
Server software:nginx/1.6.3
Server Hostname:localhost
Server port:80
Document Path:/wordpress/
Document length:8886 bytes
Concurrency level:10
Time taken for tests:79.554 seconds
Complete requests:1000
Failed requests:0
Total transferred:9099000 bytes
HTML transferred:8886000 bytes
Requests per second:12.57 [#/sec] (mean)
Time per request:795.536 [MS] (mean)
Time per request:79.554 [MS] (mean, across all concurrent requests)
Transfer rate:111.70 [Kbytes/sec] Received
Connection Times (MS)
Min MEAN[+/-SD] Median max
connect:0 0 0.0 0 0
processing:258 793 163.7 771 2227
waiting:249 777 163.1 755 2227
total:258 793 163.7 771 2227
Percentage of the requests served within a certain time (MS)
50% 771
66% 822
75% 849
80% 867
90% 926
95% 963
98% 1040
99% 1901
100% 2227 (Longest request)
Lyolzj@localhost ~ $ ab-n 1000-c http://localhost/wordpress/
This is apachebench, Version 2.3 < $Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus technology LTD, http://www.zeustech.net/
Licensed to the Apache software Foundation, http://www.apache.org/
Benchmarking localhost (Be patient)
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Finished requests
Server software:nginx/1.6.3
Server Hostname:localhost
Server port:80
Document Path:/wordpress/
Document length:8886 bytes
Concurrency level:100
Time taken for tests:81.475 seconds
Complete requests:1000
Failed requests:0
Total transferred:9099000 bytes
HTML transferred:8886000 bytes
Requests per second:12.27 [#/sec] (mean)
Time per request:8147.464 [MS] (mean)
Time per request:81.475 [MS] (mean, across all concurrent requests)
Transfer rate:109.06 [Kbytes/sec] Received
Connection Times (MS)
Min MEAN[+/-SD] Median max
Connect:0 0 1.0 0 5
processing:232 7758 1533.2 7921 9906
waiting:220 7740 1532.2 7908 9893
total:237 7758 1532.3 7921 9906
Percentage of the requests served within a certain time (MS)
50% 7921
66% 8258
75% 8488
80% 8682
90% 9020
95% 9289
98% 9531
99% 9674
100% 9906 (Longest request)
Installing Opcache
LYOLZJ@LOCALHOST/USR/LOCAL/SRC $ sudo wget http://pecl.php.net/get/zendopcache-7.0.5.tgz
[Email protected]/usr/local/src $ sudo tar-zxf zendopcache-7.0.5.tgz
[Email protected]/USR/LOCAL/SRC $ cd zendopcache-7.0.5/
[Email protected]/usr/local/src/zendopcache-7.0.5 $ ls
CONFIG.M4 zend_accelerator_debug.c
Config.w32 zend_accelerator_debug.h
CREDITS ZendAccelerator.h
LICENSE zend_accelerator_hash.c
Optimizer ZEND_ACCELERATOR_HASH.H
README zend_accelerator_module.c
SHARED_ALLOC_MMAP.C zend_accelerator_module.h
SHARED_ALLOC_POSIX.C ZEND_ACCELERATOR_UTIL_FUNCS.C
SHARED_ALLOC_SHM.C Zend_accelerator_util_funcs.h
SHARED_ALLOC_WIN32.C zend_persist.c
Tests ZEND_PERSIST_CALC.C
Zend_accelerator_blacklist.c zend_persist.h
Zend_accelerator_blacklist.h ZEND_SHARED_ALLOC.C
ZENDACCELERATOR.C zend_shared_alloc.h
[Email protected]/usr/local/src/zendopcache-7.0.5 $ sudo/usr/local/php5.4/bin/phpize
Configuring for:
PHP Api version:20100412
Zend Module Api no:20100525
Zend Extension Api no:220100525
[Email protected]/usr/local/src/zendopcache-7.0.5 $ sudo./configure--with-php-config=/usr/local/php5.4/bin/ Php-config
[Email protected]/usr/local/src/zendopcache-7.0.5 $ sudo make
[Email protected]/usr/local/src/zendopcache-7.0.5 $ sudo make install
Installing Shared extensions:/usr/local/php5.4/lib/php/extensions/no-debug-non-zts-20100525/
Configure Opcache
Add in PHP.ini
zend_extension=/usr/local/php5.4/lib/php/extensions/no-debug-non-zts-20100525/opcache.so
[Opcache]
opcache.memory_consumption=128
Opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
Opcache.revalidate_freq=60
Opcache.fast_shutdown=1
Opcache.enable_cli=1
[Email protected]/usr/local/src/zendopcache-7.0.5 $ sudo netstat-ntlp
Active Internet connections (only servers)
Proto recv-q send-q Local address Foreign address State Pid/program Name
TCP 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 2549/php-fpm.conf)
TCP 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
[Email protected]/usr/local/src/zendopcache-7.0.5 $ sudo kill 2549
[Email protected]/usr/local/src/zendopcache-7.0.5 $ sudo/usr/local/php5.4/sbin/php-fpm-y/usr/local/php5.4/etc/ Php-fpm.conf
[Email protected] ~ $ ab-n 1000-c http://localhost/wordpress/
This is apachebench, Version 2.3 < $Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus technology LTD, http://www.zeustech.net/
Licensed to the Apache software Foundation, http://www.apache.org/
Benchmarking localhost (Be patient)
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Finished requests
Server software:nginx/1.6.3
Server Hostname:localhost
Server port:80
Document Path:/wordpress/
Document length:8886 bytes
Concurrency level:10
Time taken for tests:27.116 seconds
Complete requests:1000
Failed requests:0
Total transferred:9099000 bytes
HTML transferred:8886000 bytes
Requests per second:36.88 [#/sec] (mean)
Time per request:271.158 [MS] (mean)
Time per request:27.116 [MS] (mean, across all concurrent requests)
Transfer rate:327.70 [Kbytes/sec] Received
Connection Times (MS)
Min MEAN[+/-SD] Median max
connect:0 0 0.4 0 5
processing:190 270 55.9 260 628
waiting:185 263 54.2 254 625
TOTAL:190 270 56.1 260 632
Percentage of the requests served within a certain time (MS)
50% 260
66% 282
75% 301
80% 313
90% 341
95% 368
98% 398
99% 443
100% 632 (Longest request)
[Email protected] ~ $ ab-n 1000-c http://localhost/wordpress/
This is apachebench, Version 2.3 < $Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus technology LTD, http://www.zeustech.net/
Licensed to the Apache software Foundation, http://www.apache.org/
Benchmarking localhost (Be patient)
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Finished requests
Server software:nginx/1.6.3
Server Hostname:localhost
Server port:80
Document Path:/wordpress/
Document length:8886 bytes
Concurrency level:100
Time taken for tests:28.363 seconds
Complete requests:1000
Failed requests:0
Total transferred:9099000 bytes
HTML transferred:8886000 bytes
Requests per second:35.26 [#/sec] (mean)
Time per request:2836.330 [MS] (mean)
Time per request:28.363 [MS] (mean, across all concurrent requests)
Transfer rate:313.28 [Kbytes/sec] Received
Connection Times (MS)
Min MEAN[+/-SD] Median max
Connect:0 1 1.7 0 7
processing:86 2700 515.9 2804 3322
waiting:81 2692 515.3 2797 3311
total:94 2700 514.3 2804 3322
Percentage of the requests served within a certain time (MS)
50% 2804
66% 2853
75% 2886
80% 2909
90% 3025
95% 3127
98% 3186
99% 3223
100% 3322 (Longest request)
Results
changed from time per request:81.475 [MS] to times per request:28.363 [MS]; up to nearly 3 times.
PHP Opcache Effect Test