Peaks in Channel.write()

"Trustin Lee (이희승)" trustin at gmail.com
Thu Mar 25 01:33:33 EDT 2010


Old I/O tends to yields smaller latency because a write operation is
simply a blocking system call.  Not much complexity.

NIO is different - a write request is queued.  The queued request is
sometimes written immediately, but also sometimes written later when
there is a chance.  Moreover, there are often more than one connection
to handle in the same thread, which means one connection's write request
might be processed *after* the other connection's write request.

As the number of connections increases, NIO performs better because it
handles the same number of connections with smaller number of threads.
However, for relatively small number of connections, old I/O will have
lower latency.

Squigly wrote:
> Hello all.
> 
> When using NioServerSocketChannelFactory with
> Executors.newCachedThreadPool(), the average write(obj) times I'm seeing are
> around 0.2-0.3 millis. (Measured through a FutureListener).
> (There's only 1 active connection).
> Every once in a while, there's a write() that takes 8 - 9 millis.
> After about 3-4 hours of work (with a few 10K messages broadcast) every once
> in a while, there's a jump where a write() takes 30-40 millis and I've
> recorded some that took even 60-100.
> 
> All the messages are of the same size (~15 bytes).
> 
> Any idea what's going on?
> 
> off topic: When using OioServerSocket, I'm getting write() times of 0.02
> millis and even less. is there a good explanation as to why the huge decrees
> in write times?
> 
> Regards
> 
> 

-- 
what we call human nature in actuality is human habit
http://gleamynode.net/


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20100325/331bb75c/attachment-0001.bin 


More information about the netty-users mailing list