High SWAP usage eventhough plenty of RAM is available

John4782

New Member
Dec 15, 2013
2
0
1
Hello everyone,

I recently configured Proxmox VE 5.1 as my new hypervisor.
Everything works fine, but I can't explain its high SWAP usage.

Some more information about the system:

Code:
root@prxsrv:~# pveversion -v
proxmox-ve: 5.1-25 (running kernel: 4.13.4-1-pve)
pve-manager: 5.1-35 (running version: 5.1-35/722cc488)
pve-kernel-4.13.4-1-pve: 4.13.4-25
(long list omitted)

Code:
root@prxsrv:~# free -m
              total        used        free      shared  buff/cache   available
Mem:         128832       44071         994         136       83766       83572
Swap:          8191        7610         581

Code:
root@prxsrv:~# cat /proc/swaps
Filename                                Type            Size    Used    Priority
/dev/dm-1                               partition       8388604 7792752 -1

I can confirm that most of the Swap usage comes from the kvm process of one of my VMs:


Code:
root@prxsrv:~# cat /proc/16210/status | grep Swap
VmSwap:  7118964 kB


I have tried reducing the swappiness to 10 from 60 (perhaps 1 would do the trick?) and re-enabling the swap.
This has dramatically reduced Swap usage for two days, but then it steadily climbed back up to its current state (92%).

The VM has its own swap partition, which it abstains from completely. It is just the hypervisor that swaps a lot of memory.

This is obviously not a major problem, but it still gives me an itch, considering how much free RAM the machine has. I would also prefer not disabling it entirely.


Thanks a lot in advance
 
We reduced the swappiness to 1, so it only uses swap space when RAM is full—works for us.
You should benchmark if this actually does any good for your setup.
 
Why do you keep swap, when you have plenty of RAM available? Honestly, I consider swap a thing of past, something of prehistoric computer age, when you had to pay a few thousand $ for 16MB RAM...
 
Thank you for your replies.

I changed the swappiness to 1 and the Swap usage does not go beyond 60%.
That is still considerably higher than I was hoping for, but it is less worrying than 99% usage.

I think in order to further influence SWAP usage, without disabling it althogether, I need to look at the type of load the individual VMs are processing. Considering that a custom project runs on it, it is not unlikely that it doesn't handle RAM efficiently and hence the hypervisor swaps frequently; to free up idle RAM address space.

The main reason I made this thread was because I was hoping there would be some mechanism unknown to me, which might be causing this kind of behaviour.

Given that this seems to be more of a Linux-related issue and not Proxmox itself, this thread may be closed.
 

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!