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:
parent
ca895d3ad5
commit
49bb5fb642
|
@ -32,6 +32,10 @@ final class Netty4SizeHeaderFrameDecoder extends ByteToMessageDecoder {
|
||||||
|
|
||||||
private static final int HEADER_SIZE = TcpHeader.MARKER_BYTES_SIZE + TcpHeader.MESSAGE_LENGTH_SIZE;
|
private static final int HEADER_SIZE = TcpHeader.MARKER_BYTES_SIZE + TcpHeader.MESSAGE_LENGTH_SIZE;
|
||||||
|
|
||||||
|
{
|
||||||
|
setCumulator(COMPOSITE_CUMULATOR);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
|
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue