Appdomain 与进程相比的性能优势?

发布于 2024-10-09 17:28:17 字数 179 浏览 0 评论 0原文

我有一个 C# 应用程序 (foo),从中调用另一个 C# 应用程序 (bar)。目前我正在通过使用 C# 的 Process 类创建新进程来从 foo 应用程序调用 bar 应用程序。

最近我开始了解.net AppDomains。我想知道使用 AppDomains 而不是进程有什么性能优势吗?

谢谢和问候,

I have an C# application (foo) from which I am calling another C# application (bar). Currently I am invoking bar application from foo application by creating new process using Process class of C#.

Recently I came to know about .net AppDomains. I would like to know is there any performance benefit for using AppDomains instead of process?

Thanks and Regards,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

只是在用心讲痛 2024-10-16 17:28:17

是的,在 Windows 中简单地创建一个新进程会产生一些不小的开销。这就是为什么 CGI 历来在 Windows 上的表现不如其他操作系统(也是开发 FastCGI 的一个重要原因)。

但是,我想问一下,您将多久创建一次这些额外的“作业”?如果它会非常频繁,是否有理由不能简单地使用线程池线程?如果它根本不会经常发生,那么与您花在弄清楚如何让它发挥作用上的时间相比,您获得的好处就会很小。


IMO,单独的应用程序域往往有一些特定的情况,需要在完整的进程或简单的线程上使用它们。通常选择一种方式更好。

There is some non-insignificant overhead in Windows of simply creating a new process, yes. 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)

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. It's usually better to go one way or the other.

温柔女人霸气范 2024-10-16 17:28:17

在.net框架中创建进程不是托管进程,CLR必须咨询底层操作系统来启动新进程,并且启动新进程有一些定义的步骤,因此可能会出现一些性能下降,但下降多少,没有测量。

但是,如果您将 DLL 加载到新的 AppDomain 中,它将位于您的应用程序进程内,并且不需要完整的闪存进程集。

所以这取决于你好吗

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.

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.

so that depends , how are you

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文