coderzc opened a new issue, #15631:
URL: https://github.com/apache/pulsar/issues/15631

   ## Motivation
   
   Currently, when the `Proxy` server transfer data will have four triggered 
the user mode and kernel mode of context switching, respectively is the read() 
/ write() call and return when cut, it is inefficient for the `Proxy`.
   
   There is an efficient way of reducing the number of copies of data and , use 
[`splice`](https://man7.org/linux/man-pages/man2/splice.2.html) system call for 
linux system.
   
   Data transfer process diagram of `splice`:
   
   <img width="619" alt="image" 
src="https://user-images.githubusercontent.com/26179648/168755276-76a6d222-7643-4f8c-80ef-1c7077dfe1ef.png";>
   
   More details about the proxy protocol see:
   * [man splice](https://man7.org/linux/man-pages/man2/splice.2.html)
   *  
[design_and_implementation_of_zero_copy_data_path_for_efficient](https://static.aminer.org/pdf/PDF/000/253/158/design_and_implementation_of_zero_copy_data_path_for_efficient.pdf)
   * [Two new system calls: splice() and 
sync_file_range()](https://lwn.net/Articles/178199/)
   
   ## Goal
   
   Support zero-copy of NIC to NIC on Proxy, we can get some benefits:
   * Reduce the CPU load
   * Improve the network throughput
   * Reduce the delay
   
   ## Implementation
   
   * Use [`splice`](https://man7.org/linux/man-pages/man2/splice.2.html) system 
call instead of read() / write() for linux system.
   * It should only work as `proxyLogLevel == 0`
   * For `HAProxy`, it should be transformed to transform 
`HAProxyMessageDecoder` to compatible with this optimization
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to