0
votes

I have seen some articles like below suggesting for calculating the PrefetchCount.

When using the default lock expiration of 60 seconds, a good value for SubscriptionClient.PrefetchCount is 20 times the maximum processing rates of all receivers of the factory. For example, a factory creates 3 receivers, and each receiver can process up to 10 messages per second. The prefetch count should not exceed 20*3*10 = 600.

But still i have no idea on the following things,

  1. how to get the Receiver count created from the factory?
  2. how to get the details of number of message processed by the Receiver?

Thanks in advance.

1

1 Answers

0
votes

Receivers are created in your code, so you should know how many of them you have.

It doesn't really matter though. All you need to know is how many messages in total you can process within a second (per factory). You may add a custom performance counter for this, or run a test with only one factory and look into Azure Monitor statistics in the portal.

If you are calling ReceiveBatch explicitly, be sure to set PrefetchCount at a value higher than batch size. How much higher - depends on your timings a bit, but the goal is that there's always a prefetched batch available at any call to ReceiveBatch.

Finally, I should suggest that this recommendation is approximate and you don't have to exactly follow the formula. Play with PrefetchCount a bit and determine which value gives you max performance.