When celery cooperates with rabbitmq to perform asynchronous tasks, it is found that the number of messages in rabbitmq is constantly increasing, but these messages have actually been processed by the task.
Looking at the backend that comes with rabbimtq, we found that in Queued messages, the numbers of ready and total have reached more than 5,000, and the value of unacknowledged is 0. However, when actually working, the value of unacknowledged will change, but it will eventually become 0
There is nothing special about the configuration of celery, it only sets the following content
CELERY_IMPORTS = ('testtasks',)
BROKER_URL = 'amqp://guest:guest@localhost:5672//'
CELERY_RESULT_BACKEND = 'amqp://'
Then look at the system resources. The erl process memory is relatively large, and it probably uses more than 300 M
Is there something wrong with my celery configuration?
It has been solved. Just upgrade rabbitmq to version 3.3 or above.
I used rabbitmq version 3.1 before, and then celery is version 3.1
The real way to solve the problem is to add an ignore_result=True attribute to the task, as follows
@app.task(ignore_result=True)