Go Back

Extend the life of your SSD’s by adjusting swappiness in Linux


What is swappiness and why should I change it?

Swappiness is a value between 0 and 100 which controls the priority of your system using ram vs. swap.

Swap is allocated storage space on your hard disk that is used as virtual ram to extend physical ram.

Making this change will greatly increase the performance of your server! Especially if you have a newer server with lots of ram.

A swappiness value of 0 means the operating system will avoid swap as much as possible and mainly use ram.

A swappiness value of 100 means avoid ram as much as possible and only use swap.

The main reason you want to reduce the use of swap with SSD’s is that using swap will cause a high number of write cycles which will dramatically effect the lifespan of an SSD.

By default, CentOS is set for swappiness of 60.

For most servers I suggest setting it to a value of 15 or lower.

If you have 4, 8, or more GB of ram or SSD’s, consider setting your swappiness to 0.

Ok, so how to I check my swappiness?

Do this command to check your current swappiness value:

cat /proc/sys/vm/swappiness

You can temporarily change it by issuing:

sysctl vm.swappiness=10

To set the value permanently on your box, edit this file:

nano /etc/sysctl.conf

And put in the value you desire, such as:



Tags: , , , , ,