celery heart-beat

剛開始,我以爲在celery配置文件中配置的BROKER_HEARTBEAT這個參數是指worker和rabbitmq的心跳都爲十秒,不過後來測試才發現,只有rabbitmq纔會在十秒後收不到對方反應,就會將與celery的TCP連接給斷開,而worker的TCP並無反應,直到過了十幾分鍾worker才意識到連不上rabbitmq了。
很奇怪!
後來查資料才知道,rabbitmq的心跳機制是在amqp協議上的,celery的worker的心跳機制跟它不是一回事(國內有網友居然混爲一談,具體不得而知是哪個大神的文章),Stack Overflow上有一個原文講解了celery的worker的心跳:

the heartbeat of celery worker is application level heartbeat, not
AMQP protocol’s heartbeat. Each worker periodically send heartbeat
event message to “celeryev” event exchange in BROKER. The heartbeat
event is forwarded back to worker such worker can know the health
status of BROKER. If number of loss heartbeat exceeding a threshold,
the worker can do some reconnect action to BROKER.

from
https://stackoverflow.com/questions/20957134/celery-heartbeat-not-working/21038204#21038204

應該不需要我翻譯吧:)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章