Swap usage by LXC and VM

khaled.j.hussein

Active Member
Nov 29, 2017
22
1
43
46
I have a cluster of proxmox 7 from 4 nodes, sometimes I see the swap usage for some container is 190%. I gave the container 512M swap and it is using 970M, and the memory usage on the container is 10%

how the container take swap larger than the value I specified

also I see a VM usage around 37% of the host (node) swap, why the VM use host swap while it has it;s own swap configured

does these issues can be configured or how to deal with them

Thanks
 
how the container take swap larger than the value I specified

This older forum post would suggest that this is simply a behavior present in cgroup1. As far as I am aware, cgroup v1 only has legacy support in the latest Proxmox version. Are you not running cgroup2?

also I see a VM usage around 37% of the host (node) swap, why the VM use host swap while it has it;s own swap configured
How exactly do you tell how much swap the VM uses of the hosts swap?

In any case, if e.g. the qemu process takes up large amounts of memory, but the system has not enough available, the Kernel starts taking up swap space. This is expected behavior.
In some cases, the Swap is used even though enough RAM is available because the Kernel is trying to optimize RAM and Swap usage heurisitically.
In such cases it is possible to change the swappiness setting. A lower value will make the Kernel swap less. The same goes if you see high Swap usage with little used RAM in your VM.
 

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!