Tips & Tricks | PluginTypeStatistic
Performance considerations
When you add the business logic for your plug-in you need to be very aware of the impact they will have on overall performance. The business logic in plug-ins should take no more than 2 seconds to complete.

Time and resource constraints
There is a 2-minute time limit for message operations to complete. There are also limitations on the amount of CPU and memory resources that can be used by extensions. If the limits are exceeded an exception is thrown and the operation will be canceled.
If the time limit is exceeded, a TimeoutException will be thrown. If any custom extension exceeds threshold CPU, memory, or handle limits or is otherwise unresponsive, that process will be killed by the platform. At that point, any current extension in that process will fail with exceptions. However, the next time that the extension is executed it will run normally.
Optimize assembly development
The assembly should include multiple plug-in classes (or types) but can be no larger than 16 MB. It is recommended to consolidate plug-ins and workflow assemblies into a single assembly as long as the size remains below 16 MB. More information: Optimize assembly development
Details
In order to plugin performance monitoring, we can query [PluginTypeStatistic] Entity
Entity Attributes that can support performance monitoring:
• AverageExecuteTimeInMilliseconds • CrashContributionPercent • CrashCount • CrashPercent • CreatedBy • CreatedByName • CreatedOn • CreatedOnBehalfBy • CreatedOnBehalfByName • CreatedOnBehalfByYomiName • ExecuteCount • FailureCount • FailurePercent • PluginTypeId • PluginTypeIdName • PluginTypeStatisticId • TerminateCpuContributionPercent • TerminateHandlesContributionPercent • TerminateMemoryContributionPercent • TerminateOtherContributionPercent
Note: The Statistics updated periodically not after each transaction.
Recommendations
Monitor PluginTypeStatistic Entity, Especially AverageExecuteTimeInMilliseconds to monitor Logic. In addition to ExecuteCount to monitor unused Plugins or CustomSteps.
References