springcloud-community / springcloud-comment

0 stars 0 forks source link

post/2022-03/zero-copy/ #17

Open utterances-bot opened 11 months ago

utterances-bot commented 11 months ago

Improve file download efficiency with Zero Copy - Spring Cloud

Zero-Copy The “zero” of zero-copy means that the number of times data is copied between user and kernel states is zero. Traditional data copying (file-to-file, client-to-server, etc.) involves four user-state to kernel-state switches and four copies. two of the four copies between user-state and kernel-state require CPU participation, while two copies between kernel-state and IO devices do not require CPU participation in DMA mode. Zero-copy avoids copying between user and kernel states (2 times) and reduces the switching between user and kernel states twice, so the data transfer efficiency is high.

https://www.springcloud.io/post/2022-03/zero-copy/

zhaozhentao commented 11 months ago

good

lfz757077613 commented 9 months ago

It's not real Zero Copy, WritableByteChannelImpl do not support it.For tomcat, you should set http request attribute "sendFile*" in https://tomcat.apache.org/tomcat-10.1-doc/api/org/apache/coyote/Constants.html. FileChannel, SelChImpl support Zero Copy in FileChannelImpl.transferToDirectly()

KevinBlandy commented 9 months ago

It's not real Zero Copy, WritableByteChannelImpl do not support it.For tomcat, you should set http request attribute "sendFile*" in https://tomcat.apache.org/tomcat-10.1-doc/api/org/apache/coyote/Constants.html. FileChannel, SelChImpl support Zero Copy in FileChannelImpl.transferToDirectly()

谢谢指点。