fix: 降低 gthread 连接数防 MySQL 打满 + 最终一键修复脚本
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
# Gunicorn 生产配置(systemd 与 1Panel 共用此文件,勿再手写冲突参数)
|
||||
# 安装后: systemctl restart gunicorn-dianjing.service
|
||||
# Gunicorn 生产配置(systemd 与 1Panel 共用)
|
||||
# 远程 MySQL 时 worker×threads 不宜过大,否则打满 DB 连接 → 全站挂起
|
||||
|
||||
bind = "127.0.0.1:8001"
|
||||
|
||||
# 必须用 gthread:sync 模式下 4 worker 同时只能处理 4 个请求,远程 MySQL 一慢就全站卡死
|
||||
workers = 6
|
||||
threads = 4
|
||||
workers = 4
|
||||
threads = 2
|
||||
worker_class = "gthread"
|
||||
|
||||
timeout = 120
|
||||
@@ -15,12 +14,9 @@ keepalive = 2
|
||||
max_requests = 2000
|
||||
max_requests_jitter = 100
|
||||
|
||||
# 禁止输出到 stdout/stderr(曾灌满 journal 导致整机卡)
|
||||
accesslog = None
|
||||
errorlog = "/tmp/gunicorn-error.log"
|
||||
loglevel = "warning"
|
||||
|
||||
# gthread + MySQL 连接池:preload 易在 fork 后出连接问题
|
||||
preload_app = False
|
||||
|
||||
proc_name = "a_long_dianjing_gunicorn"
|
||||
|
||||
Reference in New Issue
Block a user