Reputation: 43
In our server we are loading a third-party assembly which creates its own resources like memory and threads. We need to create multiple instance of this third-party plug-in and as number of instances increases memory and threads for our server hits the limit.
One way is to load this plug-ins in different exes, which frees up server resources. This will work as each process will get benefit of its own resource pool.
The question is, if we use AppDomain and isolate the plug-in, will it give the advantage similar to hosting it in different process with respect to resource availability.
Thanks, M...
Upvotes: 0
Views: 307
Reputation: 1885
AppDomain does not enjoy a new 'resource space' provided by the OS. For example, the available memory space is not enlarged when creating a new AppDomain which could be a limitation on 32bit systems. For the same reason, an error which causes the process to die (like out of memory) will cause all AppDomains in process to die together, and so are uncatched exceptions. That's absolutely wrong when using Processes.
However .NET do deal with AppDomain as foreign units. For example garbage collection is performed for each AppDomain by its own thus one GC thread of an AppDomain will not disturb different AppDomain. It may affect the CPU time resource that AppDomains consume by lowering dependencies between AppDomains (although I've never tried to check how much it affects).
From your questions it sounds like process is the preferred solution as you want a different resource pool for each plugin, but the answer depends on what exactly resource types are you talking about.
Upvotes: 2
Reputation: 2574
My experience is that processes are more flexible and stable than AppDomains. There are some fatal limitations of AppDomains compared to processes:
Upvotes: 2