1 个带有 Gunicorn 的 web worker 是否总是意味着只有 1 个进程?

Does 1 web worker with Gunicorn always mean that there is only 1 process?

这可能是一个相当基本的问题。我正在学习 Web 应用程序开发的基础知识以及这方面的并发性和并行性。

如果我在 Gunicorn 设置为 1 个工人的情况下启动我的 Flask 网络应用程序:

gunicorn -w 1 server:app

这是否总是意味着我的应用程序只有一个进程 运行?或者这不是肯定的,有些工作人员可能不仅使用线程、greenlets,...而且会生成我的应用程序的整个附加进程?

如果是后者,这是否也适用于 syncgevent 工人,还是它们总是一个过程?

这个问题在 GitHub 上 Gunicorn 的问题跟踪器上的一篇帖子中有答案:

Yes. However, you will see two processes running. One is the Gunicorn master process, which controls the worker processes. With the number of workers set to 1 you'll have only one worker process.

来源:https://github.com/benoitc/gunicorn/issues/2082#issuecomment-522343242