'Problem Running Azure Durable Function in parallel
I am trying to run each API call to my Azure Durable Function in parallel. It works fine with executing just a single call, but when I get multiple calls at once (lets say 10) it first starts running all 10 requests. When the orchestrator function then calls the Activity Function that does the main work, it only starts executing some of the requests (2-6 depending on my host.json), and waits around 5 minutes before running the activity function with the rest of the requests.
It should be noted that my Activity Function takes roughly 3-3,5 minutes to run, and is a mix of both heavy CPU usage and I/O operations.
I have tried tweaking my parameters a lot (setting them to 1, and setting them to maximum), but nothing seems to fix it. My host.json looks like this:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[2.*, 3.0.0)"
},
"functionTimeout": "00:10:00",
"extensions": {
"durableTask": {
"maxConcurrentActivityFunctions": 10,
"maxConcurrentOrchestratorFunctions": 20,
"storageProvider": {
"controlQueueBatchSize": 5,
"controlQueueBufferThreshold": 5
}
},
"http": {
"routePrefix": "api",
"maxConcurrentRequests": 5
}
}
}
And my Azure Configuration uses:
FUNCTIONS_WORKER_PROCESS_COUNT: 10
PYTHON_THREADPOOL_THREAD_COUNT: 10
Solution 1:[1]
My experience is that most of durable functions scalability comes at Activity level.
From what you’ve said it sounds like you have one Orchestrator which runs one long running activity and you’re trying to get scalability at the orchestrator level.
Is it possible in your scenario to have a single http request trigger represent several items of work (json payload contains enough data for several work items) which the orchestrator could then run in parallel using the well documented fan out-fan in pattern?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | phil |
