If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Comment

hopefully it has an lz4 plugin which shouldn't have much if any peformance hit. i'm using lz4 in my application and its fast fast. Problem is the actual memory allocation/deallocation overhead is hurting me much worse than the compression/decompression. I'm testing very heavy thread loads with 40 hardware threads.

Comment

hopefully it has an lz4 plugin which shouldn't have much if any peformance hit. i'm using lz4 in my application and its fast fast. Problem is the actual memory allocation/deallocation overhead is hurting me much worse than the compression/decompression. I'm testing very heavy thread loads with 40 hardware threads.

Zram does not support all the available compression plugins AFAICT. (it's being worked on).

However, I have been googling around and you can use zswap with some parameters to get the same result. Mount the TMPFS FS with the memory restrains u used on the ZRAM blocks.

Code:

zswap.enabled=1 zswap.max_pool_percent=100 zswap.compressor=lz4

And then use TMPFS instead of a FS on a ZRAM backed block device.

I'm seriously confused why these things have to be two seperate implementations. The only thing ZRAM adds over ZSWAP is that it exposes the RAM as a block device. That is all. But hey, I'm just an end-use who am I to argue? .

Comment

I'm seriously confused why these things have to be two seperate implementations. The only thing ZRAM adds over ZSWAP is that it exposes the RAM as a block device. That is all. But hey, I'm just an end-use who am I to argue? .

One other advantage: zram does not require swap. You cannot use zswap on a swap-less computer, which makes it useless in embedded and running-in-RAM type scenarios. Your router cannot afford to use flash as swap, your thin client might not have a HD, etc.

Comment

One other advantage: zram does not require swap. You cannot use zswap on a swap-less computer, which makes it useless in embedded and running-in-RAM type scenarios. Your router cannot afford to use flash as swap, your thin client might not have a HD, etc.

What you said makes sense at first sight. However, zswap is capable of keeping 'swap in memory':

I set this to 100 to only use 'real' swap as a last resort. I also turned off swap with 'swapoff -a' which succeeded without complaints. Maybe the term swap is not to be seen as something as a physical device containing contents that should belong in memory, but more as not directly accessible memory (i.e. compressed in this context).

However, I'm in no way an expert in this so I might be way off base.

The advantage of zswap in this regard is that compression will only happen once memory starts going low (vm.swappiness). As far as I know, zram always compresses the content you give it. Which in scenario's where a lot of memory is free, is not necessary.