Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

azure function runs triggers in parallel?

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

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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: a)This limit is per function app, not per individual function. b) Some regions have a lower limit of 60 instances. c) You can request a higher limit by contacting Azure support.

  • 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:
    a) The rate of incoming messages, b) How long it takes to process each message
    c) Available resources

{
  "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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading