Skip to main content

CPU Governor

The Linux CPU governor controls how quickly the CPU scales frequency under load. On some servers, power-saving profiles can keep the CPU at low frequencies until sustained load is detected, adding avoidable latency to short bursts of PHP work. For latency-sensitive WordPress workloads, using the performance governor can make response times more consistent.

Quick Summary

If the governor is set to ondemand or powersave, the CPU may spend more time at lower frequencies and ramp up only after load is detected. Locking the server to performance keeps clocks high so short, bursty PHP requests are less likely to pay a ramp-up penalty.

Governor Profiles Explained

Linux automatically shifts between specific profiles depending on thermal and consumption logic. For high-throughput WordPress instances, these automated shifts are detrimental constraints.

Profile NameOperational BehaviorTarget Environment
performanceHorizontally locks the CPU frequency perfectly at absolute maximum capacity.Mandatory for production WooCommerce and APIs.
ondemandIdles aggressively; ramps to maximum only after detecting heavy sustained load.Restricted to local development test benches.
schedutilIntegrated completely into the CPU scheduler; fluid and adaptive scaling boundaries.Acceptable on generic application servers.
powersavePrioritizes lower frequency to reduce power use.Not recommended for latency-sensitive WordPress workloads.

Prerequisite Checks

  • Server Control: Root CLI access over SSH to the Linux VPS/Bare Metal.
  • Hardware Isolation: The operating system must operate via dedicated vCPUs. Cloud environments relying on shared/burstable CPU allocations (like AWS T4g nano or fractional DO Droplets) natively block governor manipulation via hypervisor restrictions.
  • Tools Requirements: Functional installation of the cpupower utility sets.

Implementing Governor Parameters

Identify the Current Operating State

Poll the specific structural settings of the first CPU core dynamically:

check-active-governor.sh
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

Expected Default Output:

current-governor.txt
ondemand

List Available Governor Options

Interrogate the processor specifically to determine which governors the kernel natively supports:

list-available-governors.sh
cpupower frequency-info

System Response Example:

cpupower-frequency-info.txt
available cpufreq governors: ondemand performance powersave schedutil

Set the Governor to Performance

Immediately force the kernel to command the processor to execute entirely inside the maximum frequency envelope:

force-performance-governor.sh
sudo cpupower frequency-set -g performance

Confirm the change utilizing the identical command from Step 1.

Guaranteeing Boot Permanence

Because the cpupower configuration clears upon rebooting the host node, the modification must be etched permanently into the Linux initialization sequence.

Enable the primary cpupower daemon directly within the systemctl path.

enable-cpupower-systemd.sh
sudo systemctl enable cpupower
sudo systemctl start cpupower

The Performance Impact Metrics

Infrastructure ResourceReal-World Output Consequence
Raw Compute CapabilityAvoids the 5ms-50ms ramp-up lag on short bursts of work.
Origin TTFBUncached WooCommerce checkout requests lock in immediately at minimum response thresholds.
Random Disks (NVMe)Faster CPU instruction delivery rapidly increases the processing ceiling for database writes.
Energy ConsumptionWattage consumption skyrockets to maximum limits persistently (financially irrelevant in flat-rate VPS structures).

Common Mistakes & Mitigation Strategy

Failure OriginSymptom ExpressionRemediation Protocol
Governor resets after restartResponse time becomes less consistent after reboot.Configure boot persistence (see "Guaranteeing Boot Permanence").
Command ignored by the kernelThe configuration has no impact (or returns permission errors).The hosting provider may block CPU frequency scaling in the hypervisor. Consider relocating to a host that allows it.
Missing Base PackagesOutput: cpupower command not found.Quickly apt install linux-tools-$(uname -r) or linux-cpupower to generate the binaries.

What's Next