In-Depth

Power Management in Hyper-V

Strike the best balance between Hyper-V power and performance.

It may seem a bit odd to discuss power management in the context of Hyper-V. After all, virtual servers run on virtual hardware. Even so, power and cooling costs can account for a big chunk of the IT budget, so it makes sense to consider how these resources are being used, and whether there are any settings that need to be changed.

Windows Power Plans
If your goal is to gain a better handle on your organization's power consumption, without adversely impacting performance, the Windows power plans are a good place to start. The power plans are designed to help administrators be able to strike the desired balance between power consumption and performance.

It's tempting to think of power plans as an automated tool for powering down monitors and hard disks on idle systems. While power plans can certainly do these things (and more), power plans also tend to have an impact on CPU speed.

To demonstrate, I created a new virtual machine (VM) running Windows Server 2012 R2 on a Hyper-V server that's also running Windows Server 2012 R2. I then downloaded a free benchmarking tool called NovaBench, which you can see in Figure 1. Prior to benchmarking my system, I powered down all other VMs so they wouldn't skew the test results.

[Click on image for larger view.] Figure 1. Power benchmarking, via NovaBench.

Windows Server 2012 R2 uses the Balanced power plan by default. For the first test, I tested the Power Optimization Power Saver, Balanced and High Performance plans by configuring the plans at the VM level, and then taking a benchmark on the VM. Because Nova­Bench offers a variety of different tests, I decided to run the full suite of tests, and record the overall score and the CPU test score. Higher scores reflect better performance.

The first time I ran the benchmarks (see Table 1), I noticed that the scores became progressively lower with each test, regardless of which power plan was being used. After doing a bit of checking, I found this to be caused by Windows Update, which I disabled before recording any scores. I also did a complete shutdown of the VM prior to each test.

Power Plan NovaBench Score CPU Tests Score
Power Saver 335 173
Balanced 333 172
High Performance 330 173

Table 1 Test 1: Virtual Machine Power Plans

You can see the full test results for the Power Saver plan in Figure 2.

[Click on image for larger view.] Figure 2. Benchmark results from a VM configured to use the Power Saver plan.

For the second test (Table 2), I tested the same power plans, but this time I configured the power plan at the host level. The VM was configured to use the Balanced plan, and the benchmarks were collected from inside the VM.

Power Plan NovaBench Score CPU Tests Score
Power Saver 265 116
Balanced 333 172
High Performance 330 173

Table 2 Test 2: Hypervisor Power Plans

The results of these tests were pretty interesting. When I adjusted the power mode at the VM level, the High Performance plan actually resulted in the lowest benchmark score (probably as a result of a background system process performing some sort of task). However, the CPU scores were nearly identical across all power plans.

When I adjusted the power plan at the hypervisor level, there was a huge dropoff in performance when I used the Power Saver plan, and a slight performance gain for the High Performance plan.

Incidentally, the power plan can be changed by opening the Control Panel and navigating to Hardware/Power Options. It's worth noting, however, that it's usually preferable to configure the power plan at the Group Policy level. You can find the necessary setting at Computer Configuration| Administrative Templates | System | Power Management. The setting you want is Select an active power plan, as shown in Figure 3.

[Click on image for larger view.] Figure 3. Using group policy to control power plan selection.

When implemented at the parent OS level, the power plan determines how much power the server will consume, but it also impacts the server's performance. This raises a number of questions:

  • Does the benefit of using more power offset the cost?
  • Is the High Performance power plan suitable for every workload?
  • Is there a way to use less power without giving up performance?

While there aren't always easy answers to the first two questions, there are a couple of different strategies that can be used to reduce power consumption, while maintaining a high level of performance. It's worth noting that both of these strategies require System Center Virtual Machine Manager (VMM), because the required functionality doesn't exist within Hyper-V Manager or the Windows OS.

Using Host Groups
One option for getting a handle on Hyper-V power consumption is to leverage VMM host groups. Host groups are really nothing more than collections of host servers and host clusters.

As you probably know, it's possible to group servers in Active Directory and assign differing Group Policies to each group. As such, you could assign the Balanced power plan to one group of Hyper-V hosts and the High Performance power plan to another group of hosts. After doing so, you could create two separate host groups within VMM: a Balanced host group and a High Performance host group. You could then place Hyper-V hosts or clusters into the appropriate host group, based on its Group Policy assignment.

Once the Hyper-V hosts have been organized into host groups, you can begin moving VMs based on their performance needs. High-demand VMs such as SQL Servers should probably reside on a host using a High Performance power plan, while less-demanding VMs such as file servers or DHCP servers could be placed on hosts running a Balanced or even a Power Saver power plan.

Such an arrangement will likely be easy to implement for many organizations because it's common to create host groups based on physical hardware capabilities. For instance, I've seen several organizations that use a host group named Gold Tier (or something similar), which contains the highest-performing virtualization hosts and is used for hosting the most-demanding VMs. Adding an appropriate power plan to the servers included in such a host group should be relatively easy to do.

Power Optimization
A second way in which you can get a better handle on Hyper-V's power consumption is through a VMM feature called Power Optimization. The basic idea behind the Power Optimization feature is pretty simple: Many organizations have certain times of the day (or night) when workloads are relatively light. During those times, it might be possible to Live Migrate VMs to alternate Hyper-V hosts, with the goal of draining some of the host servers. Upon doing so, the empty hosts can be powered down until needed. At that point, the hosts can be powered back up, and workloads can be redistributed to take advantage of the available resources.

There are a few prerequisites that must be met in order to use power optimization. First, you're going to need a suitable failover cluster. Typically, the cluster will need at least five nodes, but you can get away with using four nodes if the cluster was created through VMM. The reason is that Power Optimization is designed to keep your cluster from losing quorum. As such, it will keep a minimum number of cluster nodes online, plus one extra node (in case of a node failure).

Normally, the fewest number of nodes that can support this model is five. In a five-node cluster, at least three nodes must remain online in order to retain quorum. When you add in an extra node that will remain online in case of a node failure, the number of nodes required to remain powered on grows to four. Hence, a five-node cluster is the smallest cluster that can benefit from power optimization, with one exception: If the cluster was created using VMM, it can use a witness disk in place of a node, bringing the required cluster size to four nodes.

Because of the node requirements, larger clusters tend to receive the greatest benefit from power optimization.

A second requirement is that cluster nodes must be equipped with a Baseboard Management Controller (BMC). The BMC controller allows for out-of-band host management. This is the mechanism that allows the host to be powered down and powered back up without administrator involvement.

Microsoft makes it easy to configure power optimization: Open the VMM console, then locate the host group containing the cluster for which you wish to enable power optimization. Next, right-click on the host group and select the Properties command from the resulting shortcut menu. When you do, the console will display the host group's Properties window.

The Power Optimization settings are located within the Dynamic Optimization tab. Dynamic optimization is a VMM feature that automatically load balances the VMs running within a host cluster. If you look near the bottom of the window, you'll find a checkbox you can select to enable power optimization. This checkbox is grayed out by default, but can be enabled by selecting the option to automatically migrate VMs to balance the workload, as shown in Figure 4.

[Click on image for larger view.] Figure 4. You must enable automatic load balancing before enabling power optimization.

Before you enable power optimization, there are two settings you should pay attention to. First, the Aggressiveness setting, shown in Figure 4, should usually be set to Medium. Using more aggressive optimization will result in a more evenly balanced workload, but can cause Live Migrations to occur so frequently that performance is impacted.

The other is the load-balancing frequency. This number determines how often VMM checks to see whether VMs need to be Live Migrated. The reason you should pay attention to this value is that it applies to power optimization, as well. When nodes are powered down as a result of the power optimization feature, VMM checks every 10 minutes (by default) to see if a node needs to be brought back online.

If you click the Settings button shown in Figure 4, you'll be taken to the Customize Power Optimization Schedule dialog box, shown in Figure 5. As you can see, it allows you to configure a power optimization schedule and a corresponding set of threshold values.

[Click on image for larger view.] Figure 5. The Customize Power Optimization Schedule allows you to set a schedule and threshold values.

Keep in mind that cluster nodes will not be automatically powered down simply because the clock reaches the scheduled time. Before powering down any nodes, VMM verifies that VMs can be Live Migrated to other cluster nodes without impacting performance, and without depleting the hardware resources of the remaining nodes to the point that any of the threshold values shown in the previous figure are exceeded.

Power Save
Power management is an issue for datacenters large and small because power and cooling typically account for a significant percentage of the overall IT budget. Taking the time to establish a power management plan for your organization's Hyper-V hosts has the potential to reduce power consumption, and lower operational costs as a result.

Featured

Virtualization Review

Sign up for our newsletter.

I agree to this site's Privacy Policy.