ubuntu

Ubuntu Swap怎么调整内核参数

小樊
41
2025-11-06 16:27:41
栏目: 智能运维

Adjusting Kernel Parameters for Ubuntu Swap

1. Key Kernel Parameter: vm.swappiness

vm.swappiness controls the kernel’s tendency to move inactive memory pages from RAM to swap space. It ranges from 0 to 100:

2. Temporary Modification (Restart-Effective)

To test the impact of vm.swappiness without rebooting:

3. Permanent Modification (Boot-Effective)

For changes to persist after a reboot, edit the system’s kernel parameter configuration:

4. Verification

After modification, confirm the new value is applied:

cat /proc/sys/vm/swappiness  # Should display the updated value (e.g., 10)

Additional Recommendations

By adjusting vm.swappiness, you can optimize Ubuntu’s swap behavior to match your system’s workload and hardware, ensuring better performance under memory pressure.

0
看了该问题的人还看了