mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lécharny <elecha...@gmail.com>
Subject Re: mina version 2.0.4, thread model
Date Sun, 12 Feb 2012 15:24:25 GMT
Le 2/12/12 12:58 PM, Asher, Angela a écrit :
> Hi,
>
> I am new to Mina, and I have a question regarding the thread model.
> I am now using the Executor.newCachedThreadPool()
> Which as I understand manages the I/O processor threads.
> My question is, does the amount of live I/O processor threads match the amount of open
sockets?
No. The ExecutorFilter is used to create a separate pool of threads when 
processing a message that has been already processed by one IoProcessor. 
You may have many IoProcessor already, and each session will be 
associated with one and only one IoProcessor. As one IoProcessor thus 
can handle many Sessions, it may be necessary to use another thread pool 
behind the IoProcessor to guarantee that a slow session will not block 
teh other sessions handled by the same IoProcessor.
> For example: if I have two open sockets, each one has it's own I/O processor thread,
No. Two sockets may perfectly be handled by one single IoProcessor. But 
they can also be managed by two, it depends on how and when they have 
been opened. Currently the used algorightm to spread the newly crated 
sessions is a round robin mechanism.
> or,
> Can a single thread handle the messageReceived events for example for both sockets, if
the thread is not busy when the events arriving.
Yes. And it's likely to be the case. That also means that if one session 
is very long to process, then all the other sessions will be pending, 
waiting for this session to terminate its execution.

Hope it helps.


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com


Mime
View raw message