Sidekiq:分配权重会导致优先队列语义吗?
Sidekiq: Does assigning weights lead to priority queue semantics?
在我的 Sidekiq Pro 设置中,我有大约 10 个不同权重的队列。我的意图是使用权重来指示队列的优先级。
前几天我遇到了一个事件,导致一批中产生了大量的低权重作业,而且似乎也对高权重作业产生了竞争效应。
在文档的 this 部分,我阅读了以下内容:
Each queue can be configured with an optional weight. A queue with a weight of 2 will be checked twice as often as a queue with a weight of 1
这让我有点困惑。我可以期望权重产生优先级队列语义吗?
正如@MikePerham 指出的文档 include details 关于使用权重时调度程序中的出队机制:
When using weighted ordering, sidekiq will randomly choose a queue to check, without blocking, using weighted random choice.
我误解了选择队列时可能会默认和执行多个作业,但是现在我考虑到这一点,这种行为将添加一个附加的,非敏感的计划层,事实上,Sidekiq 并不是那样工作的。
考虑到这一点,当考虑大量排队作业时(由于队列选择的随机性),优先级队列语义是使用权重实现的。
在我的 Sidekiq Pro 设置中,我有大约 10 个不同权重的队列。我的意图是使用权重来指示队列的优先级。
前几天我遇到了一个事件,导致一批中产生了大量的低权重作业,而且似乎也对高权重作业产生了竞争效应。
在文档的 this 部分,我阅读了以下内容:
Each queue can be configured with an optional weight. A queue with a weight of 2 will be checked twice as often as a queue with a weight of 1
这让我有点困惑。我可以期望权重产生优先级队列语义吗?
正如@MikePerham 指出的文档 include details 关于使用权重时调度程序中的出队机制:
When using weighted ordering, sidekiq will randomly choose a queue to check, without blocking, using weighted random choice.
我误解了选择队列时可能会默认和执行多个作业,但是现在我考虑到这一点,这种行为将添加一个附加的,非敏感的计划层,事实上,Sidekiq 并不是那样工作的。
考虑到这一点,当考虑大量排队作业时(由于队列选择的随机性),优先级队列语义是使用权重实现的。