Hi Azeez

At present, u cannot introduce a new LB algorithm impl without code changes. Only round-robin load balancing is supported, and the implementation has been somewhat hard-coded to use round-robin load balancing. Users cannot do a config change and incorporate a new algorithm. Ideally, we should let them specify the algorithm impl in the synapse.xml file. There are two way this may be done.

*1.*

<definitions xmlns="http://ws.apache.org/ns/synapse";>

  *<loadbalanceAlgorithms>**
*

*  <algorithm name="ec2-autoscale-roundrobin"**
** implementation="org.apache.synapse.algorithms.Ec2AutoScaleRoundRobin"/>**
**  </loadbalanceAlgorithms>*

<endpoint name="dynamicLB">
  <dynamicLoadbalance failover="true" policy="*ec2-autoscale-roundrobin*">
  <membershipHandler
  class="org.apache.synapse.core.axis2.Axis2LoadBalanceMembershipHandler">
  <property name="applicationDomain" value="apache.axis2.app.domain"/>
  </membershipHandler>
  </dynamicLoadbalance>

  </endpoint>

</definitions>

We haven't yet used the synapse.xml to "define" non mediation aspects of Synapse. We already do have a synapse.properties, which defines datasources for use by the synapse.xml's DB mediators. So I think we should not do this in synapse.xml, but the properties file would be good..

*2.*

<definitions xmlns="http://ws.apache.org/ns/synapse";>

<endpoint name="dynamicLB">

<dynamicLoadbalance failover="true" *algorithm="org.apache.synapse.algorithms.Ec2AutoScaleRoundRobin"*>
  <membershipHandler
  class="org.apache.synapse.core.axis2.Axis2LoadBalanceMembershipHandler">
  <property name="applicationDomain" value="apache.axis2.app.domain"/>
  </membershipHandler>
  </dynamicLoadbalance>

  </endpoint>

</definitions>

Both approaches preserve backwards compatibility. Please send in your suggestions.

I think this approach is slightly better, since its all in "one file".. and anyway you are just defining the algorithm impl class name as a String

So between the two, I personally prefer option #2

asankha
--
Asankha C. Perera

WSO2 - http://wso2.org
http://esbmagic.blogspot.com

Reply via email to