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?