public class BGPDispatcherImpl implements BGPDispatcher, AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(BGPDispatcherImpl.class);
private static final int SOCKET_BACKLOG_SIZE = 128;
+ private static final int HIGH_WATER_MARK = 256 * 1024;
+ private static final int LOW_WATER_MARK = 128 * 1024;
+
private final MD5ServerChannelFactory<?> serverChannelFactory;
private final MD5ChannelFactory<?> channelFactory;
private final BGPHandlerFactory handlerFactory;
// Make sure we are doing round-robin processing
bootstrap.option(ChannelOption.MAX_MESSAGES_PER_READ, 1);
bootstrap.option(ChannelOption.SO_KEEPALIVE, Boolean.TRUE);
+ bootstrap.option(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, HIGH_WATER_MARK);
+ bootstrap.option(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, LOW_WATER_MARK);
if (bootstrap.group() == null) {
bootstrap.group(this.workerGroup);
serverBootstrap.childHandler(BGPChannel.createChannelInitializer(initializer, new DefaultPromise(BGPDispatcherImpl.this.executor)));
serverBootstrap.option(ChannelOption.SO_BACKLOG, Integer.valueOf(SOCKET_BACKLOG_SIZE));
serverBootstrap.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
+ serverBootstrap.childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, HIGH_WATER_MARK);
+ serverBootstrap.childOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, LOW_WATER_MARK);
if (this.keys.isPresent()) {
if (this.serverChannelFactory == null) {
throw new UnsupportedOperationException("No key access instance available, cannot use key mapping");