user584018
user584018

Reputation: 11304

azure service bus: what is the ideal number of `MaxConcurrentCalls`

As per docs using Azure Service Bus MaxConcurrentCalls feature, we can specify how many messages we want to process concurrently.

My question is what is the ideal number of MaxConcurrentCalls? I am processing service bus message in a web api application which is running and hosted over cloud VM.

var messageHandlerOptions = new MessageHandlerOptions(ExceptionReceivedHandler)
        {
            MaxConcurrentCalls = 5,
            AutoComplete = false
        };

Upvotes: 1

Views: 1706

Answers (1)

Sean Feldman
Sean Feldman

Reputation: 25994

There's no ideal number. There's a default number the property is set to that offers a safe performance for the most use cases. When you want to optimize that number, you'd need to look at the average duration of your message processing, CPU/memory/IOPS where the processor runs. You'd need to look at the number of pre-fetched messages. Potentially adjust message lock duration. Benchmark and identify the optimal concurrency for your scenario and workload.

Additional good resource to review would be the Best Practices for performance improvements using Service Bus Messaging article.

Upvotes: 3

Related Questions