Swappiness

Linux and Open Source Blog just had a great little tips & tricks post about modifying a sysctl variable to control how much the system will try to utilize the swap space. Of course, as they mention in the article, if you have large amounts of memory, you may not want a very high swappiness value.

From Linux and Open Source Blog

The use of the swap memory by default on Kernel 2.6.xx is set to 60% that means that the system will use intensively the swap memory. This sounds good if we have a small amount of memory (around 512MB) and lot of load on our PC especially if it is working as server. But if we have plenty of RAM, as I do which is 2GB, and we are using our PC as desktop machine for daily use, we can change the percentage of swap to be utilized.
This is valid for quite a lot os distributions inlcuding openSUSE, Debian, Fedora and CentOS.

On a Terminal do this as root (use sudo if running Ubuntu)

cat /proc/sys/vm/swappiness

You should see 60. Now change it to 10

sysctl -w vm.swappiness=10

Now is time to work for some minutes with some applications if you see that is better, you can make the changes permanent.

vim /etc/sysctl.conf

and add this line at the end (let me know if it is better to insert this in other file for openSUSE distribution)

vm.swappiness=10

On the same token I found a post on Kernel Trap about some of the arguments for and against doing such a thing:

“My point is that decreasing the tendency of the kernel to swap stuff out is wrong. You really don’t want hundreds of megabytes of BloatyApp’s untouched memory floating about in the machine. Get it out on the disk, use the memory for something useful.” Andrew Morton

Popularity: 1% [?]

Share and Enjoy:
  • Print
  • Identi.ca
  • Digg
  • Sphinn
  • del.icio.us
  • Mixx
  • Google Bookmarks
  • Blogplay
  • Facebook
  • Twitter
  • Posterous
This entry was posted in Linux, Operating Systems and tagged , , , , . Bookmark the permalink.

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> <pre lang="" line="" escaped="">