cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MatheusAntunes
Frequent Visitor

Same Flows Steps, Different Triggers. 7minutes V.S. 21 hours Durations

Hello everyone, 

 

I have two identical flows:

  • Flow A: triggered by a PowerApps button
  • Flow B: triggered by a Schedule trigger. 

Run Duration :

  • Flow A: 6 to 7 minutes.
  • Flow B: 16 hours to +1d to fully run. 

 

Number of actions:

  • Flow A = Flow B = ~800 actions (They are identical)

 

This same flow when I was testing reached 25k actions, which throttled it down. As it was just a test, a few days later, I downloaded the solution, changed the flow IDs, and uploaded it again. Same issue: Flow A = 6min, Flow B = +16 hours;  

 

If I am still under the limit, why is this scheduled flow taking so long to run? Why not both of them if the only change is the trigger?

I am the owner of the flow.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
MatheusAntunes
Frequent Visitor

I have found a solution to my own problem:

 

My strategy was to create a child flow with the Schedule trigger and an action calling the child flow with the logic I wanted to be executed. It is not what I wanted, because I had to split the flow in two, but it worked as it should. 

 

How to create and use a Child Flow: 

  1. Create your flow with the "Manually trigger a flow" trigger. This will be your Child Flow. 
    • MatheusAntunes_0-1650210202591.png

       

    • At the end of your child flow add the action "Respond to a PowerApp or Flow".
    • MatheusAntunes_1-1650210306734.png
  2. Now create your main flow and add your trigger. In my case, I used the Recurrence Trigger. Also, add the action to call your child flow, and don't forget to reference the child flow inside the action. 

    •  

      MatheusAntunes_2-1650210645188.png
  3. Go back to the child flow details screen (Location where you can see all your run logs). In there you will see a section on the right side of the screen called "Run only users". Click on edit. 
    • MatheusAntunes_3-1650210794868.png

       

    • In the "Connections Used" section, select "Use this connection (your_email@yourbusiness.com)." Here you will specify with what credential you will be running this child flow. In my case, I want it to run using my credentials. 
    • MatheusAntunes_4-1650210998010.png

       

 

View solution in original post

10 REPLIES 10
MatheusAntunes
Frequent Visitor

@ScottShearer @Pstork1 Help! 😞

Pstork1
Dual Super User
Dual Super User

Have you looked at sample runs from both flows?  Each action will show how long that individual action took.  Figuring out if the whole flow was slower or whether some specific action was causing a bottleneck will help.  But I don't see anything in particular about a different trigger that should have that kind of effect.  Is the flow running in the same person's security context each time?  



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
okeks
Helper V
Helper V

The difference is that the PowerApps trigger uses the license of the user who actually triggered the flow and the Recurrence trigger uses the license of the flow owner.

MatheusAntunes
Frequent Visitor

Hello @Pstork1 , thank you for your help. 

 

I have three parallel Apply to Each action that takes 99% of the time for both flows. 

- For Flow A (6min): All 6 minutes are on these three Apply to Each actions. 

- For Flow B (+20 hours): All the hours spent also are on these three Apply to Each actions.

 

Unfortunately, after I deleted the solution and re-imported it with a new flow GUID, I lost the successful log.
This a sample of parallel main loops I created. 

MatheusAntunes_0-1649775915031.png

 

Goal: 

- Import all excel files in another SharePoint dynamic folder structure and load them into their respective locations. 

Example: 

- Every day a new folder structure will be generated with this info (RegionABC/2022/04/12/02 **Hour**). Within this folder will have several excel files that are being imported. 

 

Each Main Loop was balanced with similar workloads, so they pretty much finish at the same time.

The logic is the same, but the Duration is dramatically different. 

 

I've read about concurrency control, but I am afraid to use it and the data be mixed in the process of getting content and creating a new file at the desired directory. 

 

Answering your question, I own both flows, and all connections are on my account. The manual flow other people can run, but the time is the same (6 min). So the issue is not related to any other user. 

 

@okeks Agreed. But the flow owner is me. When I run it by using the PowerApp trigger I am the user actioning the flow. For the automated version of the flow, I am the owner of it as well. 

 

For other users, the manual version is also running in 6 min. 

@okeks is correct, unless in testing you are the one starting the flow in Power Apps.  That is what I am assuming.

 

I don't see anything that would suggest why the recurrence flow is running so slow.  Could it be that its running at a different time of day?  In other words the Power Apps flow is running during working hours and the recurrence flow starts overnight.  

 

But I do have a suggestion.  One of the things that really slows down flows is using variables for storage in an Apply to Each loop.  The problem is that every time you set the variable it needs to get a lock and that ruins any chance of using concurrency.  I had a flow that ran 9+ hours with variables.  When I switched it to Compose statements it dropped to 15 minutes.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
okeks
Helper V
Helper V

Which plan does it say for Flow B?

 

okeks_0-1649777337584.png

 

Pstork1
Dual Super User
Dual Super User

You are correct that the Power Apps flow will run in the context of the person who is running Power apps.  But in this case its the owner of the flow testing the app.  So its the same person and the same context.  When it goes into production that would account for the difference.  But not when one person is writing everything and testing it.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Exactly, @Pstork1 . Weird behavior. I am working on a different flow to do the same job, but I am still not confident this would solve my issue. Even after assigning a new GUID to the flow, I was still being throttled for some reason. Limit? I doubt it. As you mentioned, it is the same context as only I would be running the flow. 

MatheusAntunes
Frequent Visitor

I have found a solution to my own problem:

 

My strategy was to create a child flow with the Schedule trigger and an action calling the child flow with the logic I wanted to be executed. It is not what I wanted, because I had to split the flow in two, but it worked as it should. 

 

How to create and use a Child Flow: 

  1. Create your flow with the "Manually trigger a flow" trigger. This will be your Child Flow. 
    • MatheusAntunes_0-1650210202591.png

       

    • At the end of your child flow add the action "Respond to a PowerApp or Flow".
    • MatheusAntunes_1-1650210306734.png
  2. Now create your main flow and add your trigger. In my case, I used the Recurrence Trigger. Also, add the action to call your child flow, and don't forget to reference the child flow inside the action. 

    •  

      MatheusAntunes_2-1650210645188.png
  3. Go back to the child flow details screen (Location where you can see all your run logs). In there you will see a section on the right side of the screen called "Run only users". Click on edit. 
    • MatheusAntunes_3-1650210794868.png

       

    • In the "Connections Used" section, select "Use this connection (your_email@yourbusiness.com)." Here you will specify with what credential you will be running this child flow. In my case, I want it to run using my credentials. 
    • MatheusAntunes_4-1650210998010.png

       

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Users online (1,871)