Too many messages queued in Service bus queue which comsumed by Azure function very slow

Leon Chen 1 Reputation point
2022-10-25T17:16:30.403+00:00

I have an Azure function which subscribes a service bus queue. The function triggered every several seconds, and no more than 10 messages every trigger. But there are more than 300000 active messages in the queue. I expect the function should be triggered more than 5 times every second and at least 100 batch messages get from the queue for each trigger.

Here is the definition of the function:
[FunctionName("MessageConsumer")]
public static void Run([ServiceBusTrigger("changefeed-XXX", Connection = "ServiceBusConnectString")] string[] messages, ILogger log)
{
... code ....
}
Here is the content of host.json:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensions": {
"serviceBus": {
"clientRetryOptions":{
"mode": "exponential",
"tryTimeout": "00:01:00",
"delay": "00:00:00.80",
"maxDelay": "00:01:00",
"maxRetries": 3
},
"prefetchCount": 0,
"autoCompleteMessages": true,
"maxAutoLockRenewalDuration": "00:05:00",
"maxConcurrentCalls": 16,
"maxConcurrentSessions": 8,
"maxMessageBatchSize": 200,
"sessionIdleTimeout": "00:01:00",
"enableCrossEntityTransactions": false
}
}
}

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
594 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,679 questions
{count} votes