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:
uWSGI
<uwsgi>
<vhost-host/>
<master/>
<gid>www-data</gid>
<uid>www-data</uid>
<catch-exceptions/>
<socket>/var/tmp/uwsgi.sock</socket>
<chmod-socket/>
<idle>300</idle>
<processes>6</processes>
<no-orphans/>
<enable-threads/>
<reload-mercy>5</reload-mercy>
<threads>10</threads>
<no-default-app/>
<touch-reload/>
<!-- <reload-on-rss>128</reload-on-rss> Reload at 128MB of RSS (memory usage) -->
</uwsgi>
Update:
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.