formats

Adjust Your swappiness!

Published on June 23, 2010, by + in linux.





What is swappiness and why the heck should I change it?

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

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

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

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

By default, Ubuntu is set for swappiness of 60.

For desktop users I recommend changing swappiness to a value of 10.

For most servers I suggest setting it to a value of 25.

If you have 4, 8, or more GB of ram, 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:

sudo sysctl vm.swappiness=10



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

sudo nano /etc/sysctl.conf



And put in the value you desire, such as:

vm.swappiness=10



2 Responses

  1. James Watt
    Twitter:

    Really appreciate this info. Setting up a headless linux server (CentOS) with 32GB of physical RAM. It took longer for me to write this than it did to follow your guide. Thanks again.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Home linux Adjust Your swappiness!