如何确保 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/