CakePHP网站的主页时间到第一个字节是很长 [英] CakePHP site's main page's Time to First Byte is very long

查看:173
本文介绍了CakePHP网站的主页时间到第一个字节是很长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用pingdom检查网站的加载时间。我发现了来自其他域的一些瓶颈,并修复它们。但最慢的部分仍然存在。

首页在12秒内打开!一秒钟来自所有内部和外部js,css和jpeg文件。 11秒来自主页。我的主页从pingdom结果的详细信息:

  DNS 157 ms 
连接213 ms
发送0 ms
等待10.5 s
接收56 ms

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



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



我还能做些什么来诊断这种延迟吗?

谢谢



strong>修改:您可以查看此链接

编辑2 :看起来我的应用程序运行0.35秒。 (它甚至没有在主页中的数据库查询)但我可以在10-11秒内在我的浏览器上看到结果。是因为访客负载吗?是否有太多访问者正在使用该网站?

Edit3 :我仍然遇到此问题。我发现 error_log 的服务器有太多的记录,如下所示。我希望这会提供一些信息:

 第384行:2012-09-02 17:39:47.505 [INFO] [92.45 .160.177:51491-0#APVH_example.com]与请求#361的[/tmp/lshttpd/APVH_example.com_Suphp.sock.230]连接,确认,0,关联进程:705101,正在运行:1,错误:同行! 
线385:2012-09-02 17:41:16.223 [INFO] [78.162.236.209:28170-0#APVH_example.com]与[/tmp/lshttpd/APVH_example.com_Suphp.sock.671]的连接请求#78,确认,0,相关过程:705246,运行:0,错误:连接由对等重置!
线387:2012-09-02 17:57:15.455 [INFO] [109.228.230.250:54280-0#APVH_example.com]与[/tmp/lshttpd/APVH_example.com_Suphp.sock.412]的连接请求#92,确认,0,关联进程:709770,运行:0,错误:连接由对等重置!
线388:2012-09-02 17:58:24.008 [INFO] [95.65.209.252:64082-0#APVH_example.com]与[/tmp/lshttpd/APVH_example.com_Suphp.sock.858]的连接请求#500,确认,0,关联进程:-1,运行:0,错误:连接由对等重置!
线395:2012-09-02 18:14:53.744 [INFO] [85.103.215.78:54135-0#APVH_example.com]与[/tmp/lshttpd/APVH_example.com_Suphp.sock.241]的连接请求#460,确认,0,关联进程:714360,运行:0,错误:连接由对等重置!
行401:2012-09-02 18:34:22.476 [INFO] [78.173.185.165:14411-0#APVH_example.com]与[/tmp/lshttpd/APVH_example.com_Suphp.sock.728]的连接请求#500,确认,0,关联进程:720637,运行:1,错误:连接由对等重置!
行402:2012-09-02 18:35:07.269 [INFO] [78.174.20.184:53766-0#APVH_example.com]连接到[/tmp/lshttpd/APVH_example.com_Suphp.sock]请求# 26,确认,0,关联过程:720626,运行:0,错误:连接由对等重置!
线404:2012-09-02 18:49:57.659 [INFO] [85.96.10.138:59346-0#APVH_example.com]与[/tmp/lshttpd/APVH_example.com_Suphp.sock.728]的连接请求#500,确认,0,关联进程:724847,运行:0,错误:连接由对等重置!
行405:2012-09-02 18:50:44.566 [INFO] [81.6.120.50:39926-0#APVH_example.com]与[/tmp/lshttpd/APVH_example.com_Suphp.sock.173]的连接请求#500,确认,0,关联进程:725035,运行:0,错误:连接由对等重置!
行413:2012-09-02 19:15:28.953 [INFO] [78.181.128.53:1344-0#APVH_example.com]到[/tmp/lshttpd/APVH_example.com_Suphp.sock.738]的连接请求#500,确认,0,关联进程:731389,运行:1,错误:连接由对等重置!
行414:2012-09-02 19:15:41.572 [INFO] [78.191.100.24:51095-0#APVH_example.com]连接到[/tmp/lshttpd/APVH_example.com_Suphp.sock]请求# 500,确认,0,关联过程:731344,运行:1,错误:连接由对等重置!
线417:2012-09-02 19:33:09.700 [INFO] [78.165.162.13:65231-0#APVH_example.com]到[/tmp/lshttpd/APVH_example.com_Suphp.sock.317]的连接请求#58,确认,0,关联进程:736102,运行:0,错误:连接由对等重置!
行419:2012-09-02 19:43:16.749 [INFO] [178.233.166.110:51083-0#APVH_example.com]与[/tmp/lshttpd/APVH_example.com_Suphp.sock.895]的连接请求#128,确认,0,关联进程:738842,运行:0,错误:连接由对等重置!


解决方案

由于安装了litespeed,在你的服务器上,你会得到超时(慢响应),因为你有错误的配置。查看您提供的日志。我没有litespeed的经验,但你可以试试看这些。



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



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

CakePHP和suphp套接字,连接由对等重置



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


I used pingdom to check for website's loading times. I found some bottlenecks that comes from other domains and fixed them. But slowest part still exist.
Homepage opens nearly in 12 seconds! One second comes from all internal and external js, css and jpeg files. And 11 seconds comes from main page. Details for my home page from the pingdom result:

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

I put tic-toc to beforeFilter and afterFilter of main page's controller. I run it many times in one hour. Result is main page is loaded between 0.15 and 0.35 seconds.

I pinged my server and get the result as 70 ms.

What can I do more to diagnose this latency?
Thank you

Edit: you can check results from this link
Edit2: It seems like my application is run for 0.35 seconds. (It even doesn't have database query in home page) But I can see result on my browser within 10-11 seconds. Is it because of visitor load? Whether too many visitors are using the site at that moment?
Edit3: I still got this problem. I found out that error_log of server has too much records like the below. I hope this would give some information:

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!

解决方案

You have problems with slow page speed because of litespeed installed on your server, you get timeouts (slow response) because you have wrong configuration. Look at your logs you provided. I don't have experience with litespeed but you can try look at these.

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

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

CakePHP and suphp socket, connection reset by peer

Also i recommend you try temporary disable litespeed to make sure it's the main reason.

这篇关于CakePHP网站的主页时间到第一个字节是很长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆