简体   繁体   中英

Web Farm Framework + PLINQ

I have a question about web farm framework and PLINQ.

As we know, we can use AsParallel extension in .NET 4.0 Framework.

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.

Assume I have 3 servers.

Sever A: 8 cores Sever B: 4 cores Sever C: 4 cores

Question is how many total CPU cores I receive? Is it 8+4+4=16 cores?

I am asking because I am wondering how many CPU cores are available to the parallel computing.

Thanks everyone.

Parallel LINQ is uses the cores available only on the machine it is executing . 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.

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). It all depends on the workload.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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