Page 1 of 1

Forcing ARC/SPL to Release RAM?

PostPosted: Thu Jan 20, 2022 1:22 pm
by Haravikk
Is the Performance page on the wiki still accurate when it comes to controlling ARC memory usage?

I ask because the command "sysctl -w kstat.spl.misc.spl_misc.simulate_pressure=<amount of ram to release in bytes>" no longer seems to work:

Code: Select all
$ sysctl -w kstat.spl.misc.spl_misc.simulate_pressure=4294967296
sysctl: unknown oid 'kstat.spl.misc.spl_misc.simulate_pressure'


There's also no /etc/zfs/zsysctl.conf or example file created by default (is there supposed to be?), I've created one myself so I can set kstat.zfs.darwin.tunable.zfs_arc_max in it, but it's going to be a while before my next restart (got a tonne of data to copy into a new ZFS dataset and I'd prefer to just let it run).

Until now I haven't bothered touching the ARC settings, but the size seems to grow a lot faster when you have multiple proper ZFS datasets; until recently I've only really been using a single zvol which never caused the ARC to grow very much despite its size, but with me copying terabytes of data into a new plain dataset I've seen ARC usage shoot up and while it does back off with high memory pressure as expected, there is still some noticeable impact on system performance so I'd like to limit it to 4gb or so till I can install more RAM.

Re: Forcing ARC/SPL to Release RAM?

PostPosted: Fri Jan 21, 2022 3:42 pm
by Haravikk
On a related note, but are there any good stats or tools for monitoring the performance of the ARC, e.g- for things like the percentage of cache hits to misses and that kind of thing? I know the general wisdom is to just throw as much RAM as possible at it, but since my home ZFS volumes are for general purpose machines rather than servers it might be useful to measure the impact of different cache sizes.

And also, what's the relationship between kstat.zfs.misc.arcstats.arc_raw_size and kstat.spl.misc.spl_misc.os_mem_alloc, as currently the latter seems to be around 3gb larger than the former for me. Or more generally is there somewhere that fully documents what all of these stats are?

It seems like kstat.zfs.misc.arcstats.arc_raw_size declines to the value I set (or below) relatively quickly, but kstat.spl.misc.spl_misc.os_mem_alloc seems to remain large until memory pressure is really high; it seemed reluctant to give up any memory until I restarted, in which case it reserved my maximum (now 2gb) straight away.

Re: Forcing ARC/SPL to Release RAM?

PostPosted: Mon Jan 24, 2022 12:20 am
by lundman
Ah hmm i believe it was renamed:

kstat.spl.misc.spl_misc.spl_spl_free_manual_pressure: 0