Pages

Saturday, 7 March 2015

SQL Server and BIOS Changes for Performance

There has been a lot written about the importance of disabling power saving in Windows Server when running SQL Server in order to improve performance (for example here).

Particularly for those of you working in large corporate environments where there are standard server builds that may not be configured for performance, my advice is that it is essential to check the actual clock speed you are seeing. It is easy to check that power saving is not enabled at the operating system level - however BIOS settings will also play a significant part, therefore you need to check the actual clock speed that your cores are running at. There are tools such as CPU Z, but again in a constrained enterprise environment it may be impossible to install software on the server. Fortunately, you don't need to install anything to check the clock speed - you can easily read it using out-of-the-box PowerShell:

Get-WmiObject -class win32_processor -Property  "CurrentClockSpeed"

I can give you an example of how big a difference this makes. My group was upgrading from SQL Server 2008 to 2012. We were upgrading from HP DL 380 gen7 servers, with 2.6GHz Intel Xeon X5650 CPUs, with SAN storage to DL 380 gen8, with 2.9GHz Intel E5-2690 CPUs, with Fusion IO cards (rated at 500k IOPS). The SAN maxed out at somewhere between 50k and 75k IOPS in practice and we had seen peak latencies of over 20ms, therefore we had very high hopes for the new hardware. Our workloads had always been I/O bound (lots of data loading) and we rarely if ever saturated the CPUs.

When we tested our overnight batch process on the new servers, we had really strange results. Some jobs were dramatically faster however others (most notably the data loading jobs) were slower. The end result was a batch that was taking the same elapsed time as the old infrastructure.

It was tricky to pinpoint the issue because the results were so inconsistent, and data loading pointed more to I/O yet all the performance counters for I/O showed fantastic results (as did the sqlio benchmarks). When we eventually looked at the CPU clock speed we found that it was running about 1.2GHz. Disabling all the BIOS power saving settings was the key to solving the problem and difference was massive. Jobs that loaded data ran in half the time, and the overall batch was significantly faster. Even simple tests like bcp showed major reduction in elapsed runtime.

Different servers will have different settings of course but I imagine that there will be similar items to change on most BIOSes. The HP manuals are here but in summary these are the things you should be looking to change from the default settings on the DL 380 gen8 servers if you want to maximise performance (at the expense of power of course!) - these apply to other generations of DL 380 too:


  • HP Power Profile - set to "Maximise Performance"
  • HP Power Regulator - set to "HP Static High Performance Mode"
  • QPI Link Power Management - disable
  • Minimum Processor Idle Power Core States - set to "No C-States"
  • Energy/Performance bias - set to "Maximum Performance"
  • DIMM idle power saving mode - disable
  • Memory Power Savings Mode - set to "Maximum Performance"
The key thing to note is that it's not just CPU-intensive applications that will see signficant performance uplifts from these settings - my experience is that mixed SQL Server workloads, including batch jobs loading large amounts of data, will be improved significantly.