Concurrent Flow Execution

Earn 25 points (50 with Pro) in two steps

  1. ① Read through the lesson — each section gets a ✓ as you scroll through it.
  2. ② When every section has a ✓, tap Complete lesson.

0 of 11 read · keep scrolling

✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro

Lesson: Concurrent Flow Execution in Power Automate

Introduction: Why Concurrency Matters in Automation

In the world of workflow automation, efficiency is not just about finishing a task; it is about how many tasks you can manage simultaneously without sacrificing reliability. Power Automate, by default, processes actions in a sequential manner. This means that if you have a list of ten items to process, the system will finish the first item before moving to the second, then the third, and so on. While this is safe and easy to debug, it becomes a significant bottleneck when you are dealing with large datasets or time-sensitive operations.

Concurrent flow execution is the feature that allows you to break this linear progression. By enabling concurrency, you instruct Power Automate to process multiple iterations of an "Apply to each" loop or multiple branches of a workflow at the same time. This capability is vital for enterprise-level automation where speed, throughput, and timely data synchronization are critical. Without understanding how to manage concurrency, your flows may take hours to complete, potentially timing out or falling behind the pace of incoming data.

This lesson explores the mechanics of concurrent execution, how to configure it correctly, the risks associated with high-concurrency settings, and the best practices to ensure your automations remain stable under load. We will move beyond the basic "how-to" and delve into the architectural decisions that separate a novice flow builder from an automation engineer.


Not read yet

Understanding the "Apply to Each" Bottleneck

To understand concurrency, we must first look at the "Apply to each" control, which is the primary area where concurrency settings are applied. Imagine you are building a flow that processes an array of 500 email attachments. If each attachment takes three seconds to process, a sequential execution would take 1,500 seconds—or 25 minutes.

If you enable concurrency, you can process multiple attachments at once. For example, if you set the degree of parallelism to 20, you could theoretically finish those same 500 attachments in a fraction of that time. However, this is not just about speed; it is about the "Degree of Parallelism" setting. By default, this is disabled, meaning the flow runs with a degree of 1. When you enable it, you can specify a value between 1 and 50.

The Mechanics of Parallelism

When you change the degree of parallelism, you are essentially telling the Power Automate engine to spin up multiple execution threads for that specific loop. Each thread operates independently, pulling the next item from the array as soon as it finishes its current task. This is a powerful tool for scaling your automation, but it changes the behavior of your flow, particularly when it comes to state management and external service limits.

Callout: Sequential vs. Parallel Execution Sequential execution is predictable and maintains the order of items. It is ideal for tasks that depend on the output of the previous item or where order is strictly required. Parallel execution is designed for high-throughput, independent operations. It ignores the order of items, as threads will finish at different times depending on the complexity of the specific item being processed.


Not read yet

Configuring Concurrent Execution: A Step-by-Step Guide

Configuring concurrency is straightforward, but it requires caution. Follow these steps to adjust the settings for your loop:

  1. Open your Flow: Navigate to your flow in the Power Automate designer.
  2. Locate the Loop: Find the "Apply to each" action that is processing your data.
  3. Access Settings: Click on the three dots (the ellipsis menu) in the top right corner of the "Apply to each" card.
  4. Navigate to Settings: Select the "Settings" option from the menu.
  5. Enable Concurrency Control: You will see a toggle labeled "Concurrency Control." Switch this to "On."
  6. Set the Degree of Parallelism: A slider will appear. Move the slider to your desired number (between 1 and 50).
  7. Save: Click "Done" and save your flow.

Choosing the Right Degree of Parallelism

The choice of the degree of parallelism should not be arbitrary. If you set it to 50 but your target system (like a SQL database or a third-party API) can only handle 10 requests per second, you will encounter "429 Too Many Requests" errors.

  • Start Low: Begin with a value of 5 or 10.
  • Monitor Performance: Run the flow and check the run history for any failed actions due to rate limiting.
  • Incrementally Increase: If you see no errors and have plenty of overhead, increase the value in small increments (e.g., from 10 to 15).
  • Observe External Limits: Always check the API documentation or service limits of the systems your flow is interacting with.

Not read yet

Code-Based Perspective: Logic Behind the Scenes

While Power Automate is a low-code platform, it is helpful to understand the underlying JSON structure. When you enable concurrency, the definition of the Foreach action in the flow's JSON code changes.

"Apply_to_each": {
    "type": "Foreach",
    "foreach": "@triggerBody()?['items']",
    "actions": {
        "Update_Item": {
            "type": "ApiConnection",
            "inputs": { ... }
        }
    },
    "runtimeConfiguration": {
        "concurrency": {
            "maximumConcurrentExecution": 20
        }
    }
}

In the snippet above, the runtimeConfiguration block is the key. By manually editing the flow definition, you can verify that the maximumConcurrentExecution is set correctly. This is particularly useful for developers who manage flows using Source Control (like GitHub or Azure DevOps) and want to ensure that concurrency settings are consistent across different environments (Dev, Test, Prod).

Note: Be cautious when editing flow JSON directly. Always ensure you have a backup of your flow before modifying the definition code, as syntax errors can lead to the flow failing to load or save.


Not read yet

Real-World Examples of Concurrency

Example 1: Batch Processing Files in SharePoint

Imagine a scenario where a department drops 100 PDF documents into a SharePoint folder every morning. Your flow needs to move these files to a "Processed" folder and update a metadata column.

If you use sequential execution, the flow might take 20 minutes. If the department needs these files available by 8:00 AM, a 20-minute delay is significant. By setting the concurrency to 20, you can process the batch in roughly 2-3 minutes. Since SharePoint Online has high API limits, a concurrency of 20 is usually well within the safe zone, significantly improving the end-user experience.

Example 2: Sending Bulk Notifications

You are tasked with sending 500 personalized emails to customers. Each email involves looking up the customer's last purchase in a database.

If you execute this sequentially, the flow will take a long time, and if the database is slow, the flow might exceed the 30-day timeout period for long-running flows. By enabling concurrency, you can fire off requests to the email provider (e.g., Outlook or SendGrid) in parallel.

Warning: The Database Bottleneck When using parallel execution for database writes, you must ensure your database supports high-concurrency connections. If you have 50 threads trying to write to a single table, you may encounter lock contention or deadlocks. Always test for database performance before deploying high-concurrency flows to production.


Not read yet

Best Practices for Concurrent Flows

Managing concurrency is as much about discipline as it is about technology. Follow these best practices to ensure your flows remain robust:

  • Implement Error Handling: When running things in parallel, one failure does not stop the others. Use "Configure run after" settings on subsequent actions to ensure that if one branch fails, you have a way to log that error without stopping the entire process.
  • Avoid Shared Variables: Variables are global to the flow. If you are updating a single variable inside a parallel loop, you will face race conditions where the final value is unpredictable. Instead, use "Compose" actions or specific data structures that do not rely on shared state.
  • Monitor API Limits: Always be aware of the "Service Protection Limits" of the connectors you use. For example, the Dataverse connector or the Office 365 Outlook connector has specific limits on how many requests can be made per minute.
  • Test in Isolation: Before enabling concurrency on a production flow, run a test with a smaller dataset to ensure your downstream systems can handle the increased load.
  • Use Scopes for Organization: Wrap your actions inside an "Apply to each" loop within a "Scope" action. This makes it easier to collapse the view and keep your flow design clean.

Not read yet

Comparing Sequential and Parallel Execution

Feature Sequential Execution Parallel Execution
Throughput Low High
Execution Time Longer Shorter
Order Guarantee Yes No
Resource Usage Low (Single-threaded) High (Multi-threaded)
Complexity Simple Higher (Requires error handling)
Best For Dependent tasks Independent batch processing

Common Pitfalls and How to Avoid Them

1. The Race Condition on Variables

Many beginners try to use a "Set variable" action inside a parallel loop to track a count or aggregate values. Because multiple threads are trying to write to the same memory location, the final count will almost always be incorrect.

  • The Solution: If you need to aggregate data, use the "Select" or "Filter array" actions to transform your data before the loop, or use a "Dataverse" table as a temporary store if you need complex aggregation.

2. Overloading the Target System

If you set the parallelism to 50, you are effectively hitting your target application with 50 simultaneous requests. If that application is a legacy on-premises system, you might crash its service.

  • The Solution: Use a "Delay" action or, better yet, implement a "Backoff" strategy. If you receive a 429 error, the flow should ideally catch this and retry after a set duration.

3. Ignoring the "Apply to each" Limit

Power Automate imposes a limit on the number of items that can be processed in a single loop (by default, 5,000 items). If your dataset is larger, you must use "Pagination" settings in the connector that retrieves the data (like the "Get items" SharePoint action) to handle the data in chunks.

  • The Solution: Always enable pagination in your data retrieval actions and keep your loop processing logic efficient.

4. Forgetting About Transactional Integrity

If your business logic requires that all 100 items must be processed successfully or none at all, parallel execution is dangerous. Since threads run independently, you cannot easily "roll back" the entire batch if one item fails.

  • The Solution: If atomicity is required, avoid high-concurrency parallel loops. Stick to sequential loops or utilize a staging table where you can validate all data before moving it to the production table.

Not read yet

Advanced Concurrency: Beyond "Apply to Each"

While "Apply to each" is the most common place for concurrency, it is not the only place. You can also achieve concurrency by using Parallel Branches. If you have two independent tasks, such as sending a notification to Slack and updating a row in SQL, you can place these in parallel branches.

Implementing Parallel Branches

  1. Add a new step in your flow.
  2. Instead of a single action, click the "+" icon and select "Add a parallel branch."
  3. You now have two distinct paths that run at the same time.

This is excellent for workflows where the latency of one action (like waiting for an email to send) should not delay another action (like updating a record). This design pattern is a hallmark of efficient, high-performance automation.

Callout: Parallel Branches vs. Parallel Loops Parallel Branches are for executing different, independent tasks simultaneously. Parallel Loops (concurrency in "Apply to each") are for executing the same task against many items simultaneously. Both are essential tools for reducing total flow execution time.


Not read yet

Troubleshooting High-Concurrency Flows

When things go wrong in a parallel environment, debugging becomes significantly harder. Since actions are not executed in order, the "Run History" might show actions completing out of sequence.

Strategies for Effective Debugging:

  • Log Everything: Use an external logging service (like Azure Table Storage or a simple SharePoint list) to track the start and end times of each iteration.
  • Use Unique Identifiers: Ensure every item in your loop has a unique ID. Include this ID in your logs so you can filter the history for a specific failed item.
  • Check the "Run After" Configuration: If you have parallel branches, make sure your "Run After" settings are configured correctly. By default, an action runs only if the previous one succeeded. If you have multiple branches, ensure that your final "success" or "failure" notification is set to run only after all branches have completed (or failed).
  • Limit the Data: If you are debugging a failure in a 500-item loop, create a test flow that only processes 5 items. This makes the run history much easier to read.

Not read yet

Performance Tuning and Industry Standards

In a professional environment, you should treat your flows as code. This means applying performance tuning just as you would for a traditional software application.

1. Throughput Calculation

Before deploying a flow, perform a throughput calculation. If you have 10,000 items and you need to process them in under 30 minutes, calculate the required items per second.

  • 10,000 items / 1,800 seconds = ~5.5 items per second.
  • If each item takes 1 second, you need a degree of parallelism of at least 6. Setting it to 10 would give you a comfortable buffer.

2. Connector Selection

Not all connectors are created equal. Some connectors are optimized for bulk operations. For example, when working with Dataverse, use the "Perform a bound action" or "Add a new row" actions with caution. If you are doing massive bulk updates, consider using the Dataverse "Bulk Add" features or Azure Data Factory, which are designed for high-volume data movement rather than standard flow loops.

3. Monitoring and Alerting

Industry standards dictate that you should never have a "silent failure." Use the "Configure run after" feature to create a catch-all branch that sends an email or logs an error to a central dashboard whenever an action fails. In a concurrent flow, a single failure in a loop of 100 items can easily go unnoticed if you aren't logging the specific index of the item that failed.


Not read yet

Summary and Key Takeaways

Mastering concurrent flow execution is a vital skill for anyone moving from basic automation to enterprise-level process engineering. It allows you to transform slow, linear processes into high-performance workflows that keep up with modern data demands.

Key Takeaways:

  1. Concurrency is about efficiency: Use it to reduce the total execution time of your flows by processing items in parallel rather than sequentially.
  2. Control is mandatory: Always start with a low degree of parallelism and increment it only after verifying that your target systems can handle the load.
  3. Beware of race conditions: Avoid using global variables within parallel loops, as multiple threads attempting to modify the same state will cause unpredictable results.
  4. Error handling is critical: Because parallel threads operate independently, implement robust logging and error handling so that you can identify exactly which item failed in a batch.
  5. Understand your limits: Always check the API rate limits of the services you are connecting to. High-concurrency flows are the fastest way to trigger "429 Too Many Requests" errors if not configured correctly.
  6. Design for the "Worst Case": Always test your flow with the maximum expected volume of data to ensure that your concurrency settings do not cause system instability during peak usage.
  7. Document your design: Because parallel flows can be complex, document your rationale for the chosen degree of parallelism and the dependencies involved. This helps future maintainers understand why the flow was built that way.

By applying these principles, you will be able to build automations that are not only faster but also more reliable and easier to scale as your organization’s needs grow. Remember that the goal is not just to make the flow run fast, but to make it run predictably under all conditions.

Not read yet

Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.