synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hiranya Jayathilaka" <hiranya...@gmail.com>
Subject Re: Adding a Field to the AlgorithmContext
Date Fri, 19 Dec 2008 10:31:59 GMT
Hi Senaka,

Now I get your point. Thanks for the explanation. Please find my comments
in-line.

On Fri, Dec 19, 2008 at 3:33 PM, Senaka Fernando <senakafdo@gmail.com>wrote:

> Sorry for not making myself clear. What I meant was, to make it possible
> for you to store an object say AlgorithmXX in the context, in such a manner
> that it will be useful along with a LoadbalanceAlgorithm. Instead of merely
> storing an Object type. This is because an Object is very general notion,
> and I don't think the intention here is to allow someone store anything on
> the AlgorithmContext, but some additional data, which is required by the
> Algorithm.
>

The idea is to facilitate passing some algorithm implementation specific
data along with the AlgorithmContext so that they can be used in the
algorithm implementation. Different algorithm implementations may have
different data requirements. For an example one algorithm might want a
string parameter from the AlgorithmContext whereas another algorithm
requires an entire MessageContext object. The actual requirement will depend
on how the algorithm selects the members to distribute the load. This is why
I thought of adding an Object field to the class so that the same field can
be used in different ways in different algorithm implementations. It's
totally up to the algorithm developer to use it the way he/she wants. Also
in most cases some changes to the load balance endpoints will be required to
initialize the object field accordingly.

In case of the round robin algorithm all it needs is the endpoint index
value for the next member in the members list. And for most algorithm
implementations this is all that is needed. AlgorithmContext already
supports this. What I suggest is to have a field which enables passing an
arbitrary data item along with the AlgorithmContext.

WDYT?

Thanks

Best Regards,
Hiranya


> AlgorithmXX can be a base object, or an interface.
>
> However, this is a mere suggestion, and I may be wrong here as well. And,
>
> s/"since your introduction is to introduce a new algorithm"/"since your
> introduction is to assist a new algorithm"/
>
> Regards,
> Senaka
>
>
> On Fri, Dec 19, 2008 at 3:14 PM, Hiranya Jayathilaka <hiranya911@gmail.com
> > wrote:
>
>> We already have such an interface called LoadbalanceAlgorithm. Round robin
>> algorithm is implemented against this interface.
>>
>> How is adding another interface going to help? Please do explain.
>>
>> Thanks
>>
>> Best Regards,
>>  Hiranya
>>
>>
>> On Fri, Dec 19, 2008 at 3:06 PM, Senaka Fernando <senakafdo@gmail.com>wrote:
>>
>>> Hi Hiranya,
>>>
>>> just a suggestion, instead of passing a type Object, and since your
>>> introduction is to introduce a new algorithm, what about an "Algorithm"
>>> Object (or may be an interface)?
>>>
>>> Thanks,
>>> Senaka
>>>
>>>
>>> On Fri, Dec 19, 2008 at 2:00 PM, Hiranya Jayathilaka <
>>> hiranya911@gmail.com> wrote:
>>>
>>>> Hi Devs,
>>>>
>>>> Currently Synapse uses a class called AlgorithmContext to pass various
>>>> parameters to the load balance algorithm implementations.  At the moment
it
>>>> can be used to pass the endpoint index values and the configuration context
>>>> objects. This works fine with the round robin load balance algorithm which
>>>> is the only load balance algorithm in Synapse at the moment. However when
>>>> developing more advanced load balance algorithm implementations we might
>>>> want to pass several other parameters using the AlgorithmContext.
>>>>
>>>> In order to fulfill this requirement I would like to suggest adding a
>>>> new field (of type Object) to the AlgorithmContext class along with the
>>>> necessary getter-setter methods.
>>>>
>>>> This addition does not change the existing functionality at all. What do
>>>> you folks think?
>>>>
>>>> Thanks
>>>>
>>>> Best Regards,
>>>> Hiranya
>>>>
>>>
>>>
>>
>

Mime
View raw message