voldemort.tools
Class PartitionBalance

java.lang.Object
  extended by voldemort.tools.PartitionBalance

public class PartitionBalance
extends java.lang.Object


Constructor Summary
PartitionBalance(Cluster cluster, java.util.List<StoreDefinition> storeDefs)
           
 
Method Summary
 double getNaryMaxMin()
           
 int getNaryPartitionCount(int nodeId)
           
 double getPrimaryMaxMin()
           
 int getPrimaryPartitionCount(int nodeId)
           
 double getUtility()
          Return utility of current partition balance.
 double getZonePrimaryMaxMin()
           
 int getZonePrimaryPartitionCount(int nodeId)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PartitionBalance

public PartitionBalance(Cluster cluster,
                        java.util.List<StoreDefinition> storeDefs)
Method Detail

getPrimaryMaxMin

public double getPrimaryMaxMin()

getPrimaryPartitionCount

public int getPrimaryPartitionCount(int nodeId)

getZonePrimaryMaxMin

public double getZonePrimaryMaxMin()

getZonePrimaryPartitionCount

public int getZonePrimaryPartitionCount(int nodeId)

getNaryMaxMin

public double getNaryMaxMin()

getNaryPartitionCount

public int getNaryPartitionCount(int nodeId)

getUtility

public double getUtility()
Return utility of current partition balance. The utility value ought to be minimized. In the future, could offer different utility functions (and select between them via enumeration value passed into method or constant provided to constructor). The exact utility function is a combination of this method and of ZoneBalanceStats.getUtility. The current utility function is biased towards balancing IOPS (zone primary balance) over capacity (Nary partition balance). Such bias affects repartitioning algorithms that consider multiple options before selecting "the best" option (e.g., greedy repartitioning algorithms for a repartitioning and deciding among multiple repartitioning attempts). The current utility function can hit local minima if there are two or more nodes having the min value for a zone and two or more nodes having the max value for a zone. Such a situation means that pair-wise swaps may not be sufficient to improve utility. Could consider swapping more than two partitions at a time. Could also consider a utility method which has "low bits" of the number of nodes that have either min or max value per zone. If these low bits are greater than 2, then a partition swap which keeps high bits same, but reduces low bits should be kept.

Returns:
A measure of utility that ought to be minimized.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu