Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So far I have been experimenting with uWSGI to replace a lot of kludgy server code that builds and does setup for Python wsgi applications under supervise. I am running dozens of these small projects (Django, Flask, other) at once.

Currently I am running in Virtualhost mode and I allow NGINX to basically invoke applications at will. However, it seems the reload feature "touch-reload" is meant for a specific file.

Is there a way to use "touch-reload" to monitor the module that is running either by specifying it per site or automatically? Or is there a way to allow touch-reload to be configured per application?

I have also looked at emperor mode, which seems like it could be a slightly less awesome substitute but I am not sure if my use case would cause dozens if not hundreds of processes to spawn. I like the virtualhost mode because it essentially shares a pool of workers over all of the applications, this seems most efficient to me.

Current Configs:


    <!-- <reload-on-rss>128</reload-on-rss> Reload at 128MB of RSS (memory usage) -->


After doing some research about how uWSGI handles shutting down idle workers, I think I will need the emperor mode after all.

What I am trying to do is let seldom used applications take no resources and oft used applications take more resources. I am trying to do that while maintaining a hosting deployment as simple as PHP-FPM. The virtual mode achieves this but seems to shut down all workers only after all applications have been idle, which isn't useful if any app receives a steady stream of traffic. I would love to be corrected on this issue if it's untrue.

The downside to going with emperor mode is that I will have to make socket files and config files for each application (blech!). I would still like to know if it's possible to implement per application reloading as mentioned above though.

share|improve this question
up vote 2 down vote accepted

you should ask it in the official mailing-list, all of your statements are true, so you should try to ask for an improvement in the list.

share|improve this answer
Unfortunate, but I will refer the mailing list here. Thanks for the info. – Xealot Jun 18 '11 at 15:57

If you're running multiple apps, you probably want emperor mode which superceded vhost mode for most use cases (including what you describe).

For dynamically scaling workers across all the apps, you have several options.

The simplest is probably uWSGI's cheaper subsystem. It provides very fine-grained controls for setting minimum and maximum number of workers for each app, as well as enforcing a global memory limit across all apps (so you don't have a complete blowup if all apps spike at once.)

If you want a single pool of workers that are shared across all apps (rather than spinning workers up/down for each app), then the slightly more complex solution is Emperor + Broodlord + Zergs. The best place to start is probably the official docs on Broodlord mode:

share|improve this answer

Your Answer


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.