【问题标题】:In celery, what would be the purpose of having multiple workers process the same queue?在芹菜中,让多个工人处理同一个队列的目的是什么?
【发布时间】:2013-02-12 18:42:18
【问题描述】:

在 celeryd-multi 的文档中,我们找到了这个例子:

# Advanced example starting 10 workers in the background:
#   * Three of the workers processes the images and video queue
#   * Two of the workers processes the data queue with loglevel DEBUG
#   * the rest processes the default' queue.
$ celeryd-multi start 10 -l INFO -Q:1-3 images,video -Q:4,5 data
    -Q default -L:4,5 DEBUG

(来自这里:http://docs.celeryproject.org/en/latest/reference/celery.bin.celeryd_multi.html#examples)

什么是一个实际的例子,说明为什么在一个主机上让多个工作人员处理同一个队列会很好,就像上面的例子一样?这不就是设置并发的目的吗?

更具体地说,以下两行(A 和 B)之间是否有任何实际区别?:

答:

$ celeryd-multi start 10 -c 2 -Q data

乙:

$ celeryd-multi start 1 -c 20 -Q data

由于我不了解这种实际差异,我担心我错过了一些关于任务队列的宝贵知识,如果有人能启发我,我将不胜感激。

谢谢!

【问题讨论】:

    标签: celery task-queue celeryd celery-task


    【解决方案1】:

    什么是一个实际的例子来说明为什么拥有更多 比单个主机上的一个工作人员处理相同的队列,如 上面的例子?

    答案:

    因此,您可能希望在同一台机器上运行多个工作实例 节点如果:

    • 您正在使用多处理池并希望并行使用消息。一些报告使用多个工人的性能更好 实例而不是运行具有多个池的单个实例 工人。

    • 您正在使用 eventlet/gevent(并且由于臭名昭著的 GIL,还有“线程”)池),并且您希望在多个 CPU 上执行任务 核心。

    参考:http://www.quora.com/Celery-distributed-task-queue/What-is-the-difference-between-workers-and-processes

    【讨论】:

      猜你喜欢
      • 2017-08-15
      • 2021-12-27
      • 2014-06-09
      • 1970-01-01
      • 1970-01-01
      • 2015-07-04
      • 2022-11-01
      • 2015-05-13
      • 2021-10-24
      相关资源
      最近更新 更多