推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
miniyao
V2EX  ›  Python

Gunicorn 跑多个 worker,每个 worker 算是进程?还是线程?

  •  
  •   miniyao · Mar 10, 2019 · 8493 views
    This topic created in 2762 days ago, the information mentioned may be changed or developed.
    1、用 Gunicorn 带 flask,Gunicorn 开 4 个 worker,每个 worker 算是进程?还是线程?(看到也有的介绍说,gunicorn 其实是个进程池)
    2、Gunicorn 开多个 worker,可以利用到多核 CPU 吗?
    3 replies  •  2019-03-13 18:47:56 +08:00
    virusdefender
        1
    virusdefender  
       Mar 10, 2019
    -w 参数是进程,-t 是线程

    可以的
    Ehco1996
        2
    Ehco1996  
       Mar 11, 2019
    有个 worker class 默认的是 sync 也就是多进程的
    当然也有 gthread 多线程
    gevent 协程这种
    strict
        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.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1158 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 17:03 · PVG 01:03 · LAX 10:03 · JFK 13:03
    ♥ Do have faith in what you're doing.