What is Zero-Copy

Zero-copy networking moves data from the network card to the application without copying it through intermediate kernel buffers — saving CPU cycles and memory bandwidth that would otherwise be spent on redundant data movement.

What is the traditional path?

When a packet arrives on a standard network interface:

  1. The NIC writes the packet into a kernel buffer via DMA (Direct Memory Access).
  2. The kernel processes headers and copies the payload into a user-space buffer when the application calls read().

That's at least one copy, sometimes two. At 100 Gbps, copying 12.5 gigabytes per second through the CPU just to move data between buffers wastes enormous amounts of processing power.

How does zero-copy work?

Zero-copy techniques eliminate these intermediate copies. The main approaches are:

  • Shared memory — the kernel and application share the same buffer. The NIC writes data into a region that the application can read directly, with no copy needed. io_uring supports this model.
  • Memory mapping — the application maps the kernel's packet buffer into its address space using mmap(). The data stays in one place; only a pointer is passed.
  • Sendfile — for serving files over the network, sendfile() transfers data directly from the filesystem cache to the network socket without passing through user space at all.
  • Hardware offloadDPUs and SmartNICs can place data directly into application-accessible memory regions.

What are the tradeoffs?

Zero-copy adds complexity. The application and kernel must coordinate carefully about when buffers can be reused. If the application frees a buffer while the NIC is still writing to it, you get corruption. Most zero-copy APIs require explicit buffer management that is harder to program than simple read() and write() calls.

Why it matters

At modern network speeds, the CPU cost of copying data exceeds the cost of processing it. Zero-copy is not an optimization — it's a requirement. Any system handling 100 Gbps or more needs zero-copy techniques to avoid turning the CPU into an expensive memory-copy engine.