修改连接数
This commit is contained in:
1 parent
3b31867319
commit
d342bba458
2 files changed
+4
-2
No files matched your search
@@ -15,7 +15,8 @@ worker_class = "gevent"
|
||||
|
||||
# 进程数
|
||||
# 公式: 2 * CPU核心数 + 1
|
||||
workers = multiprocessing.cpu_count() * 2 + 1
|
||||
# workers = multiprocessing.cpu_count() * 2 + 1
|
||||
min(int(os.getenv("GUNICORN_WORKERS", "9")), multiprocessing.cpu_count() * 2 + 1)
|
||||
|
||||
# 每个 Worker 的最大并发连接数
|
||||
worker_connections = 1000
|
||||
|
||||
@@ -4,6 +4,7 @@ backend/gunicorn_config.py
|
||||
生产环境 Gunicorn 配置 (支持高并发)
|
||||
"""
|
||||
import multiprocessing
|
||||
import os
|
||||
|
||||
# 绑定地址
|
||||
bind = "0.0.0.0:8000"
|
||||
@@ -12,7 +13,7 @@ bind = "0.0.0.0:8000"
|
||||
worker_class = "gevent"
|
||||
|
||||
# Worker 数量:通常 CPU 核数 * 2 + 1
|
||||
workers = multiprocessing.cpu_count() * 2 + 1
|
||||
workers = min(int(os.getenv("GUNICORN_WORKERS", "9")), multiprocessing.cpu_count() * 2 + 1)
|
||||
|
||||
# 核心:每个 Worker 最大并发连接数
|
||||
# Gevent 下这个值可以设置得很高,支持海量 SSE 连接
|
||||
|
||||
Reference in new issue
Block a user