Thomas Segato
Thomas Segato

Reputation: 5221

Azure storage queue max concurrent clients

I have an azure function with a servicebus trigger. I only want x numbers og function instances to run concurrently. This is done with the maxConcurrentCalls=x in the host file. Can this also be achieved with Azure Storage Queues?

Upvotes: 2

Views: 1245

Answers (1)

Jerry Liu
Jerry Liu

Reputation: 17790

Make sure you have installed latest nuget package(e.g Microsoft.Azure.WebJobs.Extensions.Storage) and try following settings.

  1. If the function is on Consumption plan, in Application settings, set WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT to 1 to avoid adding host instances. For dedicated App service plan, we could fix instance count to 1.

  2. In host.json, configure queue batch size according to runtime version(Find in portal, Platform features> Function app settings).

    Runtime ~1

    {
        "queues": {
          "batchSize": x,
           "newBatchThreshold": 0
        }
    }
    

    Runtime ~2

    { 
      "version":"2.0",
      "extensions": { 
        "queues": { 
          "batchSize": x,
          "newBatchThreshold": 0 
         }
       } 
    } 
    

Upvotes: 4

Related Questions