A server administrator notes that a critical database server running Linux is experiencing extremely high swap space utilization, even though physical RAM usage appears to be only 60%. This is causing significant performance degradation. Which of the following is the MOST likely reason for this behavior?
- AA memory leak in a specific application.
- BInsufficient disk space on the swap partition.
- CThe kernel's `swappiness` parameter is set too high.
- DA faulty RAM module causing memory errors.
Show answer & explanationAnswer & explanation
Correct answer: C. The kernel's `swappiness` parameter is set too high.
Linux uses a kernel parameter called `swappiness` (usually `/proc/sys/vm/swappiness`) to control how aggressively the system moves processes out of physical memory and into swap space. A high `swappiness` value (e.g., default 60) can cause the kernel to swap out 'cold' (less frequently accessed) pages even when there is still plenty of free physical RAM, leading to unnecessary I/O and performance degradation.
Why the other options are wrong
- A. A memory leak would typically cause physical RAM usage to climb continuously, eventually leading to swap usage, but the scenario states RAM is only at 60%.
- B. Insufficient disk space on the swap partition would prevent swapping from occurring or cause errors, not lead to high swap utilization while RAM is partially free.
- D. A faulty RAM module would likely cause system crashes, kernel panics, or data corruption, not simply excessive swap usage with moderate physical RAM consumption.
Linux Swappiness Parameter
A kernel parameter (`vm.swappiness`) in Linux that controls the tendency of the kernel to move processes out of physical memory and into swap space. A higher value (0-100) means more aggressive swapping.
- Default value is often 60 on many distributions.
- Lowering `swappiness` (e.g., to 10 or 0 for databases) can improve performance by keeping more data in physical RAM.
- Excessive swapping, even with free RAM, points to a high `swappiness` value.
- Checked with `cat /proc/sys/vm/swappiness` and set with `sysctl -w vm.swappiness=X`.
Memory trick: Swappiness too high? Your RAM is lazy, making disk do all the work!