Thursday, June 16, 2011

Windows Magic Performance Button

Who knew changing a single setting away from the default in Windows 2008 and later (as of Windows 2016) would result in an increase of 70% in performance? That's exactly what happened recently at a client experiencing JD Edwards EnterpriseOne UBE performance issues during upgrade testing. We were able to make UBE's that previously ran in 10 minutes run in less than 3 minutes simply by changing a setting on only the SQL Server.


Background

Windows 2008 includes a new ACPI (Advanced Configuration and Power Interface) setting called Processor Power Management (PPM) that allows the CPU to change its performance state to one that lowers power consumption. When looking at the big picture this is a good thing: Microsoft is doing its part by setting a default that helps the world consume less energy and limit pollution. My clients however, are generally not as concerned about world energy consumption as they are about the performance of their system.

The problem is that the default setting for PPM of 'Balanced' makes the performance state of the CPU 'Adaptive'. A CPU in this adaptive state will throttle core frequency back to save power. This comes at the cost of lower performance. When higher demands are placed on the CPU it is supposed to react quickly and increase its core frequency to address the increased load. This makes sense - when performance is not needed the CPU essentially rests and saves power, when high performance is needed the CPU switches to a higher core frequency and performs optimally but uses more electricity. Unfortunately, the CPU cannot react quickly enough under the loads we typically see in an ERP system's servers (Database, Application and Web) to suitably increase performance.


Changing the Setting

Update (6/30/2011): You should probably visit the Testing section below first to determine if the Processor Power Management setting is already being controlled by BIOS, making the change to the OS unnecessary. If PPM is already being controlled by the BIOS, go ahead and leave it that way. If testing shows that the BIOS isn't controlling, make the changes below and tell the BIOS to allow the OS to control PPM.


We need to change the power plan setting from the default Balanced to High Performance.

Open Control Panel | Hardware | Power Options. You may see the following:

Figure 1































Notice that the options are greyed out. Select 'Change settings that are currently unavailable' to enable the radio buttons.

Select 'High performance' and close Control Panel.

Figure 2































You still have one step remaining to fully enable the High Performance power plan. In most modern servers, the BIOS will have a setting that either gives the BIOS control of Processor Power Management or allows the OS to control PPM. We want to set the BIOS to allow Windows 2008 to manage PPM. The BIOS setting will be different for HP, Dell, etc. so consult your manual or just use your noggin. Then test.


Testing

To check whether your changes have taken effect is as simple as downloading the CPU-Z tool and checking the measured core speed against the known spec's of your CPU. What you are looking for is a measured core speed equal or greater than the CPU's potential speed.

Here's a system that has the High Performance setting properly enabled:

Figure 3


You can see that the core speed is greater than the OS-reported CPU speed. This is what we want.

Here is a system that does not have the Processor Power Management set to High Performance:

Figure 4


You'll notice that not only is the core speed lower than reported by the OS, CPU-Z also reports a much lower multiplier than expected. The multiplier for the tested CPU should be 23 but CPU-Z shows it to be only 12. You can find your processor's proper multiplier here: http://en.wikipedia.org/wiki/List_of_Intel_Xeon_microprocessors.  You may also be able to find your processor's multiplier on http://www.cpu-world.com/index.html or by simply Googling your processor's model number (ex: Xeon E5-2620) plus the word 'multiplier'.

This is a system not properly configured for High Performance PPM.


Conclusion

Significant performance gains can be realized by changing the Windows 2008 default setting for Processor Power Management. It is recommended that you do so.


Update (6/27/2011): Information on changing this setting for a large number of servers using Group Policy is here: http://greg.blogs.sqlsentry.net/2011/01/ensuring-maximum-cpu-performance-via.html. Note that you will still need to update each machine's BIOS to allow the OS to control PPM.

Update (8/18/2011): More information on power management for VMware is in the comments.


References

PPM in Windows Vista and Windows Server 2008
http://msdn.microsoft.com/en-us/windows/hardware/gg463252

Degraded overall performance on Windows Server 2008 R2 (Ya' think?)
http://support.microsoft.com/kb/2207548
Subscribe to Jeff Stevenson's Technology Blog - Get an email when new posts appear

6 comments:

Bill said...

Have you ever done this on Windows running on VMWare? I have tried to set the performance boost as you indicate but I don't see any effect. The CPU-Z results are pegged on the exact processor specs. I talked to the people managing my host and they say the power properties of the host will not pass to the VM, so changing the BIOS wouldn't have any effect if I understand that correctly.

Jeff Stevenson said...

Every layer in a VMware machine allows power management, hardware, ESXi and OS, so each layer must be told how to do so. If we set the BIOS to allow the OS to handle power management then we must also configure the VMware layer in between to allow the OS to handle power management.

1- Set the BIOS to allow the OS to control power management.

2- Set ESXi to allow the OS to control power management.

In ESX 4 this is done by selecting the host in vSphere, going to Configuration (tab)|Advanced Settings|Power|Power.CpuPolicy and setting the value to static. The setting can be checked in Configuration (tab)|Processors|Power Management Policy.

In ESX 4.1 go to Configuration (tab)|Power Management|Properties and change the value to High Performance to disable power management at the VMware level. The setting can be checked in Configuration (tab)|Power Management.

3- Set OS PPM using the original article above.

Chances are the VMware settings are correct, the OS settings have been appropriately changed by you but the BIOS is still set to do hardware power management. If you are ESX(i) 4 or 4.1 VMware knows how to handle the BIOS settings being presented to it.

Jeff Stevenson said...

Also, I noticed you mentioned that "The CPU-Z results are pegged on the exact processor specs." This is as it should be, CPU-Z should measure a core speed roughly the value of the CPU's specs. You also want to take a look at the multiplier that CPU-Z shows. The chart at http://en.wikipedia.org/wiki/List_of_Intel_Xeon_microprocessors shows what your multiplier should be. If it is less than it should be, throttling is taking place via PPM and either the OS setting is incorrect or the whole system (BIOS, VMware, OS) is not set properly to allow the OS to control power management (and thus CPU speed).

We are measuring CPU values to determine if power management is limiting CPU performance. If we are not measuring proper CPU values then something is not set correctly with PPM.

Rich said...

Thanks for sharing this it gave me about a 100% performance increase. Stoked!

Anonymous said...

Interesting! And I wish i had found this earlier....I'm thinking about applying this change to a Physical Windows 2008 SQL DB Server for JDE 9.0. From the Monitoring graphs we have it would appear that we are using approx. 40/50% CPU and its never really spiking towards 90/100 %. My question is - is this change still relevant (and useful) in systems that don't show high CPU ? While we don't have high CPU I want to get the best out of this system and address any inefficiency...

Jeff Stevenson said...

It absolutely will be useful. I set it properly on every machine I configure.

It would be good if you could take some performance metrics before you make the change and after to see the effect.