I have 3 remote workers, each one is running with default pool (prefork) and single task.
A single task is taking 2 to 5 minutes for completion as it runs on many different tools and inserts database in ELK.
worker command: celery -A project worker -l info
Which pool class should I use to make processing faster?
is there any other method to improve performance?
Prefork. The prefork pool implementation is based on Python's multiprocessing package. It allows your Celery worker to side-step Python's Global Interpreter Lock and fully leverage multiple processors on a given machine. You want to use the prefork pool if your tasks are CPU bound.
Eventlet is a concurrent networking library for Python that allows you to change how you run your code, not how you write it. It uses epoll or kqueue or libevent for highly scalable non-blocking I/O.
Celery itself is using billiard (a multiprocessing fork) to run your tasks in separate processes.
When you run a celery worker, it creates one parent process to manage the running tasks. This process handles the book keeping features like sending/receiving queue messages, registering tasks, killing hung tasks, tracking status, etc.
funny that this question scrolled by.
We just switched from eventlet to gevent. Eventlet caused hanging broker connections which ultimately stalled the workers.
General tips:
More advanced options to tune your celery workers:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With