The New Turbo Button - Balancing Power Management and Performance on Windows Servers
Do you remember the Turbo Button? I actually thought of it is the "be slow button" because we always kept it on Turbo. Why wouldn't you want a fast computer all the time? The Turbo Button was actually an "underclock" button. When it was off, you were setting your 286 or 386 to XT speeds so older DOS games would work at their designed speed.
Power Management, both software and hardware, seems to be the new Turbo Button. My laptops get way faster when I plug it in - like very noticeably faster to the point where I just don't like using them on battery. For typing documents, it's fine, but for development, compiling, running VMs, it's unacceptable to me. I'll end up spending more power to get more performance.
It's important to remember that Power Management affects servers as well.
Recently Mike Harder, a development manager, noticed that stuff he does every day was taking longer on the "Balanced" power option than the "High Performance" option. He said:
My naïve belief was that “Balanced” is supposed to save power when your machine is idle, but give full power when needed, so the overall perf hit should be small.
Here's a very basic benchmark Mike did:
Hardware/OS
Hardware: HP z420, Intel Xeon E5 1650 @ 3.2GHz, 32GB RAM, SSD
OS: Windows Server 2012 Standard
(in seconds) High Performance Balanced Delta 7-Zip, LZMA, 2 Threads 55 115 109% 7-Zip, LZMA2, 12 Threads 28 49 75% Build Source Tree, 48 Threads 37 55 49%
This started a fascinating thread on power management and the balance between getting good performance from a system (desktop or laptop or server) and wasting power and heat. Here's the best parts of that internal thread here for all of our education.
Bruce Worthington said:
Depends on the workload. The full performance of the system is available, but (for example) if the workload is very bursty you will take an initial hit at the beginning of each burst as the power management algorithms determine that more resources need to be brought on line. Or if it is a low-utilization steady state workload, you will run at a lower CPU frequency throughout.
There is no free lunch, so there is always a tradeoff that is being made.
There is also an excellent thread on this at ServerFault. Jeff Atwood asks:
Our 8-cpu database server has a ton of traffic, but extremely low CPU utilization (just due to the nature of our SQL queries -- lots of them, but really simple queries). It's usually sitting at 10% or less. So I expect it was downclocking even more than the above screenshot. Anyway, when I turned power management to "high performance" I saw my simple SQL query benchmark improve by about 20%, and become very consistent from run to run.
This makes sense to me. The CPU isn't working hard enough for long enough for the power management algorithms to put full power to the CPU. But, if Jeff sets power management to High Performance he's effectively saying "full speed ahead...always."
In the last half-decade power management in servers has become more of an issue. With high power comes heating and cooling as well as power costs. Windows Server 2008's default power is "Balanced."
Bruce again in an excellent explanation with emphasis mine:
I'll try to give a quick perspective below as to why we use Balanced mode as our default and how we arrive at the tunings for that mode.
As of Windows Server 2008, the default setting of the OS was switched from High Performance to Balanced. Energy efficiency was becoming a larger factor in the real world, and our ability to balance between the oft-opposing poles of Power and Perf was improving. That being said, there will always be environments where our recommendation is that the power policy should be switched back to High Performance. Anything super latency sensitive will clearly fall into that bucket, such as banking, stock markets, etc.
OEMs have the flexibility to add custom tunings onto their factory settings if they want to put in the additional effort to find a balance that works better for their specific customers. System administrators also have that flexibility. But tuning the power/perf knobs in the OS is a very tricky business, not for the faint of heart.
<snip…>
Some of us on the Windows "power" teams were performance analysts before we become power analysts, so we are very sensitive to the tradeoffs that are being made and don’t like seeing any perf lost at all. But there is no free lunch to be had, and there are big electric bills being paid (and polar bears falling into the water) that can be helped through sacrificing some level of performance in many environments.
<snip>
We will continue to provide multiple power policies because one size clearly does not fit all servers.
Another great point made for why have "Balanced" be the default, from Sean McGrane:
[We're] looking at an industry landscape where servers in data centers are very underutilized, typically somewhere below 20% utilization. By going with balanced mode we saved a lot of energy and cost and improved their carbon footprint more or less for free. There was very strong support from customers to do this.
Virtualization has helped raise the utilization levels and most cloud DCs now operate at higher levels of utilization. However the majority of servers deployed are still running a single workload and that will be the case for a while.
This get to the point of measuring. Are your servers working hard now? Perhaps they'll perform better on High Performance. Are they often idle or at lower levels of utilization? Then Balanced is likely fine and will save power. Test and see.
As with all things in software development, it's a series of trade offs. If you blindly switch your servers' power options to High Performance because you read it on a random blog on the Internet, you're of course missing the point.
Change a variable, then measure.
Consider your workloads, how your workloads cause your CPUs to idle and how hard they work the CPU when pushed. Are you doing single threaded low CPU work, or massively parallel CPU intensive work?
I'm now going to pay more attention to power management profiles when developing, putting machines into production, stress testing and benchmarking. It's nice to have a Turbo Button.
Sponsor: Thank you to RedGate for sponsoring the feed this week! Easy release management: Deploy your .NET apps, services and SQL Server databases in a single, repeatable process with Red Gate’s Deployment Manager. There’s a free Starter edition, so get started now!
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
Michael - Don't worry, the VM setting doesn't matter, it's the HOST setting that matters. They tune that stuff themselves.
Jeff - Again, it's very likely that setting is overridden by VMWare/Parallels.
It is also very important to use a tool like CPU-Z to verify that the Windows Power Plan is not being overridden by hardware-level power management(controlled in the BIOS).
For instance, change power settings automatically based on time. A FTP server in an office doesn't need to run at full speed at night. And active directory should have the ability to change the power states of various servers based on the number of logged in users.
Hi, I always struggle configuring Hyper-V's Virtual Switch on Windows 8. What are the configuration steps so the host and guest have intranet and both can access internet? Whatever configuration I try, I end up Internet working on both or none. Why don't Microsoft make it easy like VirtualBox... just start the box and you will get aforementioned configuration by default!
Please post a blog about it on blogs.windows.com, so more people know how to configure it for basic usage: like we have Win 8.1 RTM ISOs from BizSpark partner account, but we can't fully utilize it on Hyper-V due to complexity of Virtual Switch settings. Most people ended up using VirtualBox on Win8 to run 8.1 RTM and it worked like a charm..without altering network settings.
Please also cover this scenario: "Using Hyper-V with VirtualBox". Or support Hyper-V plugin development for Vagrant (an opensource Ruby implementation of abstraction of Virtual Machines for developers), so we don't need Hyper-V at all.. github.com/mitchellh/vagrant/issues/1244. Here is the proposed bounty www.bountysource.com/fundraisers/429-basic-vagrant-hyperv-support. If Microsoft chip-in some bucks, we can probably achieve the target.
Thanks.
You can create custom profiles, and do what's best for your use case (what that is can be triky though :-)
Example: if you run a database that is slow-changing, but fast-reading, you might put it all in-memory, push the CPU to max, but allow the hard-disks to go down, maybe even go to sleep.
http://aspnet.uservoice.com/forums/41199-general-asp-net/suggestions/4449961-zurb-foundation-as-a-template-option-when-creatin
Please vote it up if you like the idea.
Thanks
But to the point of your article it certainly is an aspect of performance engineering that folks should be aware of!
That said, one of the first things I do with a new laptop is create/configure my own power profile... never goes to sleep, never auto hibernates, closing laptop lid does nothing (I like to close it while I move between rooms, which only takes a min or so), CPU/HDD/LAN/WiFi are always at 100% performance...
While I love my profile, I'll gladly switch away when scenarios dictate (i'm on "balanced" right now), I just like having my profile as a default, or just a click or two away.
More than anything though, I'd be curious if there are any long term impacts on the battery, since my usage tends to encourage either AC power all day, or quick discharge and frequent recharge.
Comments are closed.
Another option (what I do), during the peak window (business hours/trading hours), we press the turbo button aka High Performance.
To save money/environment/make the world a happy place, off peak we switch to balanced.
Easy to do with task scheduler and a power shell script.