4

I have written an implementation of azure service bus into our application using Topics which are subscribed to by a number of applications. 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).

So do we have Topics (something like):

  • TestHigh
  • TestMedium
  • TestLow
  • UatHigh
  • UatMedium
  • 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.

Tom
  • 603
  • 1
  • 6
  • 17

2 Answers2

5

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 (e.g. 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. 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.

Slava Asipenko
  • 392
  • 1
  • 3
  • We decided to go this route in the end. Your point about filtering the same was across environments is valid. ps. we were already generating the topics depending on configuration on start up of the application, which makes testing easier as we can just delete subscriptions as we needed. – Tom Feb 02 '17 at 14:54
4

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.

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.

Clemens Vasters
  • 2,666
  • 16
  • 28