受PrefetchCount影响的Azure Servicebus主题订阅竞争的消费者 [英] Azure Servicebus Topic Subscription competing consumers affected by PrefetchCount

查看:67
本文介绍了受PrefetchCount影响的Azure Servicebus主题订阅竞争的消费者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当将Azure ServiceBus主题订阅与多个具有竞争力的使用者一起使用时,只有在未设置 SubscriptionClient的PrefetchCount 的情况下,我才能让消费者进行轮询.

When using an Azure ServiceBus Topic Subcription with multiple competing consumers, I can only get consumers to round-robin when the SubscriptionClient's PrefetchCount not set.

当指定任何PrefetchCount> 1时,然后在低负载下,碰巧收到消息的第一个使用者似乎被赋予了对消息的亲和力,使得所有消息仅由该使用者接收.

When specifying any PrefetchCount > 1, then under low load, the first consumer that happened to receive a message seems to be given an affinity to messages such that ALL messages are received by only that consumer.

如果我增加了负载(即在订阅时同时抛出更多消息),那么其他使用者确实会收到一些消息,但是负载并不是平均分配的.

If I add load (i.e. throw more messages concurrently at the subscription), then other consumers do get some messages, but load is not evenly distributed.

使用队列(和QueueClient),或多或少地将消息均匀地分发给客户端-带有任何PrefetchCount.

Using a Queue (and QueueClient), messages are more-or-less evenly distributed to clients -- with any PrefetchCount.

注意:

  • MaxConcurrentCalls 是一个高"值(200)
  • 在所有情况下我都使用 PeekLock 模式;
  • 订阅使用CorrelationFilter
  • MaxConcurrentCalls is a a 'high' value (200)
  • I'm using PeekLock mode in all cases;
  • Subscriptions use a CorrelationFilter

这种主题订阅行为对我来说似乎不正确...我假设队列和订阅客户端竞争性消费者机制应该是一致的.

This Topic-Subscription behavior doesn't seem correct to me...I was under the assumption that Queue and Subscription client competing consumers mechanism should be consistent.

我可能配置错误?还是这种预期的行为?

What could I have configured incorrectly? Or is this expected behavior?

推荐答案

队列和订阅都以相同的方式支持竞争的使用者.预取无法按您期望的方式工作.当您要求预取N项商品时,经纪人将不会在竞争的消费者中平均分配这些商品.相反,Rather会尽力为每个消费者提供尽可能多的东西.因此,如果您有10条消息并将prefetch设置为10,则第一个使用者可能会得到所有信息,而第二个使用者则无法处理.

Both queues and subscriptions support the competing consumers in the same way. Prefetch is what not working the way you might expect. When you ask to prefetch N items, the broker will not distribute those evenly among the competing consumers. Rather will try to give each consumer as much as it can. So if you have 10 messages and set the prefetch to 10, the first consumer might get it all leaving nothing to handle to the second consumer.

这篇关于受PrefetchCount影响的Azure Servicebus主题订阅竞争的消费者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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