I've been reading Norman Maurer's presentation on Netty best practices and had a question about using direct buffers versus heap buffers. One slide recommends "always use direct ByteBuffer when writing to SocketChannel," but another encourages using heap buffers when using MessageToByteEncoder
. I don't think I quite get the nuances in the second slide; in the MessageToByteEncoder
case, why does using heap buffers "save extra byte copies?"
Thanks!