One: Problem Description:
Using supervisor to manage the celery process, the broker uses Redis, and the Gevent pool runs Task,celery uses a version of 4.0.2, randomly appearing missed hearbeat worker, running normally after restarting the process
Workaround:
1. Set the heartbeat packet check interval and the length of time, so as to ensure that due to system load causes detection is not allowed, because the check mechanism is to send a message to the queue, the worker can receive this message, if the system does not work, it may take a long time, if the interval is not set, It may be thought that the worker was lost.
Set the parameters as follows:
Broker_heartbeat = 24 * 60 * 60
broker_heartbeat_checkrate = Int (BROKER_HEARTBEAT/60 * 60)
2. Set the maximum runtime length for each task. If the task runs longer than the time, the task is actively ended, so that all resources in the pool are not consumed, and the exception task is terminated as soon as possible to improve processing speed.
Set the parameters as follows:
Task_time_limit = 1 * 60 (can be modified according to the desired run time of your task)