TPL Dataflow Starvation Fixed


TPL Dataflow Starvation Fixed

Great news for all TPL Dataflow developers.

The old  bug (more than a year since I reported it) was finally fixed at version 4.5.24.

now it is safe to use fallback scenario with TPL Dataflow.

ISourceBlock, ITargerBlock, TDF, TPL, TPL Dataflow, Bug, Fallback, Frame, Bounded Capacity

for example: if you’re having 2 face recognition algorithm:

* excellent but slow

* fine and fast

and you want to use those algorithm on a video streams without getting to much

behind. You can limit the Bounded Capacity of the excellent algorithm’s block,

link the two algorithm’s blocks to a buffer block.

As long as the excellent algorithm stand the pace you will have the best recognition

but when it start to get behind, it will reach the bounded capacity and the fast algorithm

will start to process messages until the excellent algorithm will get below the bounded capacity.

the code will look something like:

Code Snippet
  1. var excellentAlgorithmYetSlow =
  2.     new ActionBlock<byte[]>(frame =>
  3.     {
  4.         // put you're excellent algorithm here
  5.     },
  6.     new ExecutionDataflowBlockOptions
  7.     {
  8.         BoundedCapacity = 20
  9.     } );
  10. var fineAndFastAlgorithm =
  11.     new ActionBlock<byte[]>(frame =>
  12.     {
  13.         // put you're fast algorithm here
  14.     });
  15. var input = new BufferBlock<byte[]>();
  16. input.LinkTo(excellentAlgorithmYetSlow);
  17. input.LinkTo(fineAndFastAlgorithm);
  19. // now you can start sending frames



I was waiting for this fix for a long time and I got fixed right on time because I really

need it now in at one of mine customers.

Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>