Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to enable auto scaling with Celery multi workers?

Tags:

python

celery

The command celery worker -A proj --autoscale=10,1 --loglevel=info starts workers with auto scaling.

When creating workers with multi,

me@mypc:~/projects/x$ celery multi start myworker --autoscale=10,1
celery multi v4.1.0 (latentcall)
> Starting nodes...
    > myworker@mypc: OK

me@mypc:~/projects/kate$ celery multi show myworker
/home/me/.virtualenvs/kate/bin/python2.7 -m celery worker --detach -n myworker@mypc --pidfile=myworker.pid --logfile=myworker%I.log --executable=/home/me/.virtualenvs/x/bin/python2.7 

How do I enable multi to autoscale?

like image 226
All Іѕ Vаиітy Avatar asked Oct 28 '17 12:10

All Іѕ Vаиітy


People also ask

Is Celery scalable?

Celery allows for many, many long-running tasks to run at the same time. For this reason, Celery helps make systems more robust and supports high availability and horizontal scaling.

Is Celery multithreaded?

So Celery (and other queue frameworks) has other benefits as well - Think of it as a 'task/function manager' rather then just a way of multithreading.

What is concurrency in Celery?

As for --concurrency celery by default uses multiprocessing to perform concurrent execution of tasks. The number of worker processes/threads can be changed using the --concurrency argument and defaults to the number of available CPU's if not set.


1 Answers

Autoscaling will start new processes when the work load increases. In your case you have set the min number to 1, so you will only see 1 process, unless you start putting more tasks onto your queues. You can change the way the autoscaler works. See the link below for more details:

http://docs.celeryproject.org/en/latest/userguide/workers.html#autoscaling

like image 155
Lingster Avatar answered Sep 28 '22 06:09

Lingster