Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Memory leak in run Celery Django, Gevent strategy with Multi Worker

Tags:

django

celery

I used celery with rabbitmq in Django. my tasks are io-bound and I used the gevent strategy. I want to run celery tasks on a multi-process (because gevent runs on a single process). but memory grows up for no reason, without doing any tasks. what happened?

this is my celery command:

celery multi start 10 -P gevent -c 500 -A my-app -l info -E --without-gossip --without-mingle --without-heartbeat --pidfile='my-path' --logfile='my-path'

my Django celery config:

CELERY_IGNORE_RESULT = True
CELERY_WORKER_PREFETCH_MULTIPLIER = 100
CELERY_WORKER_MAX_TASKS_PER_CHILD = 400
CELERYD_TASK_SOFT_TIME_LIMIT = 60 * 60 * 12
CELERYD_TASK_TIME_LIMIT = 60 * 60 * 13

celery==5.2.7 django==4.1.2

enter image description here

like image 851
rmaleki Avatar asked Oct 17 '25 12:10

rmaleki


1 Answers

I found the problem:

Celery warns of this on worker startup that running with DEBUG causes a memory leak. I did change debug mode to False and fixed memory leak.

like image 180
rmaleki Avatar answered Oct 20 '25 08:10

rmaleki



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!