in terminal when you execute $ swapon you can see your current swap status
Personally I use systemd-swap because it just takes what it needs and there are extra tuning options like in /etc/systemd/swap.conf.d/myswap.conf:
zswap_enabled=1
zram_enabled=1
swapfc_enabled=1
But maybe experts here have arguments that systemd-swap is not so good in certain situations?
systemd-swap is fine too.
In my case … I want swap used as little as possible … but want to make sure it has a decent pool to pull from if needed. So its at equal to my RAM and low priority and then I dont have any other services or worry about it.
(I have dozens of FF tabs open, telegram, some terminals, etc … so my RAM use is ~50% and my swap isnt being touched … which is what I want.)
I have 8GB RAM, so I use dynamic swap file plus zswap and zram. It’s an automated solution that I love, because since I set it, there are no more perma-freezes because of RAM depletion. It works great on SSD, because swap is almost as good as RAM and new allocation of space is done quickly in the background, without any noticeable bad effects.
I use a swapfile, currently 4 GB on most of my machines.
It is easier to handle. If I want to change the size, create a new one or delete one, I can simply do this while the system is running, without booting in a live system to resize partitions.
For me the best option so far, using this setup for some years now.
A good question is: what happens with a default installation of the OS? I happened to install on a laptop, I5, 8GB mem. and an SSD a few months ago and… there is no swap. Thanks to your suggestion I installed a swap file but then again it depends on your usage and of course you never know but the idea of swap dates from a time where memory was a problem like 512 MB or even less. Never forget that 512 KB was a lot in 1990, the year Linus started. So I guess swap will become obsolete in the years to come, there will be ample resources.
thanks, I actually did this lol
thought it would be extra fast but I guess I was wrong.
Personally I am a big fan of systemd-swap, I think it’s better than if you just use a simple swapfile.
I also think it is superior to a swap partition and superior to noswap at all.
I always use swap partitions. It’s what I’ve done since my time with Windows and this setup works for me. I prefer to have disk space pre-allocated for swap and a few other things on my systems.
Only 8GB here (max on this system unfortunately) and it’s usually heavily loaded. The browser is the biggest memory hog, in particular when viewing YouTube videos, but I always have watch -n5 free -h running on one of the Terminal tabs to keep an eye on things & restart the browser when necessary, esp. when I’m running virtual machines.
I have a 10GB swap partition & performance starts to suffer when it gets around half full, which is to be expected.