sendfile zero-copy

During the traditional read/write network file transfer process, the file data actually goes through four copy operations:


Hard disk—>kernel buf—>user buf—>socket related buffer—>protocol engine

 

The sendfile system call reduces the above multiple copies and improves file transfer performance:

 

Hard disk—>kernel buf—> user buf—> socket related buffer—>protocol engine

1. The sendfile system call, the file data is copied to the kernel buffer
2, then copied from the kernel buffer to the socket-related buffer in the kernel
3, and finally the socket-related buffer is copied to the protocol engine

 

Reduced the file copy of kernel buf to user buf , and then from user buf to socket related buffer

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326353483&siteId=291194637