python uwsgi 监控与性能观察
https://github.com/timonwong/uwsgi_exporter https://pypi.org/project/uwsgi-prometheus/ https://pypi.org/project/uwsgitop/ https://www.digitalocean.com/community/tutorials/how-to-setup-uwsgi-on-ubuntu-12-10#step-6-confirmation-access-the-application https://developer.aliyun.com/article/652884 https://www.bloomberg.com/company/stories/configuring-uwsgi-production-deployment/
strict = true:启用严格模式,uwsgi将在配置文件中发现未知选项时抛出错误。
master = true:启用主进程模式,uwsgi将创建一个主进程来管理工作进程。
enable-threads = true:启用多线程模式,uwsgi将在工作进程中启用线程。
vacuum = true:在关闭时删除套接字文件。
single-interpreter = true:所有工作进程共享一个解释器。
die-on-term = true:接收到SIGTERM信号时关闭uwsgi进程,而不是重新生成工作进程。
need-app = true:要求配置文件中必须指定应用程序。
disable-logging = true:禁用uwsgi的内置日志记录功能。
log-4xx = true:记录HTTP 4xx错误。
log-5xx = true:记录HTTP 5xx错误。
harakiri = 60:在请求处理时间超过60秒后强制杀死工作进程。
py-call-os-afterfork = true:
允许工作进程捕获信号。
max-requests = 1000:在处理完1000个请求后重新启动工作进程。
max-worker-lifetime = 3600:在工作进程运行时间达到3600秒后重新启动工作进程。
reload-on-rss = 2048:在工作进程的驻留内存达到2048MB后重新启动工作进程。
worker-reload-mercy = 60:在强制杀死工作进程之前等待的时间。
cheaper-algo = busyness:选择启用负载均衡算法为busyness。
processes = 128:允许的最大工作进程数。
cheaper = 8:允许的最小工作进程数。
cheaper-initial = 16:在启动时创建的工作进程数。
cheaper-overload = 1:一个循环的长度(以秒为单位)。
cheaper-step = 16:一次生成的工作进程数。
cheaper-busyness-multiplier = 30:在杀死工作进程之前等待的循环数。
cheaper-busyness-min = 20:当负载低于此阈值时,杀死工作进程(如果稳定保持多个循环)。
cheaper-busyness-max = 70:当负载高于此阈值时,生成新的工作进程。
cheaper-busyness-backlog-alert = 16:如果请求队列中等待的请求数大于此值,则生成紧急工作进程。
cheaper-busyness-backlog-step = 2:当请求队列中的请求数过多时,一次生成的紧急工作进程数。