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 have a local Web Server (running CentOS 5.5) that hosts an intranet for my company. The server itself runs fine, and the web pages are servered, but it is very, very slow. I find myselft having to restart the httpd service at least once a day to try and get some sort of reasonable speed.

On the home page for example, I have 11 requests, whcih firebug tells me took 406ms, yet the 'onload' that it specifies is 6.47s. Indeed, looking at all of the requests, I can see that the first was not served until after +4.9s (Request start time since the beginning).

Being fairly new to web servers, I have no idea what is happening for those 4.9s, and more improtantly why it is taking so long. 406ms to load all requests is fine, but 6.47s (on a gigabit network) is far to slow.

Any tips on what I should be looking at in an effot to speed this process up?

share|improve this question
    
did you issue top or other perfomance monitoring tool on server to see waht is slowing server? –  user106666 Sep 14 '12 at 10:40
    
Using top I can see that httpd is running 2 times (both from user Apache) when I call a web page, but the CPU time is no where near 30%, even with all other tasks being run. –  David Gard Sep 14 '12 at 10:52
    
Not enough information. What kind of app are you hosting PHP/Perl with what backend MySQL/SQLite etc. What is the server specification? What is the average page size? This could be anything from a network issue to a server configuration issued, to a badly built website. –  Ben Lessani - Sonassi Sep 15 '12 at 21:31

1 Answer 1

Definitely confirm that your httpd is not set up to do reverse lookups, which can cause multi-second stalls like this. I've run into it enough that it's always worth ruling out. Specifically, the HostnameLookups directive and the %h stanza for logging can cause this behavior. There's more too. You can verify by tcpdumping on the server during your testing. If you see PTR lookups coming from the web server for your IP address (or any NAT address that you may be passing through), this is likely the issue. Here is a nice summary of the places to look:

http://betabug.ch/blogs/ch-athens/933

Hope this helps.

share|improve this answer
    
HostnameLookup is set to Off, so that is ok. I did find 3 instances of my logging using %h though, so I changed that and it seems to have shaved about 2.5 seconds off of the page load time (great start). I'm still trying to digest the rest of your post/link, but thank you for your help so far. –  David Gard Sep 14 '12 at 13:15
    
tcpdump - I have run this, but I'm afraid I do not understand the output. I am getting multiple lines of 14:22:06.755105 IP webserver.dynedrewett.com.ssh > sh047.dynedrewett.com.multip-msg: P 62525780:62526072(292) ack 72081 win 19296 (where webserver is the Web Server, and sh047 is the Client PC that I am using. The only thing that changes on the output is the number in the brackets (292 in this case) - it is mostly 180, but sometimes 292, 404 and 660. –  David Gard Sep 14 '12 at 13:25
    
@David: try doing this in your tcpdump - 'tcpdump -ni <your interface> udp port 53, which will filter out the ssh traffic you see coming from your workstation and home in on udp port 53, which is DNS (usually). –  mcauth Sep 18 '12 at 13:15

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.