Closed HackerDaGreat57 closed 8 months ago
How are you checking swap space used? Is there a chance you're checking real memory used rather than virtual?
The script isn't doing anything that would limit how much you can swap into a zram device, at least I'm pretty sure it isn't. You might try looking through your kernel virtual memory settings too, your distro may be shipping something that causes this behavior.
Just as a note I run ~24GB (8-ishGB compressed) zram swaps on all of my Proxmox boxes and I've never had an issue utilizing as much as needed.
Edit: forgot to mention I changed my zram size from 102M to 6.5G.
I'm using htop's zram bar to monitor the zram usage.
My current understanding of the zram bar gives me this information:
^^ I'm confused about this last part. Will Linux stop using the zram device as soon as it is storing 6.5G of compressed data? Because that frankly wouldn't make any sense compared to my understanding.
So apparently you can just set a total size of x*y where x is the amount of RAM you're willing to allocate for zram. This value is multiplied by y, which is the average compression ratio you've seen for your algorithm. (This means that you have to use a ludicrous compression ratio target in your config to get the best possible results.)
If the compression craps out, though, and doesn't get the desired ratio, I'm sorry to say you're screwed. So might wanna subtract 0.5 from y before making the calculation just to be safe.
I have allocated a total size of 0.1GB (~102MB) to
/dev/zram0
with compression algozstd
. Compression ratio is about 1:3, which is expected and good.But after 100MB of compressed data is inside the zram object, it switches over to disk swapping, even though it is possible to fit about 200MB more data into the zram. Do I not understand how this works or is it a bug?