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?
It supports SSL/TLS, has both blocking and non-blocking unified APIs, and a flexible threading model. It's also fast and performant. Netty's asynchronous, non-blocking I/O model is designed for highly scalable architectures and may allow for higher throughput than an analogous blocking model.
The gc() method is used to invoke the garbage collector to perform cleanup processing. The gc() is found in System and Runtime classes.
We plan to implement pooling of buffers, but its not done yet.
See https://github.com/netty/netty/issues/62
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With