I have an Ubuntu 22.04 Linux machine that runs some services and heavily uses ZFS file system. I observe some serious discrepancies in memory reporting when using various system tools.
For example, the free command shows the following data:
# free -gh
total used free shared buff/cache available
Mem: 125G 119Gi 5.2Gi 1.0M 315Mi 4.5Gi
Swap: 11Gi 0.0Ki 11Gi
The top command shows some similar data:
MiB Mem: 128492.1 total, 5506.6 free, 122668.6 used, 316.9 buff/cache
Prometheus node exporter also reports that 96% of memory is taken and shows this in red.
However, the htop shows:
Mem: 125G used: 60.4G buffers: 8.27M cache: 59.8G
I know about buffers/cache and stuff, but as you can see, the free utility doesn't report big buffers. My understanding is that ZFS reserves memory to buffer/cache some data, but this is not getting reported by system utilities, besides htop.
SO, my questions are:
It looks like
htopmemory reporting is more accurate than all other utilities, why?How do I see how much memory is actually reserved by ZFS?
Is it possible to adjust Prometheus node exporter to report it more accurately (as
htopdoes)?The memory reserved by ZFS, is it available for other processes to be claimed?
How do I know when my machine will require more RAM? I mean before it starts to use the SWAP space.