From 7950ca6f362f67ea3355deaa83f95d68f9e71718 Mon Sep 17 00:00:00 2001 From: RogerWork Date: Mon, 19 Feb 2024 11:10:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95=20uvicorn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gunicorn_config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gunicorn_config.py b/gunicorn_config.py index cef19d7..140dcc4 100644 --- a/gunicorn_config.py +++ b/gunicorn_config.py @@ -6,8 +6,8 @@ bind = '0.0.0.0:8000' # 指定监听的地址和端口,用于nginx转发 backlog = 2048 # 服务器中排队等待的最大连接数,建议值64-2048,超过2048时client连接会得到一个error。 workers = multiprocessing.cpu_count() * 2 + 1 # 用于处理工作的进程数,这里使用了文档建议的值 -# worker_class = 'gthread' # worker进程的工作方式,有sync、eventlet、gevent、tornado、gthread, 缺省值sync, django使用gthread的方式好一些。 -worker_class = "uvicorn.workers.UvicornWorker" # worker进程的工作方式,有sync、eventlet、gevent、tornado、gthread, 缺省值sync, django使用gthread的方式好一些。 +worker_class = 'gthread' # worker进程的工作方式,有sync、eventlet、gevent、tornado、gthread, 缺省值sync, django使用gthread的方式好一些。 +# worker_class = "uvicorn.workers.UvicornWorker" # worker进程的工作方式,有sync、eventlet、gevent、tornado、gthread, 缺省值sync, django使用gthread的方式好一些。 worker_connections = 1000 # 最大客户端并发数量,默认情况下这个值为1000。此设置将影响gevent和eventlet工作模式 threads = int(480 / workers) # 数据库连接数=workers*threads*2