synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "indika kumara" <indika.k...@gmail.com>
Subject Re: Adding a Field to the AlgorithmContext
Date Sat, 20 Dec 2008 04:51:02 GMT
Hi Hiranya

Algorithm Context was introduced to encapsulate how and where states
related to the algorithm are kept. It hides fact that states are in
clustered configuration context or in local. In clustered environment
states are kept in configuration context whereas non- clustered
environment, those are locally kept. User of Algorithm Context
(Algorithm) can access these states using provided API without caring
above fact.

Actually, Algorithm Context only need to local to Algorithm itself and
must remove reference from LB Endpoint as on one need to keep or need
to know other's states. So, it is needed to move Algorithm Context
into Algorithm and encourage as a best practice to use that for keep
states related to any algorithm implementation.  We need to introduce
initialization method to algorithm API, so that algorithm itself can
initiate Algorithm Context as Algorithm Context needs configuration
context.

Keeping states in the Algorithm Context - I think it is better to keep
a Map with setProperty and getProperty methods and must avoid adding
any algorithm specific thing to load balance endpoint. It is needed to
keep properties with KEYs specific to a particular algorithm
implementation (constant local to implementation – only care itself).
It is needed to keep primitive types as possible as in the map. This
is because, it is needed to supports both clustered and non-clustered
environment. In a clustered environment, you have to replicate states
and replicating primitive types are efficient.  If there are many
states, then it may be better to encapsulate those into a serializable
data structure (need to support state replication needed in clustered
environment) and keep it in Map. BTW, these data structure and look up
keys must be local to particular algorithm implementations.

Thanks
Indika

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


Mime
View raw message