Prohibiting swap when there is still free RAM, swappiness parameter in Ubuntu

If there is still a lot of free RAM, but some operations begin to use Swap in Ubuntu, you should edit the swappiness parameter.

The swappiness parameter controls how actively the kernel moves processes from RAM to the swap disk. Because disk operations take much longer than memory operations, moving processes from memory to disk too aggressively can reduce system and application responsiveness.

This parameter can take values from 0 to 100:

swappiness=0 tells the kernel to avoid swapping processes from RAM for as long as possible. In kernel version 3.5 and later, it completely disables swapping.

swappiness=100 tells the kernel to aggressively move processes from RAM to the swap disk.

The default value in Ubuntu is swappiness=60.

Value check:

cat /proc/sys/vm/swappiness

Changing a parameter for this session (after a reboot the old one will return):

sudo sysctl vm.swappiness=20



Change parameter permanently, in file:

sudo gedit /etc/sysctl.conf

find string:

vm.swappiness=20

If it is not found, add it to the end of the file.

After these steps, restart your computer or:

sudo sysctl --load=/etc/sysctl.conf

Source

1255 0

Comments

Be the first to review this item. Share your rating and review so that other customers can decide if this is the right item for them.
You have to log in to leave a comment. Sign in

Similar articles