How to Configure Linux CPU Frequency Governor using the cpupower Command

The Processor Bottleneck

Modern Linux servers, especially those running on bare-metal hardware or dedicated cloud instances, are powered by CPUs capable of dynamic frequency scaling. To conserve electricity and reduce thermal output, the CPU will automatically underclock itself (e.g., dropping from 3.5 GHz to 1.2 GHz) when the server is idle. When a heavy computational load hits the server, the CPU scales back up to its maximum frequency.

While this power-saving logic is excellent for laptops and standard workstations, it can be disastrous for extreme high-performance applications like High-Frequency Trading algorithms, real-time VoIP servers, or massive Redis databases. The microsecond latency involved in the CPU waking up and shifting from 1.2 GHz to 3.5 GHz can cause dropped packets or missed database transactions.

To guarantee absolute, uninterrupted bare-metal performance, system administrators must forcefully configure the CPU Frequency Governor to lock the processor at its maximum possible clock speed, regardless of the active load. This is accomplished using the cpupower utility.

Installing the cpupower Utility

The cpupower command is deeply tied to the specific version of the Linux kernel you are running. It is not typically installed by default.

To install it on Ubuntu/Debian:

sudo apt-get install linux-tools-common linux-tools-$(uname -r)

To install it on CentOS/RHEL:

sudo yum install kernel-tools

Analyzing Current CPU Frequencies

Before making changes, you should determine the current state of your processor. The cpupower frequency-info command dumps the active hardware state directly from the kernel.

sudo cpupower frequency-info

Look for two specific lines in the output:

  • hardware limits: This tells you the minimum and maximum physical capabilities of the silicon (e.g., 1.20 GHz - 3.50 GHz).
  • current policy: This tells you which governor is actively managing the CPU. In most default installations, it will say powersave or ondemand.

Configuring the Performance Governor

To eliminate latency, you must switch the active policy to the performance governor. The performance governor instructs the kernel to completely ignore power consumption and force every single CPU core to run at its maximum hardware limit (e.g., 3.50 GHz) permanently, 24/7.

Execute the following command to apply the policy to all CPU cores simultaneously:

sudo cpupower frequency-set -g performance

The terminal will output a confirmation for each CPU core (e.g., Setting cpu: 0, Setting cpu: 1). If you run cpupower frequency-info again, you will see the active governor is now locked to performance.

Making the Configuration Persistent

The cpupower frequency-set command applies the change directly to the active kernel in RAM. If the server is rebooted, the CPU will revert to the default powersave or ondemand governor.

To make the change permanent across reboots, you must enable the cpupower systemd service.

Open the configuration file using a text editor with root privileges:

sudo nano /etc/default/cpupower

Uncomment (remove the #) or modify the governor line to read:

governor='performance'

Save and close the file. Now, enable the service to start automatically during the boot sequence:

sudo systemctl enable cpupower
sudo systemctl start cpupower

Your Linux server is now permanently locked into maximum performance mode, ensuring zero thermal scaling latency for your critical applications.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.