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.

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!

share|improve this question
    
I'm not exactly sure how the apache benchmarking tool works, but seeing as it spawns a ton of connections I would assume it uses a fair amount of cpu and is probably what's killing your performance... Try running ab on a different machine. –  photoionized Apr 21 '11 at 22:33
    
you may get more responses from Webmasters –  Mike Pennington Apr 22 '11 at 2:10
    
Thanks @photoionized, I never considered that. I tried it from another instance and got the same results, though. –  asciitaxi Apr 22 '11 at 2:24
    
Wasn't aware of Webmasters, I'll repost over there. Thanks, Mike. –  asciitaxi Apr 22 '11 at 2:25

1 Answer 1

Increase WSGIDaemonProcess procecesses to at least twice the number of cpus and try again

share|improve this answer

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.