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 / Apply for each is very...
Power Automate
Unanswered

Apply for each is very slow

(4) ShareShare
ReportReport
Posted on by 36

Hello,

 

I am using Apply for Each to loop through the records and some conditions in LOOP. My observation is that the Flow gets stuck up in Apply for Each and takes 30 mins for looping through 150 records.

Any help is appreciated for improving the performance of the Flow

Categories:
I have the same question (1)
  • MattWeston365 Profile Picture
    1,701 on at

    Hi @bondy_07 the amount of time the looping takes will depend on the actions which are contained within the loop. When I'm working on my Flows, I always try to limit the number of steps that are in each loop.

     

    Another consideration is concurrency. By default the loop will process sequentially, whereas, assuming you're using an apply to each loop, I can change the concurrency to allow side by side iterations of the loop. To do this

    1. click on the ellipsis (...) in the top right corner of your loop
    2. Select settings
    3. Switch the concurrency control on (toggle switch)
    4. Either leave the degree of parallelism as it is (default 20) or up it as you see fit.

    Give that a go and see if that brings the run time down.

  • bondy_07 Profile Picture
    36 on at

    Hi, @MattWeston365  this didn`t help.....

  • MattWeston365 Profile Picture
    1,701 on at

    Hi @bondy_07 can you please post a screenshot of your Flow actions? If you can post one screenshot which just outlines the overall Flow, and one which shows the execution times for each of the steps please?

  • Community Power Platform Member Profile Picture
    on at

    I agree with this. I am insert 13,000 records into a sharepoint list. Entire payload converted into JSON is 10 MB.  With parallelism set to the maximum of 50 it takes 30 minutes to complete.  That is not an acceptable amount of time. A couple of minutes, maybe.

  • DenisMolodtsov Profile Picture
    317 on at

    I have the same issue. I'm testing flows, while developing them. I need to iterate through a small array for 20 items that was already retreived. It takes more than 10 minutes for it to go through. I never saw it to be that slow before.

     
  • Alan_Sanchez Profile Picture
    45 on at

    I'm experiencing a similar issue in speed. I have a loop with 8 actions contained within that is meant to loop through several hundred CSV values and store in an array on it's way to JSON. It takes ~30 minutes sequentially and upwards of 1.25 hours at full concurrency. I understand the reasoning to keep the loop as simple as possible, but what stumps me is that concurrency is slower than sequential. That doesn't make much sense to me...

     

    2020-03-20 19_38_54-Edit your flow _ Power Automate.png2020-03-20 19_39_42-Run History _ Power Automate.png

  • bouillons Profile Picture
    302 on at

    Can anybody explain what is the root cause for these delays ? Seconds, I can understand, minutes is just baffling.

    Stephane

  • Community Power Platform Member Profile Picture
    on at

    Yes, the unexplainable slowness of Power Automate flows is something that's rankled me, as well.

    While it's not a solution, per se, one way to mitigate the time it takes to complete a "apply to each" loop is to limit the number of iterations it needs to complete. I do this by always using a "filter" action immediately before the loop, and then feeding the loop with the result of that filter. You will often need to get creative with your filter conditions, but it can significantly reduce the amount of time it takes for your flow to complete.

    Another trick I've found is to break up the loop into multiple loops (again, using the filter action to break up the data). If, for example, you use a condition inside your loop to do one thing to some data and another thing to the rest of the data, perform this data separation outside of the loop using a pair of filter actions, and then run two loops in parallel, each taking the result of one of the filter actions. This avoids the use of a conditional inside the loop, which can halve the time to complete.

    Something like this...

    Screenshot 2021-04-30 151519.png

     

  • bouillons Profile Picture
    302 on at

    Whenever something is slow, it makes me wonder if between certain steps the workflow engine is doing transactional writing of data to a persistent storage, in case it needs to restart due to some failure. At least, that's what I learned from my Biztalk years. There should be a way to tell the engine not to bother with that and just restart from the saved state before the apply to each.

  • Community Power Platform Member Profile Picture
    on at

    Or it could be Microsoft being...well...Microsoft, and not bothering to implement anything correctly. >_>

    Seriously, I've seen better code come out of an eight year-old. Microsoft's dev teams ought to be ashamed of themselves.

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 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard