为什么 gunicorn 显示这么多进程?
Why is gunicorn displaying so many processes?
我有一个使用 Django 和 运行 Gunicorn 与 Nginx 构建的简单网络应用程序。
当我打开 HTOP 时,我看到生成了如此多的进程和线程 -- 对于一个只显示登录表单的教程应用程序。 HTOP截图如下:
为什么这么简单的应用程序打开这么多?
这是我的配置
"""gunicorn WSGI server configuration."""
from multiprocessing import cpu_count
from os import environ
def max_workers():
return cpu_count() * 2 + 1
max_requests = 1000
worker_class = 'gevent'
workers = max_workers()
谢谢
那是因为gunicorn's design:
Gunicorn is based on the pre-fork worker model. This means that there is a central master process that manages a set of worker processes. The master never knows anything about individual clients. All requests and responses are handled completely by worker processes.
这意味着 gunicorn 将生成所需数量的进程和线程,具体取决于工作组的配置和类型。
我有一个使用 Django 和 运行 Gunicorn 与 Nginx 构建的简单网络应用程序。
当我打开 HTOP 时,我看到生成了如此多的进程和线程 -- 对于一个只显示登录表单的教程应用程序。 HTOP截图如下:
为什么这么简单的应用程序打开这么多?
这是我的配置
"""gunicorn WSGI server configuration."""
from multiprocessing import cpu_count
from os import environ
def max_workers():
return cpu_count() * 2 + 1
max_requests = 1000
worker_class = 'gevent'
workers = max_workers()
谢谢
那是因为gunicorn's design:
Gunicorn is based on the pre-fork worker model. This means that there is a central master process that manages a set of worker processes. The master never knows anything about individual clients. All requests and responses are handled completely by worker processes.
这意味着 gunicorn 将生成所需数量的进程和线程,具体取决于工作组的配置和类型。