跪求ThinkPHP开发程序的性能问题(最多只能15个并发)

浏览:2539 发布日期:2014/06/28 分类:求助交流
目前在维护一个THINKPHP框架开发的网站,性能存在很大的问题,采用ab
测试了一下,带数据库库的页面并发只能到10左右,但是mysql的cpu基本上不占用,导致现在用户稍微访问一下,网站的CPU就一直保持100%,基本上就无法访问网站了。

然后我编写了一个最简单的页面,不读取任何数据库内容进行测试,发现并发也只能到15,在高的话每个页面的处理时间都要超过2秒以上了,下面是测试结果,请熟悉给看看到底什么地方配置出现了问题,非常感谢。
------------------------------PHP环境--------------------------
网站部署在阿里云的服务器上,有一部分代码是通过 Zend 加密的,所以配置了 Zend Optimizer v3.3.3

PHP 5.2.17 (cli) (built: Jan 6 2011 17:28:41)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
with Zend Extension Manager v1.2.0, Copyright (c) 2003-2007, by Zend Technologies
with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies

-----------------------------调试日志-----------------------------

请求时间 : 2014-06-28 10:51:12
当前页面 : /activity/perf
请求协议 : HTTP/1.1 GET
运行信息 : Process: 0.0913s ( Load:0.0094s Init:0.0586s Exec:0.0060s Template:0.0173s ) | Cache :2 gets 0 writes | UseMem:4,315 kb | LoadFile:47 | CallFun:204,2492
会话ID : tl529g4lmqdimciin3qm11t3d2
日志记录 : 23条日志
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | INFO: Tag[ route_check ] --START--
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | INFO: Run CheckRoute Behavior [ RunTime:0.004495s ]
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | INFO: Tag[ route_check ] --END-- [ RunTime:0.004606s ]
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | INFO: Tag[ app_begin ] --START--
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | INFO: Run ReadHtmlCache Behavior [ RunTime:0.000911s ]
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | INFO: Run CheckLang Behavior [ RunTime:0.001576s ]
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | INFO: Tag[ app_begin ] --END-- [ RunTime:0.002586s ]
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | NOTIC: [2048] Declaration of ActivityAction::redirect() should be compatible with that of Action::redirect() ActivityAction.class.php 第 4 行.
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | NOTIC: [2] Missing argument 1 for get_bconf_setting(), called in D:\www\App\Lib\Action\HCommonAction.class.php on line 19 and defined DataSource.php 第 258 行.
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | NOTIC: [8] Undefined index: u_user_name functions.php 第 459 行.
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | INFO: Tag[ view_template ] --START--
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | INFO: Run LocationTemplate Behavior [ RunTime:0.001123s ]
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | INFO: Tag[ view_template ] --END-- [ RunTime:0.001222s ]
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | INFO: Tag[ view_parse ] --START--
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | INFO: Run ParseTemplate Behavior [ RunTime:0.011520s ]
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | INFO: Tag[ view_parse ] --END-- [ RunTime:0.011603s ]
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | INFO: Tag[ view_filter ] --START--
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | INFO: Run ContentReplace Behavior [ RunTime:0.000742s ]
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | INFO: Run TokenBuild Behavior [ RunTime:0.000343s ]
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | INFO: Run WriteHtmlCache Behavior [ RunTime:0.000222s ]
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | INFO: Run ShowRuntime Behavior [ RunTime:0.000536s ]
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | INFO: Tag[ view_filter ] --END-- [ RunTime:0.001983s ]
[ 2014-06-28T10:51:12+08:00 ] /activity/perf | INFO: Tag[ view_end ] --START--
加载文件 : 47
[0] => D:\www\index.php
[1] => D:\www\CORE\Core.php
[2] => D:\www\CORE\Common\runtime.php
[3] => D:\www\CORE\Common\common.php
[4] => D:\www\CORE\Lib\Core\Think.class.php
[5] => D:\www\CORE\Lib\Core\ThinkException.class.php
[6] => D:\www\CORE\Lib\Core\Behavior.class.php
[7] => D:\www\CORE\Conf\alias.php
[8] => D:\www\CORE\Conf\convention.php
[9] => D:\www\App\Conf\config.php
[10] => D:\www\CORE\Lang\zh-cn.php
[11] => D:\www\CORE\Conf\tags.php
[12] => D:\www\App\Conf\tags.php
[13] => D:\www\CORE\Common\functions.php
[14] => D:\www\CORE\Lib\Core\Log.class.php
[15] => D:\www\CORE\Lib\Core\Dispatcher.class.php
[16] => D:\www\CORE\Lib\Core\App.class.php
[17] => D:\www\CORE\Lib\Core\Action.class.php
[18] => D:\www\CORE\Lib\Core\View.class.php
[19] => D:\www\App\Common\common.php
[20] => D:\www\App\Common\Lib.php
[21] => D:\www\App\Common\DataSource.php
[22] => D:\www\CORE\Conf\debug.php
[23] => D:\www\App\Conf\debug.php
[24] => D:\www\App\Conf\crons.php
[25] => D:\www\CORE\Lib\Behavior\CheckRouteBehavior.class.php
[26] => D:\www\App\Conf\Home\config.php
[27] => D:\www\App\Common\Home\function.php
[28] => D:\www\CORE\Lib\Behavior\ReadHtmlCacheBehavior.class.php
[29] => D:\www\CORE\Extend\Behavior\CheckLangBehavior.class.php
[30] => D:\www\App\Lang\zh-cn\common.php
[31] => D:\www\App\Lib\Action\Home\ActivityAction.class.php
[32] => D:\www\App\Lib\Action\HCommonAction.class.php
[33] => D:\www\CORE\Lib\Core\Cache.class.php
[34] => D:\www\CORE\Lib\Driver\Cache\CacheFile.class.php
[35] => D:\www\Webconfig\loginconfig.php
[36] => D:\www\CORE\Lib\Behavior\LocationTemplateBehavior.class.php
[37] => D:\www\CORE\Lib\Behavior\ParseTemplateBehavior.class.php
[38] => D:\www\CORE\Lib\Template\ThinkTemplate.class.php
[39] => D:\www\CORE\Lib\Driver\TagLib\TagLibCx.class.php
[40] => D:\www\CORE\Lib\Template\TagLib.class.php
[41] => D:\www\App\Runtime\Cache\Home\33861c1a8acd27d27ef88fd5fa7fc4c1.php
[42] => D:\www\CORE\Lib\Behavior\ContentReplaceBehavior.class.php
[43] => D:\www\CORE\Lib\Behavior\TokenBuildBehavior.class.php
[44] => D:\www\CORE\Lib\Behavior\WriteHtmlCacheBehavior.class.php
[45] => D:\www\CORE\Lib\Behavior\ShowRuntimeBehavior.class.php
[46] => D:\www\CORE\Lib\Behavior\ShowPageTraceBehavior.class.php

-----------------------------分隔符---------------------------------

------------------------------分隔符----------------------------

------------------------------分隔符----------------------------

------------------------------分隔符----------------------------

------------------------------分隔符----------------------------

------------------------------分隔符----------------------------

------------------------------分隔符----------------------------

------------------------------分隔符----------------------------

------------------------------分隔符----------------------------

------------------------------分隔符----------------------------

------------------------------分隔符----------------------------

------------------------------分隔符----------------------------
最佳答案
评论( 相关
后面还有条评论,点击查看>>