Skip to content

What it is

A buffer is a temporary memory region that holds data between a producer and a consumer, so neither has to wait for the other.

A buffer absorbs differences in throughput. A network card delivers packets at 10 Gbit/s; the application reads them at 500 Mbit/s. Without a buffer, most packets would be dropped. With a buffer, they queue in kernel memory, and the application drains them at its own pace.

Buffers exist in every layer: CPU caches, disk controllers, network sockets (SO_RCVBUF, SO_SNDBUF), keyboard input, audio output, video streaming, HTTP response bodies. A buffer is different from a cache: a cache holds data for reuse; a buffer holds data for transfer.