Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AppDomain communication and performance

i am hosting a WCF service, where the requirements are that an object, of a type the WCF service is not directly referenced, is invoked and some (common) methods run on it. So the type is created via reflection and AssemblyResolve: this is OK.

but then i got thinking - that we are expecting maybe 50 - 100 of these assemblies / types to arrive, especially when we are versioning them. this should presumably bloat (still on theory here rather than practice) the memory and performance of the service host application due all these assemblies being referenced in mem.

so then we should unload: but the only way to do this is via an appdomain. the thinking is, that each assembly would somehow run in it's own appdomain and the WCF service is actually just passing messages to the appropriate appdomain. If the appdomain is not used for some_period_of_time then we simply unload the appdomain.

i'll probably get marked down for this, but some guidance would be useful on:

  1. is this an insane idea?
  2. should the process should run fine with ~100 assemblies in memory?
  3. communication with appdomains would presumably come at some cost (via remoting / named pipes): does this disqualify the idea?
  4. creating an appdomain to basically service one type of .dll would involve many appdomains, is this retarded?

i have no experience in this area. My worries are the size and the performance of the app if i don't do something like this. however with the app domain idea, this basically sounds like massive over-engineering. the requirement to host this unknown .dlls is not something i can change.

i guess my overall question is:

is this idea as idiotic as it sounds, and what are the pro's / con's associated with it?

like image 255
peteisace Avatar asked May 21 '11 11:05

peteisace


1 Answers

should the process run fine with ~100 assemblies in memory?

You'll have to try (it's easy to create a mock-up) but you're only stuck with the code. So at 1 MB a piece you would be using 100MB of discardable memory, I don't expect a problem.

Provided your instances are released and collected.

like image 86
Henk Holterman Avatar answered Sep 23 '22 17:09

Henk Holterman