GigaSpaces XAP 9.7.2 API

org.openspaces.grid.gsm.rebalancing
Class RebalancingUtils

java.lang.Object
  extended by org.openspaces.grid.gsm.rebalancing.RebalancingUtils

public class RebalancingUtils
extends Object


Constructor Summary
RebalancingUtils()
           
 
Method Summary
static org.openspaces.core.internal.commons.math.fraction.Fraction getAverageCpuCoresPerPrimary(ProcessingUnit pu, CapacityRequirementsPerAgent aggregatedAllocatedCapacity)
           
static GridServiceContainer[] getContainersOnMachines(ProcessingUnit pu)
           
static Machine[] getMachinesHostingContainers(GridServiceContainer[] containers)
           
static org.openspaces.core.internal.commons.math.fraction.Fraction getNumberOfCpuCores(Machine machine, CapacityRequirementsPerAgent allocatedCapacity)
           
static int getNumberOfPrimaryInstancesOnMachine(ProcessingUnit pu, Machine machine)
           
static org.openspaces.core.internal.commons.math.fraction.Fraction getNumberOfPrimaryInstancesPerCpuCore(ProcessingUnit pu, Machine machine, CapacityRequirementsPerAgent allocatedCapacity)
           
static Set<ProcessingUnitInstance> getOtherInstancesFromSamePartition(ProcessingUnitInstance instance)
           
static Set<ProcessingUnitInstance> getOtherInstancesFromSamePartitionInContainer(GridServiceContainer container, ProcessingUnitInstance instance)
           
static Set<ProcessingUnitInstance> getOtherInstancesFromSamePartitionInMachine(Machine machine, ProcessingUnitInstance puInstance)
           
static int getPlannedMaximumNumberOfInstancesForContainer(GridServiceContainer container, GridServiceContainer[] approvedContainers, ProcessingUnit pu)
           
static int getPlannedMinimumNumberOfInstancesForContainer(GridServiceContainer container, GridServiceContainer[] approvedContainers, ProcessingUnit pu)
           
static GridServiceContainer[] getReplicationSourceContainers(ProcessingUnitInstance instance)
           
static String gscsToString(List<GridServiceContainer> containers)
           
static String gscToString(GridComponent container)
           
static boolean isEvenlyDistributedAcrossContainers(ProcessingUnit pu, GridServiceContainer[] containers)
           
static boolean isEvenlyDistributedAcrossMachines(ProcessingUnit pu, CapacityRequirementsPerAgent aggregatedAllocatedCapacity)
           
static boolean isProcessingUnitHasMinimumNumberOfInstancesPerPartition(ProcessingUnit pu, int minimumNumberOfInstancesPerPartition)
           
static boolean isProcessingUnitIntact(ProcessingUnit pu)
           
static boolean isProcessingUnitIntact(ProcessingUnit pu, GridServiceContainer[] containers)
           
static boolean isProcessingUnitPartitionIntact(ProcessingUnitInstance instance)
           
static boolean isProcessingUnitPartitionIntact(ProcessingUnit pu, int instanceId, GridServiceContainer[] containers)
           
static boolean isRestartRecommended(ProcessingUnit pu, Machine source, Machine target, org.openspaces.core.internal.commons.math.fraction.Fraction optimalCpuCoresPerPrimary, CapacityRequirementsPerAgent allocatedCapacity)
           
static String machineToString(Machine machine)
           
static String processingUnitDeploymentToString(ProcessingUnit pu)
           
static String puInstanceToString(ProcessingUnitInstance instance)
           
static FutureStatefulProcessingUnitInstance restartProcessingUnitInstanceAsync(ProcessingUnitInstance candidateInstance, Log logger, long timeout, TimeUnit timeUnit)
           
static List<GridServiceContainer> sortAllContainersByNumberOfInstancesAboveMinimum(ProcessingUnit pu, GridServiceContainer[] approvedContainers)
          Sorts all of the admin containers based on (number of instances from the specified pu - min number of instances) If the container is not in the specified approved container list then min=0, meaning it will get a higher weight in the sort.
static List<Machine> sortMachinesByNumberOfPrimaryInstancesPerCpuCore(ProcessingUnit pu, Machine[] machines, CapacityRequirementsPerAgent allocatedCapacity)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RebalancingUtils

public RebalancingUtils()
Method Detail

getReplicationSourceContainers

public static GridServiceContainer[] getReplicationSourceContainers(ProcessingUnitInstance instance)
Parameters:
instance -
Returns:
list of containers that are used by the relocated processing unit instance to synchronize all data.

isProcessingUnitIntact

public static boolean isProcessingUnitIntact(ProcessingUnit pu,
                                             GridServiceContainer[] containers)

isProcessingUnitHasMinimumNumberOfInstancesPerPartition

public static boolean isProcessingUnitHasMinimumNumberOfInstancesPerPartition(ProcessingUnit pu,
                                                                              int minimumNumberOfInstancesPerPartition)

isProcessingUnitPartitionIntact

public static boolean isProcessingUnitPartitionIntact(ProcessingUnitInstance instance)

isProcessingUnitIntact

public static boolean isProcessingUnitIntact(ProcessingUnit pu)

isProcessingUnitPartitionIntact

public static boolean isProcessingUnitPartitionIntact(ProcessingUnit pu,
                                                      int instanceId,
                                                      GridServiceContainer[] containers)

getOtherInstancesFromSamePartition

public static Set<ProcessingUnitInstance> getOtherInstancesFromSamePartition(ProcessingUnitInstance instance)
Parameters:
instance -
Returns:
all instances from the same partition that is not the specified instance.

getOtherInstancesFromSamePartitionInContainer

public static Set<ProcessingUnitInstance> getOtherInstancesFromSamePartitionInContainer(GridServiceContainer container,
                                                                                        ProcessingUnitInstance instance)

getOtherInstancesFromSamePartitionInMachine

public static Set<ProcessingUnitInstance> getOtherInstancesFromSamePartitionInMachine(Machine machine,
                                                                                      ProcessingUnitInstance puInstance)

isEvenlyDistributedAcrossMachines

public static boolean isEvenlyDistributedAcrossMachines(ProcessingUnit pu,
                                                        CapacityRequirementsPerAgent aggregatedAllocatedCapacity)

isRestartRecommended

public static boolean isRestartRecommended(ProcessingUnit pu,
                                           Machine source,
                                           Machine target,
                                           org.openspaces.core.internal.commons.math.fraction.Fraction optimalCpuCoresPerPrimary,
                                           CapacityRequirementsPerAgent allocatedCapacity)

getContainersOnMachines

public static GridServiceContainer[] getContainersOnMachines(ProcessingUnit pu)
Returns:
all containers that the gsm can deploy the specified pu.

isEvenlyDistributedAcrossContainers

public static boolean isEvenlyDistributedAcrossContainers(ProcessingUnit pu,
                                                          GridServiceContainer[] containers)
Returns:
true if number of instances are evenly distributed across the specified containers

getMachinesHostingContainers

public static Machine[] getMachinesHostingContainers(GridServiceContainer[] containers)

getPlannedMinimumNumberOfInstancesForContainer

public static int getPlannedMinimumNumberOfInstancesForContainer(GridServiceContainer container,
                                                                 GridServiceContainer[] approvedContainers,
                                                                 ProcessingUnit pu)
Parameters:
container - - the container for which planned min number of instances is requested
approvedContainers - - the containers approved for deployment for the specified pu
pu - - the processing unit
Returns:
the planned minimum number of instances for the specified container

getPlannedMaximumNumberOfInstancesForContainer

public static int getPlannedMaximumNumberOfInstancesForContainer(GridServiceContainer container,
                                                                 GridServiceContainer[] approvedContainers,
                                                                 ProcessingUnit pu)
Parameters:
container - - the container for which planned min number of instances is requested
approvedContainers - - the containers approved for deployment for the specified pu
pu - - the processing unit
Returns:
the planned minimum number of instances for the specified container

sortAllContainersByNumberOfInstancesAboveMinimum

public static List<GridServiceContainer> sortAllContainersByNumberOfInstancesAboveMinimum(ProcessingUnit pu,
                                                                                          GridServiceContainer[] approvedContainers)
Sorts all of the admin containers based on (number of instances from the specified pu - min number of instances) If the container is not in the specified approved container list then min=0, meaning it will get a higher weight in the sort.

Parameters:
pu -
approvedContainers -
Returns:
the list of sorted containers
See Also:
getPlannedMinimumNumberOfInstancesForContainer(GridServiceContainer, GridServiceContainer[], ProcessingUnit)

sortMachinesByNumberOfPrimaryInstancesPerCpuCore

public static List<Machine> sortMachinesByNumberOfPrimaryInstancesPerCpuCore(ProcessingUnit pu,
                                                                             Machine[] machines,
                                                                             CapacityRequirementsPerAgent allocatedCapacity)

getNumberOfPrimaryInstancesPerCpuCore

public static org.openspaces.core.internal.commons.math.fraction.Fraction getNumberOfPrimaryInstancesPerCpuCore(ProcessingUnit pu,
                                                                                                                Machine machine,
                                                                                                                CapacityRequirementsPerAgent allocatedCapacity)

getNumberOfPrimaryInstancesOnMachine

public static int getNumberOfPrimaryInstancesOnMachine(ProcessingUnit pu,
                                                       Machine machine)

restartProcessingUnitInstanceAsync

public static FutureStatefulProcessingUnitInstance restartProcessingUnitInstanceAsync(ProcessingUnitInstance candidateInstance,
                                                                                      Log logger,
                                                                                      long timeout,
                                                                                      TimeUnit timeUnit)

getAverageCpuCoresPerPrimary

public static org.openspaces.core.internal.commons.math.fraction.Fraction getAverageCpuCoresPerPrimary(ProcessingUnit pu,
                                                                                                       CapacityRequirementsPerAgent aggregatedAllocatedCapacity)

getNumberOfCpuCores

public static org.openspaces.core.internal.commons.math.fraction.Fraction getNumberOfCpuCores(Machine machine,
                                                                                              CapacityRequirementsPerAgent allocatedCapacity)

puInstanceToString

public static String puInstanceToString(ProcessingUnitInstance instance)

machineToString

public static String machineToString(Machine machine)

gscToString

public static String gscToString(GridComponent container)

gscsToString

public static String gscsToString(List<GridServiceContainer> containers)

processingUnitDeploymentToString

public static String processingUnitDeploymentToString(ProcessingUnit pu)

GigaSpaces XAP 9.7.2 API

Copyright © GigaSpaces.