1

I own an Ubuntu 10 VPS Server with Apache 2 hosting a Magento website. The first hit to the site from any client takes about 15-20 sec, while the subsequent hits from the same client take 0-1 sec. I suppose it doesn't have to do with Magento caching, because this happens also when the first call is on a very light page and the next calls are on heavy ones.

Does anyone have an idea on what is going wrong here?

papakost
  • 11
  • 1

1 Answers1

0

If you have access directives like allow and order enabled apache will attempt to verify every ip that connects to it and also tries to resolve the clients ip address to hostname and results to the delay you just described.

Can you please check apache logs and make sure if apache is logging by ip address or hostname?

Hex
  • 1,949
  • 11
  • 17
  • 2
    15 seconds sounds very much like a timeout value. Maybe the first DNS lookup times out after 15 seconds and when it falls back to the second DNS server it works fine. Subsequent requests are cached and hence quick. – Ladadadada Sep 27 '12 at 09:29
  • I just checked it and it's logging by IP address. I also checked apache2.conf again and HostnameLookups is: Off. –  Sep 27 '12 at 09:41
  • Another slow first request happened when I had a big iptables list. So it is worth making sure if you are getting same latency in other services like ftp or ssh. – Hex Sep 27 '12 at 16:54