Azure 服务总线 - 快速队列和主题说明

Azure Service Bus - Express queues and topics explanations

我刚刚读了这篇文章:

并且发现了一个关于 Express queues and topics 的有趣点:

Express entities enable high throughput and reduced latency scenarios. With express entities, if a message is sent to a queue or topic is, it is not immediately stored in the messaging store. Instead, the message is cached in memory. If a message remains in the queue for more than a few seconds, it is automatically written to stable storage, thus protecting it against loss due to an outage. Writing the message into a memory cache increases throughput and reduces latency because there is no access to stable storage at the time the message is sent. Messages that are consumed within a few seconds are not written to the messaging store. The following example creates an express topic.

TopicDescription td = new TopicDescription(TopicName);
td.EnableExpress = true;
namespaceManager.CreateTopic(td);

If a message containing critical information that must not be lost is sent to an express entity, the sender can force Service Bus to immediately persist the message to stable storage by setting the ForcePersistence property to true.

如果我创建一个只有一个发件人的快速队列,并且发件人发送 BrokeredMessage 和 属性 ForcePersistence = true,是否有兴趣创建一个快速队列?

我想这没什么用,但不太明白它是如何工作的...

感谢任何澄清^^

在某些情况下,您通常希望获得快速消息,并且您不关心商店是否崩溃并且它们消失了(例如库存更新)。但是有些消息类型太重要了,不能丢失。您不能将邮件标记为快递。由于队列描述决定了队列是否是 express,因此在处理缓存和数据存储崩溃时不应该丢失的消息时,您需要强制使用持久性标志。当您有大量消息并且每一毫秒的延迟都很重要时,这非常方便。

official documentation 说明它将:

Messages that are consumed within a few seconds are not written to the database. Send, Receive, and Complete operations execute faster because these operations only modify the message cache.

Express Entities like Service Bus Queues and Topics can be created only in standard tiers. Entities created in Premium namespaces do not support the express option. The messages sent to the express entities are cached in the memory instead of storing them immediately in the message store. If the messages persist for more than few seconds then they are written into the message store.So the messages are written into the message store only if they aren't received within the few seconds the messages are received by that entity.

Force persistence property of a message decides whether the message is to be persisted to the database immediately, instead of being held in memory for a short time. This property is ignored if the message is sent to a non-express queue or topic.Refer this link to know more about Force persistence property.

因此,当需要高吞吐量和减少延迟时,可以使用快速实体。有关更多信息,请参阅此 link

最近几天我不得不重新开始一些关于 SB 的调查。

过去,这个选项帮助我提高了吞吐量。但基于 this recent commit in GH,围绕快递实体的建议已删除,标题为:"removing outdated perf recommendations"

不过似乎还可以通过 ARM 配置 and/or AZ-CLI 2.0.