python - 对于 celery worker 来说,禁止八卦、交流和心跳会产生什么后果?

标签 python redis celery worker cloudamqp

禁用八卦、交流和心跳对我的 celery worker 有什么影响?

为了减少发送到 CloudAMQP 的消息数量以保持在免费计划内,我决定遵循 these recommendations 。因此,我使用了选项--without-gossip --without-mingle --without-heartbeat。从那时起,我在所有 celery 项目中默认使用这些选项,但我不确定是否有任何我不知道的副作用。

请注意:

  • 我们现在迁移到 Redis 代理,并且对发送到代理的消息数量没有太多限制
  • 我们有多个实例运行多个带有多个队列的 celery 工作线程

最佳答案

这是基础documentation这并没有给我们太多信息

心跳

与工作人员和代理之间的通信有关(在您的情况下,代理是 CloudAMQP)。 请参阅explanation

使用--without-heartbeat,工作线程不会发送心跳事件

混在一起

它只在启动时向其他工作人员请求“逻辑时钟”和“撤销任务”。

取自 whatsnew-3.1

The worker will now attempt to synchronize with other workers in the same cluster.

Synchronized data currently includes revoked tasks and logical clock.

This only happens at startup and causes a one second startup delay to collect broadcast responses from other workers.

You can disable this bootstep using the --without-mingle argument.

另请参阅docs

八卦

工作线程向所有其他工作线程发送事件,当前用于“时钟同步”,但也可以编写自己的事件处理程序,例如 on_node_join,请参阅 docs

取自 whatsnew-3.1

Workers are now passively subscribing to worker related events like heartbeats.

This means that a worker knows what other workers are doing and can detect if they go offline. Currently this is only used for clock synchronization, but there are many possibilities for future additions and you can write extensions that take advantage of this already.

Some ideas include consensus protocols, reroute task to best worker (based on resource usage or data locality) or restarting workers when they crash.

We believe that although this is a small addition, it opens amazing possibilities.

You can disable this bootstep using the --without-gossip argument.

关于python - 对于 celery worker 来说,禁止八卦、交流和心跳会产生什么后果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55249197/

相关文章:

node.js - 基准测试 Node.JS 服务器

python - Celery 与 Django - 部署

python - 如何为 Django 中的每个用户创建单独的数据库?

python - 创建列表,其中的元素是子列表,这些子列表在其他两个列表的子列表中的元素之间交替

caching - Grails cache-redis version 1.1.0 插件编译报错

ruby-on-rails - 每个 sidekiq worker 有多种方法

linux - 关于服务器上的内存和进程

python - celery 、uvicorn 和 FastAPI

Python 多处理错误 'ForkAwareLocal' 对象没有属性 'connection'

python - Matplotlib:流图的线宽键?