You run free -h on a ZFS host and see 58 of 64 GiB “used”, with almost nothing in buffers/cache. Your application processes account for maybe 8 GiB. Something is eating the machine, and you start hunting for a leak.
There is no leak. The missing memory is the ZFS ARC (Adaptive Replacement Cache), ZFS’s primary read cache in kernel memory. On Linux the ARC lives outside the kernel page cache, so free and top report it as used slab, not as reclaimable cache. Operators who do not know this tune swappiness, add swap, or kill innocent processes to “free” memory that was never in danger.
This symptom has two distinct halves. The first is a reporting problem: the ARC looks like a memory shortage when it is actually the cache working as designed. The second is a real risk: with no explicit cap, the ARC can grow large enough that applications genuinely starve and the OOM killer fires, because the ARC is reclaimable but not instantly reclaimable. This guide covers how to tell the two apart and how to set zfs_arc_max correctly.
What this means
The ARC caches both data and metadata blocks, and grows and shrinks in response to memory pressure. Left alone, it consumes available memory aggressively, because from ZFS’s perspective unused RAM is wasted cache.
The default ceiling depends on your OpenZFS version. Before OpenZFS 2.3.0, Linux defaulted the maximum ARC size to 50% of system RAM. Since OpenZFS 2.3.0, every platform uses the larger of all_system_memory - 1 GiB and 5/8 x all_system_memory, which approaches nearly all of RAM on larger hosts. Either way, if you never set zfs_arc_max, the effective ceiling is far above what a shared application host can tolerate.
The reclaim problem is the dangerous part. The ARC shrinks under kernel memory pressure, but with latency. A sudden large allocation can trigger the OOM killer before the ARC has had time to shrink. Compounding this, the ARC is not accounted as available memory the way page cache is: it shows up in slab usage, and a long-standing OpenZFS issue (#10255) tracks the fact that ARC is not reflected in MemAvailable. Tools like earlyoom and systemd-oomd therefore see falsely low available memory on ZFS hosts.
flowchart TD
A["free/top shows almost no free memory"] --> B{"ARC size large in arcstats?"}
B -- "no" --> D["Real application or kernel memory use - not ARC"]
B -- "yes" --> C{"memory_throttle_count rising, or OOM kills in dmesg?"}
C -- "no" --> E["Healthy ARC caching - by design, no action"]
C -- "yes" --> F["Genuine pressure - cap the ARC"]
F --> G["Runtime: sysfs parameter, Persistent: /etc/modprobe.d/zfs.conf"]Common causes
| Cause | What it looks like | First thing to check |
|---|---|---|
No zfs_arc_max set (the default) | ARC size tracks total RAM; free shows nearly everything used; no OOM, no throttle | cat /sys/module/zfs/parameters/zfs_arc_max returns 0 or a huge value |
zfs_arc_max set too high for a shared host | ARC plus application working set exceeds RAM; swap in use; occasional OOM kills | Compare ARC size plus application RSS against physical RAM |
| Genuine application memory growth squeezing the ARC | ARC shrinking well below c_max, hit ratio falling, disk reads climbing | ps aux --sort=-%mem | head and watch ARC size trend |
| Metadata-heavy workload inflating ARC usage | ARC large but data hit ratio poor; many small files or directory scans | Check data vs metadata hit fields in arcstats |
Quick checks
All of these are read-only and safe on a production host.
# What is the ARC allowed to grow to? 0 means "no explicit cap"
cat /sys/module/zfs/parameters/zfs_arc_max
# Current ARC size, target, and hard limits (bytes)
grep -E "^(size|c|c_min|c_max) " /proc/spl/kstat/zfs/arcstats
# Is ZFS actively throttling I/O due to memory pressure?
grep "^memory_throttle_count" /proc/spl/kstat/zfs/arcstats
# How much of what free calls "used" is actually slab (where the ARC lives)?
grep -E "^(MemTotal|MemAvailable|Slab|SReclaimable)" /proc/meminfo
# Has the OOM killer actually fired?
dmesg | grep -i -E "out of memory|oom-kill"
# Human-readable summary of ARC state
arc_summary
Interpretation: if size is near c_max, memory_throttle_count is flat, and there are no OOM events, you are looking at healthy caching. If memory_throttle_count is incrementing or dmesg shows OOM kills, the ARC (or something else) is genuinely starving applications.
How to diagnose it
- Establish uptime context. If the machine booted recently, a growing ARC is just the cache warming. Only diagnose pressure on hosts up long enough to reach steady state (the playbook uses uptime > 600 seconds as the noise floor).
- Confirm the memory is ARC. Compare
sizefromarcstatsagainst the gap between your application RSS total and physical RAM. If ARC size explains the “missing” memory, stop hunting for a leak. - Check for real pressure. A single snapshot of
memory_throttle_countis meaningless; watch it over a minute or two. Incrementing means ZFS is actively throttling I/O because of memory pressure, which is real, not cosmetic. - Check for OOM evidence. Look in
dmesgandjournalctl -k. If the OOM killer fired and the victim was an application while ARC size was large, the ARC did not shrink fast enough. That is the failure mode a cap prevents. - Decide which situation you are in. Large ARC, flat throttle counter, no OOM: healthy, optionally cap for headroom. Large ARC plus throttle or OOM: cap now. Shrinking ARC plus rising disk reads: some other process is the memory consumer; find it before blaming ZFS.
Metrics and signals to monitor
| Signal | Why it matters | Warning sign |
|---|---|---|
ARC size vs c_max (/proc/spl/kstat/zfs/arcstats) | Tells you whether the ARC is at its ceiling or being squeezed | size persistently well below c_max on a busy host means memory pressure from elsewhere |
memory_throttle_count | Increments when I/O is throttled due to memory pressure | Any sustained incrementing; this is the earliest real-pressure signal |
ARC hit ratio (hits / (hits + misses)) | Shows whether the cache you are spending RAM on is earning it | Below 80% sustained on read-heavy workloads after warmup |
System MemAvailable and slab (/proc/meminfo) | The operator-facing view; slab is where the ARC hides | MemAvailable near zero on a host that also runs applications |
| OOM kills in kernel log | The terminal failure of the ARC starvation pattern | Any OOM event on a host with uptime > 600s |
Fixes
Cap the ARC at runtime
# Example: cap the ARC at 32 GiB (takes effect immediately)
echo 34359738368 > /sys/module/zfs/parameters/zfs_arc_max
The new ceiling applies immediately, with two caveats. First, the ARC is reclaimable but not instantly: if the current size is above your new cap, it shrinks as memory pressure and eviction push it down, not all at once. Second, the parameter may not accept being set back to 0 (uncapped) while the module is loaded; returning to the default can require a reboot or module reload.
Sizing guidance from the operational playbook: the ARC should leave 20-25% of system RAM for the OS and applications, and should not exceed 80% of RAM. On a dedicated storage host, 75% of RAM is a common target. On a shared host running databases or application servers, be more conservative and size from the application’s working set upward.
Make the cap persistent
The sysfs write does not survive a reboot. Set it in module configuration:
# /etc/modprobe.d/zfs.conf
options zfs zfs_arc_max=34359738368
On root-on-ZFS systems the module is loaded from the initramfs, so regenerate it (for example update-initramfs -u on Debian/Ubuntu, dracut on RHEL-family) or the cap will not apply early in boot.
One constraint worth knowing: zfs_arc_max must be above the ARC minimum (c_min; check grep ^c_min /proc/spl/kstat/zfs/arcstats on your host). Values below that floor are rejected, and on recent OpenZFS releases the module logs a warning rather than silently ignoring the setting.
When the ARC is not the problem
If size is well below c_max and memory is still tight, the ARC is the victim, not the cause. Find the real consumer (ps aux --sort=-%mem), and if it is a legitimate workload, size zfs_arc_max explicitly so the split between ARC and application is deliberate rather than fought over by the kernel at 3 a.m. Setting the cap too low is a real tradeoff: hit ratio falls and read latency rises. Treat the cap as a budget decision, not a reflex.
One sharp edge: do not put swap on a ZFS zvol or dataset. Under memory pressure, ZFS itself needs memory to service swap I/O, which can deadlock. Use a separate non-ZFS partition for swap.
Prevention
- Set
zfs_arc_maxon every ZFS host at provisioning time. The default ceiling (nearly all of RAM on OpenZFS 2.3.0+ on larger hosts) is only safe on dedicated storage appliances, and even there it deserves an explicit decision. - Alert on
memory_throttle_countincrements, not on ARC size. A large ARC is normal. Throttling is the signal that pressure is real. - Monitor the ARC hit ratio alongside the cap. If you lower the cap and the hit ratio falls off a cliff, you traded an OOM risk for a latency problem; revisit the split.
- Be skeptical of
freeon ZFS hosts. Train the team to readarcstatsbefore declaring a memory emergency. This one habit prevents most of the misdiagnosis this symptom causes.
How Netdata helps
- ARC size vs target vs ceiling in one view. Netdata charts
size,c, andc_maxfromarcstats, so “is the ARC at its cap or being squeezed?” is a glance, not a grep. memory_throttle_countas a rate. Continuous collection separates a flat line (healthy caching) from an incrementing one (real pressure) without manual sampling.- Hit ratio next to memory pressure. Correlating ARC hit ratio with MemAvailable and slab usage shows whether your RAM is buying cache hits or just sitting large.
- OOM events on the same timeline. Kernel OOM kills overlaid on ARC size and application memory makes the “ARC did not shrink fast enough” failure mode visible instead of inferred from
dmesgafter the fact. - Disk reads as the downstream signal. When the ARC is squeezed, read IOPS climb; having all three signals on one dashboard is what distinguishes ARC starvation from a disk problem.
Related guides
- How ZFS actually works in production: a mental model for operators
- ZFS monitoring checklist: the signals every production pool needs
- ZFS monitoring maturity model: from survival to expert
- ZFS checksum errors on multiple devices: suspect RAM or the controller, not the disks
- ZFS No space left on device: ENOSPC, the slop reserve, and the pool you cannot delete from






