0
我有8个Netty服务器通道监听不同的端口(HTTP/S,WebSocket,MQTT,TCP等)。从源代码我看到,所有这些服务器将共享相同的分配器 - ByteBufAllocator.DEFAULT
。所以我的问题 - 推荐在不同服务器之间使用相同分配器的方式吗?或者我可以为每个服务器创建单独的分配器?就像这样:我应该在不同的netty ServerChannel中共享相同的ByteBuf分配器吗?
ByteBufAllocator allocator = new PooledByteBufAllocator();
b.childOption(ChannelOption.ALLOCATOR, allocator)
b.option(ChannelOption.ALLOCATOR, allocator)