简体   繁体   English

Appdomain与流程的性能优势?

[英]Performance benefits of Appdomain vs process?

I have an C# application (foo) from which I am calling another C# application (bar). 我有一个C#应用程序(foo),从中我可以调用另一个C#应用程序(栏)。 Currently I am invoking bar application from foo application by creating new process using Process class of C#. 目前,我正在通过使用C#的Process类创建新进程来从foo应用程序中调用bar应用程序。

Recently I came to know about .net AppDomains. 最近,我开始了解.net AppDomains。 I would like to know is there any performance benefit for using AppDomains instead of process? 我想知道使用AppDomains而不是流程会对性能产生任何好处?

Thanks and Regards, 谢谢并恭祝安康,

There is some non-insignificant overhead in Windows of simply creating a new process, yes. 在Windows中,简单地创建一个新进程会产生一些无关紧要的开销,是的。 This is why CGI has historically not performed as well on Windows as on other operating systems (and a big reason why FastCGI was developed instead) 这就是为什么CGI在Windows上历来不如在其他操作系统上表现出色的原因(也是为什么开发FastCGI的重要原因)

However, I would ask how frequently are you going to be creating these extra 'jobs'? 但是,我想问一下您将多久创建一次这些额外的“工作”? If it's going to be very frequent, is there a reason you can't simply use a thread pool thread? 如果要经常使用它,是否有不能简单地使用线程池线程的原因? If it's not going to be frequent at all, the benefit you would gain would be minor compared to the time you will spend figuring out how to get it to work. 如果根本不会经常使用它,那么与花时间弄清楚如何使其工作相比,您将获得的收益将是微不足道的。


IMO, separate AppDomains tend to have some specific situations that call for their use over a full process or a simple thread. IMO,单独的AppDomain倾向于具有某些特定情况,要求在整个过程或简单线程中使用它们。 It's usually better to go one way or the other. 通常最好选择一种方式。

Creation of a process in .net framework is not a managed process , CLR has to consult underlying OS to initiate a new process and initiating a new process has some defined steps so there may be some performance degradation but how much , there is no measurement. 在.net框架中创建进程不是托管进程,CLR必须咨询基础OS来启动新进程,而启动新进程具有一些已定义的步骤,因此可能会导致性能下降,但是多少却没有衡量标准。

But , if you load your DLL into a new AppDomain, that will be inside your application process and would not require a full flash process set. 但是,如果您将DLL加载到新的AppDomain中,则它将位于您的应用程序进程内,并且不需要完整的Flash进程集。

so that depends , how are you 所以要看你好吗

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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