2

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!

4
  • 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. Commented Apr 21, 2011 at 22:33
  • you may get more responses from Webmasters Commented Apr 22, 2011 at 2:10
  • Thanks @photoionized, I never considered that. I tried it from another instance and got the same results, though. Commented Apr 22, 2011 at 2:24
  • Wasn't aware of Webmasters, I'll repost over there. Thanks, Mike. Commented Apr 22, 2011 at 2:25

1 Answer 1

0

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

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.