[Mono-list] Massive performance slowdown in C# SOAP client when one AppDomain per thread versus just one (ie the primary) AppDomain

River Satya river.satya at gmail.com
Mon Jan 4 23:45:26 UTC 2016


After running a profiler on the test code, I noticed that most of the extra
time is spent in this method:

4319260 4319260 7579 (wrapper managed-to-native) System.Threading.WaitHandle
:WaitOne_internal (System.Threading.WaitHandle,intptr,int,bool)

When I examined the trace of the profile output, most of the stack traces
had (rougly) the same number of calls, except for this one:

System.Threading.ExecutionContext:Run
(System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
System.Threading.ExecutionContext:RunInternal
(System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
System.Threading.ThreadHelper:ThreadStart_Context (object)
System.Threading.Timer/Scheduler:SchedulerThread ()
System.Threading.WaitHandle:WaitOne (int)
System.Threading.WaitHandle:WaitOne (int,bool)

251 calls for the case with multiple AppDomains vs 4581 calls for the
single AppDomain case.

Does anyone have any idea why this would be happening? Is this a bug in the
Mono SOAP stack?

Thanks,

River

On 4 January 2016 at 16:47, River Satya <river.satya at gmail.com> wrote:

> A piece of code I inherited recently uses separate AppDomains to
> parallelise calls to a SOAP web service.
>
> We were seeing an intermittent bug in Mono which caused crashes when the
> AppDomains were unloaded, and since AppDomains seemed like overkill for the
> purposes of multithreading calls to the service, I removed them and
> simplified the code. All seemed to work fine, however, there was a drastic
> performance regression (around 3x slower).
>
> I put together a simplified chunk of code to reproduce the issue:
>
>
> http://stackoverflow.com/questions/34585272/massive-performance-slowdown-in-c-sharp-soap-client-when-one-appdomain-per-threa
>
> Any insight appreciated!
>
> Thanks,
>
> River
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20160105/bcbde13d/attachment.html>


More information about the Mono-list mailing list