Im almost sure thats because of this:<br><br> future.awaitUninterruptibly();<br><br>This will give you some overhead...<br><br>bye<br>norman<br><br>Am Mittwoch, 21. September 2011 schrieb ArvidSvensson &lt;<a href="mailto:arvid.svensson@gmail.com">arvid.svensson@gmail.com</a>&gt;:<br>
&gt; Hi there,<br>&gt; I&#39;m trying to burst data from a server to a clients and I can&#39;t get any<br>&gt; speed out of Netty&#39;s NIO channel.<br>&gt;<br>&gt; If I do the following with a *Nio*ServerSocketChannelFactory I get poor<br>
&gt; performance. The profiler tells me Channel#write eats CPU and I only get<br>&gt; ~20k messages/s @ ~20 bytes each to the client. I get ~20k both over network<br>&gt; and localhost loop-back. If I do the same with a<br>
&gt; *Oio*ServerSocketChannelFactory I roughly double to ~40k messages/s over<br>&gt; network and well above 100k messages/s on localhost loop-back.<br>&gt;<br>&gt; while (true) {<br>&gt;    Object message = nextMessage();<br>
&gt;    ChannelFuture future = channel.write(message); // call write from<br>&gt; non-I/O worker.<br>&gt;    future.awaitUninterruptibly();<br>&gt; }<br>&gt;<br>&gt;<br>&gt; If I do the following with a *Oio*ServerSocketChannelFactory it hangs. If I<br>
&gt; do it with *Nio*ServerSocketChannelFactory I almost match the ~40k<br>&gt; messages/s.<br>&gt;<br>&gt; Object message = nextMessage();<br>&gt; ChannelFuture future = channel.write(message); // call write from non-I/O<br>
&gt; worker.<br>&gt; future.addListener(new ChannelFutureListener() {<br>&gt;    public void operationComplete(ChannelFuture future) {<br>&gt;         Object message = nextMessage();<br>&gt;         channel.write(message).addListener(this); // call write from I/O<br>
&gt; worker.<br>&gt;    }<br>&gt; });<br>&gt;<br>&gt; Why is it so expensive to call (NIO) Channel#write from a non-I/O worker?<br>&gt;<br>&gt; If I have the next message available when the previous future signals<br>&gt; operationComplete everything is fine since I can call write on the<br>
&gt; I/O-worker. However, If I miss that moment I&#39;m forced to write to the<br>&gt; channel from a non-I/O worker again takin a bit hit.<br>&gt;<br>&gt; --<br>&gt; View this message in context: <a href="http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Slow-writes-from-outside-an-I-O-worker-tp6817213p6817213.html">http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Slow-writes-from-outside-an-I-O-worker-tp6817213p6817213.html</a><br>
&gt; Sent from the Netty User Group mailing list archive at Nabble.com.<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">https://lists.jboss.org/mailman/listinfo/netty-users</a><br>&gt;