[uwsgi]
project = fortune_cat
uid = ubuntu
gid = ubuntu
path = fortune_cat
base = /home/%(uid)
chdir = %(base)/%(path)/%(project)
module = %(project).wsgi:application
master = true
thunder-lock = true
processes = 2
#cheaper = 1 # 最少进程
#cheaper-algo = backlog #
#worker = 4
#threads=5
harakiri=30
listen = 4096
#gevent=100
pidfile= /home/ubuntu/uwsgi/run/%(project).pid
socket = /home/ubuntu/uwsgi/run/%(project).sock
vacuum = true
die-on-term = true
daemonize = %(base)/%(path)/%(project)/uwsgi.log
logto = %(base)/%(path)/%(project)/uwsgi.log
venv = /home/ubuntu/.virtualenvs/fortune_cat/
env = env=dev
https://uwsgi-docs.readthedocs.io/en/latest/Cheaper.html 动态增加/减少uwsgi进程
在/etc/sysctl.conf中加入:
net.core.somaxconn = 2048
使用:sysctl -p 生效
uwsgi listen 必须小于等于上边这个值
uwsgi processes 并非越大越好 一般为cpu核数的1-2倍比较合适
gevent 对于我的程序效果不佳 可能是因为我的程序io开销比较小