On 6/11/07, Niklas Therning <[EMAIL PROTECTED]> wrote:
Ofer Kalisky wrote:
> Hi,
>
> I'm using a test client to connect with many sockets to a MINA-1.1.0
> based server.
>
> Short explanation of what I do:
> I extend the CumulativeProtocolDecoder class, and in the end of the
> "doDecode" method I use: out.write(...)
> I also extend the IoHandler class, and there I implement the
> "messageReceived" method, and print a log (for the sake of the
> argument).
>
> The problem is after running 30 seconds, the "doDecode" methods run more
> often than the "messageReceived" methods, which means messages aren't
> handled as fast as they are parsed.
>
> Is this a known issue? Do the worker threads of the IoHandler get a
> lower priority than the ProtocolDecoder ones?
>
> Thanks, Ofer.
>
>
There are no dedicated ProtocolDecoder/IoHandler worker threads. Please
have a look at http://mina.apache.org/configuring-thread-model.html for
info on MINA and threads.
The situation you are describing suggests that you have a
ProtocolCodecFilter before an ExecutorFilter in your filter chain. If
you use ThreadModel.MANUAL as recommended in the document I pointed you
to above you could try to put the ProtocolCodecFilter after the
ExecutorFilter and see what happens. In that case your ProtocolDecoder
and IoHandler will be called in the same thread.
Beware that regardless of whether you put the ProtocolCodecFilter before
or after the ExecutorFilter you may eventually end up with
OutOfMemoryErrors if you are flooding your server with more data than it
can handle. Please have a look at ReadThrottleFilterBuilder for a
solution to this problem.
I think our documentation on thread model still needs more work; we
are still getting similar questions. :)
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6