Stop ZFS from burning through your spare RAM for metadata
By Saket Jain Published Linux/Unix
Stop ZFS from burning through your spare RAM for metadata
Technical Briefing | 11/22/2026
You probably think the Adaptive Replacement Cache is smart enough to handle itself. Most of the time it is. But I have seen it turn into a runaway train on systems with mixed workloads, where the ARC aggressively pins metadata while the application layer gasps for air. This bite me in prod back when we were hosting heavy database indexes on ZFS. If you find your OOM killer waking up despite having plenty of free memory, check your ARC stats.
Why the ARC refuses to let go
The ARC is greedy by design. It wants to keep everything cached, and when pressure hits, it often holds onto metadata far longer than it holds onto actual file data. If your system is swapping but the ARC is still sitting at ninety percent usage, you have a mismatch between your workload and your kernel parameters. You need to enforce a hard ceiling before the kernel decides to start pruning your application processes instead.
echo 16106127360 > /sys/module/zfs/parameters/zfs_arc_max
- Calculate your ceiling based on physical RAM minus your core service requirements
- Test the setting via sysfs first before burning it into modprobe.d
- Verify your actual hit rates with arcstat to ensure you aren’t throttling too hard
Make the change stick for the long haul
Don’t just run that echo command and walk away, or you will be back to square one after the next reboot. Toss the limit into your modprobe configuration so it loads when the ZFS module initializes. If you are still seeing weird pressure after capping it, look into zfs_arc_meta_limit to see if the metadata cache specifically is the culprit. It is better to have a slightly slower cache hit rate than to have your entire stack restart because the kernel panicked over memory availability.
