title: Server take long time to response
body: <p>I have 2 websites one hosted on hostgator.com
  and the second hosted on hosterpk.com</p>
  
  <p>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,</p>
  
  <p>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.</p>
  
  <p>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,</p>
  
  <pre><code>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
  </code></pre>
  
  <p>.</p>
  
  <pre><code>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,
  </code></pre>
  
  <p><strong>i notice one thing in past 1 week:</strong></p>
  
  <p>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,</p>
  
  <p><code>after 5-10 min</code> when I again press CTRL+F5 so it takes <code>20 sec</code> to load,  but admin panel always take 3-4 seconds to load,</p>
  
  <p>I notice this thing an its same in pingdom, I attached a snap shot, see below, first time it takes 16.97 seconds.</p>
  
  <p>When I test again it take 1.98 seconds
  <img src="https://i.stack.imgur.com/6xhkc.png" alt="enter image description here"></p>
  
  <p>.</p>
  
  <p><strong>Second test</strong></p>
  
  <p>.</p>
  
  <p>.</p>
  
  <p><img src="https://i.stack.imgur.com/WDQiY.png" alt="enter image description here"></p>
  
  <p>If I test again after 5-10 minutes, it again takes 15-20 seconds.</p>
  
  <p>Please give me some advice how can i solve this problem? google does not accept my pages due to long response.</p>
  
  <p>Is server sleep after 5-10 min?</p>
  
  <p>If not, why does it take such a long time when I load my site again after 5-10 min?</p>
  
  <p>I see in my cpanel there is some information</p>
  
  <pre><code>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
  </code></pre>
  
  <p>CPU usage, virtual memory and Entry processes are 0, when they are in used?</p>
  
  <p>If I use virtual memory, will this solve my problem?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <pre><code>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
  </code></pre>
  
  <p>How is it possible that a 3.4MB page loads in 588ms,
  What technique or code YouTube are using to increase page speed?</p>