How do I allocate same amount of resource for all my tasks deployed on a Celery cluster? How do I allocate same amount of resource for all my tasks deployed on a Celery cluster? docker docker

How do I allocate same amount of resource for all my tasks deployed on a Celery cluster?


Dealing with CPU cores should be fairly easy by specifying concurrency to 6. But limiting memory usage is hard part of the requirement and I believe you can accomplish that by making worker processes be owned by particular cgroup that you specified memory limit on.

An alternative would be to run Celery workers in containers with specified limits.

I prefer not to do this as there may be tasks (or task with particular arguments) that allocate tiny amount of RAM so it would be wasteful if you can't use 4G of RAM while such task runs.

Pity Celery autoscaling is deprecated (it is one of the coolest features of Celery, IMHO). It should not be a difficult task to implement Celery autoscaler that scales up/down depending on memory utilization.