swap on node full but ram 90% free

informant

Renowned Member
Jan 31, 2012
762
10
83
hi all, on node we have 100% full swap but ram is >=90% free, what can we do here, restart of swap is not a option, why is swap full and ram free, why dotn clean swap automatical here? any ideas?
regards
 
hi yes it stay on 60, you mean also we set is smaller to have swap faster free? any empirical values?
regards
 
In principle there is no problem with the pages being in swap, it simply means the system does not need them at the moment and instead of having them in RAM you have them on disk. As soon as they are needed, they will get swapped back. You can try to set to a smaller value of maybe 10 to keep pages more aggressively in RAM if that is what you prefer.
 
ok thanks, do we set it only as new entry in /etc/sysctl.conf save or do we must reboot server? or do you have a option without server reboot?
regards
 
If you apply with `sysctl vm.swappiness=val` it will take effect immediately, no reboot required. If you wish the setting to survive a reboot you have to set it in the /etc/sysctl.conf
 
  • Like
Reactions: ZipTX
ok sysctl vm.swappiness=10 is this static or temp. only to reboot?
regards
This takes effect immediately, no reboot required. But it will be lost on reboot.
 
ok, also i do add it in /etc/sysctl.conf and it was static, thanks for you good help.
best regards
 
Keep in mind that although it really, really annoys me, and causes me concern, having 100% swap usage is not a bad thing *unless at that point things slow down*.

Over the years, we have been told that Linux systems use swap when they run out of RAM and we have been taking that at face value. We are used to thinking that seeing very high swap usage is always a bad thing. We think something is running out of memory and using disk-based swap instead. Instinctively, we see 100% swap as indicating a problem.

BUT in reality, at least in modern kernels, Linux swap is much more complex and much more useful than merely a disk-based RAM overflow.

Now I don't pretend to understand very much about the kernel and swap. This isn't my area of expertise. But if you read the posts of those who do understand it, the emphasis is on the kernel moving pages into swap that aren't needed in RAM. This frees up RAM for things that are needed in RAM, which in theory will speed the system up. It also keeps as much RAM "free" as possible should it be needed later. The more free RAM, the better.

Once 100% swap is reached, it can't do that anymore, but it doesn't mean things will fall over or even noticeably slow down. It just means stuff will stay in RAM that would otherwise have been moved to swap if you had a bigger swap partition/file. I would imagine RAM usage would go up a little at that point.

Reducing swappiness reduces the kernel's preference to move unwanted things into swap. I expect RAM usage to increase as swappiness is decreased. This figure of 10 that is often mentioned as being reasonable for a server as opposed to a workstation is, I think, merely a suggestion. As with all these things, mileage will vary. I suspect most systems are left at the default 60.

What I would like is for someone to write a paper on all this if such a thing doesn't exist. It would make a very good project for a CompSci student.

There are caveats to my rambling theories above, however. Firstly, if you don't have any "free" RAM, and you reach 100% swap, then bad things will happen as there's just no more memory to be had and things will start falling over. Secondly, we have one member on this forum who is having a very bad time with swap - even though he has "free" RAM indicated, when his system reaches 100% swap usage, he finds things slow down considerably, to a great degree - so much so that it is a big problem for him. And nobody (so far) seems able to figure out how to help him.

Also, keep in mind that everything I've said is based on my observations and my very basic understanding of how things work, and I fully expect to be told some or all of this is completely wrong. So much so that I hesitate to post this. But I'm going to do it anyway.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!