Question

At the moment, we're using Service Broker on a lot of our critical components in our database, and I wanted to ask about the best practices on Conversation and Conversation Group reuse.

Presently, we're storing into a table our key for our object, which I'll use an SalesOrder as an example, and the Conversation for that order. We then reuse that Conversation for updates related to that SalesOrder, to preserve processing order.

From reading about Conversation Reuse I understand we may be better off reusing these Conversations, as we're creating new ones per SalesOrder, which may bloat the amount of Conversations if we leave them for a long time (30 days?) without explicitly ending them.

So, I have a few questions, as I have been doing a lot of reading, and some of it has been conflicting (for example, one entry said that Conversation Groups would keep transactions ordered, where I believe that is only Conversations, and Conversation Groups is a locking mechanism, so only one Conversation is retrieved or updated at once.

  1. Would we be better off keeping fewer Conversations, and reusing them - such as a Sequence of 100, and saving to our table the Conversation against the SalesOrder, and minimising the amount of Conversations that way.
  2. Are there any problems with sharing Conversations among many SalesOrders (or similar objects).
  3. If we had 10 MAX_QUEUE_READERS is there a good threshold to how many Conversations we should be creating? I'd assume a minimum to the number of readers and then YMMV?
  4. Are we better off storing all our Conversations in one Conversation Group, or starting separate Conversation Groups for each Conversation - keeping the locking on the Conversations in that group down? A mix? 10 x 10?

I'm assuming, if I use the code below I am not reusing Conversations or Conversation Groups - so am I better just reducing the numbers of Conversations and leaving it at one Conversation per Conversation Group rather than the tens of thousands of Conversations we are producing each day?

;BEGIN DIALOG CONVERSATION @unqConversation
        FROM SERVICE [//SalesOrder/InitiatorService]
        TO SERVICE '//SalesOrder/TargetService'
        ON CONTRACT [//SalesOrder/Contract]
        WITH ENCRYPTION = OFF,
        LIFETIME = @lifetime

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top