Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to run a Django webapp with Apache and mod-wsgi. Every page take a solid 10 seconds to load. I've ruled out the MySQL database (enabled slow querie logging and they are all fast) so I think that I have an issue with DNS settings. I have the server in my office and I'm trying to access the webapp from within the same office LAN. When I run the webapp on the Django test server it is lightening fast, so I'm convinced it's apache or my networking settings somehow.

My hosts file looks like this:       localhost       localhost  RDCServer

The is the sub-domain of the webapp, the main domain is the main website which is located on a VPS server (different IP addy)

What am I doing wrong?

share|improve this question
And which DNS server is responsible (authoritative) for your subdomain? – mailq Nov 6 '11 at 19:32
DNSMadeEasy -- why? I'm not sure I understand the connection... – Garfonzo Nov 6 '11 at 19:34
So then the host entry for the subdomain isn't necessary if it is already present in the DNS. – mailq Nov 6 '11 at 19:35
Good to know. However, removing the app part didn't change the slowness situation. – Garfonzo Nov 6 '11 at 19:39
Have you looked at the general performance of the machine you are running it on? System load, disk performance, etc? – Phil Hollenback Nov 6 '11 at 20:33

Make sure you aren't using mod_wsgi in embedded mode, especially with Apache prefork MPM. If you are then you may be hitting a different process for every request and seeing the delay in loading Django the first time. If this were the case though you might expect that after a while as Django gets loaded, that response times then drop. This is not absolute though because if request load is very light, depending on how you have set up Apache, Apache could decide your processes aren't needed and shut them down, meaning that on subsequent requests after idle period, it is loading the whole of Django once again.

Ensure you are using:

LogLevel info

in Apache configuration so that mod_wsgi logs stuff about when it is initialising Python in processes and loading WSGI script for first time. That will at least help you to eliminate that as the issue.

Better still, if you don't know much about setting up Apache or mod_wsgi, use daemon mode of mod_wsgi as that will save you from many of the mistakes you can make in setting up Apache badly for Python web applications.

share|improve this answer

Thanks for the responses. I checked into your suggestions and determined it to be an issue with my server's hosts file. I added the IP address of my router with the and all is now well.


Is this a poor solution or does it makes sense?

In any event, it is working. Thanks!

share|improve this answer

(Better title for your question: How do I diagnose apache taking 10 seconds for each page?)

Use chrome's web dev tools to determine exactly (from the client's perspective) what's slow.

If it's Apache, turn on ALL apache debugging and run it in the foreground. This ought to give you more hints as to what its doing.

Do you get the delay serving static resources? Or only WSGI requests?

You need to isolate the problem first, you're trying to debug this through trial and error.

share|improve this answer

Majority of times, when the sites are not loading correctly, then the Simples and basic disagnostic tool is our BROWSER. it tells you a lot about what it is doing with the site you gave it to process and display. for example, in chrome browser, when you have typed the address of site, then just after pressing enter button, keep an eye on the status bar of chrome. it might be telling you any of these: - " waiting for" - "resolving" if its the first case, then it tells us that your DNS is 100% healthy. and if it takes 10 seconds stuck at showing "Resolving...." that means DNS is the culprit.

You can use Firebug in forefox or chrome, to see detailed debug of exactly where it is taking so much time.

share|improve this answer

Your Answer


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.