How to download more RAM
Table of Contents
No, actually. We can do this by increasing our swap with Zram.
What exactly is Zram?
Zram basically takes a part of your actual physical ram and stores compressed ram contents in it. The gains are crazy
Why not just increase the swap directly?
Because regular swap is slower than Zram.
Setup
Install zram-generator. On Archlinux, its
pacman -S zram-generator
Configure your
/etc/systemd/zram-generator.conf
[zram0 ] zram-size = ram * 2 compression-algorithm = zstd swap-priority = 100 fs-type = swap
Now we just need to care about
zram-size
, it actually refers to the uncompressed size of Zram, not the compressed one, this means it will use a lot less of you actual physical ram. Please experiment with it until you find the sweet spot. For me it is 4 times the size of the ram. It works fine.Start Systemd service.
systemctl daemon-reload systemctl start systemd-zram-setup@zram0.service
Note that you don't need to enable it. It will happen automatically upon reboot.