swappiness
also: vm.swappiness
A kernel parameter that controls how aggressively the system swaps memory pages to disk. Higher values favor swapping; lower values favor keeping pages in RAM.
swappiness is a tunable parameter (0–100) that influences the kernel's memory management decisions. It determines the relative weight given to swapping out anonymous memory (like heap and stack) versus reclaiming cache pages when the system needs to free RAM.
A value of 0 tells the kernel to avoid swapping unless absolutely necessary, keeping your working set in physical memory. A value of 100 encourages aggressive swapping to disk. The default is usually 60 on most distributions.
You can view the current setting with cat /proc/sys/vm/swappiness and adjust it temporarily with sysctl vm.swappiness=10 or persistently by editing /etc/sysctl.conf. Lower values are often preferred on interactive systems and servers with adequate RAM, while higher values may help heavily oversubscribed systems avoid out-of-memory kills.