ZFS Reduce memory-hogging interactively?

I added another 16GB to my fileserver with a view to making it a server-of-all-work, since it's up all the time. But it appears, from top, that ZFS has grabbed most of the additional memory. 28GB is "wired" and there's only 900MB free, whereas on another machine, also 32GB but without ZFS, 29GB is free with only 453MB "wired".

It would be nice if I could restrict its usage without having to bring down the system, since I've a Java filter that's been running for more than a week, and it's not smart enough to recover from where it leaves off.

Is there a way to limit ZFS's memory use interactively?
 
I think you can set primarycache=none on datasets that you don't want in cache. It won't evict though, but no new reads will be cached.. Most of the time zfs will give back the memory if it is pressed..
 
Actually you read the numbers wrong. How much free memory you have is not important, if your swap size is large then should consider setting a LIMIT on the ARC, but most likely that wont help either.

https://www.freebsd.org/doc/handbook/zfs-advanced.html
vfs.zfs.arc_max - Maximum size of the ARC. The default is all RAM less 1 GB, or one half of RAM, whichever is more. However, a lower value should be used if the system will be running any other daemons or processes that may require memory. This value can only be adjusted at boot time, and is set in /boot/loader.conf.
 
You can't change the VM subsystem tunables on the fly, they are read-only on a running system. Limit the size of the ARC cache to a suitable size as noted above.
 
It may be broken. I set vfs.zfs.arc_max="8G" and rebooted. Didn't work. I subsequently tried "8192M" and the number in bytes, and then tried 8G without quotes. Nothing worked.

[EDIT:]It's possible (the zfs-stats -A display is a little unclear) that entering the number in bytes (i.e., without M or G) without quotes works.
 
I added another 16GB to my fileserver with a view to making it a server-of-all-work, since it's up all the time. But it appears, from top, that ZFS has grabbed most of the additional memory. 28GB is "wired" and there's only 900MB free, whereas on another machine, also 32GB but without ZFS, 29GB is free with only 453MB "wired".
Free memory is memory that isn't doing anything. Various parts of the system will acquire memory for different purposes. Some parts are easier for the system to reclaim than others - for example, dirty disk buffers can only be reclaimed at the speed the disk(s) can write those buffers out. I used to fiddle with the various tunables to try to override the system's defaults, but I rarely came up with something better for any specific case, and my tuning hurt things if the usage pattern changed.

As long as your system isn't swapping (a few pages in and out is to be expected), unless you're running a desktop system where interactivity is valued above efficiency, your system is probably behaving pretty well. Here's the output from top on one of my ZFS systems:
Code:
last pid:  1080;  load averages:  0.08,  0.10,  0.10    up 5+05:10:39  05:43:16
71 processes:  2 running, 68 sleeping, 1 waiting
CPU:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt, 99.9% idle
Mem: 318M Active, 4987M Inact, 87G Wired, 152M Cache, 1655M Buf, 1600M Free
ARC: 82G Total, 18G MFU, 63G MRU, 2320K Anon, 345M Header, 792M Other
Swap: 32G Total, 32G Free
 
Back
Top