web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / PowerAutomate Cloud Fl...
Power Automate
Unanswered

PowerAutomate Cloud Flow takes too long with ForEach component

(0) ShareShare
ReportReport
Posted on by 16

I'm having a strange issue with PowerAutomate.

I have a basic Cloud Flow which consists of the following steps:

  • Dataverse connector (a simple query: list EventEditions)
  • For Each (EventEdition)
    • Dataverse connector (a simple query: list CustomerProfiles)
    • For Each (CustomerProfile)
      • Dataverse connector (a simple query: list WebEntries)
      • For Each (WebEntry)
        • Compose a string with CustomerProfile and WebEntries

The issue is that, while when I call the flow for one EventEdition (the most outer for each), it takes 30 mins at most (it is for the EventEdition with the largest data), a run for all EventEditions takes longer than a day. The number of EventEditions is 11, the flow for the largest one takes 30 mins at most, and most of them take only a few mins.

  • Handling each EventEdition in separate flow instances: 30 + 6 + 5 + ... ~= 1 h
  • Handling all EventEditions in the same flow instance: > 24 h

What would cause this?

 

I'm trying the simplest approach to overcome this which is to run the flow for each Event Edition sequentially. To do this, I set the Degree of Parallelism of the relevant ForEach components to 1 to make them run sequentially. But it seems this doesn't impact the running time.

 

If my explanation is not clear or detailed enough, I'll update it based on your comments.

 

I'd really appreciate your comments and suggestions on this. Thank you in advance.

 

Edit: Adding a screenshot of the flow.

 

The main flow, including one child flow.The main flow, including one child flow.

Categories:
I have the same question (0)
  • leo85 Profile Picture
    609 on at

    Hi @karr ,

    There are a few things you can check and try.

     

    Complexity: You've got three nested for-each loops. So you're dealing with exponential complexity, which is not ideal. The inner most loop (list WebEntries) has got the biggest influence. If you have 11 events, 100 customers and 100 web entries (just as an example), "compose string" will be called 110.000 times.

     

    You may run into throttling problems here:

    You have already changed the parallelism. But running things sequentially will slow your flow down. Try to increase the parallelism on every level if possible by setting the degree of parallelism to a number higher than 1. You need to watch out, because running things in parallel can mess up your flow.

     

    Did you list all of the actions in your flow or are there any other actions (e.g. conditions) which you did not list?

     

    Regards,

    Leo

     

    ----------------------------

    If my answer solved your issue, please mark it as a solution.

    If what I wrote helped you, please give it a thumbs up.

  • karr Profile Picture
    16 on at

    Hi @leo85,

     

    First of all, thank you for your help.

     

    You are right, and I'm aware of the exponential complexity. But when I run the same flow for each data record (EventEdition) separately, I don't run into any performance issues, which must be equal to the same number of actions in total.

     

    • API request limits. I run into this limit when I include all the necessary actions in the flow. Here, in my question, I put only the main actions such as Dataverse calls, loops, and string operations. This way I don't observe the slow flow warning but the flow is still too slow.
    • Data limits. I haven't seen any banner regarding the data usage. But I'll keep an eye on it.
    • Connector limit. I'll read it.

     

    But... Returning back to the beginning, I think I should be getting over this issue by ensuring each flow run for only one EventEdition. Because when I run the flow manually for only one EventEdition, it takes much less as I mentioned before. That would make only about 1 h for all events compared to a day.

     

    But I couldn't achieve it yet for some reason. I tried to read/write to/from a Blob Storage to store the processed event IDs and the processing status (if an EventEdition is being processed, it is true) to be able to process one event each time. But it doesn't work. Maybe my design is still wrong.

     

    I'm really surprised that the PowerAutomate falls short in doing that kind of task. It shouldn't be that difficult. The equivalent data process takes 15-30 mins as an Azure Function in C#.

     

    You have already changed the parallelism. But running things sequentially will slow your flow down. Try to increase the parallelism on every level if possible by setting the degree of parallelism to a number higher than 1. You need to watch out, because running things in parallel can mess up your flow.


    I already tried it and it didn't change anything. Also, as I mentioned before, the flow must take about 1 h in total, because when I run the flow manually for each EventEdition, it takes that much (1 h). The core of the problem must be to do with running one flow for all EventEditions (which, I guess, means using parallelism). Setting the most outer loop (ForEachEventEdition) to run sequentially must do the trick, but it doesn't. Am I wrong?

     

    Did you list all of the actions in your flow or are there any other actions (e.g. conditions) which you did not list?


    There are many other actions in the original version of the flow and when used they cause the "slow flow" issue. To get rid of this, I split the entire flow into 3 flows. But this didn't help reduce the running time as well.

  • leo85 Profile Picture
    609 on at

    Can you post a screenshot of the flow? Maybe there are other actions that are causing the problem.

    Can you go through the flow run, which lasted 24h and post screenshots of the actions that take the longest amount of time?

    Can you also post a screenshot of the "actions" chart of the flow's "analytics" page?

  • karr Profile Picture
    16 on at

     

    flow-single-eventedition-1.pngSingle EventEdition (19 m - the longest one)Single EventEdition (19 m - the longest one)flow-all-eventeditions-1.pngAll EventEditions (13 h - 11 event editions)All EventEditions (13 h - 11 event editions)

     

    PS. When I put all the necessary actions in the flow, the running time for all EventEditions is about a day. Here, for the light/test version of the flow, it took 13 h.

  • leo85 Profile Picture
    609 on at

    Can you also post a screenshot of the "actions" chart of the flow's "analytics" page?

  • karr Profile Picture
    16 on at

    Do you mean Run Details as in Logic Apps? As far as I know, it is available for only Logic Apps. My flow is a PowerAutomate Cloud Flow and I don't see any option to see more details about runs.

  • leo85 Profile Picture
    609 on at

    No, not the run details. When you are in the flow studio on the "Cloud flows" page, click the flow name to open its details page. In the top banner there is a button "Analytics". If you click on that, you will see the actions.

     

    leo85_1-1641062243910.png

     

     

  • karr Profile Picture
    16 on at

    But I don't have it. Maybe it's because of the subscription/plan or my permissions.

     

    Edit: Yes, it is. The documentation says "Admins with the following roles and a license can view the reports in Power Automate analytics." https://docs.microsoft.com/en-us/power-platform/admin/analytics-flow

    ribbon.png

  • karr Profile Picture
    16 on at

    Another strange issue is that, in the same run, a smaller record took much longer than the largest one as you can see below.

    "26 m" of running time for "the largest" record"26 m" of running time for "the largest" record"5 h" of running time for a "smaller" record"5 h" of running time for a "smaller" record

  • leo85 Profile Picture
    609 on at

    Hi @karr,

    no, this is a standard feature that should be available to every creator of a flow irrespective of their license. What you quote is a feature of the Power Platform Admin Center. This is not was I was referring to.

    Are you the owner/co-owner of the flow?

    Is your flow part of a solution? In that case, you may need to select "See analytics" by clicking "more options" (see screenshot).

    leo85_0-1641072062440.png

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard