During routine benchmarking of our production database server, I observed inconsistent query execution times that initially puzzled me. The server was running at just 10% CPU utilization with the "Balanced" power plan enabled, yet switching to "High Performance" yielded a 20% performance improvement with more consistent results.
# Sample benchmark comparison (Python psycopg2)
import time
import psycopg2
conn = psycopg2.connect("dbname=production user=monitor")
cur = conn.cursor()
# Test query
query = "SELECT * FROM transactions WHERE date > NOW() - INTERVAL '1 hour'"
# With power management
start = time.time()
cur.execute(query)
results = cur.fetchall()
print(f"Balanced plan: {time.time() - start:.4f}s")
# After switching to High Performance
start = time.time()
cur.execute(query)
results = cur.fetchall()
print(f"High Performance: {time.time() - start:.4f}s")
Modern Xeon and EPYC processors exhibit interesting power management characteristics:
- Downclocking occurs even at moderate loads (observed at 35-40% utilization)
- Voltage scaling follows frequency changes (2.8GHz @ 1.25V → 2.0GHz @ 1.15V)
- Latency-sensitive workloads suffer more than batch processing
For Linux servers, consider these BIOS and OS-level adjustments:
# Check current scaling governor
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# Temporarily set to performance mode
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# Permanent solution via tuned (RHEL/CentOS)
sudo dnf install tuned
sudo tuned-adm profile latency-performance
The database server showed these characteristics:
Metric | Balanced | High Performance |
---|---|---|
Avg query time | 42ms ±15ms | 34ms ±3ms |
95th percentile | 67ms | 38ms |
Power draw | 180W | 210W |
For environments where power savings are critical but performance must remain consistent:
# Windows Powercfg advanced settings
powercfg /setacvalueindex SCHEME_BALANCED SUB_PROCESSOR PERFBOOSTMODE 1
powercfg /setactive SCHEME_BALANCED
# Intel-specific tuning (requires intel-undervolt)
sudo intel-undervolt apply --no-gpu --cache -50 --uncore -50
During routine performance testing on our production database servers, I observed significant query latency inconsistencies (15-20% variance) when running identical SQL queries under the Windows "Balanced" power plan. This was particularly surprising given our relatively low CPU utilization (typically under 10%).
-- Benchmark query showing inconsistent execution times
SELECT COUNT(*) FROM large_table
WHERE created_at BETWEEN '2023-01-01' AND '2023-12-31'
-- Execution times varied between 820ms to 1.2s with power management enabled
Using Intel Power Gadget and SQL Server Extended Events, we collected these metrics during tests:
Power Plan | Avg. Clock Speed | Query Time | Power Draw |
---|---|---|---|
Balanced | 2.1 GHz | 980ms ± 150ms | 85W |
High Performance | 2.8 GHz | 820ms ± 20ms | 112W |
For Windows servers, these PowerShell commands force maximum performance:
# Set power plan to High Performance
powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
# Disable core parking (for NUMA systems)
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Power\" -Name "ParkingEnabled" -Value 0
# Set processor performance boost mode
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Power\" -Name "PerfBoostMode" -Value 0
For Linux-based database servers, the cpufreq governor significantly impacts performance:
# Check current scaling governor
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# Set to performance mode (temporary)
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# Permanent configuration (for RHEL/CentOS)
sudo dnf install kernel-tools
sudo cpupower frequency-set -g performance
For SQL Server, these configurations help mitigate power management impacts:
-- Set priority boost (use with caution)
EXEC sp_configure 'priority boost', 1;
RECONFIGURE;
-- Configure max server memory to prevent swapping
EXEC sp_configure 'max server memory', 32768; -- 32GB
RECONFIGURE;
-- Enable optimize for ad hoc workloads
EXEC sp_configure 'optimize for ad hoc workloads', 1;
RECONFIGURE;