mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ashish <paliwalash...@gmail.com>
Subject Re: ExecutorFilter quick poll: How do you use it ?
Date Tue, 04 Nov 2008 17:38:32 GMT
On Tue, Nov 4, 2008 at 10:33 PM, Emmanuel Lecharny <elecharny@gmail.com> wrote:
> Ashish wrote:
>>> 2) Where in the chain do you put this filter ?
>> Multiple places to implement SEDA (before ProtocolDecoder, before
>> IoHandler)
> I would like to know if you are not ask risk to have a hell lot of thread if
> you do so. And I'm not sure that it has any added value, as the idea is to
> use a thread to handle a costly operation, no need to spawn a new thread
> when it's already done... Am I missing something ?

Well we needed SEDA to attain a very high processing rate. Since its
one way, no response to be sent back. That's why we choose this
approach. Again at each stage, we do something meaningful. Say in
protocolcodec, we convert raw bytes into objects, next these objects
get converted into OSSJ object and then handler dumps them into DB.
Each of these stages are decoupled, onces passed no need to look back.
Processing in one thread was like blocking it, let the messages be in
queue and then use them. This is quite helpful for a high burst or a
sustained load for a while.

I hope I have used MINA correctly, though I haven't benchmarked my
application for sustained load, for a peak load it did fairly well,
taking care of 5000 packets/sec, though had to set slightly higher
value of receive buffer.

>>> 4) Is this a problem if the chain is not protected when using an
>>> ExecutorFilter ?
>> Not sure if I can comment on this, but does this mean same byte chunk
>> (IoBuffer) can be processed by more than one thread?
>> If it can be, I have flow in my implementation :-(
> That's for sure, unless you have already gathered all the bytes before
> processing the created message in its own thread (via the Executor). The
> idea is pretty much to collect the bytes until you can build a new Object,
> and then spawn a thread passing this object to it. Otherwise, assuming that
> the bytes arrive by chunk, which thread will swallow the next incoming bytes
> ?

I guess I am safe here :-) I wait until my message is complete, before
putting it into next queue.

> --
> cordialement, regards,
> Emmanuel L├ęcharny
> www.iktek.com
> directory.apache.org


Blog: http://www.ashishpaliwal.com/blog

My Photo Galleries: http://www.pbase.com/ashishpaliwal

View raw message