Bases: watcher.decision_engine.strategy.strategies.base.ServerConsolidationBaseStrategy
VM Workload Consolidation Strategy.
Description
A load consolidation strategy based on heuristic first-fit algorithm which focuses on measured CPU utilization and tries to minimize hosts which have too much or too little load respecting resource capacity constraints.
This strategy produces a solution resulting in more efficient utilization of cluster resources using following four phases:
A capacity coefficients (cc) might be used to adjust optimization thresholds. Different resources may require different coefficient values as well as setting up different coefficient values in both phases may lead to to more efficient consolidation in the end. If the cc equals 1 the full resource capacity may be used, cc values lower than 1 will lead to resource under utilization and values higher than 1 will lead to resource overbooking. e.g. If targeted utilization is 80 percent of a compute node capacity, the coefficient in the consolidation phase will be 0.8, but may any lower value in the offloading phase. The lower it gets the cluster will appear more released (distributed) for the following consolidation phase.
As this strategy laverages VM live migration to move the load from one compute node to another, this feature needs to be set up correctly on all compute nodes within the cluster. This strategy assumes it is possible to live migrate any VM from an active compute node to any other active compute node.
Requirements
Limitations
<None>
Spec URL
Add an action for node disablity into the solution.
Parameters: | node – node object |
---|---|
Returns: | None |
Add an action for node enabler into the solution.
Parameters: | node – node object |
---|---|
Returns: | None |
Add an action for VM migration into the solution.
Parameters: |
|
---|---|
Returns: | None |
Perform consolidation phase.
This considers provided resource capacity coefficients. Consolidation phase performing first-fit based bin packing. First, nodes with the lowest cpu utilization are consolidated by moving their load to nodes with the highest cpu utilization which can accomodate the load. In this phase the most cpu utilizied VMs are prioritizied as their load is more difficult to accomodate in the system than less cpu utilizied VMs which can be later used to fill smaller CPU capacity gaps.
Parameters: |
|
---|
Generate actions for disablity of unused nodes.
Parameters: | model – model_root object |
---|---|
Returns: | None |
Execute strategy.
This strategy produces a solution resulting in more efficient utilization of cluster resources using following four phases:
Parameters: | original_model – root_model object |
---|
Collect cpu, ram and disk utilization statistics of a VM.
Parameters: |
|
---|---|
Returns: | dict(cpu(number of vcpus used), ram(MB used), disk(B used)) |
Collect cpu, ram and disk capacity of a node.
Parameters: |
|
---|---|
Returns: | dict(cpu(cores), ram(MB), disk(B)) |
Collect cpu, ram and disk utilization statistics of a node.
Parameters: |
|
---|---|
Returns: | dict(cpu(number of cores used), ram(MB used), disk(B used)) |
Calculate relative cluster utilization (rcu).
RCU is an average of relative utilizations (rhu) of active nodes. :param model: model_root object :return: {‘cpu’: <0,1>, ‘ram’: <0,1>, ‘disk’: <0,1>}
Return relative node utilization (rhu).
Parameters: |
|
---|---|
Returns: | {‘cpu’: <0,1>, ‘ram’: <0,1>, ‘disk’: <0,1>} |
Get resource state in string format.
Parameters: | state – resource state of unknown type |
---|
Indicate whether is a node able to accommodate a VM.
This considers provided resource capacity coefficients (cc). :param instance_uuid: string :param node: node object :param model: model_root object :param cc: dictionary containing resource capacity coefficients :return: [True, False]
Indicate whether a node is overloaded.
This considers provided resource capacity coefficients (cc). :param node: node object :param model: model_root object :param cc: dictionary containing resource capacity coefficients :return: [True, False]
Perform offloading phase.
This considers provided resource capacity coefficients. Offload phase performing first-fit based bin packing to offload overloaded nodes. This is done in a fashion of moving the least CPU utilized VM first as live migration these generaly causes less troubles. This phase results in a cluster with no overloaded nodes. * This phase is be able to enable disabled nodes (if needed and any available) in the case of the resource capacity provided by active nodes is not able to accomodate all the load. As the offload phase is later followed by the consolidation phase, the node enabler in this phase doesn’t necessarily results in more enabled nodes in the final solution.
Parameters: |
|
---|
Optimize solution.
This is done by eliminating unnecessary or circular set of migrations which can be replaced by a more efficient solution. e.g.:
Parameters: | model – model_root object |
---|