System administrators and power users have long debated the role of swap in modern Linux systems.
With RAM prices dropping and memory capacity increasing, the conventional wisdom suggested swap was obsolete.
However, the reality of swap management reveals a more nuanced situation.
The challenge emerges when systems run low on available memory.
The swappiness parameter—which controls the kernel’s preference for moving inactive memory pages to disk—plays a crucial role in determining system responsiveness.
Set it too high, and your system becomes unresponsive as mechanical drives (or even SSDs) prove far slower than RAM.
Set it too low, and the kernel may struggle to make efficient use of available resources.
Recent kernel changes have introduced performance regressions in swap handling.
A 33% regression in swapin throughput was reported following kernel optimizations intended to improve HDD performance.
Users with SSD-backed swap reported issues where their systems would freeze during swap operations, even though their SSDs should handle the I/O efficiently.
Best Practices for Swap Configuration:
- Always use SSD-backed swap, never traditional hard drives
- Enable zswap to compress swap pages in RAM before writing to disk
- Monitor swap usage with vmstat 1 to detect patterns
- Consider systemd-oomd for proactive memory management
Bibliography:
- Alibabacloud. (2025, December 26). Configure optimize and troubleshoot a swap partition for a Linux instance. Retrieved from https://www.alibabacloud.com/help/en/ecs/support/how-do-i-configure-the-swap-partition-of-a-linux-instance
- DEV Community. (2025, November 14). How to detect if your Linux system is running low on memory. Retrieved from https://dev.to/kingyou/how-to-detect-if-your-linux-system-is-running-low-on-memory-and-about-to-use-swap-47pk
- Hostperl. (2025). How Linux handles memory, OOM killer, and swappiness. Retrieved from https://hostperl.com/kb/tutorials/how-linux-handles-memory-oom-killer-and-swappiness
