Zero Copy data transfer
Improving the performance of I/O-intensive applications
Zero copy lets you avoid redundant data copies between intermediate buffers and reduces the number of context switches between user space and kernel space.
Steps involved in sending file to Socket in general
- Read data from the storage media to the page cache in an OS
- Copy data in the page cache to an application buffer
- Copy application buffer to another kernel buffer
- Send the kernel buffer to the socket
Includes 4 data copying and 2 system calls
On Linux and Unix OS there exists a sendfile API that can directly transfer bytes from a file channel to a socket channel
This typically avoids 2 of the copies and 1 system call introduced in steps (2) and (3).