My setup is django 1.3 and the default mod_wsgi and apache packages for ubuntu 10.04. I tested one view of my app on my development VM (DEBUG and debugging toolbar off):

ab -n 200 -c 5 http://127.0.0.1/

and got 4 requests per second. This seemed slow so I simplified the queries, used indexes, etc. to the point where debugging toolbar tells me I have 4 queries taking 8ms. Running the same test, I only get 8 requests per second. The CPU seems to be at 100% the whole time. This seems quite slow for what is now a quite simple view, but it is just a low powered VM.

I decided to start up a large ec2 instance (4 cpu) to see what kind of performance I would get on that class of machine and was surprised to only get 13 requests per second. How can I change the configuration of apache/mod_wsgi to get more performance out of this class of machine?

I think I am using worker rather than prefork:

$ /usr/sbin/apache2 -l
Compiled in modules:
  core.c
  mod_log_config.c
  mod_logio.c
  worker.c
  http_core.c
  mod_so.c

My worker configuration is:

<IfModule mpm_worker_module>
    StartServers          2   
    MinSpareThreads      25  
    MaxSpareThreads      75  
    ThreadLimit          64  
    ThreadsPerChild      25  
    MaxClients          150 
    MaxRequestsPerChild   0   
</IfModule>

and my WSGI settings look like this:

WSGIScriptAlias / /home/blah/site/proj/wsgi.py
WSGIDaemonProcess blah user=blah group=blah processes=1 threads=10
WSGIProcessGroup blah

Thanks very much for your help!

NOTE: I tried the ab test from another instance and got the same result

NOTE: I posted this on ServerFault before I was aware of this site

link|improve this question
Daemon configuration is beyond the Pro Webmasters scope (see FAQ). I believe that StackOverflow will be the best place for you to ask in this case, as you are the developer (as opposed to the sysadmin) - take a look at Django request impossibly slow, can't find why and consider posting your question at SO. – danlefree Apr 22 '11 at 6:01
@danlefree - thanks, I'll post it on SO – asciitaxi Apr 22 '11 at 20:35
feedback

closed as off topic by danlefree Apr 22 '11 at 21:07

Questions on Pro Webmasters - Stack Exchange are expected to generally relate to webmastering, within the scope defined in the faq.

Browse other questions tagged or ask your own question.