Benefits of using BufferBlock<T> in dataflow networks


  • I was wondering if there are benefits associated with using a BufferBlock linked to one or many ActionBlocks, other than throttling (using BoundedCapacity), instead of just posting directly to ActionBlock(s) (as long as throttling is not required).
    I do think that using a BufferBlock and posting items to buffer instead of directly to ActionBlocks does seem to be cleaner way of organizing the network, but not quite sure if overhead (if any) of having a BufferBlock as an extra step is worth it.
    Monday, October 08, 2012 12:24 PM


  • Other situations in which you might want to do this include:

    - Buffering up the data before you want it processed, and then later connecting it to the targets

    - Related, temporarily stopping the flow of data by unlinking the buffer from the target

    - Related to your throttling comments, using the buffer to store the data which is then load balanced across multiple bounded targets


    If you don't need the extra flexibility of having the separate buffer, then you can certainly go to the ActionBlock directly, and doing so will have less overhead.

    Friday, October 12, 2012 6:40 PM