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