php opcache 效果测试

测试环境

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测试??

lyolzj@localhost ~ $ ab -n 1000 -c 10 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 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:        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 100 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 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:        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)

安装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/

配置opcache

在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 10 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 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:        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 100 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 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:        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)

结果

    由Time per request:       81.475 [ms] 变成Time per request:       28.363 [ms];提升了近3倍。

时间: 2024-07-29 00:44:44

php opcache 效果测试的相关文章

opcache 效果

加上opcache 效果还挺明显, 我们的业务特点是curl_exec很多, 请求开启了gzip

caffe使用mnist训练的效果测试

今天根据网上的文章,训练了一下mnist的数据 效果不是很好 配置的过程参考: http://www.cnblogs.com/yixuan-xu/p/5858595.html http://www.cnblogs.com/yixuan-xu/p/5862657.html 其实最后他是用的是classification.exe进行分类 我修改了一个下classification.cpp里面的代码,代码如下: int main(int argc, char** argv) { /*** if (ar

机器视觉支架制作(带效果测试)

图像处理系统中,镜头.光源的选配,对于最后能否产生稳定的识别效果至关重要.而搭载镜头.光源的是支架.机器视觉的支架一般都是根据项目的具体需要进行配置的,搜索淘宝能够得到一些商品. 这些支架形状不一,价格在数百元到千元之间:也有比较专业但是更贵的. 以前在IHalcon上面也看到过一个自己制作的机器视觉框架“.这种就地取材的思路很有教益. http://www.ihalcon.com/read-380.html 基于我的实际情况和手头有的东西,我设计实现了自己的机器视觉框架.因为我目前用的是高分辨

thinkphp 无限极分类的数据库设计及效果测试

控制器继承IndexAction.class.php <?php // 本类由系统自动生成,仅供测试用途 class IndexAction extends CateAction { } ?> 控制器代码CateAction.class.php <?php class CateAction extends Action{ function index(){ $cate=M('Cate'); $list=$cate->field("id,name,pid,path,conc

Nginx 反向代理缓存效果测试

实验环境: 3台Centos 7的虚拟机 角色 ip 代理服务器 192.168.148.101 后端服务器 192.168.148.102 测试主机 192.168.148.103 后端服务器部署 httpd 准备测试网页 [[email protected] ~]# yum -y install httpd [[email protected] ~]# cp -v /etc/man_db.conf /var/www/html/man.html ]# ls -lh /var/www/html/

.NET Socket TCP 50W在线连接交互测试

在平常的交流中经常有人问.net socket能支持多少在线?和C++或linux下比起来应该差很远吧?其实产生这样问题的主要原因是.net很少人去做这方面的测试,而在linux下则经常听到什么100w或500w在线连接的测试.这样一个数字看起来多么地让人兴奋...其实在这几年编写通讯服务的过程中已经意识到连接数的多少对整体影响并不大,主要归功于现有成熟悉的网络模型和硬件资源.为了更进一步证实这个问题,所以打算在.NET下测试一下100w连接交互情况,不过由于硬件内存不足不能进行100W连接量,

php配置opcache

官网地址:http://php.net/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 你也可以禁用 opcache.save_comments 并且

2D游戏平滑的迷雾战争效果

最近刚好有做2D游戏的点光源效果,然后就扩展一下,研究了一下战争迷雾的效果.主要是想实现类似魔兽争霸那种人物走动,然后黑色的战争迷雾随着人物的移动渐渐打开的效果.使用具有渐变透明图片作为光源来使得战争迷雾呈现出平滑的效果.本文后面介绍了两个简单的实现方法,效果有细微的差别,有兴趣的同学可以分别研究.最后也有完整展示代码和提供例子下载. 一.常见的战争迷雾效果 早期的红警的战争迷雾大家应该也比较熟悉,不过看起来没那么平滑,应该是采用图块拼出来.可以明显看得出一些方方块块. 可见早期魔兽争霸2也是没

(译文)A/B测试从入门到熟练指南

(译文)A/B测试从入门到熟练指南 原文地址: http://www.smashingmagazine.com/2014/07/11/roadmap-to-becoming-an-a-b-testing-expert/ A/B测试,也叫做分离测试(也有叫做对比测试的),这是一种针对观察页面布局相似的两个不同版本着陆页的转化率, 来进行对比的点蚀测试方法(抽样测试法). A/B测试是通过观察和测试用户使用过程,找到最快捷引导用户到目标页面的着陆页版本.比如注册或者订阅网站信息的引导页面. 测试的内