Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nginx+uWSGI: dynamic vs emperor mode

Tags:

nginx

uwsgi

I am doing multi-application nginx+uWSGI setup and I wonder if I should use dynamic mode of uWSGI as documented here (under Dynamic apps) or the Emperor mode. I am slightly more inclined to use the emperor mode but maybe it is not the best choice. What are pros/cons of each?

like image 786
clime Avatar asked Feb 24 '13 00:02

clime


People also ask

What is uWSGI emperor?

It is a special uWSGI instance that will monitor specific events and will spawn/stop/reload instances (known as vassals, when managed by an Emperor) on demand. By default the Emperor will scan specific directories for supported (. ini, .

What is the difference between Nginx and uWSGI?

Nginx is “a web server which can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache”. uWSGI is an implementation of the WSGI spec, which describes how a web server should communicate with a web app, which makes uWSGI also a type of web server.

What is the difference between uWSGI and WSGI?

WSGI is a specification. uWSGI provides an implementation of the WSGI specification. You can't compare them. You can only compare different implementations.

Which is better Gunicorn or uWSGI?

Gunicorn and uWSGI are primarily classified as "Web Servers" and "Web Server Interface" tools respectively. Gunicorn and uWSGI are both open source tools. Gunicorn with 5.96K GitHub stars and 1.12K forks on GitHub appears to be more popular than uWSGI with 2.5K GitHub stars and 541 GitHub forks.


1 Answers

Emperor mode is for handling multi-application environments. It basically monitors the directories you specify for new apps & events you want it to respond to.

Pros:

  • You can gracefully reload a site when you update your code by touching the vassal file.
  • Apps respawn on crashes & reboots.
  • Scales very nice if you need to add multiple servers
  • Throttles your vassals to prevent Denial of Service (DoS)

Cons

  • I'm not sure there are any. I believe this is the preferred way to run apps (even if only one).

I'm not 100% certain, but I believe launching with the settings provided in the docs will only launch an app Nginx passes. There are two issues I see with this, you're stuck with Nginx. Not saying that's bad, but if you wanted to play around with, or decided to move to another server, you might need to redo the setup. Also, this does not provide any of the benefits I mentioned earlier.

like image 56
chirinosky Avatar answered Oct 10 '22 05:10

chirinosky