I just changed the dedicated server for my website. Since that my pages loads in much more time.

With developers tools of chrome I can see this (image):

Dns Lookup: 1ms
Connecting: 50ms
Sending: 1ms
Waiting: 4.57s (O_O)
Receiving: 44ms

The waiting time is absurd. 4 sec.

What Can I do? Is this a temporany problem due to the IP-DNS change?


Ok I get what is it.

It's the frea*ing Apache. I just restarted it and now the waiting time are normal (below 100ms)

DAMN mpm prefork settings, always giving problem, damn apache.

  • What kind of files are you serving? If it's doing this to a script maybe it could be a database issue. If it's doing this to a .jpg, then there's some problem with the webserver itself. – DerfK Feb 20 '11 at 18:41
  • @derfk: read my first post edited – dynamic Feb 20 '11 at 19:31

A few things you can try to narrow down the cause:

  • Try running the page query locally on the server (for example, with wget) and see if you get similar or different loading times. If the page loads quickly locally on the server then it is some sort of network issue.
  • You can also use a benchmarking program like ab both remotely and locally on the server to give you some concrete numbers. The remote test will always be slower but it will help you determine the effectiveness of whatever you do to try fixing it (i.e., make a change and test it to see what effect it had).
  • If you determine that the issue is local to the server you can start to eliminate possible causes from there. Try loading static pages which should load very quickly. If not it is likely due to the server configuration. Test a simple dynamic page. Test a page with a simple database query.
  • If that still doesn't yield any results start profiling a page you know is slow. The simplest method is to just insert a bunch of log output messages displaying the time at various points and then check the log file after loading the page (this doesn't work too well on a high traffic site). If that method doesn't show any obvious issue you'll have to move on to more thorough profiling methods.
  • If you narrow down the issue to a database query try running the query locally on the server to confirm if it is slow or not.

Note that a 4-5sec page load is not great but is not terrible either. There may be just one primary cause or you may need to optimize all layers of your application (server, database, application, caching, etc...) to see any significant decrease in loading time.

| improve this answer | |
  • @usep: thanks for the info but in this case the waiting time isn't related to "load time" of my dynamic pages, infact they loads usually in less than 0.1 sec (w/ 5-6queries) I think it's a network issue but I would like to know what Can I do for testing such stuff – dynamic Feb 20 '11 at 19:29

Can you use Firefox and make a screenshot with Firebug? When it's possible, goto "Firebug -> Network" and press F5 important that the Browser reload all content. Then send us a Screenshot of this.

| improve this answer | |
  • in my first post there is the image img196.imageshack.us/img196/3232/immaginele.png of chrome, that's basically the same – dynamic Feb 20 '11 at 20:18
  • Yes i know i have seen that. But on Firebug you can see for which file he wait ;) and the sreenshot for Chrome you have postet is only a summary. There you can't see what or which file is really slow. – René Höhle Feb 21 '11 at 10:45

My problem was Apache2. In the error log i found exceeded MaxClient. Anyway even without rising the setting with just an apache restart the Waiting time went down to few ms (<150ms).

I rised now both ServerLimit and MaxClients (mpm_prefork) Anyway the problem was/is Apache2 Setting.

| improve this answer | |

Is it possible that you have reverse name lookups enabled in your apache config?

Make sure the following line is in your apache2.conf:

HostnameLookups Off

| improve this answer | |
  • how can I check if it's on? – dynamic Feb 20 '11 at 19:25
  • You should look for:HostnameLookups Off – Zeki Feb 20 '11 at 19:27
  • it's off in etc/apache2/httpd.conf – dynamic Feb 20 '11 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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