celery並發方式


 

Celery支持不同的並發和序列化的手段

並發:Prefork, Eventlet, gevent, threads/single threaded
序列化:pickle, json, yaml, msgpack. zlib, bzip2 compression, Cryptographic message signing 等等

默認是進程池方式,進程數以當前機器的CPU核數為參考,每個CPU開四個進程。
如何自己指定進程數:    celery worker -A proj --concurrency=4
如何改變進程池方式為協程方式:  celery worker -A proj --concurrency=1000 -P eventlet -c 1000
# 安裝eventlet模塊
$ pip install eventlet

# 啟用 Eventlet 池
$ celery -A celery_tasks.main worker -l info -P eventlet -c 1000


https://www.cnblogs.com/yuanfang0903/p/13518236.html
https://docs.celeryproject.org/en/v4.4.6/reference/celery.bin.worker.html#cmdoption-celery-worker-c
https://docs.celeryproject.org/en/v4.4.6/userguide/concurrency/eventlet.html#concurrency-eventlet

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM