Search code examples
linuxubuntunginxuwsgiweb2py

emperor.uwsgi (nginx, uwsgi and web2py) takes a very long time to restart


I current using Nginx/UWSGI/Web2py to run a web application.

When I am running a new deploy the systemctl restart emperor.uwsgi the operation takes almost a minute to be completed. How can I fix it?

My ini file is:

[uwsgi]

socket = /tmp/web2py2.socket
pythonpath = /home/www-data/2/web2py/
mount = /=wsgihandler:application
processes = 2
master = true
harakiri = 300
reload-mercy = 8
cpu-affinity = 1
stats = /tmp/stats2.socket
max-requests = 2000
limit-as = 512
reload-on-as = 256
reload-on-rss = 192
uid = www-data
gid = www-data
touch-reload = /home/www-data/2/web2py/routes.py
no-orphans = true
logto = /var/log/uwsgi/web2py2.log
vacuum = true
die-on-term = true
plugins-dir = /usr/local/lib/uwsgi
plugin = python27

My service file is:

[Unit]
Description=uWSGI Emperor
After=syslog.target

[Service]
ExecStart=/usr/local/bin/uwsgi --ini /etc/uwsgi/web2py2.ini
# Requires systemd version 211 or newer
RuntimeDirectory=uwsgi
Restart=always
KillSignal=SIGQUIT
Type=notify
StandardError=syslog
NotifyAccess=all

[Install]
WantedBy=multi-user.target

Solution

  • The problem was related with the option:

    die-on-term = true
    

    I do not know why, but when I took if off, it works file, less de 2 seconds.