简体   繁体   English

Web场框架+ PLINQ

[英]Web Farm Framework + PLINQ

I have a question about web farm framework and PLINQ. 我对网络农场框架和PLINQ有疑问。

As we know, we can use AsParallel extension in .NET 4.0 Framework. 众所周知,我们可以在.NET 4.0 Framework中使用AsParallel扩展。

For example 例如

    var source = Enumerable.Range(1, 10000);


// Opt-in to PLINQ with AsParallel
var evenNums = from num in source.AsParallel()
               where Compute(num) > 0
               select num;

I know web farm framework will do the auto load balancing for me. 我知道Web场框架将为我做自动负载平衡。

Assume I have 3 servers. 假设我有3台服务器。

Sever A: 8 cores Sever B: 4 cores Sever C: 4 cores 服务器A:8核服务器B:4核服务器C:4核

Question is how many total CPU cores I receive? 问题是我总共收到多少个CPU内核? Is it 8+4+4=16 cores? 是8 + 4 + 4 = 16核吗?

I am asking because I am wondering how many CPU cores are available to the parallel computing. 我问是因为我想知道并行计算有多少个CPU内核可用。

Thanks everyone. 感谢大家。

Parallel LINQ is uses the cores available only on the machine it is executing . 并行LINQ使用仅在其正在执行的机器上可用的内核。 I believe there are some 3rd party products (Microsoft Research has DryadLINQ ) which can extend it to a cluster, however, out of the box this is not possible. 我相信有些第三方产品(Microsoft Research有DryadLINQ )可以将其扩展到群集,但是,开箱即用是不可能的。

Additionally, cores available and threads used are two separate things (to nitpick even more, unmanaged and managed threads are also two separate things). 此外, 可用的内核使用线程是两个独立的事物(要进一步挑剔,非托管和托管线程也是两个独立的事物)。

To answer your question, regardless of which server the code executes on, PLINQ may use 1 or more threads (up to a limit provided by the scheduler being used). 为了回答您的问题,无论代码在哪台服务器上执行,PLINQ都可以使用1个或更多线程(最多由正在使用的调度程序提供的限制)。 It all depends on the workload. 这完全取决于工作量。

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

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