Adjust Virtual Memory (VM) Tunables
Virtual Memory (VM) tunables are kernel parameters that control how the system manages memory, including how aggressively it uses swap space. Adjusting these settings can significantly impact system performance based on the workload.
About this task
The vm.swappiness parameter controls the kernel’s tendency to move processes out of physical memory and into swap space. The value is a percentage, ranging from 0 to 100:
- Higher Value (e.g., 60 or 100): The kernel will swap processes to disk more aggressively. This can free up physical memory for other uses (like the file system cache), but it may increase I/O operations and latency if swapped processes are frequently needed.
- Lower Value (e.g., 0 or 10): The kernel will try to avoid swapping and keep processes in physical memory for as long as possible. This is generally preferred for desktop systems or servers with fast I/O and large amounts of RAM.
Following other relevant VM tunables can influence swap behavior:
- vm.dirty_ratio: The percentage of system memory that can be filled with "dirty" pages (memory pages that have been modified but not yet written to disk) before the kernel begins actively writing them out.
- vm.dirty_background_ratio: The percentage of system memory that can be filled with dirty pages before a background kernel process begins writing them out. This is a less aggressive action than
vm.dirty_ratio.