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 <<a href="mailto:arvid.svensson@gmail.com">arvid.svensson@gmail.com</a>>:<br>
> Hi there,<br>> I'm trying to burst data from a server to a clients and I can't get any<br>> speed out of Netty's NIO channel.<br>><br>> If I do the following with a *Nio*ServerSocketChannelFactory I get poor<br>
> performance. The profiler tells me Channel#write eats CPU and I only get<br>> ~20k messages/s @ ~20 bytes each to the client. I get ~20k both over network<br>> and localhost loop-back. If I do the same with a<br>
> *Oio*ServerSocketChannelFactory I roughly double to ~40k messages/s over<br>> network and well above 100k messages/s on localhost loop-back.<br>><br>> while (true) {<br>> Object message = nextMessage();<br>
> ChannelFuture future = channel.write(message); // call write from<br>> non-I/O worker.<br>> future.awaitUninterruptibly();<br>> }<br>><br>><br>> If I do the following with a *Oio*ServerSocketChannelFactory it hangs. If I<br>
> do it with *Nio*ServerSocketChannelFactory I almost match the ~40k<br>> messages/s.<br>><br>> Object message = nextMessage();<br>> ChannelFuture future = channel.write(message); // call write from non-I/O<br>
> worker.<br>> future.addListener(new ChannelFutureListener() {<br>> public void operationComplete(ChannelFuture future) {<br>> Object message = nextMessage();<br>> channel.write(message).addListener(this); // call write from I/O<br>
> worker.<br>> }<br>> });<br>><br>> Why is it so expensive to call (NIO) Channel#write from a non-I/O worker?<br>><br>> If I have the next message available when the previous future signals<br>> operationComplete everything is fine since I can call write on the<br>
> I/O-worker. However, If I miss that moment I'm forced to write to the<br>> channel from a non-I/O worker again takin a bit hit.<br>><br>> --<br>> 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>
> 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">https://lists.jboss.org/mailman/listinfo/netty-users</a><br>>