Stop ZFS from eating your RAM before the OOM killer does
Technical Briefing | 11/26/2026
You probably installed ZFS on Linux because you wanted data integrity and those sweet, sweet snapshots. It runs great for months, then one day your monitoring alerts fire because the system is thrashing. You check top, and the ARC is sitting there like a dragon guarding a pile of gold, refusing to yield a single megabyte despite your applications screaming for memory. This bit me in prod during a particularly heavy backup window, and I had to learn the hard way that ZFS doesn’t always play nice with the kernel’s memory management.
Why the ARC won’t let go
The Adaptive Replacement Cache is smart, but it’s not a mind reader. By default, it wants to gobble up almost all your system memory to cache your filesystem operations. In a dedicated storage server, that’s fine. But on a general-purpose box running a database or a bunch of containers, that hunger becomes a liability. The kernel usually manages memory pressure well, but ZFS operates in its own little bubble outside the standard page cache, which means the OOM killer might start nuking your production services while the ARC is still holding onto pages that haven’t been touched in hours.
echo 8589934592 > /sys/module/zfs/parameters/zfs_arc_max
- Cap the ARC size to roughly 50 percent of your total system memory if the server has other jobs to do
- Set the value in /etc/modprobe.d/zfs.conf so it actually survives a reboot
- Use zpool iostat to verify your cache hit ratio doesn’t crater after you artificially limit the ARC
If you are running ZFS on a system with less than 16GB of RAM, you should be proactive. Don’t wait for the OOM killer to pick your most important process as its next victim. Drop your zfs_arc_max into a modprobe config file, reboot, and watch your metrics. If you see the cache hit ratio drop into the gutter, you’ve gone too far, but at least you’ll have a responsive shell when you go to fix it.
