Durable function Timeout

Shreekumar Suggamad 146 Reputation points
2022-08-20T08:10:49.08+00:00

I'm Using Azure Durable Functions .Net Core.

[FunctionName("Calculate")]  
public async Task RunOrchestrator(  
    [OrchestrationTrigger] IDurableOrchestrationContext context, ILogger log)  
{  
    await context.CallActivityAsync<object>(FuncConstants.Cal1, null);  
    await context.CallActivityAsync<object>(FuncConstants.Cal2, null);  
    await context.CallActivityAsync<object>(FuncConstants.Cal3, null);  
    await context.CallActivityAsync<object>(FuncConstants.Cal4, null);  
    await context.CallActivityAsync<object>(FuncConstants.Cal5, null);     
    await context.CallActivityAsync<object>(FuncConstants.Cal6, null);  
    await context.CallActivityAsync<object>(FuncConstants.Cal7, null);  
    await context.CallActivityAsync<object>(FuncConstants.Cal8, null);  
    await context.CallActivityAsync<object>(FuncConstants.Cal9, null);  
}  

[FunctionName("Starter_Calculation")]  
public static async Task<HttpResponseMessage> HttpStart(  
    [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post")] HttpRequestMessage req,  
    [DurableClient] IDurableOrchestrationClient starter,  
    ILogger log)  
{  
    string instanceId = await starter.StartNewAsync("Calculate", null);  
    return starter.CreateCheckStatusResponse(req, instanceId);  
}  

Here, each function takes more than 5-6 hours to perform some logical calculations (arithmetic operations) as they deal with more than 27-30 million database records.

I'm getting the error for the first function itself as "Timeout value of 00:30:00 was exceeded by function. In Azure, I'm using Premium App Service Plan, so I can set AlwaysOn.

I have a couple of questions:

  1. Is Azure Function the best fit for such a scenario/long-running operations?
  2. If yes, is there any way I can test it locally without a time-out error?

Please advice.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,909 questions
0 comments No comments
{count} vote

Accepted answer
  1. Damiano Andresini 171 Reputation points
    2022-08-20T13:35:30.043+00:00

    have you seen this link?

    ----------

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. MughundhanRaveendran-MSFT 12,506 Reputation points
    2022-08-23T06:51:39.667+00:00

    Hi @Shreekumar Suggamad ,

    Thanks for reaching out to Q&A.

    I am answering your questions and providing some additional information

    Is Azure Function the best fit for such a scenario/long-running operations?

    Yes. Azure durable functions are best fit for long running operations as they are stateful functions. You are already using durable functions orchestrator and activity functions.
    Please make sure you are aware of the orchestrator code constraints : https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-code-constraints?tabs=csharp

    is there any way I can test it locally without a time-out error?

    For an app running on Premium plan, the timeout value is unbounded so you can set to -1 initially and test it. Once you figure out the execution time, you can set the upper limit timeout value
    https://learn.microsoft.com/en-us/azure/azure-functions/functions-host-json#functiontimeout

    Hope this helps! Feel free to reach out to me if you have any questions or concerns.


Your answer

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