Beanstalkd 中的优先级是否跨队列/管工作? [英] Do priorities work across queues/tubes in Beanstalkd?

查看:24
本文介绍了Beanstalkd 中的优先级是否跨队列/管工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于优先级是在作业还是队列/管道级别起作用,我有点困惑.我问的原因是我在 Drupal 中使用 beanstalkd 集成模块.该模块使人们能够定义队列/管并为创建的每个队列/管分配优先级值.

I am a little confused as to whether priorities work at the job or queue/tube level. The reason I ask is that I am using a beanstalkd integration module in Drupal. This module enables one to define queues/tubes and assign a priority value to each queue/tube created.

我正在努力解决以下问题.假设我在 Beanstalkd 中有两个队列/管(队列 A 和队列 B).如果分配给队列 A 的项目的优先级高于队列 B 中的项目,是否意味着只有在队列 A 为空时才会处理队列 B 中的项目?

What I am trying to work out is the following. Let's say I have two queues/tubes in Beanstalkd (queue A and queue B). If items assigned to Queue A have a higher priority than items in Queue B, does that mean items in Queue B will only be processed when Queue A is empty?

推荐答案

优先级是每个工作,您可以在以下位置阅读更多相关信息:https://github.com/kr/beanstalkd/blob/master/doc/protocol.txt

Priorities are per jobs, you can read more about this at: https://github.com/kr/beanstalkd/blob/master/doc/protocol.txt

在没有作业优先级的情况下,beanstalkd 作为 FIFO 队列运行.

Without job priorities, beanstalkd operates as a FIFO queue.

关于工作优先级,需要了解三个硬性事实:

There are three hard facts to know about job priorities:

  • 优先级编号较低的作业在优先级编号较高的作业之前被保留.
  • beanstalkd 优先级是 32 位无符号整数(范围从 0 到 2^32 - 1).
  • beanstalkd 使用 2^31 作为默认作业优先级 (beanstalkd.DEFAULT_PRIORITY)(客户端可能会覆盖它,我已经看到默认设置为 1024).

另请注意,相同优先级的作业仍以 FIFO 方式处理.因此,如果您有一个代理监视多个管,并且当您在这些管上获得相同优先级的作业时,它们将以 FIFO 方式保留.

Note also that within the same priority jobs are still handled in a FIFO manner. So if you have an agent that watches on multiple tubes, and when you get same priority jobs on those tubes they will get reserved in FIFO manner.

您可以使用 https://github.com/ptrofimov/beanstalk_console

这篇关于Beanstalkd 中的优先级是否跨队列/管工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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