Linux Swap Space Configuration & zRAM Sizing for Cloud VPS Memory Optimization
Z
Published by ZodHost Engineering Team
Executive Summary & Key Takeaways
Learn how to configure swap files, tune swappiness kernels, and utilize zRAM compressed memory to prevent Out-Of-Memory (OOM) crashes on VPS.
Preventing Linux Out-Of-Memory (OOM) Killer Crashes
When a cloud VPS runs out of physical RAM during sudden traffic spikes, the Linux kernel invokes the OOM killer to terminate high-memory processes like MySQL/MariaDB. A properly configured swap space acts as a vital safety buffer.
Configuring Swappiness
Set vm.swappiness = 10 in /etc/sysctl.conf to preserve physical RAM for active database buffers while retaining swap as an emergency safety valve.