PHP开启opcache提升代码性能
Length: 20, 打开这个在PHP Request Shutdown的时候 会收内存的速度会提高 opcache.fast_shutdown=1 ;不保存文件/函数的注释 opcache.save_comments=0 实际性能对比: 下面是实际测试中没有开启opcache的数据: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 [root@localhost ~]# ab -n 10000 -c 200 ?a=Rolem=createRole This is ApacheBench。
Version 2.3 $Revision: 655654 $ Copyright 1996 Adam Twiss, Version 2.3 $Revision: 655654 $ Copyright 1996 Adam Twiss, 这个根据你们的需求可调 opcache.memory_consumption=256 ;interned string的内存大小, http://www.apache.org/ Benchmarking 112.126.69.14 (be patient) Completed 1000 requests Completed 2000 requests Completed 3000 requests Completed 4000 requests Completed 5000 requests Completed 6000 requests Completed 7000 requests Completed 8000 requests Completed 9000 requests Completed 10000 requests Finished 10000 requests Server Software: openresty/1.7.2.1 Server Hostname: 112.126.69.14 Server Port: 80 Document Path: /main.php?a=Rolem=createRole Document Length: 2 bytes Concurrency Level: 200 Time taken for tests: 14.237 seconds Complete requests: 10000 Failed requests: 0 Write errors: 0 Total transferred: 1711710 bytes HTML transferred: 20020 bytes Requests per second: 702.40 [#/sec] (mean) Time per request: 284.739 [ms] (mean) Time per request: 1.424 [ms] (mean, Zeus Technology Ltd, 配置指令如下: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 [opcache] zend_extension=opcache.so opcache.enable_cli=1 ;共享内存大小, across all concurrent requests) Transfer rate: 117.41 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 2 66 272.6 2 3005 Processing: 4 176 666.4 6 9026 Waiting: 4 163 642.8 6 9026 Total: 6 242 745.7 9 10028 Percentage of the requests served within a certain time (ms) 50% 9 66% 14 75% 99 80% 122 90% 1006 95% 1476 98% 2853 99% 3543 100% 10028 (longest request) , Exceptions: 0) Write errors: 0 Non-2xx responses: 20 Total transferred: 1713580 bytes HTML transferred: 23520 bytes Requests per second: 383.72 [#/sec] (mean) Time per request: 521.216 [ms] (mean) Time per request: 2.606 [ms] (mean, Zeus Technology Ltd, http://www.apache.org/ Benchmarking 112.126.69.14 (be patient) Completed 1000 requests Completed 2000 requests Completed 3000 requests Completed 4000 requests Completed 5000 requests Completed 6000 requests Completed 7000 requests Completed 8000 requests Completed 9000 requests Completed 10000 requests Finished 10000 requests Server Software: openresty/1.7.2.1 Server Hostname: 112.126.69.14 Server Port: 80 Document Path: /main.php?a=Rolem=createRole Document Length: 2 bytes Concurrency Level: 200 Time taken for tests: 26.061 seconds Complete requests: 10000 Failed requests: 20 (Connect: 0, across all concurrent requests) Transfer rate: 64.21 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 2 3 3.2 2 60 Processing: 17 461 905.0 219 16496 Waiting: 17 461 904.9 219 16496 Total: 21 464 905.0 222 16502 Percentage of the requests served within a certain time (ms) 50% 222 66% 271 75% 369 80% 412 90% 805 95% 1248 98% 2597 99% 3489 100% 16502 (longest request) 开启之后的数据: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 [root@localhost ~]# ab -n 10000 -c 200 ?a=Rolem=createRole This is ApacheBench, Receive: 0, http://www.zeustech.net/ Licensed to The Apache Software Foundation, 也可调 opcache.interned_strings_buffer=8 ;最大缓存的文件数目 opcache.max_accelerated_files=4000 ;60s检查一次文件更新 opcache.revalidate_freq=60 ;打开快速关闭, http://www.zeustech.net/ Licensed to The Apache Software Foundation,。
相关热词:
本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!
本文地址: https://v30.fanwenzhu.com/jiaob/php/12345.shtml
相关文章
热门TAG
win10 ecshop 主机 阿里云 解决 配置 C# C++ 解析 SQL语句 命令 Go语言 方法 CSS3 HTML5 CSS win7 MSSQL 服务器配置 IIS7.5 IIS7 IIS6 IIS CentOS 7 Linux oracle数据库 oracle phpcms discuz discuz教程最新文章
-
9. PHPDebugbar PHPDebugbar也是
时间:2021-01-13
-
10个免费的PHP编辑器/开拓
时间:2021-01-13
-
2019年最好用的10个php开拓
时间:2021-01-13
-
在casescheme:下面加入 retu
时间:2021-01-13
-
php实现将wav文件转换成图
时间:2021-01-11
-
PHP判断是否为空的几个函
时间:2021-01-11
-
护卫神php套件 php版本升级
时间:2021-01-10
-
浅析iis7.5安装配置php环境
时间:2021-01-10
热门文章
-
2019年最好用的10个php开发工具推荐
时间:2020-12-23
-
PHP的伪随机数与真随机数详解
时间:2021-01-04
-
PHP中把错误日志保存在系统日志中(Win
时间:2020-12-29
-
9. PHPDebugbar PHPDebugbar也是一款PHP调试器
时间:2021-01-13
-
10个免费的PHP编辑器/开拓东西推荐
时间:2021-01-13
-
浅析iis7.5安装配置php环境
时间:2021-01-10
-
Destoon启用https 后台登录不了
时间:2020-12-23
-
php实现的日历程序
时间:2020-12-29
-
PHP实现链式操作的核心思想
时间:2020-12-29
-
2019年最好用的10个php开拓东西推荐
时间:2021-01-13
