I've noticed that you can start multiple processes within one uWSGI instance behind nginx:
uwsgi --processes 4 --socket /tmp/uwsgi.sock
Or you can start multiple uWSGI instances on different sockets and load balance between them using nginx:
upstream my_servers {
server unix:///tmp.uwsgi1.sock;
server unix:///tmp.uwsgi2.sock;
#...
}
What is the difference between these 2 strategies and is one preferred over the other?
How does load balancing done by nginx (in the first case) differ from load balancing done by uWSGI (in the second case)?
nginx can front servers on multiple hosts. Can uWSGI do this within a single instance? Do certain uWSGI features only work within a single uWSGI process (ie. shared memory/cache)? If so it might be difficult to scale from the first approach to the second one....