You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Trustin Lee <tr...@gmail.com> on 2005/02/07 05:19:14 UTC

[mina] Filter priority

Hi,

I modified the internal algorithm which manages filters, and now the
range of filter priority is limited from 0 to 99.  The new algorithm
stores filter entries in an array, and thus evaluating all filters in
the chain will iterate the internal array 100 times every time an
event is fired.  I'm not sure this will be a performance hit.  WDYT?

And, I think the priority range 0~99 is really big.  We'll usually add
not more than 3~5 filters IMHO.  So we need to decide a proper value. 
How about 0~9?  Please note that the priority numbers cannot be
duplicate because the evaluation order gets ambiguous.

The thread-safety issue still exists for the filters which filters
both dataRead(or messageReceived) and Session.write(...) like SSL
filters when the session traffic is high; read data is decrpyted but
written data is not encrypted.  Of course there should be some
negotiation mechanism in user application to prevent this situation.

Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/

Re: [mina] Filter priority

Posted by Michal Slocinski <ms...@gmail.com>.
On Mon, 7 Feb 2005 13:19:14 +0900, Trustin Lee <tr...@gmail.com> wrote:
> Hi,
> 
> I modified the internal algorithm which manages filters, and now the
> range of filter priority is limited from 0 to 99.  The new algorithm
> stores filter entries in an array, and thus evaluating all filters in
> the chain will iterate the internal array 100 times every time an
> event is fired.  I'm not sure this will be a performance hit.  WDYT?
> 
> And, I think the priority range 0~99 is really big.  We'll usually add
> not more than 3~5 filters IMHO.  So we need to decide a proper value.
> How about 0~9?  Please note that the priority numbers cannot be
> duplicate because the evaluation order gets ambiguous.
> 

maybe it'll be reasonable to pass this number in a constructor and
allow protocol developer to adjust it to her needs?

-- 
best regards,
Michal

Re: [mina] Filter priority

Posted by Trustin Lee <tr...@gmail.com>.
On Sun, 6 Feb 2005 23:25:55 -0500, Noel J. Bergman <no...@devtech.com> wrote:
> > The new algorithm stores filter entries in an array
> 
> Why not use a sorted list?  That would be more compact, and inserts are not
> likely to be a high frequency issue.

The chain traversal occurs whenever an event is fired, and thus the
traversal is not synchronized for performance (and it is hard to
synchronize it).  If we add or remove an element in a sorted list,
there is possibility a chain is evaluated more than once. So, I didn't
use sorted list.

> 
>         --- Noel
> 
> 

Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/

RE: [mina] Filter priority

Posted by "Noel J. Bergman" <no...@devtech.com>.
> The new algorithm stores filter entries in an array

Why not use a sorted list?  That would be more compact, and inserts are not
likely to be a high frequency issue.

	--- Noel