Cross AppDomain call overhead - Test Results

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

After developing basic plug-in system I have put it to performance test.
The general concept is two app domains one, the primary hosts main
application, secondary runs plug-ins (dynamic assemblies pre-compiled or
compile-on the first use)

Here are some basic numbers for those that care about performance:

Assembly loaded into primary app domain, dynamic object instantiation,
interface based access.

Execution time 0.586019172827831 seconds
Executions per second 1706428.81046794

The same exact code, except assembly is loaded into second app domain,
interface based access as well.
Execution time 32.1589118170047 seconds
Executions per second 31095.5795298779

Optimizations didn’t really help (for an obvious reason)

The point of the story is - dynamic code compilation is nice, but if you
cant execute within the same domain or greatly reduce a number of cross
domain calls - don’t expect high performance.


When I moved execution process into secondary domain and reduced number of
cross domain function calls from 1000000 to 4, performance was back on track
and summarized to:

Within Primary App domain
Execution time 4.17137876461953 second
Executions per second 2397288.8975744

Within Secondary App Domain
Execution time 4.27427592054297 second
Executions per second 2339577.55322676
 
Performance update:

Specifying Loader Optimization ( LoaderOptimization.MultiDomain ) on primary
application entry point causes performance increase on cross domain calls:

Execution time 4.59662163766624 seconds
Executions per second 217551.079646336

If anyone can shed some light on what really happens with different
LoaderOptimizations that would be greatly appreciated.

Optimization setting for MultiDomainHost seems to fit description better for
calling a function from a remote class (i.e. unique code in multiple domains)
Yet MultiDomain setting seems to be getting much better performance.
 
Back
Top