Categories: Computing

Setting the CPU speed frequency on dedicated server

Fixing a dedicated server CPU not running at full max speed by setting an upper and lower limit with cpufrequtils.

A processor will scale for certain reasons like power consumption, temperature and stability. However, at a lower clock rate tasks will take longer and the CPU could put itself under more load than if it was running at full speed, to begin with.

A CPU’s speed is the rate in wave frequencies which it can execute tasks, also called a clock rate.

Running this command will give you the CPU name/model/type, thread count and the speed (MHz) that thread is running at

grep -E '^model name|^cpu MHz' /proc/cpuinfo

Chances are that on a VPS your allocated CPU will be running at its max speed. On a dedicated however it will have speed scaling enabled. This means that when the CPU isn’t under intensive strain it will find a lower clock speed that makes it comfortably able to do simple tasks.

I found that my Intel Xeon E3-1245 v5 @ 3.50GHz stayed at a mere 800 Mhz most of the time when doing small tasks. Removing CPU scaling and setting a ceiling for the CPU speed was rather easy.

Install cpufrequtils with

sudo apt install cpufrequtils

Once that has finished run:

cpufreq-info

This returns plenty of details about the CPU like its limits, hardware restriction, current speed, and steps.

Set max speed

As my max CPU speed is 3.50GHz I am going to set that as the max upper limit

sudo cpufreq-set -u 3.5Ghz

Set minimum speed

Next is the lower limit, what it will be at when not under a load. I can set 3.5Ghz meaning the CPU will run at that speed 24/7 even if it has no load or I can be conservative.

sudo cpufreq-set -d 3.3Ghz

Sets the CPU minimum clock speed at 3.3GHz, this fixes the problem of my CPU scaling its speeds and not running some tasks at/close to full speed and capability.

Share

Recent Posts

Kennington reservoir drained drone images

A drained and empty Kennington reservoir images from a drone in early July 2024. The…

2 years ago

Merrimu Reservoir drone images

Merrimu Reservoir from drone. Click images to view larger.

2 years ago

Early September spring shots

Some early September spring shots from a bushwalk, It is still too early for wildflowers.

3 years ago

Cloning an NVMe to SK Hynix Platinum P41 NVMe

I recently needed to clone over a smaller NVMe to a 2TB SK Hynix Platinum…

3 years ago

Using Laravel’s deleteDirectory to delete folders and their contents

If you ever needed a simple solution in Laravel to delete an entire directory and…

3 years ago

How to allow only 1 user to register in a Laravel application

How to enforce only one user to register or be registered in a Laravel web…

3 years ago