Reputation: 12817
I have 8 Netty Server Channels listening on different ports (HTTP/S, WebSocket, MQTT, TCP, etc). From source code I see that all of this servers will share same allocator - ByteBufAllocator.DEFAULT
. So my question - is that recommended way to use same allocator among different servers? Or I can create separate allocator for every server? Like this :
ByteBufAllocator allocator = new PooledByteBufAllocator();
b.childOption(ChannelOption.ALLOCATOR, allocator)
b.option(ChannelOption.ALLOCATOR, allocator)
Upvotes: 2
Views: 342
Reputation: 12817
Ok, so for those who have the same question - it is better to reuse the default allocator as your app, in that case, will actually allocate less memory. However, creating own allocator per listening socket will decrease the level of contention between the channels. But as for most apps, this is not a case single allocator is better.
Upvotes: 1