Slow writes from outside an I/O-worker?
ljohnston
johnstlr at yahoo.co.uk
Thu Sep 22 09:21:24 EDT 2011
ArvidSvensson wrote:
>
> 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.
>
> while (true) {
> Object message = nextMessage();
> ChannelFuture future = channel.write(message); // call write from
> non-I/O worker.
> future.awaitUninterruptibly();
> }
>
Is it necessary to wait for the write to complete before writing the next
message? Netty maintains an internal write queue per channel which helps
with bursty traffic. You can write to the channel until the channel is not
writable then wait until you receive a channelInterestChanged event stating
that the channel is writable again. Take a look at the
http://docs.jboss.org/netty/3.2/xref/org/jboss/netty/example/discard/DiscardClientHandler.html
DiscardClientHandler .
The main difference is that you'll want to notify your thread to start
generating traffic again in channelInterestChanged to avoid blocking the I/O
thread.
Cheers
Lee
--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Slow-writes-from-outside-an-I-O-worker-tp6817213p6820154.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list