How to reduce net garbage production?

I have a network application that processes about 40 thousand msg / sec written using the netty grid, and I want to reduce the number of garbage collector calls. During profiling, I discovered that there are a significant number of byte[] instances, and I suspect that it comes from this part of the code:

 public class MessageHandler extends SimpleChannelHandler { public void messageReceived(ChannelHandlerContext ctx, final MessageEvent e) { ChannelBuffer message = (ChannelBuffer) e.getMessage(); } } 

Is it possible to get netty to reuse / pool ChannelBuffers some way to prevent it from being created every time?

+6
source share
1 answer

We plan to implement buffer merging, but it has not yet been done.

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

+5
source

Source: https://habr.com/ru/post/907464/


All Articles