I can see that if I start uwsgi like this:
sudo /usr/local/bin/uwsgi --emperor /etc/uwsgi/vassals --uid www --gid www
it creates one emperor copy. But if I start it with --master
additionally (as recommended here), it creates two emperor copies. Does it make sense to use --master
with --emperor
? I would say no, but if I run it without that option I get this warning:
*** WARNING: you are running uWSGI without its master process manager ***
Here is what official documentation says:
The emperor should generally not be run with --master, unless master
features like advanced logging are specifically needed.
If you're wondering what master
option does, here is the answer:
master
uWSGI’s built-in prefork+threading multi-worker management
mode, activated by flicking the master switch on. For all practical
serving deployments it’s not really a good idea not to use master
mode.
So, to summarize:
- Use
--master
for usual uWSGI instance,
- Do not use
--master
for uWSGI Emperor.
I disagree - the documentation says it is not a good idea NOT to use it, in production anyway; I guess the double negative could be written more clearly.
Therefore it would appear it IS a good idea to use it, hence the warning.
I'd like to add some specific information for using harakiri mode for vassals running under emperor. If master is not also in the config for the vassals harakiri will have no effect regardless of whether master/harakiri is specified in the emperor config. Given an example emperor config:
[uwsgi]
emperor = ...
daemonize = ...
emperor-pidfile = ...
vassal-set = enable-metrics=1
emperor-stats = 127.0.0.1:6000
The vassals will need the following for harakiri to work:
[uwsgi]
strict
processes = 4
stats = 127.0.0.1:5000
memory-report
daemonize = ...
pidfile = ...
close-on-exec
py-tracebacker = /tmp/tbsocket
master
harakiri = 5
harakiri-verbose
Note that master and harakiri are both present in the vassal and setting them in emperor config would have no effect on the vassals for uwsgi version 2.0.12