python - Celeryd 启动太多进程

标签 python django celery django-celery celeryd

如何确保 celeryd 仅作为单个进程运行?当我运行 manage.py celeryd --concurrency=1 然后运行 ​​ps aux | grep celery 我看到 3 个实例在运行:

www-data  8609  0.0  0.0  20744  1572 ?        S    13:42   0:00 python manage.py celeryd --concurrency=1
www-data  8625  0.0  1.7 325916 71372 ?        S    13:42   0:01 python manage.py celeryd --concurrency=1
www-data  8768  0.0  1.5 401460 64024 ?        S    13:42   0:00 python manage.py celeryd --concurrency=1

我注意到 celerybeat 也有类似的问题,它总是作为 2 个进程运行。

最佳答案

根据 this链接 .. 进程数为 4:1 个主进程,2 个子进程和 1 个 celerybeat 进程, 此外,如果您使用的是 FORCE_EXECV,则会有另一个进程开始清理信号量。

如果你使用celery+django-celery开发,并且使用RabbitMQ或者Redis作为broker,那么应该不用多 多于一个线程(如果设置了 CELERY_DISABLE_RATE_LIMITS,则没有)

关于python - Celeryd 启动太多进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17073052/

相关文章:

python - 从给定标签读取 xml 文件

python - 在 Python 中的特定时间生成信号

python - 如何确保使用 nosetests 调用 tearDown(在测试中未捕获异常的情况下)?

python - 将 celery 与 django 应用程序和后端服务器一起使用

python - MySQL 在 celery 任务期间不断失去连接

python - 去除非零值的嵌套字典

database - 在管理站点中运行时,django db 写入不会立即发生

javascript - 如何使用动态表中的唯一 ID 通过按钮传递数据

django-rest-framework 返回创建的对象但字段较少

python - 从 celery 中撤销任务