I have an IEnumerable with a lot of items that needs to be processed in parallel. The items are not CPU intensive. Ideally these items should be executed simultaneouslyon 100 threads or more.
I've tried to do this with Parallel.ForEach(). That works, but the problem is that new threads are spawn too slowly. It takes a (too) long time before the Parallel.Foreach() reaches the 100 threads. I know there is a MaxDegreeOfParallelism property, but that's a maximum, not mimimum.
Is there a way to execute the foreach immediatelly on 100 threads? ThreadPool.SetMinThreads is something that we prefer to avoid, because it has an impact on the whole process.
Is there a solution possible with a custom partitioner?