Share via

Azure Function not scaling correctly

Anonymous
2022-04-25T07:24:12.323+00:00

I have a Function App written in dotnet-isolated and running in Windows on Azure. In this Function I run an .exe file (using System.Diagnostics.Process), which takes roughly 1 minute to run. This .exe file also writes some output files which I then later read. So, it is heavy on both CPU usage and I/O. The rest of the function takes ~1 second to run.
My problem then occurs when I have multiple http requests coming in at once. When Azure schedules multiple of these requests on the same VM, then the running time of the .exe drastically increases. When the running time of the .exe then exceeds this 230 second mark Azure has set, it returns an error.

My question is then: Is there a way for me to force Azure to scale to more VM's, as the .exe can't run in parallel across the threads on the same VM?
I have tried with some different parameters in the host.json on Azure configuration, but they only seem to help a little.

My added Azure configuration:
FUNCTIONS_WORKER_PROCESS_COUNT: 2 (I've tried with 5 and 10, but they made it worse than the default value 2)

My host.json:

{
  "version": "2.0",
  "functionTimeout": "00:10:00",
  "extensions": {
    "durableTask": {
      "storageProvider": {
        "controlQueueBatchSize": 1,
        "controlQueueBufferThreshold": 1
      }
    },
    "http": {
      "maxConcurrentRequests": 20
    }
  },
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  }
}
Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.

Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.