Thread pooling in AIO/

Nord, James JNord at nds.com
Thu Dec 18 04:34:33 PST 2008


> Although the AsynchronousDatagramChannel is simple I wouldn't 
> expect the performance to be too bad. Is it keeping up with 
> the multicast load or are you seeing packet loss? I recall 
> you were trying out the multicast support in DatagramChannel 
> so I'm curious if this was the same load.

It is keeping up - 
but with CachedPool the load is much higher than with plain old java.net
and much higher than the synchronous nio2.
With a fixedPool (size of 8 on dual quad core box) the load is slightly
higher than java.net and synchronous nio2.

We are seeing the occaisonal lost packets with Async IO - but we're
experimenting to find the best tradeoff of load and packet loss.


> > But that is my point - you have to supply the pool (via the 
> executor) 
> > *and also* to the AsynchronousChannelGroup.
> >
> > E.g. for a fixed pool you need the following:
> > 	ExecutorService executor = Executors.newFixedThreadPool(8);
> > 	AsynchronousChannelGroup group =
> > AsynchronousChannelGroup.withFixedThreadPool(executor, 8);		
> >
> > And for a cached pool you need:
> > 	ExecutorService executor = Executors.newCachedThreadPool();
> > 	AsynchronousChannelGroup group =
> > AsynchronousChannelGroup.withCachedThreadPool(executor, 4);	
> >
> >
> > Why don't we just have
> > 	ExecutorService executor = // whatever executor type 
> you want / fixed 
> > cached etc...
> > 	AsynchronousChannelGroup group =
> > AsynchronousChannelGroup.withThreadPool(executor);
> >   
> Others have also commented on this so there is a
> withThreadPool(executor) in for the next build. It's identical to
> withCachedThreadPool(executor,0) as this method can be 
> invoked with any executor service.

> > Does the group really care if its fixed or cached - doesn't it just 
> > want something to do some work?
> >   
> This page attempts to explain it:
>   http://openjdk.java.net/projects/nio/resources/AsynchronousIo.html

OK.

*********************************************************************************************************
This e-mail is confidential, the property of NDS Ltd and intended for the addressee only.  Any dissemination, copying or distribution of this message or any attachments by anyone other than the intended recipient is strictly prohibited.  If you have received this message in error, please immediately notify the postmaster at nds.com and destroy the original message.  Messages sent to and from NDS may be monitored.  NDS cannot guarantee any message delivery method is secure or error-free.  Information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses.  We do not accept responsibility for any errors or omissions in this message and/or attachment that arise as a result of transmission.  You should carry out your own virus checks before opening any attachment.  Any views or opinions presented are solely those of the author and do not necessarily represent those of NDS.

To protect the environment please do not print this e-mail unless necessary.

NDS Limited Registered office: One Heathrow Boulevard, 286 Bath Road, West Drayton, Middlesex, UB7 0DQ, United Kingdom. A company registered in England and Wales  Registered no. 3080780   VAT no. GB 603 8808 40-00
**********************************************************************************************************



More information about the nio-discuss mailing list