简体   繁体   中英

c# : single process with multiple app domain VS multiple process

I am currently having multiple process. All of them are doing different task. Some of them also hosts WCF services and interacting with database. Most of them are multi threaded process doing some heavy duty. All of them need to up all the time (they all together act as server). Some process also interact with unmanaged code through CLI.

Recently i came across "single process with multiple app domain" concept. I am wondering is it any good in my case? what are the limitations and advantage of this over multi process architecture ?

Edit: If any process crashes then it has to restart again. currently there is a process watcher for that.

tldr : You have native dependencies. Keep using separate processes if you need robustness.

In my opininion, it mostly depends if you're running pure .Net code, or if you have native dependencies: Process isolation will prevent a global failure in case of a native crash (which could take down the whole process).

Same thing for unmanaged resouces: If you have an unmanaged resource leak somewhere, restarting a process "fixes" the leak. But restarting an appdomain does not.

If you're only using managed code only (which does not seems to be your case), a single process with multiple appdomains is OK, and has the advantage of getting rid of processes creation overhead (creating a new AppDomains is lighter than creating processes)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM