I have about a dozen small Django sites I want to run using Nginx and uWSGI. They are on a 4-core server with 8 gigs of ram. Should each site be configured on its own socket and how can I control the total number of processes across all instances of uWSGI? If each up app has 30 processes, how can I prevent running out of ram?


add --limit-as option to each instance and limit the number of requests each process will manage after being restarted (-R 1000 is normally a good value, this will mitigate leaks)

30 processes per app looks a bit too much for me, start with 8 (ncpu*2) and increase them if you need it

If you want, you can use the development tree (take it via mercurial) and use jailing features:



  • That is pretty handy, but the situation I am most worried about is that one site gets a lot of traffic on one day and needs most of the server resources, on a different day another site needs the same thing. If site one has enough idle processes to fill memory what will happen when site two needs the memory? – Jason Christa Feb 19 '11 at 14:10
  • 1
    In such situation (no deterministic resource allocation) you can go for multiple application mode + virtual hosting. You will spawn a relatively big number of processes that hosts all the apps. It is a bit complex to setup, but once you get it you will add new apps in no time. projects.unbit.it/uwsgi/wiki/VirtualHosting – roberto Feb 19 '11 at 17:23
  • I tried to get that working for hours but it seems whatever app started first is the only one it would show. In the wsgi.py I add two relative directories 'apps' and 'sites' that live inside the project directory to the python path. Is it possible the python path is being shared across apps even though I am using a virtual env and running uWSGI with the correct pyhome and with vhost and no-sites. – Jason Christa Feb 21 '11 at 3:56
  • @Jason Christa: Did you succeed on this? I'm having the same problem. – Sergio May 21 '11 at 15:34
  • @Sergio: Yes, I use one uWSGI config (you must use xml and not ini here) and use Nginx vhosts to pass in the correct import paths and the location of the configuration file for each site. – Jason Christa May 23 '11 at 18:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.