使用--without-heartbeat标志运行的芹菜工人对应用程序的影响 [英] Application impacts of celery workers running with the `--without-heartbeat` flag

查看:32
本文介绍了使用--without-heartbeat标志运行的芹菜工人对应用程序的影响的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

讨论

Discussion here talks high level about some of the impacts of running celery workers with the --without-hearbeat --without-gossip --without-mingle flags.

我想知道-without-heartbeat 标志是否会影响工作人员检测代理断开连接并尝试重新连接的能力.celery文档仅不透明地引用了这些作用于应用程序层而不是TCP/IP层的心跳.好的-我真正想知道的是消除这些消息是否会影响我的工作人员的功能-具体来说是检测代理断开连接,然后尝试适当地重新连接?

I wanted to know if the --without-heartbeat flag would impact the worker's ability to detect broker disconnect and attempts to reconnect. The celery documentation only opaquely refers to these heartbeats acting at the application layer rather than TCP/IP layer. Ok--what I really want to know is does eliminating these messages affect my worker's ability to function--specifically to detect broker disconnect and then to try to reconnect appropriately?

我自己进行了一些快速测试,发现通过传递-without-heartbeat 标志后,工作人员仍然非常快速地检测到代理断开连接(由我关闭RabbitMQ实例启动),尝试重新连接到代理,并在重新启动RabbitMQ实例时成功完成.因此,我的基本测试表明,对于基本的健康检查和功能而言,心跳不是必需的.他们到底有什么意义呢?对我来说尚不清楚,但它们似乎并未在最基本的级别上对工作人员功能产生影响.

I ran a few quick tests myself and found that with the --without-heartbeat flag passed, workers still detect broker disconnect very quickly (initiated by me shutting down the RabbitMQ instance), and they attempt to reconnect to the broker and do so successfully when I restart the RabbitMQ instance. So my basic testing suggests the heartbeats are not necessary for basic health checks and functionality. What's the point of them anyways? It's unclear to me, but they don't appear to have impact on worker functionality at the most basic level.

关闭心跳对应用程序的实际影响是什么?

What are the actual, application-specific implications of turning off heartbeats?

推荐答案

所以这是心跳机制的解释.现在,由于AMQP使用TCP,所以当无法建立连接或TCP协议要求时,芹菜工作者将尝试重新连接.因此,似乎不需要心跳机制.但这有几个优点:

So this is the explanation of the heartbeat mechanism. Now since AMQP uses TCP the celery workers will try to reconnect if they can't establish a connection or whenever the TCP protocol dictates. So it looks like the heartbeat mechanism is not needed. But it as a few advantages :

  1. 它不基于代理协议进行中继,因此,如果代理存在一些内部问题或使用UDP,工作人员仍将知道是否未接收到事件,并将能够采取相应的行动

  1. It doesn't relay on the broker protocol, so if the broker have some internal issues or uses UDP the worker will still know if events are not received, and will be able to act accordingly

心跳机制会检查是否已发送和接收事件,这是该应用程序正在按预期运行的重要指示器.例如,如果代理没有足够的空间并开始丢弃事件,则工作人员将通过心跳机制对此进行指示.而且,如果该工作人员正在使用多个代理,它还可以决定连接到另一个不那么忙碌的代理.

The heartbeat mechanism checks that events are sent and received which is a much greater indicator that the app is running as expected. If for example the broker doesn't have enough space and is starting to drop events, the worker will have an indication for that with the heartbeat mechanism. And if the worker is using multiple brokers, it can also decide to connect to another broker which should be less busy.

这篇关于使用--without-heartbeat标志运行的芹菜工人对应用程序的影响的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆