I’ll definitely double my RAM for my next system (in a year or two) and will definitely have to consider swap on zram then.
I’ll definitely double my RAM for my next system (in a year or two) and will definitely have to consider swap on zram then.
Zswap is somewhat similar and might also work well for you, it uses disk swap but with a compressed cache in RAM.
I used to do this as well, but consider that the VFS cache basically does the same thing. The main difference is that cached data can be dropped or flushed if necessary to free memory, whereas this can't be done automatically with tmpfs.
Benchmark both cases and I'll bet you'd be surprised at how little difference there is.
I do a lot of builds on my system and most are small enough to entirely live in RAM. But when you build Firefox it is best to start flushing some data to disk.
Entrusting this to the VFS cache has better predictability, and nearly the same performance in many cases.
Incidentally, Darwin creates, defragments and reclaims swapfiles dynamically. All this complaining about swap partition / file sizes is kind of … silly. None of that code is rocket science.
One can always use and write wasteful programs but it is a choice, rather than necessity as folks often portray.