Solution:
Root Cause: ZFS ARC Exhausting Host RAM and Inducing Linux Kernel Swap Thrashing By default, ZFS on Linux consumes up to 50% of total system memory for its Adaptive Replacement Cache (ARC). On Proxmox VE nodes with heavily provisioned VMs, the Linux kernel's out-of-memory avoidance mechanisms force pages into swap space when KVM guest requests memory faster than ZFS can shrink its ARC. This results in severe kernel
iowait (IO Delay) as virtual machine memory ranges are continuously read from and written to slow swap storage.
Diagnostic Verification: Execute the following terminal commands on the Proxmox host to verify memory utilization and ZFS ARC size:
Copy
bash
free -h
arcstat
swapon --show
Observe if
arcstat shows ARC memory near maximum while swap usage (
swapon) is actively increasing during IO delay spikes.
Step-by-Step Fix: 1 Limit Maximum ZFS ARC Size:
Edit or create the ZFS module configuration file in /etc/modprobe.d/zfs.conf: Copy
bash
nano /etc/modprobe.d/zfs.conf
Set zfs_arc_max to a hard ceiling (e.g., 16 GB = 17179869184 bytes for a 64 GB host): Copy
text
options zfs zfs_arc_max=17179869184
options zfs zfs_arc_min=8589934592
2 Apply Module Configuration and Update Initramfs:
Apply the new ZFS parameter dynamically without rebooting: Copy
bash
echo 17179869184 > /sys/module/zfs/parameters/zfs_arc_max
Persist changes across host reboots by updating the initial RAM disk: Copy
bash
update-initramfs -u -k all
3 Tune Kernel Swappiness:
Reduce kernel aggressiveness when swapping host memory pages by setting vm.swappiness in /etc/sysctl.conf: Copy
bash
sysctl -w vm.swappiness=10
echo "vm.swappiness=10" >> /etc/sysctl.conf
Prevention & Long-Term Monitoring: Ensure the sum of maximum guest VM RAM allocation + ZFS zfs_arc_max does not exceed 85% of total physical host memory.