Hi Tharani,
Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.
Understanding the Challenge:
You have a Logic App with three large dependent for loops, each requiring values from previous iterations. You are correct that Concurrency is not feasible due to these dependencies. The current run time is 8-10 minutes, and you aim to reduce it significantly.
We can implement various strategies to optimize the performance.
Profiling and Bottleneck Identification:
- Use Logic App monitoring tools (Azure Monitor, Logic App Diagnostics) to identify the most time-consuming steps within the loops.
- Focus on optimizing these bottlenecks first.
Batching and Parallelism:
- If possible, batch operations within each loop to reduce the number of API calls or function executions.
- Explore opportunities for limited parallelism within each loop, such as processing multiple items in parallel while maintaining dependencies.
Data Structure Optimization:
- Consider using more efficient data structures (e.g., dictionaries, sets) to store and retrieve intermediate results within the loops.
- Avoid unnecessary data copying or conversions.
Caching:
- Implement caching mechanisms to store frequently used values and avoid redundant calculations.
- Use Azure Cache for Redis or other caching services for external storage.
Code Optimization:
- Review the code within the loops for potential optimizations, such as:
Using more efficient algorithms or data structures.
Avoiding unnecessary calculations or function calls.
Minimizing the number of API calls or external service interactions.
Leverage Azure Functions:
- If applicable, offload computationally intensive tasks to Azure Functions, which can be scaled independently and offer better performance.
Parallel Processing (If Dependencies Allow):
- If dependencies between loops are limited, consider running some loops in parallel using Azure Batch or other parallel processing services.
Consider Azure Durable Functions:
- For complex workflows with orchestration and state management, explore Azure Durable Functions, which can help manage dependencies and improve scalability. If you find this answer helpful, please click "Accept Answer" and kindly upvote it.