我有一个运行在python 2.7,nginx 1.4.4和uWSGI 2.0.12上的Django应用程序。一切都运行良好。无论如何,我决定升级到python 3.6并安装uWSGI 2.0.17。现在,当我启动uWSGI时,启动该过程所需的时间比旧的python和uWSGI组合要多得多。
这是我开始使用uWSGI时得到的结果:
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address :3111 fd 3
Python version: 3.6.5 (default, Jun 04 2018, 13:19:41) [GCC 4.7.0]
Python main interpreter initialized at 0x101a8d70
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 302472 bytes (295 KB) for 2 cores
*** Operational MODE: preforking ***
WSGI app 0 (mountpoint='') ready in 36 seconds on interpreter 0x101a8d70 pid: 17655 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 17655)
spawned uWSGI worker 1 (pid: 17708, cores: 1)
spawned uWSGI worker 2 (pid: 17709, cores: 1)
它需要18-42秒,而它只有2秒(每次)!任何人都知道为什么?
uWSGI以:
开头uwsgi --ini /etc/uwsgi/apps-enabled/my_conf.ini
my_conf.ini如下所示:
[uwsgi]
logto = /var/log/uwsgi/uwsgi.log
buffer-size = 32000
socket = :3111
chdir = /abc
wsgi-file = abc/wsgi.py
uid = uwsgi
gid = www-data
processes = 2
master = true
enable-threads = true
max-requests = 200
limit-as = 1024
reload-on-as = 1024
reload-on-rss = 1024
这是在具有2GB RAM的双核机器OpenWrt上运行。