I have my azure function running python app and recently I faced an issue about azure function being timeout after every 10 minutes if process taking more than 10 minutes. This is because of default timeout settings we have for each hosting plans for azure function.
There are couple of hosting plans for Azure functions.
Consumption Plan: https://learn.microsoft.com/en-us/azure/azure-functions/consumption-plan
- Python platform support
- Linux - Yes
- Widows - NO
- Linux Docker - Not Supported
- Timeout Duration
- Default: 5 min
- Maximum: 10 minutes
Premium Plan: https://learn.microsoft.com/en-us/azure/azure-functions/functions-premium-plan
- Python platform support
- Linux - Yes
- Widows - NO
- Linux Docker - Yes
- Timeout Duration
- Default: 30 min
- Maximum: unlimited/unbounded
Dedicated (App Service) Plan: https://learn.microsoft.com/en-us/azure/azure-functions/dedicated-plan
- Python platform support
- Linux - Yes
- Widows - NO
- Linux Docker - Yes
- Timeout Duration
- Default: 30 min
- Maximum: unlimited/unbounded
The timeout duration for azure functions can be set in host.json file using functiontimeout parameter - https://learn.microsoft.com/en-us/azure/azure-functions/functions-host-json#functiontimeout
{"functionTimeout": "00:05:00"}
Sample Host.json file. - https://learn.microsoft.com/en-us/azure/azure-functions/functions-host-json#sample-hostjson-file
{
"version": "2.0",
"aggregator": {
"batchSize": 1000,
"flushTimeout": "00:00:30"
},
"concurrency": {
"dynamicConcurrencyEnabled": true,
"snapshotPersistenceEnabled": true
},
"extensions": {
"blobs": {},
"cosmosDb": {},
"durableTask": {},
"eventHubs": {},
"http": {},
"queues": {},
"sendGrid": {},
"serviceBus": {}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[4.0.0, 5.0.0)"
},
"functions": [
"QueueProcessor",
"GitHubWebHook"
],
"functionTimeout": "00:05:00"
}
After changing the "functionTimeout": "-1" there is no timeout issues again.
Thanks for reading, CloudOps ⌂Signing Off! 😊
No comments:
Post a Comment