Recently I had the opportunity to audit a SQL Server database hosted on a Hyper-V 2012 cluster. I noticed that the guest operating system had the Power Plan configured to High performance. This is great thing but when I talked to the system administrator to verify if the same option is turned on on the Hyper-V operating system, this was unfortunately not the case.

As a reminder, the power policy setting has no effect on the guest operating system in case of virtual environments and we always have to verify if this option is configured correctly at the right level.

I performed a quick demonstration to my customer by using the SuperPI benchmark tool that is pretty simple: it calculates pi to a specific number of digits by using one thread and for my purpose it’s sufficient.

–> Let’s have the situation when Power Saver is enabled on the Hyper-V side and High performance turned on on the guest side. Then let’s run SuperPI tool with 512K of digit to compute:

blog_25_-_superpi_calculation_-_power_saving

Here the time taken by the guest to calculate pi:

blog_25_-_superpi_calculation_-_power_saving_-_result

Now let’s change the story by reversing the power settings value: High performance on the Hyper-V side and Power Saver on the guest side. Then we can do the same benchmark test:

blog_25_-_superpi_calculation_-_high_perf_-_result

5,688 seconds for this test against 13,375 seconds for the first test – 57% of improvement .. not so bad 🙂 but let’s have a more suitable situation. Indeed in most configurations power management setting is configured to Balanced by default and my customer asked me if there is a noticable difference if we leave the default configuration. In order to justify my recommandation we performed the same test but this time I decided to change the number of digits to compute to simulate a more realistic OLTP transaction (short and requiere all CPU resources during a short time). The table lists and compare the both results:

 

Settings Duration (s)
Hyper – V : Load balancing 0.219
Hyper – V : High performance 0.141

 

We can notice a 64% of CPU time improvement in the context of my customer! So after that, my customer was convinced to change this setting and I hope it is the same for you! Of course with long running queries that consume a lot of CPU resources during a long time the difference may be less discernible because the processor wake-up time is very small compared to the total worker time consumed by them.

Keep in mind that changing Power Management state from the guest has no effect on virtualized environment. You must take care of this setting directly on the hypervisor.

Happy virtualization !!

By David Barbarin