FAQ Database Discussion Community


TPL dataflow, MaxDegreeOfParallelism vs load balancing

task-parallel-library,tpl-dataflow
Through TPL dataflow one can assign MaxDegreeOfParallelism for the block to run in parallel, another way is to 'load balance' the load by connecting the source to multiple target by limit the BoundedCapacity of each target block. Question, what is the difference with two approaches, why do I even bother...

TPL Dataflow : How to throttle an entire pipeline?

c#,.net,task-parallel-library,throttling,tpl-dataflow
I want to limit the number of items posted in a Dataflow pipeline. The number of items depends of the production environment. These objects consume a large amount of memory (images) so I would like to post them when the last block of the pipeline has done its job. I...

ActionBlock Framework 4 rx alternative

c#,system.reactive,tpl-dataflow
I'm interested in an ActionBlock implementation for Framework 4.0, since there it seems that TPL.Dataflow isn't supported for Framework 4.0. More particularly, I'm interested in the case of the constructor that receives the Func<TInput, Task> delegate and the MaxDegreeOfParallism = 1 case. I thought about implementing it using reactive extensions,...

TPL Dataflow LinkTo only if no others match

.net,task-parallel-library,tpl-dataflow
I know the following works: var forwarder = new BufferBlock<SomeType>(); forwarder.LinkTo(target1, item => matchesTarget1(item)); forwarder.LinkTo(target2, item => matchesTarget2(item)); forwarder.LinkTo(DataflowBlock.NullTarget<SomeType>()); The problem is I will be linking and unlinking items continuously at runtime. Will dataflow choose from most specific to least specific or will it go in the order things were...

Guarantee TransformBlock output sequence

c#,multithreading,async-await,task-parallel-library,tpl-dataflow
From the TPL documentation As with ActionBlock<TInput>, TransformBlock<TInput,TOutput> defaults to processing one message at a time, maintaining strict FIFO ordering. However, in a multi-threaded scenario, i.e. if multiple threads are "simultaneously" doing SendAsync and then "awaiting" for a result by calling ReceiveAsync, how do we guarantee that the thread that...