Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jan 172010

Reduce the chance of using swap if you have enough memory


If you have enough memory but the Linux is still using swap at sometimes, you can adjust the swappiness parameter

1. See the current setting

# cat /proc/sys/vm/swappiness

The range is from 0 to 100 (lower value means you system will try to avoid swap as much as possible)

2. To set a lower value at runtime

# echo "30" >  /proc/sys/vm/swappiness

3. To set it permanently

# /sbin/sysctl -w vm.swappiness=30

Reboot after the changes.

 Leave a Reply



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>