I can’t figure out what is going on with my memory utilization. I am constantly running out of RAM and having problems with applications. It doesn’t seem to be buffer related as in linuxatemyram.com.
I just closed some applications to free up some RAM and here is a snapshot of what I am seeing:
---------------------------------
13.1 GiB
=================================
>> free -m
total used free shared buff/cache available
Mem: 64217 46005 17089 129 1122 17374
Swap: 16383 6613 9770
The top section is the output from ps_mem, applications are using 13.1 GiB. But I have over 52 GiB in use and only about 1 GiB of that is shared memory/buffers/cache.
I can only take a guess maybe some VM left running somewhere?
They have some funky way of managing RAM (meaning it doesn’t always show as normal process)
OK, I figured it out. It is the ZFS ARC cache. It defaults to 50% of available memory which appears to include swap. While it automatically scales down when applications demand memory, that doesn’t help when applications take action based on available memory.
I lowered the cache to a more reasonable number for my use case(5GiB) and the impact was instant.
---------------------------------
17.3 GiB
=================================
>> free -m
total used free shared buff/cache available
Mem: 64217 17398 45109 547 1708 45589
Swap: 16383 6759 9624
I am a bit curious to see if there is any notable decrease in performance since I no longer have ~40GiB of data in cache.
Hmm…I think it is different. zram is compressing swap into RAM. Essentially giving you more available RAM at the expense of the CPU cost of having to decompress it on the fly.
ARC, if I understand it, is caching data from the disk in memory. Making disk reads faster at the expense of RAM utilization.
Zswap is a Linux kernel feature providing a compressed write-back cache for swapped pages. This increases the performance and decreases the IO-Operations. ZRAM creates a virtual compressed Swap-file in memory as alternative to a swapfile on disk.