TPL data flow, MaxDegreeOfParallelism, and load balancing

Through the TPL datastream, you can assign MaxDegreeOfParallelism to execute a block in parallel, another way is to "load balance" the load by connecting the source to multiple targets by limiting the BoundedCapacity of each target block.

Question: what's the difference with the two approaches, why am I even bothering about load balancing if I can just set MaxDegreeOfParallelism?

+3


source to share


1 answer


MaxDegreeOfParallelism enforces how many instances of a task can run concurrently at the task scheduler layer, which is absolutely necessary as you can easily set it to call your data flow network. “Load balancing,” as you call it, is not really a realistic concept.



Linking to multiple targets requires either a broadcast block (which you don't want as it will publish to all target blocks) or a predicate to define the flow. This will be messy and very discreet as you will need to keep track of which block the next message has. The TPL is more consistent with the Actor model, where the message is state, so trying to inject such a dynamic binding state is not actually model compliant.

0


source







All Articles