Hi guys. I have a 20GB of ram, and 4GB of swapfile. Do I need swapfile if I have a lot of free ram? Maybe be better to delete it from root partition and fstab?
Check your RAM and swap usage:
free -m; swapon -s; zramctl
This all depends on your use case - I think only you can answer that question. If you system never uses more than 75 or 85% of your RAM, then you don’t need a swap file.
If you are not shy of storage, it doesn’t hurt to leave the 4 GB swapfile there as long as the priority is swapping on zram.
Actually, disk/file swap can hurt and lowering its priority might not help if some process goes nuts eating all available memory.
I always add it anyway even with 32gb ram. Its not likely that you will miss the few GB used and it can help avoid the system locking up. Usually I notice the system slow down when it starts to swap so I can kill something.
Thanks for answers, everyone, who wrote something in this topic!
Which is where lowering the precedence of swapping (or reducing the swappiness) comes handy.
Priority/swappiness can help if you are working on the verge of free RAM.
It cannot help in a situation described above.
I think it can. When I am copying files (or usually doing any kind of file operation like saving to file or reading from file), there’s some kind of swankiness which I get to observe. I immediately open up
htop and find activity in the swap partition even when my RAM is not even half full.
Reducing swappiness would allow increased preference to using RAM and not swap partition even in those circumstances when there’s ample amount of physical memory in disposal but still somehow swap is picked and used just because it is a file operation.
Enable disk swap and try to launch a task which requires huge amount of RAM.
Your other tasks should start swapping, and even if there’s zram, it’s going to be filled up, so swapping continues to disk negatively impacting system responsiveness.
Yes, yes. I have observed this even when I am copying a great tons of small-sized files.
Swap file/partition is usefull for hibernate too (copy ram into swap, so swap size = ram size), but if you don’t use this feature, you don’t really need swap in most case.
A lot of people (including me) recommends to decrease swapiness kernel parameter to 10 instead of disabling totally swap.
I am running fedora 33 with 32G ram. The only swap I use is the 4G zram it sets up by default in memory. It is a desktop to I don’t need to hibernate or suspend. If I did it would require swap >= memory.
Something I do too when not using a ZRAM.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.