Re: Compressed swap.
> Wasn't sure what was meant here
Ah, sorry. My bad; I considered adding more explanation but decided not to for reasons of space (and relevance).
> something like zcache instead of zram
Possible but probably not as productive.
> or swap on a compressed logical volume (lvmvdo?)
No.
ZRAM creates compressed RAMdisks (1 per CPU core), then puts dynamically-sized swap on them. So the kernel pages a program out of memory, effectively, it's compressed but kept in memory. It's much quicker to uncompress it from RAM to RAM than load an uncompressed image from disk -- even SSD.
ZRAM is handy for small-memory machines with multiple tasks and slow storage -- e.g. Raspberry Pi. Low memory means lots of paging programs in and out. That means lots of writing to SD card, which wears it out.
Linux has the ability to handle multiple swap devices and set priorities on them. So, ZRAM _and_ conventional swap means that -- if properly configured -- when RAM is full and programs are swapped out, it will stash compressed copies in RAM, and then if that fills up and the stuff hasn't been accessed for a while, it will move from RAMdisk to real disk (uncompressed).
But ZSWAP makes that unnecessary. If you have rewritable storage to hand, and a reasonable amount of RAM, then ZSWAP takes stuff being paged out and compresses it before it goes into the swap file or swap partition.
So, if a 1GB program is swapped out, it only takes (say) 50% of that in the swap storage. The OS compresses the data on the fly, so it only writes ~500MB to swap, and when it's swapped back in, it reads ~500MB, decompresses it on the fly back into RAM.
Basically if you have a fairly fast CPU and not enough RAM then putting:
````
zswap.enabled=1
````
... into your kernel command line reduces the amount of data swapped in and out by half.
I have some older machines which are maxed out with 8GB or 16GB of RAM but on which I occasionally load 20-30GB of programs. Notably Electron apps which are horrible memory hogs. This 1 setting changes regular disk thrashing to modest amounts of disk activity and a more responsive system.
Most machines have at least 4 logical cores now, and some of mine have 8 or more. I don't care if one of those cores is maxed out if it buys me a more responsive system.