For When You Can't Have The Real Thing
[ start | index | login ]
start > Linux > swappiness


Created by dave. Last edited by dave, 16 years and 253 days ago. Viewed 9,509 times. #2
[diff] [history] [edit] [rdf]

Force use of your RAM vs. Swap

Linux uses hard disk space called swap to write information it needs for accessing various temporary programs when system RAM is busy. This is because many years ago, RAM sizes were relatively small. To combat this, swap space was born. Now the OS could write to the disk when RAM wasn't available. Times have changed though and many systems have much more RAM than they did in the past. With this tip you can change the tendency of the distro when it writes to Swap so that it uses Swap less and RAM more. This setting is called "swappiness." PCLinuxOS comes with a default of 60 (seen by parsing the command "cat /proc/sys/vm/swappiness" in a console as root). To change it, use the following command:

# sysctl -w vm.swappiness=10

This will change the tendency of the OS to write to RAM which is faster than hard disk writes.

To make this change apply after reboot, edit /etc/sysctl.conf and add the following line at the very bottom:

# swapinness

You're all done! That should make the change permanent and allow you to have more writes to RAM and less to Swap to speed things up. Note that you should only do this if you have a larger amount of RAM (I have 2GB...I'd say 1GB and up).


no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful: | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt