Core Parking for VM host servers in Windows

To get the full benefit of power savings from server and desktop virtualization, follow these steps to use the Core Parking feature in Windows Server 2008 R2 and Windows 7.

Virtualization appeals to many organizations because it promises to make better use of underused hardware through server consolidation. As long as adequate hardware resources are allocated to the virtual machines, they tend to perform almost as well as physical ones. However, some IT administrator are wondering why their virtual server's performance diminished after they upgraded their host servers to Windows Server 2008 R2. The answer may be Core Parking, a power-saving feature in Windows Server 2008 R2 and Windows 7.

With Core Parking, the operating system can help reduce the power consumption of multicore CPUs by shutting down underused CPU cores. The workload that the parked cores were previously handling is shifted to the remaining CPU cores. You can use the Resource Monitor to see which cores have been parked and which are active, as shown in Figure 1.

Figure 1: See which cores have been parked in the Resource Monitor (click to enlarge).

While Microsoft doesn't provide a GUI fore the Core Parking feature, you can control it from the command line or through the registry. Anatomy behind Windows power management features: Crash course
Windows has multiple built-in power schemes. Each of these schemes has a global unique identifier (GUID) associated with it. You can view the schemes and their GUIDs by entering the following command:

Powercfg --list

As you can see in Figure 2, the active scheme is denoted with an asterisk.

Figure 2: Windows has multiple power schemes (click to enlarge).

If you have experimented with Windows power management features before, then you know that you are not stuck using a power plan's default settings. Each power management setting has its own GUID, and you can see the various settings and their GUIDs by entering the following command:

Powercfg /q

Figure 3 below shows the Windows configuration settings, Minimum Processor State and Maximum Processor State. But here is where things get tricky -- processor states are set as a percentage.

Figure 3: Processor states are set as a percentage (click to enlarge).

For example, suppose that you are concerned about power consumption and that you want to prevent your server from using more than 50% of its CPU cores. The command that you would use to accomplish this is:

Powercfg --setacvalueindex scheme_current sub_processor bc5038f7-23e0-4960-96da-33abaf5935ec 50

In this command, the first parameter is setacvalueindex. This tells Windows that this setting should apply only when the server is running on AC power (as opposed to running on battery). You will notice in the figure above that Windows provides separate settings for AC power and DC power.

The second parameter is scheme_current. This tells Windows that the changes should apply to the system's current power scheme. This parameter could also be replaced with the name of a specific power scheme.

Next is a parameter named sub_processor bc5038f7-23e0-4960-96da-33abaf5935ec 50. If you look back to Figure 2, you can see that bc5038f7-23e0-4960-96da-33abaf5935ec is the GUID associated with the Maximum Processor State. This parameter ends with the number 50, which means that we want to use a maximum of 50% of the available CPU cores.

What is odd is that the power settings shown beneath the Maximum Processor State have a range between zero and 64. The minimum possible setting is set to zero, so you have the option of telling Windows to use 0% of the CPU cores. (Don't do this!) The maximum possible setting is 64. A value of 64 indicates that 100% of the CPU cores can be used.

To get a better idea of how this works, see Figure 4 below. We have told Windows to use a maximum of 50% of the available cores. Notice in Figure 4 that the Current AC Power Index for the Maximum Processor State is now set to 32. Thirty two is 50% of 64, which means that a maximum of 50% of the available cores will be used.

Figure 4: Windows will only use 50% of our CPU cores (click to enlarge).

Now you know how to decrease the number of cores that are used, but what if you want to increase that number or disable core parking altogether? Well, you would use the same basic concept, but you would need to set both the maximum processor state and the minimum processor state to 100%.

You can set the maximum processor state to 100% by using the same command described above. Just replace 50 with a value of 100. The actual command that you would use is:

Powercfg --setacvalueindex scheme_current sub_processor bc5038f7-23e0-4960-96da-33abaf5935ec 100

To set the minimum processor state to 100%, you would use the same command that I just described, but you would replace the GUID with that of the minimum processor state. The actual command that you would use is:

Powercfg --setacvalueindex scheme_current sub_processor 893dee8e-2bef-41e0-89c6-b55d0929964c 100

Any time that you make a change to the power configuration, you should verify your changes by entering the powercfg /q command. Once you are happy with your changes, you can execute them with the following command:

Powercfg --setactive scheme_current

You can see an example of this in Figure 5.

Figure 5: Use the "Powercfg --setactive scheme_current" command to finalize your settings (click to enlarge).

Brien M. Posey, MCSE, has received Microsoft's Most Valuable Professional Award seven times for his work with Windows Server, IIS and Exchange Server. He has served as CIO for a nationwide chain of hospitals and health care facilities and was once a network administrator for Fort Knox. You can visit his personal website at www.brienposey.com.

Dig Deeper on Virtual desktop management