[英]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.
其中一些还托管WCF服务并与数据库进行交互。 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.
某些进程还会通过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. tldr :您具有本地依赖性。 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). 在我看来,这主要取决于您运行的是纯.Net代码还是具有本机依赖项:进程隔离将在发生本机崩溃的情况下防止全局故障(这可能会使整个过程崩溃)。
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.
但是,重新启动appdomain不会。
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) 如果您仅使用托管代码(这似乎不是您的情况),则具有多个应用程序域的单个进程就可以了,并且它具有消除进程创建开销的优点(创建新的AppDomain比创建进程更轻松) )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.