I'm using parallel linq, and I'm trying to download many urls concurrently using essentily code like this:
int threads = 10;
Dictionary<string, string> results = urls.AsParallel( threads ).ToDictionary( url => url, url => GetPage( url );
Since downloading web pages is Network bound rather than CPU bound, using more threads than my number of processors/cores is very benificial, since most of the time in each thread is spent waiting for the network to catch up. However, judging form the fact that running the above with threads = 2 has the same performance as threads = 10 on my dual core machine, I'm thinking that the treads sent to AsParallel is limited to the number of cores.
Is there any way to override this behavior? Is there a similar library available that doesn't have this limitation?
(I've found such a library for python, but need something that works in .Net)