You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Brigham Stevens <br...@vikingmind.com> on 2007/04/27 20:31:25 UTC

just a little clarification on IoAcceptor construction & CachedThreadPool

Hello,
 
The docs say to pass in the number of IO processors you want, and suggest
the number of processors +1 as a good place to start. The docs also say that
you should always use a CachedThreadPool as the executor, which is an
unbounded pool by default:
 
        //  create an acceptor with 3 IO processor threads (on a dual core)
        IoAcceptor acceptor = new
SocketAcceptor(Runtime.getRuntime().availableProcessors() + 1,
                Executors.newCachedThreadPool());
        
        // configure the thread models
        IoServiceConfig acceptorConfig = acceptor.getDefaultConfig();
        acceptorConfig.setThreadModel(ThreadModel.MANUAL);
        
Will mina spawn more than 3 IoProcessors threads from the
Executors.newCachedThreadPool()for a dual core server given this example? Or
is the threadpool passed in used for another stage when the IoProcessor is
done, and is indeed ubounded? If it will spawn more threads from the pool,
then what is the limit on I/O processors mean? 
 
Thanks for clarifying this!
--brigham

Re: just a little clarification on IoAcceptor construction & CachedThreadPool

Posted by Trustin Lee <tr...@gmail.com>.
On 4/29/07, peter royal <pr...@apache.org> wrote:
>
> On Apr 27, 2007, at 8:31 PM, Brigham Stevens wrote:
> Will mina spawn more than 3 IoProcessors threads from the
> Executors.newCachedThreadPool()for a dual core server given this example? Or
> is the threadpool passed in used for another stage when the IoProcessor is
> done, and is indeed ubounded? If it will spawn more threads from the pool,
> then what is the limit on I/O processors mean?
>
> MINA will spawn "IoProcessor Count + 1" threads from the pool.
>
> The additional thread is the thread that is used for accepting new
> connections.

I clarified the documentation more:

http://cwiki.apache.org/MINA/configuring-thread-model.html

The changes will be rsync'd in a couple hours.

Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: just a little clarification on IoAcceptor construction & CachedThreadPool

Posted by peter royal <pr...@apache.org>.
On Apr 27, 2007, at 8:31 PM, Brigham Stevens wrote:
> Will mina spawn more than 3 IoProcessors threads from the  
> Executors.newCachedThreadPool()for a dual core server given this  
> example? Or is the threadpool passed in used for another stage when  
> the IoProcessor is done, and is indeed ubounded? If it will spawn  
> more threads from the pool, then what is the limit on I/O  
> processors mean?

MINA will spawn "IoProcessor Count + 1" threads from the pool.

The additional thread is the thread that is used for accepting new  
connections.

-pete


-- 
proyal@apache.org - http://fotap.org/~osi