[QUERY] Azure.Messaging.ServiceBus Processing speed of messages question
See original GitHub issueQuery/Question How can we help?
I have been testing using Azure.Messaging.ServiceBus recently and have noticed slow processing speeds when using session message processor or any of the Session Receiver ReceiveMessagesAsync overloads and just looping through all my messages. So far in my testing I have only been able to make a single receiver process between 5 and 8 messages a second when receiving 5000 messages that are 100 byte per message. When running a lot of session receivers concurrently processing different messages session with a small number of messages the performance is pretty good but a single receiver with a lot of messages doesn’t seem great. I’ve also played around with the prefetch option and maybe saw a message or two a second improvement. I’ve tried prefetch values of 100 and 500.
Is this excepted or am I doing something wrong here?
Here is a sample of my code to receive just as a basic example. This uses the IAsyncEnumerable implmentation but I get similar speeds when using the other overload of ReceiveMessagesAsync and when using the session processor itself.
var receiver = await _serviceBusClient.CreateSessionReceiverAsync(<topicName>,
<subscriptionName>, new ServiceBusSessionReceiverOptions
{
SessionId = "1",
}, token);
var messageCount = _consoleOptions.NumberOfMessagesPerSession;
await foreach (var message in receiver.ReceiveMessagesAsync(token))
{
messageCount--;
await receiver.CompleteMessageAsync(message, token);
if (messageCount == 0)
{
break;
}
}
Environment:
- Azure.Messaging.ServiceBus-preview 4
- .net core 3.1
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (7 by maintainers)
I think this might be a difference in the behavior when using sessions: https://docs.microsoft.com/en-us/azure/service-bus-messaging/message-sessions#impact-of-delivery-count
The delivery count is apparently only incremented if the session lock is lost.
@JoshLove-msft Think i’m good for now. Thanks for all your assistance!