From rocketmq to zero copy

Source: Internet
Author: User
Tags sendfile

Rocketmq is Alibaba's open-source MQ.

The Network implementation of rocketmq depends on netty.

Http://my.oschina.net/plucury/blog/192577 this article describes netty's zero copy implementation:

According to the description in the article, "sendfile () in Linux and filechannel in Java NiO. the transferto () method implements the zero copy function. "It seems that" filechannel. transferto () and sendfile () are implemented at the same layer. "netty encapsulates the filechannel of NiO in fileregion. transferto ().

At the same time, netty has another form of zero copy, that is, netty allows us to merge multiple segments of data into a whole segment of virtual data for users to use, without the need to copy the data during the process. Netty uses compositechannelbuffer to form a virtual channelbuffer for operations in user space. In this process, only the reference of channelbuffer is operated.


--------------------------- I am a split line.


However, if compared with the scope of C's capabilities, Java's limitations are exposed.

C can rewrite some network software stacks to directly send data from the DMA or Nic buffer, without even having to finish the entire network stack (Java can only be stunned ~)

Http://blog.csdn.net/jiangbo_hit/article/details/6146502 to add a reference, content is what you guess

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.