简体   繁体   English

Azure Service Bus-多个主题与筛选的主题

[英]Azure Service Bus - Multiple Topics vs Filtered Topic

I have written an implementation of azure service bus into our application using Topics which are subscribed to by a number of applications. 我已经使用许多应用程序订阅的主题将Azure Service Bus的实现写入了我们的应用程序。 One of the discussions in our team is whether we stick with a single Topic and filter via the properties of the message or alternatively create a Topic for our particular needs. 我们团队中的讨论之一是我们是坚持一个主题,还是通过消息的属性进行过滤,或者创建一个满足我们特定需求的主题。

Our scenario is that we wish to filter by a priority and an environment variable (test and uat environments share a connection). 我们的场景是希望按优先级和环境变量(测试和uat环境共享连接)进行过滤。

So do we have Topics (something like): 因此,我们是否有主题(类似):

  • TestHigh TestHigh
  • TestMedium TestMedium
  • TestLow TestLow
  • UatHigh UatHigh
  • UatMedium UatMedium
  • UatLow UatLow

OR , just a single topic with these values set as two properties? 或者 ,仅将这些值设置为两个属性的单个主题?

My preference is that we create separate topics, as we'd be utilising the functionality available and I would imagine that under high load this would scale better? 我的偏好是我们创建单独的主题,因为我们将利用可用的功能,并且我想在高负载下这样做会更好吗? I've read peeking large queues can be inefficient. 我读过偷看大队列可能效率低下。 It also seems cleaner to subscribe to a single topic. 订阅一个主题似乎也比较干净。

Any advice would be appreciated. 任何意见,将不胜感激。

Either approach works. 两种方法都有效。 More topics and subscriptions mean that you have more entities to manage at deployment time. 更多主题和订阅意味着您在部署时需要管理更多实体。 If High/Medium/Low reflect priorities, then multiple topics may be a better choice since you can pull from the the highest priority subscription first. 如果高/中/低反映了优先级,则多个主题可能是一个更好的选择,因为您可以先从优先级最高的订阅中提取。

From a scalability perspective there really isn't too much of a difference that you would notice since Service Bus already spreads the load across multiple logs internally, so if you use six topics or two topics will not make a material difference. 从可伸缩性的角度来看,由于Service Bus已经在内部将负载分散到多个日志中,因此您实际上不会注意到太多差异,因此,如果您使用六个主题或两个主题将不会产生实质性的变化。

What does impact performance predictability is the choice of service class. 影响性能可预测性的是服务类别的选择。 If you choose "Standard", throughput and latency are best effort over a shared multi-tenant infrastructure. 如果选择“标准”,则吞吐量和延迟是共享多租户基础结构上的最大努力。 Other tenants on the same cluster may impact your throughput. 同一群集上的其他租户可能会影响您的吞吐量。 If you choose "Premium" , you get ringfenced resources that give you predictable performance, and your two or six Topics get processed out of that resource pool. 如果选择“ Premium” ,则会获得使您的性能可预测的异常资源,并且从该资源池中处理两个或六个Topic。

I would go with separate topics for each environment. 我将针对每种环境分别讨论不同的主题。 It's cleaner. 比较干净 Message counts in topics can be monitored separately for each environment. 可以针对每个环境分别监视主题中的邮件数。 It's marginally more scalable (eg topic size limits won't be shared) - but the limits are generous and won't matter much in testing. 它的可扩展性略高一些(例如,不会共享主题大小限制)-但是这些限制很宽泛,在测试中没有太大关系。

But my main argument: that's how production will (hopefully) go. 但是我的主要观点是:这就是(希望)生产的方式。 As in, production will have it's own connection (and namespace) in ASB, and will have separate topics. 与之类似,生产将在ASB中拥有自己的连接(和名称空间),并且将具有单独的主题。 Thus you would not be filtering messages via properties in production, so why do it differently in testing? 因此,您将不会在生产环境中通过属性过滤消息,那么为什么在测试中会有所不同呢?

Last tip: to make topic provision easier, I'd recommend having your app auto create them on start up. 最后提示:为了简化主题设置,我建议您的应用在启动时自动创建主题。 It's easy to do - check if they exist, and create if they don't. 这很容易-检查它们是否存在,并创建它们是否不存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM