Is it possible to use zram and zswap on the same system by increasing the zram priority? I have read several questions and answers about using both individually, but only one together. Is it still ill advised?
Additionally, which would be best for an HDD, SSD, USB, and SD card?
Basically, I have a ZFS root and my builds have a bad habit of not hitting cache and committing suicide. Apparently swap on zvols aren’t a good idea, and I was wondering whether 24 GB RAM would be enough, and whether I could set up swap anyway, just in case.
I get by with 16GB of RAM + zram, and while sometimes I need to set max-jobs to 1, that’s normally enough for me to manage building even the worst-case builds like browser engines.
Ah; got it. But wouldn’t that mean that the setting is attempting to store more data in RAM than can fit, considering zram is a part of the RAM that’s set aside…?
Yes, but if I had 24 GB RAM, 150% of that would be 36 GB, so wouldn’t the setting be trying to store 36 GB of data in a part of 24 GB of RAM? Sorry, zram’s a little confusing to me, even with everything I’ve read.
Okay, well here’s the problem: if a build is using too much RAM, you will invariably spend too many CPU cycles on I/O thrashing. zram not being on disk avoids some overhead, but (de/re)compression still does take CPU cycles and IME did not really prevent OOM for large builds
What I’ve found far more effective is to limit cores and max-jobs.
Hmm… Would a 13th Gen Intel Core i3 with 24 GB RAM be alright, then? Would I be able to build, for example, Firefox from source using all cores, or would I still have to limit them?
Browser builds use absurd amounts of RAM, it’s not really a CPU issue here. Reduce the number of cores used by nix in that case - this can reduce the amount that needs to be juggled in RAM. While obviously that will make the build take noticeably longer, you might be able to actually complete the build.
FWIW though I went down this road (building firefox and OOMing) for several months before increasing my RAM from 32 to 64 gigs, as I didn’t really enjoy the slower builds and ultimately under-utilized CPU.