Systemd-swap deprecated and may be removed

Heads up to anyone using systemd-swap that it has been proposed for removal.

https://lists.archlinux.org/pipermail/arch-dev-public/2021-May/030429.html

6 Likes

Thank for this info. Switched to zram-generator as proposed.

1 Like

I use Systemd-swap, using both the zram and SwapFC functions. Zram for the obvious benefits, SwapFC in case even with zram activated the system needs some swap. Although usually the system doesn’t generated the dynamic swapfiles, sometimes it does. I like it as a “safety net” for when zram compression isn’t enough.

Zram-generator looks fine for the zram portion of the systemd-swap functionality, but I can’t find much documentation for the dynamic swapfile functionality provided by systemd-swaps swapFC function. Can anyone point me to a reference on dynamic swapfiles - I would like to retain this functionality. Can it be enabled some other way?

I’m familiar with the old swapspace program which seems to do the same thing. It appeared to be dead but seems to have been resurrected recently. Does anyone have any recommendations on dynamic swap file functionality going forward?

Darn!
Just installed zram today on my desktop. :crazy_face:

1 Like

If you are only using it for zram you can pretty easily switch to zram-generator

1 Like

One of the devs was kind enough to explain the reason they are stopping development/maintenance on this package, for those that are interested. I would be interested in knowing whether people have tried swapspace since it has been resurrected.

https://github.com/Nefelim4ag/systemd-swap/issues/173#issuecomment-835911007

I switched to zram-generator in March. This was after I created an issue for systemd-swap (https://github.com/Nefelim4ag/systemd-swap/issues/200) and the maintainer recommended zram-generator to me.

I never looked back. zram-generator is reliable and fast. I have 64 GB of RAM and 8 GB of zram swap. I tested it with stress-ng

stress-ng --vm 20 --vm-keep --vm-bytes 64G --timeout 60s

Swapping is stable and very fast. Much faster than with SSD or NVME:

Bildschirmfoto_2021-05-10_08-19-31

I would recommend a zram swap devices for anybody with 32 GB or more. There is really no need for a physical swap device.

3 Likes

I had it initial installed because I wanted to expand my ram a little since i only have 4 gigs installed and no swap.

How many people run systems where swap is actually utilized?

I have 64GB, 32GB and 16GB systems and can’t recall ever using enough memory to trigger swap usage on any of them. I still configure a swapfile, just in case, but I’d rather leave the memory for apps rather than zram.

Doesn’t matter how fast swap is if you don’t use it.

In my 64GB desktop my swap gets utilized on occasion but it is not common. Still, I keep it because I would rather have it for those rare occasions than run out of RAM entirely.

On my laptop with 8GB of RAM it is more common but still not that common. To me, this is where zram would make the most sense.

On a laptop you need swap for hibernation. So I would assume this is common :wink:

I don’t actually use hibernation on that particular laptop.

Good for you. But if you happen to be a gimp / krita / darktable / blender artist 64 GB might not be enough here and there. This is at least true for me when I play around with my photos.

And in that case zram is a very cheap, fast and easy to setup RAM extension.

1 Like

That is why I asked the question.

Genuinely interested in how many people have systems, or use specific software and workflows, that utilize swap.

I video / photo edit and use blender a lot, not professionally though, so have yet to hit a 64GB memory limit, but if I did then you are right that zram is essential.

I would think that for most people though a swapfile saftey net would suffice.

Comes down to what systems are being used for. 8GB total ram can fill really quick, a larger SSD swapfile triggered rarely may be more resilient.

1 Like

From what research I’ve done, you can push zram all the way up to 100% of RAM without any problems. If you increase vm.swappiness (e.g. to 133) you might even see performance benefits as more data is buffered/cached in fast storage.

(100% pool is also the Garuda default, so it’s pretty widely tested there too.)

I’ve been using zswap rather than zram on my main laptop as I have a swap partition (for hibernation). I’m wondering whether a zram layer would still be of benefit, given zswap is supposed to do exactly the same thing… :thinking:

1 Like

I only use the dynamic swapfile approach with old laptop computers I am trying to keep alive, where upsizing RAM isn’t really an option. I use zram also, and it does most of the heavy lifting; the swapfile is just a backup for those rare times when something spikes and zram alone won’t do. Because these are old legacy machines, hard drive space is also at a premium, so that’s the reason I like to use the dynamically created swapfiles - I don’t want to tie up disk space for dedicated swap when I only actually need it a couple of times a year. On a modern machine with plenty of RAM, there really isn’t much need for swap except for hibernation. Still wondering if anyone has tried out swapspace since it came back to life.

Maybe if you ask again in another 20 hours someone will respond. Or, you could try it yourself seeing as you know about it? :stuck_out_tongue_winking_eye:

I do! But 95+% of the time it’s to hibernate.

I wouldn’t bother on a desktop.

I am trying it and will report back.

1 Like

I forgot to mention virtualbox.
I, for example, frequently have virtualbox guests running with 16 GB of RAM each (Windows10, Fedora, Ubuntu, Garuda, MX Linux, etc.). Together with gimp etc. I can easily reach 64 GB of RAM usage.

But, anyways, swapping is not happening that often. And that makes zram even more attractive. There is simply no need to keep a separate swap partition or swap file.