Swappiness GNU Linux systems. What is and how to configure it

In this article I present an infographic about swappiness a variable interesting that allows us to manage the use of Linux Swap.

swappiness

What is swappiness?

According to wikipedia:

Swappiness is a property of the Linux kernel that allows for a balance between the use of Swap Space (Swap English, hence the name of the property) and Random Access Memory (RAM).

What things changed?

RAM

Is where the programs and files that are in use at any given time are loaded.

It is better and faster, but is not always sufficient

Swap

A piece of hard disk that is used as RAM.

Usually larger and is very slow compared to RAM

What do the values ​​swappiness?

When you set a value the system attempts to achieve these rates of use between RAM and Swap.

Swappinness 0 RAM 100% – SWAP 0%

Swappinness 35 RAM 65% – SWAP 35%

Swappinness 60 RAM 40% – SWAP 60%

Swappinness 100 RAM 0% – SWAP 100%

With the value 100 indicate the system to try to keep as much free RAM to the hard drive past everything that is not used at all times.

Recommended values ​​swappiness

  • Servers 10

  • Desktop computers with less than 1GB of RAM 10

  • Desktop computers with 1GB or less of RAM 60

How to set swappiness?

Find out swappiness

cat /proc/sys/vm/swappiness

Try values ​​swappiness

Only valid until the next reboot is recommended to use it to test the stability of change is not always the changes go well on all computers is advisable to test various values ​​before settling definitively one.

        echo 10 > /proc/sys/vm/swappiness

Change the value of swappiness definitely

This requires changing the value of vm.swappines in /etc/sysctl.conf

opened as root configuration file

        nano /etc/sysctl.conf

If there is no next line, the final with the added value that interests us, if already, change the value.

        vm.swappiness = 10

Changing the value in the file change the value of the variable.

I hope you liked the article and infographic, if so do not forget to +1 or share the page is the engine that keeps me writing. Thank you very much in advance.

To perform this article we have used the following sources or resources:


About Ignacio Alba Obaya

Microcomputer and Technical Training for Employment. Lover of new technologies. Manager GNU / Linux and Windows.

Leave a Reply