CodexBloom - Programming Q&A Platform

Azure Functions with Durable Functions - Orchestrator not returning expected results when handling large datasets

๐Ÿ‘€ Views: 43 ๐Ÿ’ฌ Answers: 1 ๐Ÿ“… Created: 2025-06-02
azure azure-functions durable-functions C#

I'm working on a project and hit a roadblock. I'm currently working on an Azure Function that utilizes Durable Functions to manage state across multiple function calls. The orchestrator function is supposed to process a large dataset (around 10,000 records) in parallel and then aggregate the results. However, I'm working with an scenario where the orchestration seems to timeout and returns an empty result set. The function is configured with a timeout setting of 10 minutes, but I suspect the orchestration is timing out before completing the processing. Hereโ€™s a simplified version of my orchestrator code: ```csharp [FunctionName("OrchestratorFunction")] public static async Task<List<string>> RunOrchestrator( [OrchestrationTrigger] IDurableOrchestrationContext context) { var inputData = await context.CallActivityAsync<List<string>>("GetDataActivity", null); var tasks = new List<Task<string>>(); foreach (var item in inputData) { tasks.Add(context.CallActivityAsync<string>("ProcessDataActivity", item)); } var results = await Task.WhenAll(tasks); return results.ToList(); } ``` I've also set the `FunctionTimeout` in the host.json to match the orchestrator's needs: ```json { "functionTimeout": "00:10:00" } ``` However, when I run this, I receive a `DurableTaskExtension: Failed to load orchestration history` behavior in the logs, which indicates that the orchestration might be failing due to an exceeded execution time. Iโ€™ve tried splitting the input data into smaller batches and running them in separate orchestrations, but that adds complexity to the workflow. I've also checked the Azure Function plan; Iโ€™m currently on a Consumption plan, and I wonder if I should switch to a Premium plan for better performance. Can anyone provide insight into how to optimize the orchestration for large datasets or if thereโ€™s a best practice for handling timeouts in Durable Functions? Any suggestions or code modifications would be greatly appreciated. I'd really appreciate any guidance on this.