Hey Stef,
The following is oversimplified, but its what happens on my machine.
ZFS does grab all avalaible RAM, subject to a couple of tunables (so you can stop ZFS from grabbing all your RAM). It also returns RAM, but this is based on its own assessment of need rather than demand from other processes. The more memory ZFS uses (for ARC) the faster it performs.
To stop ZFS grabbing all RAM you can configure the following tuneables in loader.conf
vfs.zfs.arc_max
vm.kmem_size (don't play with this)
So if you make vfz.zfs.arc_max to 3G less than your_size, then that memory would not be available to ZFS and can be preserved for the rest of your system and applications.
I'd suggest running the following command to see what you are using now:
Code: Select all
sysctl vfs.zfs.arc_max
sysctl vm.kmem_size
Having said that - I always configure some swap because you might do something in the future that consumes more than 100% of RAM. If you have swap, the machine might slow down to a crawl. If you don't have swap you could crash the machine - and crashing is much more likely to corrupt your precious data.
Ref:
https://www.freebsd.org/doc/handbook/zfs-advanced.html
Just a small note - wrt my advice on in the link you mentioned. I don't know if putting swap on your ZFS drive is best practice (obviously do it if you have no other choice) but I would put swap in order of preference:
- an alternative SSD
- an alternative rotational HDD
- my ZFS pool.
(never put swap on a flash drive).
the reason I say this is I can imagine a memory problem might adversely affect ZFS - and then prevent you from using the pool for swap to alleviate the problem.