How to reduce netty garbage production?

那年仲夏 提交于 2020-01-12 19:26:03

问题


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:


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

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



来源:https://stackoverflow.com/questions/9108930/how-to-reduce-netty-garbage-production

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!