ASP.Net 中的 WF 和并行性需要指导

发布于 2024-08-20 03:53:51 字数 652 浏览 2 评论 0原文

我对有关 ASP.net 的几个主题研究得越多,我就越觉得在如何以及在何处正确地将某些内容应用到 ASP.net 领域(Webforms 和 MVC)方面存在着真正的差距。

Workflow Foundation

我喜欢使用 WF;但是,我读过的所有内容都是不建议将其用于 ASP.Net 应用程序,因为每个应用程序域有 1 个工作流托管环境限制。现在,我还没有看到此限制在哪里发生了变化,但自旧的 .Net 3.0 (.netfx) 时代以来,我也找不到有关此限制的任何信息。我一直在看到将工作流程变成服务的建议,这听起来不错;但是,如果服务被频繁访问,这是否会具有完全相同的限制,从而导致一些性能问题? ASP.Net 中是否有 WF 的位置?如果有,在哪里?

并行处理

并行性也是如此。我经常看到/读到的有关执行多线程 ASP.Net 应用程序的建议是不要执行此操作,因为 IIS 应用程序池中的线程池设置方式不同。现在随着.Net 4的出现和多核处理器的无处不在,多线程似乎再次成为最热门的话题之一。我喜欢在 4.0 中看到的并行扩展;但是,建议仍然不要在 ASP.Net 中执行此操作,还是在某些地方建议此时执行此操作?

多年前关于这两项的建议现在还有效吗?在 ASP.Net 世界中是否仍应避免使用它们?

谢谢

The more I research a couple topics with regards to ASP.net, the more I feel like there's a real gap on how and where to properly apply a few things to the ASP.net realm (both webforms and mvc).

Workflow Foundation

I love using WF; however, everything that I've ever read is that it's not recommended for ASP.Net apps because of the 1 workflow hosting environment per app domain restriction. Now I haven't seen where this restrictions changed but I also can't find any information about this restriction since the old .Net 3.0 (.netfx) days. I have been seeing advice to make workflows into services which sounds good; however, wouldn't such have the exact same limitations where if the service is hit too often, it would result in some performance issues? Is there a place for WF in ASP.Net and if so, where?

Parallel Processing

The same thing for parallelism. The advice that I've always seen/read about doing multi-threaded ASP.Net applications was to not do it because of the way the thread pool is setup in the application pools of IIS. Now with .Net 4 coming out and multi-core processors everywhere, multi-threading seems to be one of the hottest topics again. I like what I'm seeing in the parallel extensions in 4.0; however, is the advice still don't do it in ASP.Net or is there some places where it'd be recommended at this point?

Does the advice on these two items from years ago still stand? Should they still be avoided in the ASP.Net world?

Thanks

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

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

发布评论

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

评论(1

星星的軌跡 2024-08-27 03:53:51

多线程在 ASP.Net 中仍然相当无关紧要 - 原因是您在 ASP.Net 中编写的几乎所有代码都是为了处理单个请求。在其他类型的应用程序中使用多线程有两个主要原因:

  • 在另一个线程完成工作时更新 UI - 在 Web 应用程序上,用户在整个任务完成之前不会收到任何内容。
  • 通过使用所有可用核心获得更好的性能 - 当其他核心忙于处理其他用户的请求时,并没有多大好处。

工作流主要是为长时间运行的任务而设计的 - 不要在按钮单击处理程序中的一些简单代码可以使用的地方使用它。消除了对即时响应的要求,简单的队列可以解决大多数潜在的性能问题。我已经在 ASP.Net 页面中使用了 WF,但如果我需要速度或大量用户,我不会这样做。

Multithreading remains fairly irrelevant in ASP.Net - the reason is that pretty much any code you write in ASP.Net is intended to handle a single request. There are two main reasons for using multiple threads in other types of application:

  • Updating UI while another thread does the work - on a web app the user won't receive anything until the entire task is complete anyway.
  • Better performance by using all available cores - not much benefit when the other cores are busy handling requests from other users.

Workflow is designed mostly for long running tasks - don't use it where some simple code in a button click handler would do. Remove the requirement for an instant response and a simple queue takes care of most potential performance issues. I have used WF within ASP.Net pages, but I wouldn't do it if I needed speed or a large number of users.

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