任务结束后,芹菜不会刷新内存 [英] Celery will not flush memory when task has ended
问题描述
我让Celery与django-celery一起运行,基本上我无法弄清为什么芹菜工作者在任务停止后仍保留内存?
I have Celery running with django-celery and basically i cannot figure out why the celery worker is keeping the memory after a task has been stopped?
我正在运行Celery 3.1.16和Rabbitmq作为代理。
I am running Celery 3.1.16 and rabbitmq as broker.
来自ps aux:
1000 6411 0.3 3.8 117288 39564 pts/0 S+ 12:44 0:00 /usr/bin/python /usr/local/bin/celery -A Website3 worker -l info
1000 6454 6.7 6.1 143660 62760 pts/0 S+ 12:44 0:12 /usr/bin/python /usr/local/bin/celery -A Website3 worker -l info
数据一直保持这样,直到我杀死工人并重新启动它。
The data stays like this until i kill the worker and restart it.
是否可以设置一个参数来释放内存?
Is there a parameter that can be set to release the memory?
推荐答案
没有适合您的参数。但是,您可以使用每项最多任务儿童设置。这将导致在完成X个任务后,该过程将被一个新进程替换。
There isn't a parameter that does this for you. However, you can use the max tasks per child setting. This will cause the process to be replaced with a new one after X tasks have been completed.
这篇关于任务结束后,芹菜不会刷新内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!