How Tech - Systems Programming

How Tech - Systems Programming

Implementing Zero-Copy I/O using sendfile and splice for Network Services

Feb 07, 2026
∙ Paid

The naive approach to serving files over a network burns CPU cycles copying the same bytes multiple times. Reading a 100MB file from disk and sending it over a socket with traditional read()/write() loops forces the kernel to copy that data four times: disk → page cache → user buffer → kernel socket buffer → NIC. Each copy consumes memory bandwidth and CPU cycles. On a 10Gbps network pushing 1.25GB/s, this copying overhead can eat 40% of your CPU just shuffling bytes around.

When Netflix analyzed their CDN edge servers, they found 15% CPU usage from video streaming workers. Most of that was memcpy() between kernel and userspace. Switching to sendfile() dropped it to 2% - the kernel transferred data directly from page cache to socket buffers, letting DMA handle the NIC transfer while the CPU did useful work.

User's avatar

Continue reading this post for free, courtesy of Systems.

Or purchase a paid subscription.
© 2026 Sumedh S · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture