如何任务并行库规模的终端服务器或Web应用程序? [英] How does Task Parallel Library scale on a terminal server or in a web application?

查看:62
本文介绍了如何任务并行库规模的终端服务器或Web应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,TPL使用工作窃取队列的任务​​时,我执行之类的东西的Parallel.For和类似的结构。

I understand that the TPL uses work-stealing queues for its tasks when I execute things like Parallel.For and similar constructs.

如果我正确地理解这一点,该结构将旋转起来多项任务,其中每个将开始处理项目。如果某一个任务完成其分配的项目,它会开始偷一个还没有完成他们的其他任务物品。这解决了问题,在项目1-100便宜处理和项目101-200是昂贵的,并且这两个任务之一只想闲置直到对方完成。 (我知道这是一个简单的exaplanation。)

If I understand this correctly, the construct will spin up a number of tasks, where each will start processing items. If one of the tasks complete their allotted items, it will start stealing items from the other tasks which hasn't yet completed theirs. This solves the problem where items 1-100 are cheap to process and items 101-200 are costly, and one of the two tasks would just sit idle until the other completed. (I know this is a simplified exaplanation.)

然而,如何将这种规模的终端服务器的Web应用程序上或(假设我们使用第三方物流在code,将在Web应用程序运行)?我们能饱和的风险与任务的CPU,只是因为有我们的应用程序并排跑一边N个实例?

However, how will this scale on a terminal server or in a web application (assuming we use TPL in code that would run in the web app)? Can we risk saturating the CPUs with tasks just because there are N instances of our application running side by side?

有没有办法,我必须阅读有关此主题的任何信息?我还没有发现什么特别的,但并不意味着是没有的。

Is there any information on this topic that I should read? I've yet to find anything in particular, but that doesn't mean there is none.

推荐答案

您可能能够使用第三方物流通过移动到异步模式,提高I / O密集​​型操作。您可能还可以通过更多地利用现有的闲置产能的处理器在低负载情况下的Web服务器上,以提高申请的等待时间。你要仔细想想这个pretty的高负荷,其中处理器都已经100%使用增加了更多并行性会降低服务器的吞吐量。

You might be able to use the TPL to improve I/O bound operations by moving to an asynchronous model. You might also be able to improve request latency by making more use of the available unused processor capacity on a web server in low load situations. You want to think about this pretty carefully as under high loads where the processors are already 100% utilized adding more parallelism will reduce throughput on the server.

这是在并行扩展团队博客讨论:

This is discussed on the Parallel Extensions Team Blog:

使用并行扩展的.NET 4的ASP.NET应用程序

我怀疑,同样的道理也适用于终端服务器的应用也。

I suspect that the same argument applies to Terminal Server applications also.

这篇关于如何任务并行库规模的终端服务器或Web应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆