Netty: how do I reduce delay between consecutive messages from the server?

I'm on the dev team for a socket server which uses Netty. When a client sends a request, and the server sends a single response, the round trip time is quite fast. (GOOD) We recently noticed that if the request from the client triggers two messages from the server, even though the server writes both messages to the client at about the same time, there is a delay of more than 200ms between the first and second message arriving on the remote client. When using a local client the two messages arrive at the same time. If the remote client sends another request before the second message from the server arrives, that second message is sent immediately, but then the two messages from the new request are both sent with the delay of over 200ms. Since it was noticed while using Netty 3.3.1, I tried upgrading to Netty 3.6.5 but I still see the same behavior. We are using NIO, not OIO, because we need to be able to support large numbers of concurrent clients. Is there a setting that we need to configure that will reduce that 200+ ms delay? editing to add a code snippet. I hope these are the most relevant parts. @Override public boolean openListener(final Protocol protocol, InetSocketAddress inetSocketAddress) throws Exception { ChannelFactory factory = new NioServerSocketChannelFactory( Executors.newCachedThreadPool(), Executors.newCachedThreadPool(), threadingConfiguration.getProcessorThreadCount()); ServerBootstrap bootstrap = new ServerBootstrap(factory); final ChannelGroup channelGroup = new DefaultChannelGroup(); bootstrap.setPipelineFactory(new ChannelPipelineFactory() { .... lots of pipeline setup snipped ...... }); Channel channel = bootstrap.bind(inetSocketAddress); channelGroup.add(channel); channelGroups.add(channelGroup); bootstraps.add(bootstrap); return true; } The writer factory uses ChannelBuffers.dynamicBuffer(defaultMessageSize) for the buffer, and when we write a message it's Channels.write(channel, msg). What else would be useful? The developer who migrated the code to Netty is not currently available, and I'm trying to fill in.
Could you supply the applicable parts of your code?

以上就是Netty: how do I reduce delay between consecutive messages from the server?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏