做多的Azure工作者角色轮询相同的队列导致死锁或带毒邮件 [英] does multiple Azure worker role polling same Queue causes Dead Lock or Poison message

查看:246
本文介绍了做多的Azure工作者角色轮询相同的队列导致死锁或带毒邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

情景:

如果我有分拆多个工作角色或多个线程,它轮询的Azure队列中的新消息一个工人的作用。

if I've spin off multiple Worker roles or ONE Worker role with multiple threads, which polls the new messages in Azure Queue.

可能有人请,如果这个正确的设计方法证实?我想有很多的辅助角色的原因是为了加快PROCESSJOB。我们的应用程序应该尽快接近实时的,也就是因为有我们应该得到的,适用于复杂的业务规则,并承诺AZURE DB消息。我们每3分钟预期11000消息。

Could someone please confirm if the this the correct design approach? The reason I would like to have many worker roles is to speed up the PROCESSJOB. Our application should be near real time, i.e. as soon as there are messages we should get, apply complex business rules and commit to AZURE DB. We are expecting 11,000 message per 3min.

感谢您。

推荐答案

您可能有多达队列的读者,只要你喜欢。这是很常见的向外扩展工作者角色实例,因为他们可以从同一个队列中读取,让您更大的工作吞吐量。

You may have as many queue-readers as you like. It's very common to scale out worker role instances, as they can all read from the same queue, giving you much greater work throughput.

当你读一个队列的消息,它标志着一段时间的隐形,以prevent他人阅读和做同样的工作。消息的时间期限届满之前,必须删除它的主人,否则消息再次变得可见,并在原有的读者试图删除它的异常将被抛出。这意味着你的操作必须具有幂等。

When you read a queue message, it's marked "invisible" for a period of time, to prevent others from reading and doing the same work. The owner of the message must delete it before the time period expires, otherwise the message becomes visible again, and an exception will be thrown when the original reader attempts to delete it. This means your operations must be idempotent.

有没有直接的毒害,消息处理,但它很容易实现,因为每个消息有一个出队计数。只是检查和读取3-4次后删除有害消息。您还可以动态调整超时时间的基础上出队计数,因为说不定处理失败,因为太短的时间窗口。

There's no direct poison-message handling, but it's easy to implement, as each message has a dequeue count. Just check it and remove poison messages after being read 3-4 times. You can also dynamically adjust the timeout period based on dequeue count, as maybe the processing fails due to too-short a time window.

这里的<一个href=\"http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storageclient.cloudqueuemessage.dequeuecount.aspx\"相对=nofollow> MSDN文档 DequeueCount

编辑:至于处理在3分钟内11000消息:队列的可扩展性的目标是<击> 500 2000 TPS,涨幅高达36万的交易在3分钟内(远远超出你有11000的信息要求) 。您可以通过信息组合成一个单一的队列中的消息,并在同一时间,这也将减少你的交易数量读取多个消息进一步加快速度。您还可以看看<一个href=\"http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storageclient.cloudqueue.approximatemessagecount.aspx\"相对=nofollow>队列ApproximateMessageCount 财产,看看你的队列备份(然后向外扩展到更多的intstances帮助消耗队列中的项目)。

As far as processing 11,000 messages in 3 minutes: the scalability target for queues is 500 2,000 TPS, or up to 360,000 transactions in 3 minutes (far beyond the 11,000 message requirement you have). You can speed things up further by combining messages into a single queue message, as well as reading multiple messages at a time, which will also reduce your transaction count. You can also look at the ApproximateMessageCount property of a queue to see if your queue is backing up (and then scaling out to additional intstances to help consume queue items).

这篇关于做多的Azure工作者角色轮询相同的队列导致死锁或带毒邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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