Github user aarondav commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5234#discussion_r27505400
  
    --- Diff: 
network/common/src/main/java/org/apache/spark/network/protocol/MessageEncoder.java
 ---
    @@ -72,9 +80,84 @@ public void encode(ChannelHandlerContext ctx, Message 
in, List<Object> out) {
         in.encode(header);
         assert header.writableBytes() == 0;
     
    -    out.add(header);
         if (body != null && bodyLength > 0) {
    -      out.add(body);
    +      out.add(new MessageWithHeader(header, headerLength, body, 
bodyLength));
    +    } else {
    +      out.add(header);
         }
       }
    +
    +  /**
    +   * A wrapper message that holds two separate pieces (a header and a 
body) to avoid
    +   * copying the body's content.
    +   */
    +  private static class MessageWithHeader extends AbstractReferenceCounted 
implements FileRegion {
    --- End diff --
    
    Right, it is not documented because nio is currently "fast enough" and 
because epoll in the past was less stable.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to