PHP开启opcache提升代码性能
php  /  管理员 发布于 7年前   222
配置指令如下: 实际性能对比: 下面是实际测试中没有开启opcache的数据: 开启之后的数据: 以上所述就是本文的全部内容,希望大家能够喜欢。[opcache]zend_extension=opcache.soopcache.enable_cli=1;共享内存大小, 这个根据你们的需求可调opcache.memory_consumption=256 ;interned string的内存大小, 也可调opcache.interned_strings_buffer=8;最大缓存的文件数目opcache.max_accelerated_files=4000;60s检查一次文件更新opcache.revalidate_freq=60;打开快速关闭, 打开这个在PHP Request Shutdown的时候 会收内存的速度会提高opcache.fast_shutdown=1;不保存文件/函数的注释opcache.save_comments=0
[root@localhost ~]# ab -n 10000 -c 200 "http://112.126.69.14/main.php?a=Role&m=createRole"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 112.126.69.14 (be patient)Completed 1000 requestsCompleted 2000 requestsCompleted 3000 requestsCompleted 4000 requestsCompleted 5000 requestsCompleted 6000 requestsCompleted 7000 requestsCompleted 8000 requestsCompleted 9000 requestsCompleted 10000 requestsFinished 10000 requestsServer Software: openresty/1.7.2.1Server Hostname: 112.126.69.14Server Port: 80Document Path: /main.php?a=Role&m=createRoleDocument Length: 2 bytesConcurrency Level: 200Time taken for tests: 26.061 secondsComplete requests: 10000Failed requests: 20 (Connect: 0, Receive: 0, Length: 20, Exceptions: 0)Write errors: 0Non-2xx responses: 20Total transferred: 1713580 bytesHTML transferred: 23520 bytesRequests per second: 383.72 [#/sec] (mean)Time per request: 521.216 [ms] (mean)Time per request: 2.606 [ms] (mean, across all concurrent requests)Transfer rate: 64.21 [Kbytes/sec] receivedConnection Times (ms) min mean[+/-sd] median maxConnect: 2 3 3.2 2 60Processing: 17 461 905.0 219 16496Waiting: 17 461 904.9 219 16496Total: 21 464 905.0 222 16502Percentage 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)
[root@localhost ~]# ab -n 10000 -c 200 "http://112.126.69.14/main.php?a=Role&m=createRole"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 112.126.69.14 (be patient)Completed 1000 requestsCompleted 2000 requestsCompleted 3000 requestsCompleted 4000 requestsCompleted 5000 requestsCompleted 6000 requestsCompleted 7000 requestsCompleted 8000 requestsCompleted 9000 requestsCompleted 10000 requestsFinished 10000 requestsServer Software: openresty/1.7.2.1Server Hostname: 112.126.69.14Server Port: 80Document Path: /main.php?a=Role&m=createRoleDocument Length: 2 bytesConcurrency Level: 200Time taken for tests: 14.237 secondsComplete requests: 10000Failed requests: 0Write errors: 0Total transferred: 1711710 bytesHTML transferred: 20020 bytesRequests per second: 702.40 [#/sec] (mean)Time per request: 284.739 [ms] (mean)Time per request: 1.424 [ms] (mean, across all concurrent requests)Transfer rate: 117.41 [Kbytes/sec] receivedConnection Times (ms) min mean[+/-sd] median maxConnect: 2 66 272.6 2 3005Processing: 4 176 666.4 6 9026Waiting: 4 163 642.8 6 9026Total: 6 242 745.7 9 10028Percentage 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)
您可能感兴趣的文章:
122 在
学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..123 在
Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..原梓番博客 在
在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..博主 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..1111 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号