VM Workload Consolidation Strategy¶
Synopsis¶
display name: vm_workload_consolidation
goal: vm_consolidation
VM Workload Consolidation Strategy
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:
- Offload phase - handling over-utilized resources
- Consolidation phase - handling under-utilized resources
- Solution optimization - reducing number of migrations
- Disability of unused compute nodes
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 leverages 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¶
Metrics¶
The vm_workload_consolidation strategy requires the following metrics:
metric | service name | plugins | comment |
---|---|---|---|
memory |
ceilometer | none | |
disk.root.size |
ceilometer | none |
The following metrics are not required but increase the accuracy of the strategy if available:
metric | service name | plugins | comment |
---|---|---|---|
memory.usage |
ceilometer | none | |
cpu_util |
ceilometer | none |
Cluster data model¶
Default Watcher’s Compute cluster data model:
Nova cluster data model collector
The Nova cluster data model collector creates an in-memory representation of the resources exposed by the compute service.
Actions¶
Default Watcher’s actions:
action description migration
Migrates a server to a destination nova-compute host
This action will allow you to migrate a server to another compute destination host. Migration type ‘live’ can only be used for migrating active VMs. Migration type ‘cold’ can be used for migrating non-active VMs as well active VMs, which will be shut down while migrating.
The action schema is:
schema = Schema({ 'resource_id': str, # should be a UUID 'migration_type': str, # choices -> "live", "cold" 'destination_node': str, 'source_node': str, })The resource_id is the UUID of the server to migrate. The source_node and destination_node parameters are respectively the source and the destination compute hostname (list of available compute hosts is returned by this command:
nova service-list --binary nova-compute
).change_nova_service_state
Disables or enables the nova-compute service, deployed on a host
By using this action, you will be able to update the state of a nova-compute service. A disabled nova-compute service can not be selected by the nova scheduler for future deployment of server.
The action schema is:
schema = Schema({ 'resource_id': str, 'state': str, })The resource_id references a nova-compute service name (list of available nova-compute services is returned by this command:
nova service-list --binary nova-compute
). The state value should either be ONLINE or OFFLINE.
Efficacy Indicator¶
{'value': 0, 'name': 'released_nodes_ratio', 'unit': '%', 'description': u'Ratio of released compute nodes divided by the total number of enabled compute nodes.'}
Algorithm¶
For more information on the VM Workload consolidation strategy please refer to: https://specs.openstack.org/openstack/watcher-specs/specs/mitaka/implemented/zhaw-load-consolidation.html
How to use it ?¶
$ openstack optimize audittemplate create \
at1 server_consolidation --strategy vm_workload_consolidation
$ openstack optimize audit create -a at1