4

I'm investigating a weird behaviour happening on a function app deployed on Azure on a dedicated app service plan. When upgrading to netcore3.1 and Functions V3 the app starts erroring on connections to the SQL DB as the DTUs limit gets hit.

The function app is made of 3 projects:

  • ProductService.dll (contains Functions) - netstandard2.0
  • ProductService.Indexer.dll (library) - netstandard2.0
  • ProductService.Shared.dll (library) - netstandard2.0

The function app contains a variety of functions (60 http, 16 queue and 4 timers) for a total of 80 functions. Http triggers have a very low utilization (e.g. < 1k requests a day, spread out through the day). Queue triggers, on the other hand, are constantly firing.

The SQL DB is an Azure SQL Server DB running on a SQL Elastic pool with a 200 DTUs max utilization limit.

Currently running on netstandard2.0 and Functions v2 with no issues at all.

For your reference host.json below

{
  "functionTimeout": "12:00:00",
  "version": "2.0",
  "extensions": {
    "queues": {
      "visibilityTimeout": "00:05:00",
      "batchSize": 16,
      "newBatchThreshold":  8
    }
  }
}

The only code changes made (during the upgrade to netcoreapp3.1) were using HttpClientFactory instead of a custom wrapper of HttpClient. When deploying the netcoreapp3.1 version of ProductService and changing the azure Function app to v3 the application starts erroring because the SQL DB DTUs limit is hit. I've been struggling to understand and I keep asking why would the application put more pressure on the DB after the upgrade? Is the v3 function host now able to do more invocations compared to v2?

I've then tried to reduce the queue triggers parallelism in the host.json confguration by lowering batchSize to 8 and newBatchThreshold to 4 in the host.json and the problem seems to go away (or at least happen once in a while). By doing that though, I won't meet my throughout requirements and messages start to stack up in the queues.

I've made sure I'm using all the latest version of the depending nuget packages. Just to give as much info as I can, here's the nuget packages versions the app depends on:

  • Microsoft.Azure.WebJobs 3.0.19
  • Microsoft.NET.Sdk.Functions 3.0.9
  • Microsoft.Extensions.Caching.Memory 3.1.8
  • Microsoft.Extensions.Configuration.Binder 3.1.8
  • Microsoft.Extensions.DependencyInjection 3.1.8
  • Microsoft.Extensions.DependencyInjection.Abstractions 3.1.8
  • Microsoft.Extensions.Http.Polly 3.1.8
  • Polly 7.2.1
  • Polly.Extensions.Http 3.0.0
  • Microsoft.Azure.WebJobs.Extensions.Storage 3.0.11
  • System.Data.SqlClient 4.8.2
  • Microsoft.Rest.ClientRuntime 2.3.21
  • Microsoft.Rest.ClientRuntime.Azure 3.3.19

I'm at a bit of loss investigating this further. Any ideas on what could be causing this?

Many Thanks

Alessandro Di Lello
  • 1,041
  • 1
  • 7
  • 20
  • 2
    You're better off opening a ticket with Azure Support, and/or filing an issue on GitHub https://github.com/Azure/azure-functions-host/issues – Ian Kemp Sep 22 '20 at 09:36
  • @alessandro-di-lello: Can you please check if it works with Microsoft.Data.SqlClient: https://github.com/dotnet/SqlClient; https://www.nuget.org/packages/Microsoft.Data.SqlClient/ – Markus Meyer Sep 22 '20 at 14:00
  • @MarkusMeyer you mean instead of System.Data.SqlClient? Anyway that package wasn't actually used. I've removed it and the errors persist. – Alessandro Di Lello Sep 22 '20 at 19:18

0 Answers0