Thanks for the article recs. I’ll check those out. 
I’ve got a 2 GB Pi, and the base Ubuntu Server, with SSH enabled and some useful autoconfigured services running (SMART monitoring, the fstrim timer). I’ve not customized anything or actually set up any workloads yet.
So, with a pretty much stock system, I’ve got this:
root@statler:~# free -h
total used free shared buff/cache available
Mem: 1.9Gi 334Mi 1.2Gi 3.4Mi 473Mi 1.6Gi
Swap: 0B 0B 0B
Honestly, 334 MiB used/1.6 GiB available isn’t terrible for what I’m hoping will be a dedicated homelab log centralization/metric server–in particular given what I’ve read about Grafana Loki using relatively little RAM in a basic configuration–but I’m very conscious of the need to be very conscious of my RAM usage in this situation.
(I’m going to rip out snapd as soon as I figure out how to do that. With no snaps installed, on a fresh system, it’s idling at 36 MiB … which actually matters here.)
Still, there’s a good chance I can avoid swap, but we’ll see.
(Honestly, it’s good exercise in any case. My usual servers (two Proxmox nodes) both have more RAM than I actually need–they were spec’d and built before the Rampocalypse, and I’m old fashioned and bought as much as I could afford.)
So, I figure now is the time to learn about zram and zswap, before I actually need them.
More pressing: I have a second Raspberry Pi 2GB I want to set up to basically act as a web browsing kiosk with Xubuntu (installed on top of Ubuntu Server 25.10), and 2 GB will be a bigger constraint there. I suspect swapping will be unavoidable, so I want to set myself up for the least bad experience. (I know swap isn’t magic, and 2 GB isn’t much, but. Ram shortage.)
Which of zram or zswap would you use in those scenarios? When I’m reading the material, it might help to keep an actual practical use case in mind from someone more familiar with the technologies. Just from what you wrote, unless there’s some reason not to use it, zswap sounds like the better idea, as it’s actually part of the native swap system.
- Yes, I need to learn what free vs available means, let alone buff/cache and the others.