Logic Apps for visual workflows in Azure - Time & Space Complexity
When using Logic Apps to build workflows, it is important to understand how the time to complete tasks grows as the workflow handles more data or steps.
We want to know how the number of actions affects the total execution time.
Analyze the time complexity of a Logic App that processes a list of items by looping through each item and calling an API.
{
"definition": {
"actions": {
"For_each": {
"type": "Foreach",
"foreach": "@triggerBody()?['items']",
"actions": {
"Call_API": {
"type": "Http",
"inputs": { "method": "GET", "uri": "https://example.com/api" }
}
}
}
}
}
}
This workflow loops over each item in a list and calls an external API once per item.
Identify the API calls, resource provisioning, data transfers that repeat.
- Primary operation: HTTP API call inside the loop.
- How many times: Once per item in the input list.
As the number of items increases, the Logic App makes more API calls, one for each item.
| Input Size (n) | Approx. API Calls/Operations |
|---|---|
| 10 | 10 API calls |
| 100 | 100 API calls |
| 1000 | 1000 API calls |
Pattern observation: The number of API calls grows directly with the number of items.
Time Complexity: O(n)
This means the total execution time increases linearly as the number of items grows.
[X] Wrong: "The Logic App runs all API calls at the same time, so time stays the same no matter how many items."
[OK] Correct: While some parallelism is possible, each API call still takes time, and the total time grows roughly with the number of calls.
Understanding how workflows scale with input size helps you design efficient cloud solutions and explain your reasoning clearly in interviews.
"What if the Logic App used batch API calls instead of one call per item? How would the time complexity change?"