Hehe, that sounds like the logical value. My first search for 'netty tcpnodelay" returned this <a href="http://www.jboss.org/file-access/default/members/jbossmessaging/freezone/docs/usermanual-2.0.0.beta1/html/configuring-transports.html">http://www.jboss.org/file-access/default/members/jbossmessaging/freezone/docs/usermanual-2.0.0.beta1/html/configuring-transports.html</a><div>
which states "<span class="Apple-style-span" style="font-family: Verdana, Arial, Helvetica; font-size: 14px; "><tt class="literal" style="font-family: Verdana, Arial, Helvetica; font-size: 13px; color: rgb(17, 17, 17); ">jbm.remoting.netty.tcpnodelay</tt>. If this is <tt class="literal" style="font-family: Verdana, Arial, Helvetica; font-size: 13px; color: rgb(17, 17, 17); ">true</tt> then <a href="http://en.wikipedia.org/wiki/Nagle's_algorithm" target="_top" style="font-family: Verdana, Arial, Helvetica; font-size: 14px; color: rgb(0, 0, 204); ">Nagle's algorithm</a> will be enabled. The default value for this property is <tt class="literal" style="font-family: Verdana, Arial, Helvetica; font-size: 13px; color: rgb(17, 17, 17); ">true</tt>." </span></div>
<div><font class="Apple-style-span" face="Verdana, Arial, Helvetica" size="4"><span class="Apple-style-span" style="font-size: 14px;"><br></span></font></div><div><span class="Apple-style-span" style="font-family: Verdana, Arial, Helvetica; font-size: 14px; ">Clearly not easy to get right :)</span></div>
<div><font class="Apple-style-span" face="Verdana, Arial, Helvetica" size="4"><span class="Apple-style-span" style="font-size: 14px;"><br></span></font></div><div><font class="Apple-style-span" face="Verdana, Arial, Helvetica" size="4"><span class="Apple-style-span" style="font-size: 14px;"><br>
</span></font></div><div><font class="Apple-style-span" face="Verdana, Arial, Helvetica" size="4"><span class="Apple-style-span" style="font-size: 14px;">- Jannick</span></font></div><div><font class="Apple-style-span" face="Verdana, Arial, Helvetica" size="4"><span class="Apple-style-span" style="font-size: 14px;"><br>
</span></font><br><div class="gmail_quote">2010/1/8 "Trustin Lee (이희승)" <span dir="ltr"><<a href="mailto:trustin@gmail.com">trustin@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">Jannick Bitsch wrote:<br>
> Hi<br>
><br>
> One possibility is that the effect is caused by<br>
> <a href="http://en.wikipedia.org/wiki/Nagle's_algorithm" target="_blank">http://en.wikipedia.org/wiki/Nagle's_algorithm</a>. Could be that the tcp stack<br>
> holds on to the data with an increasing timeout algorithm, although that<br>
> doesn't really account for the variance. You can try to turn it off.<br>
><br>
> From<br>
> <a href="http://www.jboss.org/file-access/default/members/netty/freezone/api/3.2/index.html" target="_blank">http://www.jboss.org/file-access/default/members/netty/freezone/api/3.2/index.html</a><br>
> :<br>
> ServerBootstrap b = ...;<br>
> b.setOption("child.tcpNoDelay", true);<br>
><br>
> I actually think you need to set if to false to turn nagle's algorithm off,<br>
> although that doesn't seem very intuitive :)<br>
<br>
</div>Actually, setting tcpNoDelay to true disables Nagle's algorithm.<br>
Confusing! :)<br>
<div><div></div><div class="h5"><br>
> If that doesn't work, try to profile your gc and see if theres some<br>
> excessive object allocations or something, that could cause it to introduce<br>
> long pauses.<br>
><br>
><br>
> Regards<br>
> Jannick<br>
><br>
><br>
> 2010/1/7 justkevin <<a href="mailto:filter.netty@wx3.com">filter.netty@wx3.com</a>><br>
><br>
>> After noticing my game app was occasionally running sluggish, I spent quite<br>
>> a<br>
>> bit of time trying to figure out why without success. If anyone has<br>
>> suggestions on what to try I'd appreciate it. The details are long, but I<br>
>> don't know what might be important:<br>
>><br>
>> Details:<br>
>><br>
>> The client is written in AS3.<br>
>><br>
>> The server is written in Java using Netty 3.2 (I've updated to the most<br>
>> recent alpha).<br>
>><br>
>> I'm testing locally, with client and server on the same box.<br>
>><br>
>> When the first client connects, latency as measured with a round-trip ping<br>
>> pong is low, < 10 ms. It can remain low for a while, but eventually begins<br>
>> increasing in spurts at varying rates. For example, it might be < 10 ms<br>
>> for<br>
>> a while, then 50-100 ms for a while, then 100-200 ms, and so forth. There's<br>
>> no upper limit, I've seen delays in multiple seconds. The larger the<br>
>> latency, the larger the variance. The increases may be correlated to large<br>
>> bursts of data.<br>
>><br>
>> If I restart the client, the latency will usually drop, but not always.<br>
>> Sometimes it restarts high.<br>
>><br>
>> If I restart the server, the next client to connect will get a low latency.<br>
>><br>
>> Using system times, I've established that the latency is entirely on the<br>
>> downstream-- the ping takes 0ms to reach the server, and all the increase<br>
>> is<br>
>> between the time the pong is created and when its received by the client.<br>
>> >From this I'm guessing it's something with how I'm sending messages.<br>
>><br>
>> The only ChannelPipeline handler on outbound is a LengthFieldPrepender.<br>
>><br>
>> Here is how I'm sending the message:<br>
>><br>
>> // A Netty channel expects a message in the format of a<br>
>> ChannelBuffer:<br>
>> ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();<br>
>> // Wrap the buffer with a ChannelBufferOutputStream, which<br>
>> implements<br>
>> DataOutput<br>
>> // (our messages expect to write to a DataOutput)<br>
>> ChannelBufferOutputStream output = new<br>
>> ChannelBufferOutputStream(buffer);<br>
>> // First write the message id:<br>
>> output.writeByte(message.getId());<br>
>> // Then have the message write itself, checking to make sure<br>
>> the message<br>
>> // obeys its length contract:<br>
>> int beforeLength = output.writtenBytes();<br>
>> int written = message.write(output);<br>
>> if(beforeLength + written != output.writtenBytes()){<br>
>> logger.severe("Outbound message violated length<br>
>> contract:" + message);<br>
>> throw new RuntimeException("Message violated length<br>
>> contract:" +<br>
>> message);<br>
>> }<br>
>> // Finally, put into the channel. The channel pipeline<br>
>> should already have<br>
>> a length prepender:<br>
>> this.channel.write(buffer);<br>
>><br>
>> Thanks in advance for any suggestions,<br>
>> --<br>
>> View this message in context:<br>
>> <a href="http://n2.nabble.com/What-might-be-causing-increasing-latency-tp4269271p4269271.html" target="_blank">http://n2.nabble.com/What-might-be-causing-increasing-latency-tp4269271p4269271.html</a><br>
>> Sent from the Netty User Group mailing list archive at Nabble.com.<br>
>> _______________________________________________<br>
>> netty-users mailing list<br>
>> <a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>
>> <a href="https://lists.jboss.org/mailman/listinfo/netty-users" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-users</a><br>
>><br>
><br>
><br>
</div></div>> ------------------------------------------------------------------------<br>
<div><div></div><div class="h5">><br>
> _______________________________________________<br>
> netty-users mailing list<br>
> <a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/netty-users" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-users</a><br>
<br>
</div></div><font color="#888888">--<br>
what we call human nature in actuality is human habit<br>
<a href="http://gleamynode.net/" target="_blank">http://gleamynode.net/</a><br>
<br>
<br>
</font><br>_______________________________________________<br>
netty-users mailing list<br>
<a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/netty-users" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-users</a><br>
<br></blockquote></div><br></div>