I'm creating an application that will use Azure Functions combined with Azure Bus Service. The idea is to process the messages from the bus in Azure Functions. I'm reading the documentation and I want to confirm one thing: In the Consumption plan, do the instances automatically grow based on the triggers, with a limit of 100 instances? That is, if at any given time 50 messages arrive in my queue, will 50 functions be activated at the same time in parallel? Thanks
You are right in your understanding, however there are these considerations you should be aware of:
By default, for Service Bus triggers, Azure Functions processes messages one at a time within a single instance. However, you can configure concurrent message processing using the maxConcurrentCalls setting in the host.json file.
The maximum number of instances that can be created is indeed 100 for most regions in the Consumption plan. However:
The scaling is not always instantaneous or on a 1:1 ratio with incoming messages. Azure uses an algorithm to determine when to scale out, considering factors like:
{
"version": "2.0",
"extensions": {
"serviceBus": {
"prefetchCount": 100,
"messageHandlerOptions": {
"maxConcurrentCalls": 32,
"maxAutoRenewDuration": "00:05:00"
}
}
}
}
prefetchCount
: Determines how many messages the Functions runtime will retrieve in advance
maxConcurrentCalls
: Sets the maximum number of messages that can be processed concurrently on a single instance.
maxAutoRenewDuration
: Sets the maximum duration within which the message lock will be renewed automatically.