4 ms·
Everyone always shows a single server setup. What if you have a dozen sites? You can't just give each one 9 processes, you will swamp your box. Is there any way
by megaman821 15y ago
Everyone always shows a single server setup. What if you have a dozen sites? You can't just give each one 9 processes, you will swamp your box. Is there any way to do a master setup where you can dynamically feed it your settings file?
- Stiffy 15y agoIf you're already running a dozen sites on one server, collectively they're probably not getting very much traffic. You may very well be able to use a large number of processes just fine.
- megaman821 15y agoThat is probably true CPU wise, I am just worried about memory. If each process is 50 MB and you have 12 servers and 9 processes per, that is over 5 GB. If my machine only has 4 GB of RAM some of those processes must be in the swap file.
- unshift 15y agoyou can do pretty well with 1-2 processes per site; if you don't have the traffic to warrant it, there's no reason to run more. gunicorn can also use an async worker type (gevent) which can help keep the number of needed processes down. django also has a sites package, so you can run multiple sites per django instance. it's less encapsulated but if you run a high number of websites with a low amount of traffic each it makes a lot of sense.
- ehutch79 15y agoit's pretty easy to add multiple upstream servers to nginx. If you're at that point you want to be reading the docs and understanding what's going on anyway. Also gunicorn wants n+1 workers, where n is the number of cores you want to devote to it. It's in the docs. So an 8 core machine would want 9 workers. If you've got multi server scaling issues, cut and paste won't help you.
- ehutch79 15y agooops i've apparently misunderstood what you were asking. you want something like: include /etc/nginx/vhosts/enabled/* and just put your server directives into files that are in enabled.
- zeekay 15y agoI've found uwsgi is great for multiple site hosting. There are numerous ways to configure uwsgi for this purpose, one of my favorites: http://projects.unbit.it/uwsgi/wiki/VirtualHosting http://projects.unbit.it/uwsgi/wiki/VirtualHosting. Newer versions of uwsgi also have a feature called emperor mode which is pretty slick: http://projects.unbit.it/uwsgi/wiki/Emperor http://projects.unbit.it/uwsgi/wiki/Emperor.