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