本文介绍了服务器需要很长时间才能做出响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个网站托管在hostgator.com上第二个托管在hosterpk.com

I have 2 websites one hosted on hostgator.comand the second hosted on hosterpk.com

我的网站都一样,这是hostgator上的主机,其响应速度很快(2秒)以及hosterpk上托管了哪个站点,响应速度很慢,加载需要10到20秒,

Both my websites are the same,which is host on hostgator its response is fast, (2second)and which site is host on hosterpk it response is slow,it take 10-20 sec to load,

我尝试了许多技术来解决问题,我将页面大小从400kb减小到200kb,但它的响应时间仍为20秒.

I've tried many techniques to the solve problem, I Reduce my page size from 400kb to 200kb,but it still has response time of 20 seconds.

我的网站位于PHP上,在其中一个请求上运行7-35个mysql查询,因此我删除了32个查询,但仍然响应速度太慢,Google不接受响应速度慢的许多页面,

My site is on PHP, in which, on one request 7-35 mysql queries are run,so i remove 32 query, but still it's response is too slow, google does not accept many pages for slow response,

My site pages response is slow, but admin panel response is too fast,

so its mean my hosting server is fast, my admin panel page size is 450kb
index.php page size is 200kb,
i include header.php in all pages, in header file all css and js are include,
the one thing is only index.php response is too high,
all other pages are fast than index.php

.

i check my site speed in pingdom it show me that my domain is on wait,
its take all time in waiting,
i see many posting and stackover flow question, but they didn't help me,

我在过去1周内注意到一件事:

也就是说,当我尝试在一个小时左右后访问我的网站时,需要20秒才能响应,并且在加载页面后,我再次按CTRL + F5,但是第二次加载需要2秒,我清理了缓存,但是仍然需要2-3秒的加载时间,

that is, when i try to access my site after an hour or so it takes 20 sec to respond, and after load page, i again press CTRL+F5 but 2nd time it take 2 sec to load, I clean cache but still it takes 2-3 sec to load,

after 5-10 min当我再次按CTRL + F5以便加载20 sec时,但管理面板总是需要3-4秒来加载

after 5-10 min when I again press CTRL+F5 so it takes 20 sec to load, but admin panel always take 3-4 seconds to load,

我注意到这个东西在pingdom中是相同的,我附上了快照,如下所示,第一次需要16.97秒.

I notice this thing an its same in pingdom, I attached a snap shot, see below, first time it takes 16.97 seconds.

当我再次测试时,需要花费1.98秒

When I test again it take 1.98 seconds

.

第二项测试

.

.

如果我在5-10分钟后再次测试,则需要15-20秒.

If I test again after 5-10 minutes, it again takes 15-20 seconds.

请给我一些建议,我该如何解决这个问题?由于响应时间长,google不接受我的页面.

Please give me some advice how can i solve this problem? google does not accept my pages due to long response.

服务器5到10分钟后会休眠吗?

Is server sleep after 5-10 min?

如果没有,为什么在5到10分钟后再次加载网站会花费这么长时间?

If not, why does it take such a long time when I load my site again after 5-10 min?

我在我的面板中看到一些信息

I see in my cpanel there is some information

CPU Usage                   0 / 100 %
Virtual Memory Usage    0 / 4,194,304 KB
Physical Memory Usage   6,220 / 4,194,304 KB
Entry Processes             0 / 20

CPU使用率,虚拟内存和Entry进程在使用时为0?

CPU usage, virtual memory and Entry processes are 0, when they are in used?

如果我使用虚拟内存,这可以解决我的问题吗?

If I use virtual memory, will this solve my problem?

更新:

I test again in pingdom.com
but now I test `www.youtube.com` when result generate I'm shocked,

YouTube load time is 588ms, and its page size is 3.4MB

如何在588毫秒内加载3.4MB的页面,YouTube使用什么技术或代码来提高页面速度?

How is it possible that a 3.4MB page loads in 588ms,What technique or code YouTube are using to increase page speed?

推荐答案

等待并不是说您使用mysql/php会比较慢.等一下,浏览器会等到所有必需的资源加载完毕.

Wait doesn't say that you mysql/php what ever is slow.wait say, that the browser wait until all required resources are loaded.

阅读加速网站的最佳做法里面有很好的提示.

read the Best Practices for Speeding Up Your Web Sitethere are good tips inside.

有时虚拟机的I/O速度不佳.有时,网络服务器仅允许来自浏览器的一个连接.您必须分析服务器上发生的情况.

sometimes i/o speed of virtual machines is not good.sometimes the webservers allow only one connection from browser.you have to analyze whats going on on your server.

尝试缓存数据.尝试缓存内容.

try to cache data. try to cache content.

这篇关于服务器需要很长时间才能做出响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 10:24
查看更多