When .NET application highly relies on EnterpriseService Component, to avoid Performance issue, we must strictly follow below guidelines:
1. Always Call Dispose
2. If You Call COM Components, Consider Calling ReleaseComObject
For details, please refer to:
However, if the application has one thread lives long time in process and keeps repeatedly calling EnterpriseService component, you may hit intermittent slowness issue. If we take memory dump, we will see one thread holds critical section and all others are waiting on it. The thread which owns this critical section can have below call stack:
System_EnterpriseServices_Wrapper_83d0000!System::EnterpriseServices::Thunk::SimpleHashtable<unsigned long,unsigned __int64>::Remove+0x22
This issue is because of the fact that the EnterpriseServices library repeatedly inserts duplicated information into ThreadMap link, when the COM apartment is going to be cleaned, it has to go through the long tail in TheadMap link and then caused performance drop. In some scenario, frequently EnterprsieService Compnent calls can also calls continues virtual memory growth.
Microsoft has provided fix on this issue, to address such a performance issue, please apply
1. .NET 2.0 SP2
2. Contact Microsoft Support Team to get fix of 958090:
958090 FIX: The System.EnterpriseServices.TransactionProxyException exception cannot be caught from other application domains when it is triggered during a transaction completion
1. The KB958090 problem description is not related to Performance, but it has contained the fix on the performance issue about ThreadMap link.
2. In this blog I gave some FIX recommendations on general scenarios, but there are still other performance issues may be caused by application code itself, if the suggestions don't work or your .NET version is above 2.0, please go ahead to review and narrow the application code with developer team.