The reason your ActionBlock has a limited degree of parallelism is because it has BoundedCapacity of 1. BoundedCapacity (as opposed to InputCount ) enables the item to be processed at the moment. This can be easily demonstrated:
var block = new ActionBlock<int>(_ => Task.Delay(-1), new ExecutionDataflowBlockOptions { BoundedCapacity = 1, MaxDegreeOfParallelism = DataflowBlockOptions.Unbounded }); await block.SendAsync(4);
This means that when you set MaxDegreeOfParallelism = DataflowBlockOptions.Unbounded , the block cannot accept more than one element at a time and therefore practically limits the degree of parallelism.
You can fix this by setting a larger BoundedCapacity :
var action = new ActionBlock<int>(async id => { Console.WriteLine("[{0:T}] #{1}: Start", DateTime.Now, id); await Task.Delay(1000); Console.WriteLine("[{0:T}] #{1}: End", DateTime.Now, id); }, new ExecutionDataflowBlockOptions { BoundedCapacity = 10, MaxDegreeOfParallelism = DataflowBlockOptions.Unbounded });
source share