Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

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?

share|improve this answer
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 9:29
    
I just checked it and it's logging by IP address. I also checked apache2.conf again and HostnameLookups is: Off. –  user138684 Sep 27 '12 at 9: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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.