Sobes.tech
Junior — Middle

How can you configure the number of worker processes in Celery for task execution?

sobes.tech AI

Answer from AI

In Celery, the number of worker processes (worker concurrency) can be configured using the -c (or --concurrency) parameter when starting the worker. This parameter determines how many tasks can be executed in parallel within a single worker.

Example of starting a worker with 4 worker processes:

celery -A your_project worker -c 4

You can also set this value in the Celery configuration, for example:

app.conf.worker_concurrency = 4

If not explicitly specified, Celery usually sets the number of processes equal to the number of CPU cores.