Hi ,
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
DEBUG|2016-23-08
22:10:12.239|epollEventLoopGroup-4-1|RequestHandler|channelActive|system|/196.99.89.134:51871
connected
DEBUG|2016-23-08
22:10:13.085|epollEventLoopGroup-4-1|RequestHandler|channelRead0|system|Remote
Address: /196.99.89.134:51871|Request Received
DEBUG|2016-23-08
22:10:10.392|epollEventLoopGroup-4-5|RequestHandler|channelActive|system|/196.99.89.134:51870
connected
DEBUG|2016-23-08
22:10:11.233|epollEventLoopGroup-4-5|RequestHandler|channelRead0|system|Remote
Address: /196.99.89.134:51870|Request Received
DEBUG|2016-23-08
22:10:08.752|epollEventLoopGroup-4-4|RequestHandler|channelActive|system|/196.99.89.134:51869
connected
DEBUG|2016-23-08
22:10:09.378|epollEventLoopGroup-4-4|RequestHandler|channelRead0|system|Remote
Address: /196.99.89.134:51869|Request Received
There's a very strange delay here in which I cannot figure out where it's
coming from
To the source code
For the server
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();
The Request handler
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
Channel channel = ctx.channel();
channels.add(channel);
logger.debug(Utility.LOG.system(channel.remoteAddress() + "
connected"));
}
What could be the problem ?
--
You received this message because you are subscribed to the Google Groups
"Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/netty/629c7d97-7238-4f01-a4d0-fc09f7099ffb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.