Performance issues may happen to .NET Enterprise Services components

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:

https://www.guidanceshare.com/wiki/Enterprise_Services_(.NET_1.1)_Performance_Guidelines_-_Resource_Management

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

System_EnterpriseServices_Wrapper_83d0000!System::EnterpriseServices::Thunk::InitializeSpy::PostUninitialize+0x6e

ole32!NotifyInitializeSpies+0x6a

ole32!CoUninitialize+0x85

comsvcs!CSTAThread::WorkerLoop+0x256

msvcrt!_threadstartex+0x74

kernel32!BaseThreadStart+0x34

 

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

and

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

https://support.microsoft.com/default.aspx?scid=kb;EN-US;958090

IMPORTANT:

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.

 

Best Regards,

Freist Li