2

Our Azure Functions are using runtime version 4, I've upgraded Microsoft.Azure.WebJobs.Extensions.Storage to 5.3.1 as required to be able to utilise dynamic concurrency.

When I add enable dynamic concurrency as per below in the host.json file... all functions seem to be throttled to death and basically timeout?

  "concurrency": {
    "dynamicConcurrencyEnabled": true
  }

Seems like a great feature... except it doesn't work? What am I missing?

Here is the complete host.json if that helps

{
  "version": "2.0",
  "concurrency": {
    "dynamicConcurrencyEnabled": true
  },
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    },
    "logLevel": {
      "MyProject.Common.Azure": "Information"
    }
  },
  "extensions": {
    "queues": {
      "maxPollingInterval": "00:00:00.100"
    }
  }
}

Stack Settings

Screen shot of stack settings

4
  • Can you share the code which you have tried with the dynamic concurrency configuration? Commented Sep 10, 2024 at 4:47
  • Hey @Pavan it's just basic http trigger / queue trigger functions. Commented Sep 10, 2024 at 6:14
  • Try setting "concurrency": { "dynamicConcurrencyEnabled": true, "snapshotPersistenceEnabled": true } in host.json Commented Sep 10, 2024 at 12:59
  • I have tried the same and it worked and able to run the function, refer image. Commented Sep 10, 2024 at 13:07

1 Answer 1

1
+200

Add below configuration in host.json to enable dynamic concurrency in your function app, refer the article:

{
    "version": "2.0",
    "concurrency": {
        "dynamicConcurrencyEnabled": true,
        "snapshotPersistenceEnabled": true
    }
}

Set the functionTimeout in host.json:

"functionTimeout":"00:30:00"

I have created a Queue Trigger and Http Trigger in a function project.

host.json:

{
  "version": "2.0",
  "functionTimeout": "00:30:00",
  "concurrency": {
    "dynamicConcurrencyEnabled": true,
    "snapshotPersistenceEnabled": true
  },
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    },
    "logLevel": {
      "MyProject.Common.Azure": "Information"
    }
  },
  "extensions": {
    "queues": {
      "maxPollingInterval": "00:00:00.100"
    }
  }
}

.csproj:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <AzureFunctionsVersion>v4</AzureFunctionsVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="5.2.1" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.4.0" />
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
</Project>

Deployed the functions to Azure function app with Consumption Plan.

enter image description here

The concurrency value of the function is stored in the storage account specified in the AzureWebjobsStorage app setting.

The values are stored in concurrencyStatus.json file under azure-webjobs-hosts=>concurrency=> functionApp_Name folder=> concurrencyStatus.json.

enter image description here

Able to run the function as expected:

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.