Azure Functions - WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT and batchSize - how can I get the desired concurrency

Nicholas Jalonack 61 Reputation points
2022-02-01T23:33:44.52+00:00

I would like to explicitly control the amount of concurrency for each function app to manage down stream resource limits.

I am confused at how WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT and batch size would work together.

To reach a desired concurrency on a function app would the following be correct:

Example queues:

Option 1:
desired concurrency WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT FUNCTIONS_WORKER_PROCESS_COUNT batch size
orchestrator app 1 set 1 max instances default 1 set 1 no concurrency
process1 app 4 set 4 max instances default 1 set 1 no concurrency
process2 app 2 set 2 max instances default 1 set 1 no concurrency

Option 2:
desired concurrency WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT FUNCTIONS_WORKER_PROCESS_COUNT batch size
orchestrator app 1 set 1 max instances default 1 set 1 no concurrency
process1 app 4 set 4 max instances default 1 4
process2 app 2 set 2 max instances default 1 2

Something else...

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,190 questions
{count} votes

Accepted answer
  1. MughundhanRaveendran-MSFT 12,411 Reputation points
    2022-02-03T05:18:54.037+00:00

    @Nicholas Jalonack ,

    Thanks for reaching out to Q&A.

    In order to control the concurrency, you can make use of the batchsize to process the number of messages at time for a single VM. Only when you would like to limit the scale out instances of the backend VM ,you can utilize the WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT app setting. Please note that, for consumption/Elastic premium functions , increasing the VM instances is not in your control. You can only limit the VM instances, increasing the VM instances is in control of scale controller.

    When there are multiple queue messages waiting, the queue trigger retrieves a batch of messages and invokes function instances concurrently to process them. By default, the batch size is 16. So you can set the batchsize value in the host.json and it should allow you to control the concuurency.

    Concurrency in queue triggers: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-queue-trigger?tabs=csharp#concurrency

    I hope this helps!

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.


0 additional answers

Sort by: Most helpful