Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Unanswered

Plugin execution randomly takes longer than expected

(0) ShareShare
ReportReport
Posted on by

Hi,
we have a C# plugin that get's triggered, when our customer wants to retrieve ad-hoc data from an Azure Function (that also requests another endpoint in an on-premise network and returns the data to the Dataverse plugin). The plugin uses HttpClient. That's why it takes 1-5 seconds in general to execute the plugin (according to the plugin trace logs). But some of the executions take up to 9 or 10 seconds.
I implemented a C# stopwatch to trace how long every single step in my code takes. My code needs 1-5 seconds (most of the time to wait for the Azure Function) according to the trace log, but the whole plugin needs 3-5 seconds longer. I read that Dataverse needs to cache the plugin class instance (Develop IPlugin implementations as stateless - Power Apps | Microsoft Learn). Is this the reason, why the execution sometimes takes that long?

 

Thanks in advance!

  • cchannon Profile Picture
    4,702 Super User 2025 Season 1 on at
    Re: Plugin execution randomly takes longer than expected

    Ok, I don't know for sure it will tell you anything new, but...

     

    Plugin tracing has questionable timing. The traces are written asynchronously to the log and you don't have the ability to track actual plug-in initiation or closure (only events within your method and after class instantiation). So MSFT introduced.App Insights logging for plugins that gives you more granular tracking and might tell you something more about what's happening.

     

    https://learn.microsoft.com/en-us/power-apps/developer/data-platform/application-insights-ilogger

     

  • Community Power Platform Member Profile Picture
    on at
    Re: Plugin execution randomly takes longer than expected

    Execution mode is synchronous

  • cchannon Profile Picture
    4,702 Super User 2025 Season 1 on at
    Re: Plugin execution randomly takes longer than expected

    Is your plugin registered for sync or async?

     

    The async resource pool is highly variable and not at all guaranteed. You just get what you get when you get it. The Sync resource pool is much more consistent.

  • Community Power Platform Member Profile Picture
    on at
    Re: Plugin execution randomly takes longer than expected

    Hi,

    1. No, not really. Sometimes only the first execution takes very long and every subsequent one is very fast.

    - Sometimes the first 2-3 executions take longer

    - Sometimes the first one takes longer and the next 2-4 executions are very fast and then there is a slow execution followed by fast executions

    - After 5 minutes every execution was fast

    - After 10 minutes every execution was fast

    2. Hopefully I have understood correctly...in case of fast executions, one execution takes 500 to 1600 ms. This is also the duration my stopwatch logs in code. If the total plugin execution takes 10 000 ms, my code is also slower, but compared to the total duration it is only half (5000 ms). This is mainly due to Azure Function request (1500 - 2000 ms) and writing data to Dataverse tables (2500 - 3000 ms). So, logging the elapsed stopwatch time: up to 5000 ms executing the code, but the total plugin execution takes 10 000 ms

     

    Thanks!

  • Michael E. Gernaey Profile Picture
    42,461 Super User 2025 Season 1 on at
    Re: Plugin execution randomly takes longer than expected

    Hello,

     

    It is possible that it is related to caching, and or spinning it up initially or after it has essentially gone to sleep.

     

    If I may ask a couple of questions:

    1. do you find that within a specific period of use, that it happens randomly. Essentially you use it regularly for an hour, no big breaks, and every 5-10 minutes an instance takes longer?

     

    2. Do you have an idea of what your Volume and Velocity or executions are? So we can look to see if its either a limit on connections, or simply resource contention

     


    Cheers
    If you like my answer, please Mark it as Resolved, and give it a thumbs up, so it can help others
    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 109 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 82 Super User 2025 Season 1

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 72

Overall leaderboard