Frequent questions about buffers: how they differ from caches, when they add latency, and how to pick a size.
- Buffer vs cache?
A cache stores for reuse; a buffer stores for transfer. A cache is read many times; a buffer is written and read once.
- When does a buffer add latency?
Always. The question is whether the latency is worth the throughput. Small buffers = low latency, low throughput. Large buffers = high throughput, high latency.
- How to pick a size?
Measure the burst. The buffer must absorb the worst spike without dropping, at the cost of the peak latency that the buffer introduces.
- Bounded vs unbounded?
Bounded always, unless you like OOM kills. Bound it, and decide what to do when full: block, drop, or spill to disk.