Container showing 100% Swap

dburleson

New Member
Jun 6, 2018
13
0
1
40
Hi Everyone,

I'm running a PVE 5.2-2 . On one of our machines, which has 4 containers and 3 VMs, we noticed one of the containers showing 100% Swap. The Swap allocated to the container is 1GB. Upon further investigation, (running 'top' from within the container), I noticed it reported a total swap of 8GB, which is the full swap for the physical machine running the containers, and 1GB of swap usage. It's almost as if the container is reporting the swap for the entire machine.

My question, why is this container appear to be showing 1GB of swap on it and showing the full swap? Is this a known bug or is there something more wrong that needs fixing?

Thanks for any help in troubleshooting this problem.
 
Hi Everyone,

I'm running a PVE 5.2-2 . On one of our machines, which has 4 containers and 3 VMs, we noticed one of the containers showing 100% Swap. The Swap allocated to the container is 1GB. Upon further investigation, (running 'top' from within the container), I noticed it reported a total swap of 8GB, which is the full swap for the physical machine running the containers, and 1GB of swap usage. It's almost as if the container is reporting the swap for the entire machine.

My question, why is this container appear to be showing 1GB of swap on it and showing the full swap? Is this a known bug or is there something more wrong that needs fixing?

Thanks for any help in troubleshooting this problem.

displaying available and used swap in a container is a bit difficult, as the currently used cgroup implementation does not treat swap and memory as two resources that get limited separately, but as one resource with two limits (one for just memory, one for memory+swap). so if you configure a container with "4G memory, 1G swap" the container in effect gets "up to 4G memory, and up to 5G memory+swap" which means it could actually use up to almost 5G of swap (and almost no not-swapped memory). different user space tools also try to get the available and used memory (and swap) from different places, and only some places are "virtualized" by lxcfs, while others are not.

so depending on how you configure your container, how you use it, and how you look up the current memory situation you might get unexpected results - but everything except "used swap can get as high as configured memory + configured swap" is purely cosmetic.
 

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!