1、用 Gunicorn 带 flask,Gunicorn 开 4 个 worker,每个 worker 算是进程?还是线程?(看到也有的介绍说,gunicorn 其实是个进程池)
2、Gunicorn 开多个 worker,可以利用到多核 CPU 吗?
2、Gunicorn 开多个 worker,可以利用到多核 CPU 吗?
1
virusdefender Mar 10, 2019
-w 参数是进程,-t 是线程
可以的 |
2
Ehco1996 Mar 11, 2019
有个 worker class 默认的是 sync 也就是多进程的
当然也有 gthread 多线程 gevent 协程这种 |
3
strict Mar 13, 2019
>-w WORKERS, --workers=WORKERS
>The number of worker processes. This number should generally be between 2-4 workers per core in the server. >Check the FAQ for ideas on tuning this parameter. >-k WORKERCLASS, --worker-class=WORKERCLASS >The type of worker process to run. You ’ ll definitely want to read the production page for the implications of this >parameter. You can set this to $(NAME) where $(NAME) is one of sync, eventlet, gevent, tornado, gthread, gaiohttp >(deprecated). sync is the default. See the worker_class documentation for more information. |