Azure Functions Timeout For Consumption Plan


Answer :

(Other answer is a bit confusing, so writing instead of editing a lot)

Azure Functions can now run up to 10 minutes using the consumption plan by adding the functionTimeout setting to your host.json file:

In a serverless Consumption plan, the valid range is from 1 second to 10 minutes, and the default value is 5 minutes.

In the Premium plan, the valid range is from 1 second to 60 minutes, and the default value is 30 minutes.

In a Dedicated (App Service) plan, there is no overall limit, and the default value is 30 minutes. A value of -1 indicates unbounded execution, but keeping a fixed upper bound is recommended

Source: https://docs.microsoft.com/en-us/azure/azure-functions/functions-host-json#functiontimeout

File: host.json

// Value indicating the timeout duration for all functions. // Set functionTimeout to 10 minutes {     "functionTimeout": "00:10:00" } 

Source:
https://buildazure.com/2017/08/17/azure-functions-extend-execution-timeout-past-5-minutes/
https://github.com/Azure/azure-webjobs-sdk-script/wiki/host.json


Currently there's no way to have a function running for more than 5 minutes on Consumption plan. You can check the team's answer in here:

The reason we timeout at 5 minutes with the Dynamic plan is because under the Dynamic plan, the VM that is hosting your function will shut down (roughly) 5 minutes after the last trigger fired. Enforcing the timeout like we're doing today is a way to provide a consistent experience with logging that explains why the function stopped running. Before this, you would see functions simply disappear mid-invocation without any indication of why. We're evaluating improvements in this area and will update when we have more concrete details.

Long-running functions that cannot be decomposed down into smaller chunks will run into issues running in the Dynamic plan currently. However, there are often solutions for breaking down single long-running functions into smaller, quicker functions. For example, if you have a function that kicks off a long operation elsewhere, then polls for completion, could you get an 'operationId' from that operation, then put it in a Service Bus scheduled message (or even in a Queue message with an invisibility timeout), and have a second 'CheckStatus' function that reads those messages and polls for completion

https://github.com/Azure/azure-webjobs-sdk-script/issues/18

and also https://github.com/Azure/Azure-Functions/issues/75

UPDATE

Azure Functions can now run up to 10 minutes using the consumption plan: https://docs.microsoft.com/en-us/azure/azure-functions/functions-host-json#functiontimeout


Comments

Popular posts from this blog

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Can Feynman Diagrams Be Used To Represent Any Perturbation Theory?