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

  • Flash LSI MegaRAID 2208 to IT mode in Linux Mint/Debian/Ubuntu
  • LSI MegaRAID in Linux Ubuntu / Centos Tutorial Setup Guide megacli
  • Convert-im6.q16: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/413. convert-im6.q16: no images defined `pts-time.jpg' @ error/convert.c/ConvertImageCommand/3258. solution ImageMagick P
  • Apache PHP sending expires header solution cannot use cache with CDN
  • How to install virt-manager in Mint 22/Ubuntu 22
  • Infiniband Guide
  • python mysql install error: /bin/sh: 1: mysql_config: not found /bin/sh: 1: mariadb_config: not found /bin/sh: 1: mysql_config: not found mysql_config --version
  • FreePBX 17 How To Add a Trunk
  • Docker Container Onboot Policy - How to make sure a container is always running
  • FreePBX 17 How To Add Phones / Extensions and Register
  • Warning: The driver descriptor says the physical block size is 2048 bytes, but Linux says it is 512 bytes. solution
  • Cisco How To Use a Third Party SIP Phone (eg. Avaya, 3CX)
  • Cisco Unified Communication Manager (CUCM) - How To Add Phones
  • pptp / pptpd not working in DD-WRT iptables / router
  • systemd-journald high memory usage solution
  • How to Install FreePBX 17 in Linux Debian Ubuntu Mint Guide
  • How To Install Cisco's CUCM (Cisco Unified Communication Manager) 12 Guide
  • Linux Ubuntu Redhat How To Extract Images from PDF
  • Linux and Windows Dual Boot Issue NIC Won't work After Booting Windows
  • Cisco CME How To Enable ACD hunt groups