How To Speed Up Linux Ubuntu and Debian Based Computers By Improving CPU Performance and Changing the CPU Governor

I used to believe that for Desktops especially that the "ondemand" CPU frequency changing that kernels included with Ubuntu and Debian based distros have would be sufficient for snappy performance.

However, you can feel the lack of performance on the fastest computer if you have ondemand.  A lot of times even under high load 100% of your CPU frequency in MHz will not be used.

For example a 2.8Ghz CPU may only run at 1.8MHz or even .9GHz.  Now the frequency will scale up under high load but you can feel things in the OS aren't as snappy while you wait for the ondemand governor to increase the performance.  This can especially cause choppy sound and video if you are conferencing.

The solution is to change the governor to "performance" so the cores always run at the highest frequency.

How To Check Your CPU Performance Governor Settings

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

ondemand

In this case it is already set to ondemand which is generally the default slow performance mode.

If you do this you will see your CPU is set lower in frequency:

cat /proc/cpuinfo |grep MHz
cpu MHz        : 900.000
cpu MHz        : 1200.000
cpu MHz        : 1400.000
cpu MHz        : 1100.000
cpu MHz        : 1000.000
cpu MHz        : 980.000
cpu MHz        : 1112.000
cpu MHz        : 1484.000
 

How Do We Fix CPU Performance

The below will set up to 100 CPU cores to performance mode.  Just change the 99 to higher number if you have more cores than 100.

for i in {0..99}; do echo performance > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor; done

Conclusion

Setting CPU governor to performance makes a huge difference in the responsiveness of your computer.

A lot of times you may falsely believe your CPU is underutilized when checking the current CPU frequency or top but it is kind of like "auto" settings on your GPU.  By the time the frequencies are adapted you may have usage issues such as audio cutting out and lag in video conferencing due to CPU throttling

After doing this I observed apps that were using 150% CPU go down to 85% CPU

So a lot of times the lack of optimized governor that doesn't scale to the highest frequency will make it seem like your PC is not powerful enough when that's not the case.


Tags:

linux, ubuntu, debian, improving, cpu, governori, desktops, quot, ondemand, frequency, kernels, included, distros, sufficient, snappy, fastest, mhz, ghz, os, aren, choppy, conferencing, cores, settings, sys, devices, cpufreq, scaling_governor, generally, default, mode, proc, cpuinfo, grep, echo, responsiveness, falsely, underutilized, auto, gpu, frequencies, adapted, usage, audio, lag, throttling, observed, apps, optimized, doesn, pc,

Latest Articles

  • How high can a Xeon CPU get?
  • bash fix PATH environment variable "command not found" solution
  • Ubuntu Linux Mint Debian Redhat Youtube Cannot Play HD or 4K videos, dropped frames or high CPU usage with Nvidia or AMD Driver
  • hostapd example configuration for high speed AC on 5GHz using WPA2
  • hostapd how to enable and use WPS to connect wireless devices like printers
  • Dell Server Workstation iDRAC Dead after Firmware Update Solution R720, R320, R730
  • Cloned VM/Server/Computer in Linux won't boot and goes to initramfs busybox Solution
  • How To Add Windows 7 8 10 11 to GRUB Boot List Dual Booting
  • How to configure OpenDKIM on Linux with Postfix and setup bind zonefile
  • Debian Ubuntu 10/11/12 Linux how to get tftpd-hpa server setup tutorial
  • efibootmgr: option requires an argument -- 'd' efibootmgr version 15 grub-install.real: error: efibootmgr failed to register the boot entry: Operation not permitted.
  • Apache Error Won't start SSL Cert Issue Solution Unable to configure verify locations for client authentication SSL Library Error: 151441510 error:0906D066:PEM routines:PEM_read_bio:bad end line SSL Library Error: 185090057 error:0B084009:x509 certif
  • Linux Debian Mint Ubuntu Bridge br0 gets random IP
  • redis requirements
  • How to kill a docker swarm
  • docker swarm silly issues
  • isc-dhcp-server dhcpd how to get longer lease
  • nvidia cannot resume from sleep Comm: nvidia-sleep.sh Tainted: Linux Ubuntu Mint Debian
  • zfs and LUKS how to recover in Linux
  • [error] (28)No space left on device: Cannot create SSLMutex Apache Solution Linux CentOS Ubuntu Debian Mint