How to reduce netty garbage production?

2020-07-11 05:13发布

I have network application that handles about 40k msg/sec written using netty framework and I want to reduce the number of garbage collector calls. While profiling I found that there is significant amount of byte[] instances and I suspect that it comes from this part of code :

public class MessageHandler extends SimpleChannelHandler {

public void messageReceived(ChannelHandlerContext ctx, final MessageEvent e) {

    ChannelBuffer message = (ChannelBuffer) e.getMessage();
}

}

Is it possible to force netty to reuse/pool ChannelBuffers somehow to prevent it to construct them every time?

1条回答
时光不老,我们不散
2楼-- · 2020-07-11 05:23

We plan to implement pooling of buffers, but its not done yet.

See https://github.com/netty/netty/issues/62

查看更多
登录 后发表回答