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

  • CentOS 6 impossible to compile a newer libguestfs
  • chroot
  • How To Get Started on Ubuntu with gpt-2 OpenAI Text Prediction
  • Remove cloud-init in your VM
  • QEMU-KVM KVM Command Line Practical Guide
  • Linux How To Change NIC Name to eth0 instead of enps33 or enp0s25
  • virt-resize: error: libguestfs error: could not create appliance through libvirt.
  • Asterisk Does Not Retry When Authentication Fails
  • Linux Debian Ubuntu How To Install PEPPER Faster and Latest Adobe Flash Player in Firefox
  • How To Speed Up Linux Ubuntu and Debian Based Computers By Improving CPU Performance and Changing the CPU Governor
  • Convert data or file to base64 on a single line
  • Linux Mint Ubuntu Debian radeon slow 2D performance issues radeon_dp_aux_transfer_native: 158 callbacks suppressed
  • mdadm: super0.90 cannot open /dev/sdb1: Device or resource busy mdadm: /dev/sdb1 is not suitable for this array.
  • How To Install NextCloud on Centos 7 and Centos 8
  • AH01630: client denied by server configuration:
  • ERROR: Could not find a version that satisfies the requirement PIL (from versions: none) ERROR: No matching distribution found for PIL
  • ZTE Camera Cannot Work unable to connect to camera. Camera has been disabled becaue of security policies or is being used by other apps
  • QEMU KVM how to boot off a physical CD/DVD/BDROM Drive
  • How To Install OpenProject on Centos 7 Step-by-Step Guide
  • Ubuntu Debian Linux Cannot Install Wine Solution - wine1.6 : Depends: wine1.6-i386 (= 1:1.6.2-0ubuntu14.2) but it is not installable wine1.4 : Depends: wine1.6 but it is not going to be installed