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!
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
Execution mode is synchronous
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.
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!
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
WarrenBelz
109
Most Valuable Professional
Michael E. Gernaey
82
Super User 2025 Season 1
MS.Ragavendar
72