[SPARK-CORE] Why RPC message are transferred with header and body separately in TCP frame
This post has NOT been accepted by the mailing list yet.
After seeing the details of how spark leverage netty, I found one question, typically RPC message wire format would have a header+payload structure, and netty uses a TransportFrameDecoder to deal with how to determine a complete message from remote peer. But after using Wireshark sniffing tool, I found that the message are sent separately with header and then followed by body, although this works fine, but for underlying TCP there would be ACK segments sent back to acknowledge, there might be a little bit redundancy since we can sent them together and the header are usually very small.
The main reason can be found in MessageWithHeader class, since transferTo method write tow times for header and body.
Could someone help me understand the background story on why to implement in such way? Thanks!