We're writing a .NET application server that uses multiple AppDomains and have found AppDomains to be fairly resource-intensive. There's no memory sharing of either code or data between AppDomains so the same assembly loaded into two AppDomains consumes twice the memory. The CLR uses a custom remoting channel for all inter-AppDomain communication which is transparent and extremely convenient but incurs a performance overhead to serialize and deserialize objects crossing the boundary. (I haven't looked at the implementation of this inter-AppDomain remoting channel to know what mechanism it uses, ideally it would use some form of shared memory to avoid socket or named-pipe overhead. Does anyone know offhand?) We've found the use of even three or four AppDomains to push the process size into the tens of MBs.
There are other options for using multiple versions of the same assembly. Obviously only entire AppDomains can be unloaded from a process, but different versions of the same assembly can be loaded into the same AppDomain. You could implement a pooling mechanism of some sort where multiple assemblies were loaded into one AppDomain and the AppDomain was only unloaded when all assemblies within it were no longer being used. Incidentally, the platform we're developing (http://www.kinitos.com) offers much of the functionality you're looking for. We're targeting the deployment and management of smart-client applications so a centralized administrator can efficiently push upgrades out to client machines. Ignoring our messaging subsystem, we handle loading, unloading and transitioning between multiple versions of an application within a process. Mike. -----Original Message----- From: Moderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Simon Jefford Sent: October 28, 2003 8:09 AM To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] Appdomains I will soon be developing an server application which will basically consist of a bunch of controller objects listening to MSMQ queues. Messages are then processed and then dispatched onto another queue. The processing part will be performed by a helper object located in an assembly which is loaded at runtime. We want to be able to update these assemblies dynamically - without bringing the service down. The obvious method is to host each controller in a separated AppDomain which can then be unloaded when we wish to update the processor assembly. However there will more than likely be 50+ controller objects, each running a different processor assembly, which means 50+ AppDomains. Is this feasible? What will the implications for memory usage be? From my understanding the assembly which contains the controller class will have to be loaded into each AppDomain, is there any sharing of memory at all between AppDomains? Many thanks, Simon Jefford. ________________________________________________________________________ This email has been scanned for all viruses by the MessageLabs Email Security System. http://www.messagelabs.com ________________________________________________________________________ =================================== This list is hosted by DevelopMentorR http://www.develop.com NEW! ASP.NET courses you may be interested in: 2 Days of ASP.NET, 29 Sept 2003, in Redmond http://www.develop.com/courses/2daspdotnet Guerrilla ASP.NET, 13 Oct 2003, in Boston http://www.develop.com/courses/gaspdotnet View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor� http://www.develop.com NEW! ASP.NET courses you may be interested in: 2 Days of ASP.NET, 29 Sept 2003, in Redmond http://www.develop.com/courses/2daspdotnet Guerrilla ASP.NET, 13 Oct 2003, in Boston http://www.develop.com/courses/gaspdotnet View archives and manage your subscription(s) at http://discuss.develop.com
