ZRAM Swap Compression on Memory-Constrained Nodes
Configuring in-memory compressed block devices with zstd to absorb transient memory spikes without hitting slow disk swap.
Setup
Using zstd provides a balanced compression ratio with minimal CPU overhead:
modprobe zram
echo zstd > /sys/block/zram0/comp_algorithm
echo 512M > /sys/block/zram0/disksize
ZRAM is a cushion, not extra memory. If the system is swapping constantly, the fix is less memory use, not a bigger zram device.