web-04 的nemu-api uwsgi 配置
[uwsgi]
# enable master process
master = true
# load apps in each worker instead of the master
lazy-apps = true
# disable request logging
disable-logging = true
# spawn the specified number of workers/processes
# # 进程数 同workers
processes = 16
# a shortcut enabling gevent loop engine with the specified number of async cores and optimal parameters
# 这个要研究
gevent = 1024
# set the socket listen queue size 并发配置,配合设置 net.core.somaxcon = 1024
listen = 8192
# reload workers after the specified amount of managed requests
# 当worker达到指定数量的链接,就reload
max-requests = 50000
# set the maximum time (in seconds) a worker can take to reload/shutdown (default is 60)
# worker关闭或reload的时间,有仲情况是,worker关闭要太长时间了,导致一直关不掉
worker-reload-mercy = 10
#Set the max size of a request (request-body excluded), this generally maps to the size of request headers. 设置requset大小,不包括request body,
#一般指request的header,cookie,请求参数
buffer-size = 8192
# setuid to the specified user/uid
uid = nobody
#setgid to the specified group/gid
gid = nogroup
# set environment variable
env = PYTHON_EGG_CACHE=/tmp
env = PYTHONPATH=/home/project/nemu-server-src/env/local/lib/python2.7/site-packages/appinsight/
env = AGENT_CONFIG_FILE=/home/project/nemu-api/etc/config.ini
# set default WSGI callable name
# wsgi、module: load a WSGI module 配合一起看
# wsgi-file、file:load .wsgi file
callable = app
socket = /tmp/nemu-api.sock # 监听的socker
# set PYTHONHOME/virtualenv
# 同virtualenv、pyhome
venv = /home/project/nemu-server-src/env
# load .wsgi file
wsgi-file = /home/project/nemu-api/app.py
daemonize = /home/project/nemu-api/logs/uwsgi.log
touch-reload = /home/project/nemu-api/app.py # reload an instance touch 这个文件就会触发reload
# 修改进程名的
auto-procname = true
procname-prefix-spaced = nemu-api
buffer-size:
Set the max size of a request (request-body excluded), this generally maps to the size of request headers. By default it is 4k. If you receive a bigger request (for example with big cookies or query string) you may need to increase it. It is a security measure too, so adapt to your app needs instead of maxing it out.
[uwsgi]
chdir = /home/ymserver/vhost/owan-web
module = config.wsgi
workers = 8
max-requests = 5000000
disable-logging = True
virtualenv = /home/ymserver/.virtualenvs/owan-web_env
touch-reload = /home/ymserver/vhost/owan-web/reload
reload-on-rss = 512
master = True
vacuum = True
socket = /tmp/%n.sock
uid = www-data
gid = ymserver
umask=002
logto = /data/log/uwsgi/%n.log
logfile-chown=www-data:ymserver
logfile-chmod=664
# 如果你想维持 Python 的线程支持同时应用又不启动多个线程,只需要加上 --enable-threads 选项
enable-threads = True
# http://uwsgi-docs.readthedocs.io/en/latest/ThingsToKnow.html
# 启用了多线程模式后,但自动开启线程支持,因此上面的 enabled-threads 不用设置
threads = 40
# 惊群效应
#http://uwsgi-docs-zh.readthedocs.io/zh_CN/latest/articles/SerializingAccept.html
thunder-lock = true
网友评论