Boost your Cloud Machine Performance

PerformanceUbuntu

If you’re looking for a way to boost your cloud instance performance this swapiness tip might just be just the tip you’ve been looking for.

You can find in system monitor that Ubuntu is using swap space although you have plenty of free physical RAM.

The value of swappiness is between 0 ~ 100. Lower value means Linux will use swap space less whereas higher value causes Linux to use swap space more often. The default value on Ubuntu is 60 which means when your computer uses up 40% of physical RAM, Linux kernel begins swapping.

You can use the following command to check the current value.

cat /proc/sys/vm/swappiness

It’s recommended to set a low value for swappiness so that Linux kernel will use as much physical RAM as possible. For example, to set swappiness to 10:

sudo sysctl vm.swappiness=10

Do not add space before and after the equal sign. This command tells Linux kernel to use swap space when 90% or more of physical RAM is used up. This setting isn’t persistent.

To make it persistent across reboots, you need to edit a file.

sudo nano /etc/sysctl.d/99-sysctl.conf

At the end of this file, append the following line.

vm.swappiness=10

 

Credits: https://www.linuxbabe.com/ubuntu/4-tips-speed-up-ubuntu-16-04