Strange bug with memory

Frakir

Member
Jan 20, 2016
29
0
21
52
I see very strange Summary for my containers.
Summary says that containers use very little memory. But indeed the use almost all memory.

For example, now in proxmox Summary:
Memory usage 0.06% (20.54 MiB of 32.00 GiB)
Total for all containers on the node:
RAM usage 3.75% (1.32 GiB of 35.30 GiB)

At the same time when I enter in the container top sees:
KiB Mem: 33554432 total, 33160348 used, 394084 free, 0 buffers

So it uses more thn 32G but proxmox says 20Mb.

File system is zfs (and lvm for ssd). Continers only, no VM.
# pveversion
pve-manager/4.4-12/e71b7a74 (running kernel: 4.4.40-1-pve)

What can be done?

Serge
 
Hi,

container resource accounting is sometimes a bit confusing.

Simplified said: you may trust the statistics from Proxmox VE and the configured resource limits it applies to CTs.

You have to know that you would see often the hosts resources in the container by default, to address this a virtualized /proc/cpuinfo /proc/meminfo gets mapped into to the container, where only the CT resources and usages are shown.
If you use a tool which uses this file to get the accounting it will show the actual correct system usage. If you use a tool which uses other ways to get this accounting, for example a syscall, then you may get a "wrong" accounting of resources, at least from the perspective of the CT.
It depends a bit on the tool and version of said tool.

In an alpine-linux container of mine I see the following differences between "free" and "top":
Code:
~ # free
             total       used       free     shared    buffers     cached
Mem:      32819452    6045028   26774424     345856     173092       1752
-/+ buffers/cache:    5870184   26949268
Swap:     32505852          0   32505852

top:
Mem: 6832K used, 517456K free, 345908K shrd, 0K buff, 1752K cached

# Proxmox VE shows:
Memory usage
1.19% (6.12 MiB of 512.00 MiB)

So alpines free gives misleading versions in this case, interestingly top shows the correct values in my CT – probably because its the busybox version which works different as GNU top.
If I use the archlinux version of free I get the correct values. While a bit confusing at first and seemingly wrong, this is more a cosmetic issue, the limits get enforced.

If you want to be sure what the current usage is use:
Code:
cat /proc/meminfo
 

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!