We help IT Professionals succeed at work.

Running multiple django sites with mod_wsgi + apache

up-tech
up-tech asked
on
I'm currently running 50+ Django installations with mod wsgi and noticing that apache isn't dropping memory (so it just keeps holding more and more, and then the sites grind to a halt as the swap disk fills). I also host some PHP sites on these servers.

Current wsgi config looks like this:

WSGIScriptAlias / /var/www/vhosts/glenlivet/tar/src/core/wsgi.py
WSGIDaemonProcess tar.sljol.info python-path=/var/www/vhosts/glenlivet/tar/src:/var/www/vhosts/.virtualenvs/glenlivet/lib/python2.7/site-packages
<Location />
WSGIProcessGroup tar.sljol.info
</Location>

Open in new window


I'm no expert, on this type of configuration, can anyone advise how best to setup each of the vhosts?

Thanks
Comment
Watch Question

Top Expert 2004
Commented:
Right off the bat, take a look at Google's docs for the WSGIDaemonProcess directive.  The specific options you'll want to investigate are:

1) processes: without specifying this option, your application is limited to a single process.  
2) threads: without specifying this option, your application will generate, at most, 15 threads.
3) maximum-requests: provides for auto-killing a thread after it has served 'x' number of a requests.
4) inactivity-timeout: provides for auto-killing a thread after not having served a request in 'x' number of seconds.