Netty4: switch to composite cumulator (#49478)

The default merge cumulator used in netty transport leads to additional
GC pressure and memory copying when a message that exceeds the chunk
size is handled. This is especially a problem on G1 GC, since we get
many "humongous" allocations and that can in theory cause real memory
circuit breaker to break unnecessarily.
This commit is contained in:
Henning Andersen 2019-11-22 18:12:53 +01:00 committed by Henning Andersen
parent ca895d3ad5
commit 49bb5fb642
1 changed files with 4 additions and 0 deletions

View File

@ -32,6 +32,10 @@ final class Netty4SizeHeaderFrameDecoder extends ByteToMessageDecoder {
private static final int HEADER_SIZE = TcpHeader.MARKER_BYTES_SIZE + TcpHeader.MESSAGE_LENGTH_SIZE;
{
setCumulator(COMPOSITE_CUMULATOR);
}
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
try {