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 to install Windows or other OS and then bring to another computer by using a physical drive and Virtual Machine with QEMU
  • PXE-E23 Error BOOTx64.EFI GRUB booting is 0 bytes tftp pxe dhcp solution NBP filesize is 0 Bytes
  • vagrant install on Debian Mint Ubuntu Linux RHEL Quick Setup Guide Tutorial
  • RHEL 8 CentOS 8, Alma Linux 8, Rocky Linux 8 System Not Booting with RAID or on other servers/computers Solution for dracut and initramfs missing kernel modules
  • How to Upgrade to Debian 11 from Version 8,9,10
  • Ubuntu Linux Mint Debian Redhat Cannot View Files on Android iPhone USB File Transfer Not Working Solution
  • Virtualbox Best Networking Mode In Lab/Work Environment without using NAT Network or Bridged
  • debootstrap how to install Ubuntu, Mint, Debian install
  • Linux grub not using UUID for the root device instead it uses /dev/sda1 or other device name solution
  • How To Restore Partition Table on Running Linux Mint Ubuntu Debian Machine
  • Debian Ubuntu apt install stop daemon questions/accept the default action without prompting
  • iptables NAT how to enable PPTP in newer Debian/Ubuntu/Mint Kernels Linux
  • Grandstream Phone Vulnerability Security Issue Remote Backdoor Connection to 207.246.119.209:3478
  • Linux How to Check Which NIC is Onboard eth0 or eth1 Ubuntu Centos Debian Mint
  • VboxManage VirtualBox NAT Network Issues Managment Troubleshooting
  • Dell PowerEdge Server iDRAC Remote KVM/IP Default Username, Password Reset and Login Information Solution
  • Nvidia Tesla GPUs K40/K80/M40/P40/P100/V100 at home/desktop hacking, cooling, powering, cable solutions Tutorial AIO Solutions
  • Stop ls in Linux Debian Mint CentOS Ubuntu from applying quotes around filenames and directory names
  • Thunderbird Attachment Download Error Corrupt Wrong filesize of 29 or 27 bytes Solution
  • Generic IP Camera LAN Default IP Settings DVR