Skip to content

Buffer strategies

Choose the size for your worst burst, use ring buffers for bounded memory, and monitor fill level to catch pressure.

Buffers that behave

  1. Size for the worst burst

    A 1 KB buffer for a 10 Gbit/s network drops packets. Size to the peak, not the average.

  2. Ring buffers for bounded memory

    A fixed-size circular buffer never grows: when full, oldest data is overwritten or the producer blocks.

  3. Monitor fill level

    A buffer at 90% is a buffer that will overflow soon. Alert before it does.

  4. Flush on shutdown

    A buffer that loses its data on shutdown is a data-loss bug waiting for a disk fill.

  5. Bounded is safer than unbounded

    An unbounded buffer is a memory leak that grows on backpressure.