Description
openedon Mar 8, 2022
Library name and version
Azure.Messaging.ServiceBus 7.5.0
Query/Question
Is there an implicit batching mechanism built into Service Bus SDK? What I mean by implicit batching is that I'm calling ServiceBusSender.SendMessageAsync
method multiple times in a short interval and they are being somehow batched together before being sent to the Service Bus.
The documentation states that there is a batching mechanism on the server side of the Service Bus. However, I run a set of tests that shows there probably is some kind of batching even when the server-side "batching store access" is disabled on the topic. What's more, I observed that when sending each message from a separate SDK sender instance the batching stopped occurring, which may suggest that the batching is occurring inside the SDK sender (client-side).
The assumption that the batching is happening is based on the observed Incoming Requests metric on the Service Bus side and its comparison to the Incoming Messages metric. When reusing a single SDK sender, the value of the Incoming Requests metric is much lower than the Incoming Messages, but when using different SDK senders for each message, the metric values are equal.
For testing I used a performance benchmark tool created by Microsoft. The exact configuration I used and test results are available in my forked version of this tool (link below), so it can be easily reproduced. To limit the machine's resource utilization, instead of creating an SDK sender for each message I actually used a pool of 1.000 senders created before the test.
https://github.com/starkpl/service-bus-dotnet-messaging-performance/tree/master/ThroughputTest#sdk-senders-pooling-experiment
I would be very grateful for a further explanation of how exactly does implicit batching work in the Service Bus, because it would be very useful when deciding on the topology of topics and for proper usage of the SDK.
Environment
No response