Skip to content

Reduce the chance of using swap if you have enough memory

Reduce the chance of using swap if you have enough memory

Answer:

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
60

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.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
  1. List processes by memory usage
  2. How to display swap information on Linux
  3. Synchronize data on disk with memory
  4. Display physical memory size in Linux
  5. How do I check memory information in Linux?

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*