简体   繁体   中英

Which pool class should i use prefork, eventlet or gevent in celery?

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?

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:

  • Use a higher concurreny if you're I/O bound, I would start with 25, check the cpu load and tweak from there, aim for 99,9% cpu usage for the process.
  • you might want to use --without-gossip and --without-mingle if your workforce grows.
  • don't use RabbitMQ as your result backend (redis ftw!), but RabbitMQ is our first choice when it comes to a broker (the amqp emulation on redis and the hacky async-redis solution of celery is smelly and caused a lot of grief in our past).

More advanced options to tune your celery workers:

  • pin each worker process to one core to avoid the overhead of moving processes around (taskset is your friend)
  • if one worker isn't always working, consider core-sharing with one or two other processes, use nice if one process has priority

I use celery in my django project.
When use eventlet I got a lot of errors like

dns timeout

in eventlet==0.25.2

Another error:

GreenSSLSocket does not have a public constructor

in eventlet==0.22.0 . So Sad.

So I replace eventlet with gevent==20.6.2 , and Everything works perfectly

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM