me.prettyprint.cassandra.connection
Class DynamicLoadBalancingPolicy

java.lang.Object
  extended by me.prettyprint.cassandra.connection.DynamicLoadBalancingPolicy
All Implemented Interfaces:
Serializable, LoadBalancingPolicy

public class DynamicLoadBalancingPolicy
extends Object
implements LoadBalancingPolicy

This LB Algorithm has the Phi algo which Dynamic snitch uses, LB is based on the probablity of failure of the node. TODO: Make cassandra code abstracted enough so we can inherit from the same.

Author:
Vijay Parthasarathy
See Also:
Serialized Form

Constructor Summary
DynamicLoadBalancingPolicy()
           
 
Method Summary
 HClientPool createConnection(CassandraHost host)
           
 double getBadnessThreshold()
           
 HClientPool getPool(Collection<HClientPool> pools, Set<CassandraHost> excludeHosts)
           
 int getResetInterval()
           
 int getUpdateInterval()
           
 void setBadnessThreshold(double badness)
          This is the percentage of badness which is acceptable...
 void setResetInterval(int resetInterval)
          Set the configured interval for the stats to be reset so that the new stats are allowed and we can get rid of bad nodes value.
 void setUpdateInterval(int updateInterval)
          Set the configured interval for the stats to be recalculated (until this time it is been cached.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicLoadBalancingPolicy

public DynamicLoadBalancingPolicy()
Method Detail

getPool

public HClientPool getPool(Collection<HClientPool> pools,
                           Set<CassandraHost> excludeHosts)
Specified by:
getPool in interface LoadBalancingPolicy

createConnection

public HClientPool createConnection(CassandraHost host)
Specified by:
createConnection in interface LoadBalancingPolicy

getUpdateInterval

public int getUpdateInterval()

setUpdateInterval

public void setUpdateInterval(int updateInterval)
Set the configured interval for the stats to be recalculated (until this time it is been cached.

Parameters:
updateInterval - In ms.

getResetInterval

public int getResetInterval()

setResetInterval

public void setResetInterval(int resetInterval)
Set the configured interval for the stats to be reset so that the new stats are allowed and we can get rid of bad nodes value. This is under the assumption that the bad nodes will eventually get better....

Parameters:
resetInterval - in ms

getBadnessThreshold

public double getBadnessThreshold()

setBadnessThreshold

public void setBadnessThreshold(double badness)
This is the percentage of badness which is acceptable... Example: A should be 0.20 (20%) bad than B before B is choosen rathar than A.

Parameters:
badness - in %


Copyright © 2011. All Rights Reserved.