Hi,
Darryl Pentz wrote:
I'm trying to get my head around the way that MINA 1.1.7. configuration is
meant to work.
First, I think that you should switch to MINA 2.0.0-M6. The Thread model
is much easier. Also consider that this version is mainained, and
performances are better. That being said ...
The current implementation I'm using is basically the default implementation. No arg SocketAcceptor() constructor, with no ExecutorFilter in the filter chain. This leads to the AnonymousIoService thread pool that I observe in the thread dumps.
However if I look at this: http://mina.apache.org/configuring-thread-model.html
it appears I am not using the correct strategy, and the suggestion is to
disable the default threading model and instead specify separate Executor
thread pools. If I understand it correctly, there appears to be 1 IoAcceptor
thread, N IoProcessor threads (N being the number you specify, suggested to be
#CPU's + 1) and then an executor threadpool to do the 'work'.
What I'm struggling to understand is why the IoAcceptor requires a threadpool
in addition to the ExecutorFilter threadpool. What is the IoAcceptor threadpool
used for? If there's only 1 IoAcceptor threads, and (in my case) 3 IoProcessor
threads, then what is the threadpool used for? Furthermore, what is the
consequence of this approach using an ExecutorFilter over the current default
approach I'm using.
As we associate a session with an IoProcessor, when a message is
processed by this IoProcessor, no other session can be processed by this
IoProcessor. If the handler takes a while to process the event, then it
will block potentially many other messages. Having an exectutor in the
chain, you will allow more than one message to be processed by a single
IoProcessor (what happens is that the message is dispateched to the
Executor, and enqueued. This queue is handled by the ThreadPoolExecutor,
but at the same time, the IoProcessor is able to process more messages).
The executorFilter needs to know about the ThreadPool model you will
use, and this is the information you provide. If you don't tell what
kind of ThreadPool model to use, it will use an UnorderedThreadPool by
default. There is no threadPool in the IoAcceptor btw.
Hope it helps...
--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org