Very long delay when sending a simple message

jartur jartur at l-square.net
Wed Jan 26 23:08:10 EST 2011


Hello,

I'm having a little trouble here which I cannot resolve and I do not
understandd why it occurs and what to tune. I have a very simple Netty
server which just serves Adobe Flash policy requests. It receives
"<policy-file-request/>\0" and sends back a simple String with appropriate
policy XML. I use DelimiterBasedFrameDecoder with null delimiter to split
requests, StringDecoder to get a string and StringEncoder to send a
response.

I set tcpNoDelay to true for a connected channel. When I receive message in
my main handler I do 

if (msg.equalsIgnoreCase(PolicyServer.POLICY_REQUEST))
{
  PolicyServer.ex.execute(new Runnable() {
    public void run()
    {
      e.getChannel().write(PolicyServer.POLICY_XML +
"\0").addListener(ChannelFutureListener.CLOSE);
    }
  });
}

I do writing in a separate thread pool because I had problems previously
with writing from the same thread (everything just becomes slow to react).
Now, with .addistener(ChannelFutureListener.CLOSE) everything works just
fine, but when it wasn't there (which is the case  for my other, much more
complex server where I keep long-running sessions) I noticed that client
first received about 250 bytes and then only after about 9 seconds did it
receive the rest of the message. I'm worried about this because in case of
my other server this behaviour might lead to client not receiving full
packet of data in time which is crucial because client must react to certain
messages within rather short amount of time (say, couple of seconds). I
tried to search the Internet for this but I really don't know how to make a
correct search query or so it seems. Please, if you can tell me what I
should do to avoid such stalls I would be very grateful.

Thank you,
Ilya
-- 
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Very-long-delay-when-sending-a-simple-message-tp5965153p5965153.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list