Use of swap memory in ubuntu

I’ve just realised that my swap file is at 100% however I still have a lot of free memory. Should I be increasing the size of the swap file or just turn it off?

I turn it off on all plotters as people have recommended this for Chia - for me I prefer not to have the increased r/w activity on my boot drives as they are cheap low grade SSDs and USB drives.

Ubuntu server headless doesn’t use much RAM itself so just allow for a couple of GB for it when assigning your plot memory usage.

1 Like

I think it’s recommended to turn it off for performance reasons:

I use the following command:

sudo swapoff -a

It doesn’t persist between reboots though.

Comment out the swap line in /etc/fstab

2 Likes

It’s good practice to have a swap file so the OOM (out of memory) reaper doesn’t kill tasks when you are one byte over the total system memory. This also lets you monitor for swap file use, and stuff that is truly never used can get swapped out and memory can be used more efficiently.

But, if you’re 100% confident you will never exceed total system memory use, then it’s also fine to turn it off.

2 Likes

I’ve heard rumours that suspend / sleep on Linux also requires swap. Of course chia plotting kinda pointless if your computer is suspended or asleep!

I disabled swap and set vm.swappiness=0

1 Like