CakePHP网站的主页时间到第一个字节很长

时间:2012-08-24 21:13:48

标签: php performance cakephp pagespeed pingdom

我用pingdom检查网站的加载时间。我发现了一些来自其他领域的瓶颈并修复了它们。但最慢的部分仍然存在 主页几乎在12秒内开启!一秒钟来自所有内部和外部js,css和jpeg文件。主页上有11秒钟。 pingdom结果的主页详细信息:

DNS 157 ms
Connect 213 ms
Send 0 ms
Wait 10.5 s
Receive 56 ms

我把tic-toc放到了主页面控制器的beforeFilter和afterFilter之后。我在一小时内跑了很多次。结果是主页加载在0.15到0.35秒之间。

我ping了我的服务器,结果为70毫秒。

我可以做些什么来诊断这种延迟?
谢谢

修改:您可以查看this link的结果 Edit2 :好像我的应用程序运行了0.35秒。 (它甚至在主页中没有数据库查询)但是我可以在10-11秒内在浏览器上看到结果。是因为访客负载吗?当时是否有太多访问者在使用该网站? Edit3 :我还是遇到了这个问题。我发现服务器的 error_log 有太多记录,如下所示。我希望这会提供一些信息:

Line 384: 2012-09-02 17:39:47.505 [INFO] [92.45.160.177:51491-0#APVH_example.com] connection to [/tmp/lshttpd/APVH_example.com_Suphp.sock.230] on request #361, confirmed, 0, associated process: 705101, running: 1, error: Connection reset by peer!
Line 385: 2012-09-02 17:41:16.223 [INFO] [78.162.236.209:28170-0#APVH_example.com] connection to [/tmp/lshttpd/APVH_example.com_Suphp.sock.671] on request #78, confirmed, 0, associated process: 705246, running: 0, error: Connection reset by peer!
Line 387: 2012-09-02 17:57:15.455 [INFO] [109.228.230.250:54280-0#APVH_example.com] connection to [/tmp/lshttpd/APVH_example.com_Suphp.sock.412] on request #92, confirmed, 0, associated process: 709770, running: 0, error: Connection reset by peer!
Line 388: 2012-09-02 17:58:24.008 [INFO] [95.65.209.252:64082-0#APVH_example.com] connection to [/tmp/lshttpd/APVH_example.com_Suphp.sock.858] on request #500, confirmed, 0, associated process: -1, running: 0, error: Connection reset by peer!
Line 395: 2012-09-02 18:14:53.744 [INFO] [85.103.215.78:54135-0#APVH_example.com] connection to [/tmp/lshttpd/APVH_example.com_Suphp.sock.241] on request #460, confirmed, 0, associated process: 714360, running: 0, error: Connection reset by peer!
Line 401: 2012-09-02 18:34:22.476 [INFO] [78.173.185.165:14411-0#APVH_example.com] connection to [/tmp/lshttpd/APVH_example.com_Suphp.sock.728] on request #500, confirmed, 0, associated process: 720637, running: 1, error: Connection reset by peer!
Line 402: 2012-09-02 18:35:07.269 [INFO] [78.174.20.184:53766-0#APVH_example.com] connection to [/tmp/lshttpd/APVH_example.com_Suphp.sock] on request #26, confirmed, 0, associated process: 720626, running: 0, error: Connection reset by peer!
Line 404: 2012-09-02 18:49:57.659 [INFO] [85.96.10.138:59346-0#APVH_example.com] connection to [/tmp/lshttpd/APVH_example.com_Suphp.sock.728] on request #500, confirmed, 0, associated process: 724847, running: 0, error: Connection reset by peer!
Line 405: 2012-09-02 18:50:44.566 [INFO] [81.6.120.50:39926-0#APVH_example.com] connection to [/tmp/lshttpd/APVH_example.com_Suphp.sock.173] on request #500, confirmed, 0, associated process: 725035, running: 0, error: Connection reset by peer!
Line 413: 2012-09-02 19:15:28.953 [INFO] [78.181.128.53:1344-0#APVH_example.com] connection to [/tmp/lshttpd/APVH_example.com_Suphp.sock.738] on request #500, confirmed, 0, associated process: 731389, running: 1, error: Connection reset by peer!
Line 414: 2012-09-02 19:15:41.572 [INFO] [78.191.100.24:51095-0#APVH_example.com] connection to [/tmp/lshttpd/APVH_example.com_Suphp.sock] on request #500, confirmed, 0, associated process: 731344, running: 1, error: Connection reset by peer!
Line 417: 2012-09-02 19:33:09.700 [INFO] [78.165.162.13:65231-0#APVH_example.com] connection to [/tmp/lshttpd/APVH_example.com_Suphp.sock.317] on request #58, confirmed, 0, associated process: 736102, running: 0, error: Connection reset by peer!
Line 419: 2012-09-02 19:43:16.749 [INFO] [178.233.166.110:51083-0#APVH_example.com] connection to [/tmp/lshttpd/APVH_example.com_Suphp.sock.895] on request #128, confirmed, 0, associated process: 738842, running: 0, error: Connection reset by peer!

1 个答案:

答案 0 :(得分:2)

由于您的服务器上安装了litespeed,您的页面速度会有问题,因为配置错误而导致超时(响应缓慢)。查看您提供的日志。我对litespeed没有经验,但你可以尝试看看这些。

http://www.litespeedtech.com/support/forum/showthread.php?t=6125

http://bobcares.com/blog/?p=114

CakePHP and suphp socket, connection reset by peer

另外我建议您尝试临时禁用litespeed以确保它是主要原因。