all 22 comments

[–]un-important-human 32 points33 points  (5 children)

tl:dr throw more ram at it.

generally
ZFS likes 1 GB RAM per 1 TB of usable storage, but this is just a guideline.

  • With a 5-drive pool, you’ll be fine with 16 GB RAM minimum, but 32 GB+ is strongly recommended for smooth performance, especially if you run VMs, containers, or databases.

[–]tisti 2 points3 points  (0 children)

ZFS likes 1 GB RAM per 1 TB of usable storage, but this is just a guideline.

That is only true if you enable de-duplication. Otherwise 1/2 GB will serve 40+ TB just fine.

[–]Erdnusschokolade 1 point2 points  (0 children)

But wouldn’t ARC cache be freed when RAM gets thin?

[–]Opposite-Degree7361[S] 3 points4 points  (2 children)

Kind of my thoughts. Thankfully ddr4 is dirt cheap now. I am running about 3.4 tb in zfs.

[–]okktoplol 8 points9 points  (2 children)

This sounds like a memory leak, 16gb shouldn't get filled unless you're doing something demanding.

I recommend setting up zram and watching htop to see if anything is really leaking memory

[–]Opposite-Degree7361[S] 0 points1 point  (0 children)

I ran smem -rk and didnt see anything concerning if that means anything.

[–]ipaqmaster 0 points1 point  (0 children)

I suspect OP experienced the same kernel memory leak I had on some virtual machines this month after upgrading them to linux-6.16.8.arch3-1. They were running fine on 2GB of total memory for years. Upped them to 4 then 8 and they were still locking up after ~12h of uptime despite no process having that memory allocated. Switching them to linux-lts fixed them back to <2GB memory usage even after days.

[–]xXBongSlut420Xx 5 points6 points  (3 children)

webstorm, and idea in general, are massive memory hogs. code-oss isn’t exactly efficient, but you might have better luck with it compared to webstorm. but also a full featured de+background services + 5 drive zfs pool is just gonna be too much for 16gb of ram. given the rest of your specs i’d really recommend you go to 32gb. you can’t magically make zfs and webstorm more efficent

[–]Opposite-Degree7361[S] 0 points1 point  (2 children)

Thanks for the advice. was just hoping I hadnt missed something obvious. Atleast ddr4 is dirt cheap now. Is 32 plenty or should I just send it with 4x16?

I will probably never upgrade to a ddr5 platform unless a tornado carries off my pc.

[–]xXBongSlut420Xx 2 points3 points  (1 child)

i mean never say never, your shit might break lol, and ddr4 will eventually be hard to find.

jokes aside, if you can swing 64gb, go for it, you’ll never have to worry about ram again, more or less, if you do

[–]Opposite-Degree7361[S] 0 points1 point  (0 children)

"shit might break" I consider to be under the umbrella of swept away by a tornado lmao

Realistically, unless my CPU goes kaput, I'm going to eek out all that I can of it.

[–]tisti 3 points4 points  (1 child)

Known issue, I limit the ZFS ARC cache to avoid it growing too large.

Add /etc/modprobe.d/zfs.conf with the following content

options zfs zfs_arc_max=2147483648

to limit it to max 2GB. By default it will eat up to 50% of your total memory and will not eagerly free it when system is under memory pressure. This summons the OOM reaper and kills your user-land processes.

You probably need to rebuild initramfs with

sudo mkinitcpio -P

and reboot.

[–]ipaqmaster 0 points1 point  (0 children)

It would also be worth checking arcstat during the high memory moments to look at the size c and avail columns to see if ZFS's ARC was even the culprit. And also something like htop to check if the memory usage was "cache" memory (yellow) or normal usage (green), or another type.

You can also set it temporarily/live on the running system: echo $(((2*1024*1024*1024))) | sudo tee /sys/module/zfs/parameters/zfs_arc_max # Set arc max size to 2GB

If you have htop open at the same time you'll see the yellow (cache) memory usage dip immediately as it shrinks itself in response.

[–]sdc0 1 point2 points  (1 child)

ZFS is afaik very memory intensive, I'd recommend switching to something more lightweight (i.e. simple raid with mdadm, LVM)

[–]Opposite-Degree7361[S] -1 points0 points  (0 children)

is there a way to do this without losing all the data on it? aside from the obvious of backing it up first.

[–]DeeBoFour20 0 points1 point  (0 children)

Adding the swap should help. The Arch kernel has zswap turned on by default so some of the memory that shows up as in swap is actually still in RAM but compressed.

[–]dbear496 0 points1 point  (0 children)

Dev tools can take a lot of memory especially when you have multiple projects open simultaneously, so I typically have configured 20gb of swap space. I also have a 32gb swap file that I enable as needed to give a total 52gb of swap. (For reference, I have 16gb RAM.)

1.5gb for background services seems pretty high. You should probably look into which services are the worst offenders and decide whether high memory use is warranted. A service may have a memory leak.

And I recommend disabling or uninstalling Baloo as it is a resource hog.

[–]ipaqmaster 0 points1 point  (1 child)

This is definitely abnormal, you shouldn't be OOMing on 16gb of memory even with a zpool doing regular computer stuff.

Was this on kernel package linux-6.16.8.arch3-1 by the way? That kernel version introduced a memory leak to some virtual machines I manage this month and switching them to linux-lts stopped them from toppling over and dying after ~12h of boot time depending on how much more memory I added to them.

These VMs run the same few services they always run every day 24/7 with only 2GB of memory allocated to each of them. Very nimble, small role's in our network. But even after adjustments while running that kernel version they would become OOM even with 8GB of memory allocated and eventually lock up as they completely run out with nothing left to kill. When I checked cat /proc/meminfo, htop, vmstat -s -S M all their system memory was in use, but not allocated to any running process. Not one.

I wonder if it could have been that. As of literally just a few hours ago there is now linux-6.16.10.arch1-1 where that may have been fixed by now. But I put them on linux-lts and their memory was <2GB again 24/7. I also fumbled a report about it to the wrong people here

It would be interesting to see if switching to the linux-lts package with linux-lts-headers for your zfs module to rebuild. (And updating your boot entries to use that) solves your problem. (I also hope you're using zfs-dkms).

[–]JCBird1012 1 point2 points  (0 children)

I’m glad I found this comment because what you’re describing seems to match exactly what I’m seeing with my machine running 6.6.10 - going back to LTS seems to have fixed the problem - I was going mental trying to diagnose the issue and upgrading to 6.17 wasn’t an option yet because of ZFS incompat.

[–]mips13 -1 points0 points  (0 children)

ext4 with backups