I have written a HTTP server and I have an issue where there's a 100 ms to 1 second delay between these two events for majority of requests.
Below are a few of examples I am sharing. There are many more
There's a very strange delay here in which I cannot figure out where it's coming from
this.bootstrap.group(bossGroup, workerGroup)
.channel(isLinux
? EpollServerSocketChannel.class
: NioServerSocketChannel.class)
.childHandler(new ChannelInitializer<SocketChannel>() {
@Override
protected void initChannel(SocketChannel c) throws Exception {
ChannelPipeline pipeline = c.pipeline();
pipeline.addLast("requestIdleHandler", new IdleStateHandler(60, 60, 60, TimeUnit.SECONDS));
pipeline.addLast("requestCodec", new HttpServerCodec());
pipeline.addLast("requestAggregator", new HttpObjectAggregator(64 * 1024));
pipeline.addLast("requestHandler", new RequestHandler(feeder));
}
});
this.bootstrap.handler(new ChannelInboundHandlerAdapter() {
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
logger.info(Utility.LOG.system(ctx.channel().localAddress() + " started."));
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
logger.info(Utility.LOG.system(ctx.channel().localAddress() + " closed."));
}
}).option(ChannelOption.SO_BACKLOG, configs.getQueueSize())
.option(ChannelOption.SO_REUSEADDR, true)
.option(ChannelOption.TCP_NODELAY, true)
.childOption(ChannelOption.TCP_NODELAY, true)
.bind(hostAddress, hostPort).sync();