Proxmox is consuming too much physical memory

serra123123

New Member
Aug 5, 2022
9
0
1
Hello,

KVM machines are using more physical memory from pve than supposed. In the summary of each KVM (there are 3 KVM machines) they are using an average of 2g of ram each or about 6gb of ram in total. Containers are not the problem as they are pulling about 2GB of ram and before having the KVM machines created pve's RAM was as per the consumption of containers.

1660519365293.png

1660519417464.png1660519431728.png

1660519458287.png

In pve it is using a lot of physical memory 42 GB of RAM :( .

1660519531770.png

The settings for all KVM machines are as above.

I ran the htop command in pve to see if it could just be a visual error but no.

1660519628845.png


I apologize for my bad English.
I appreciate any answer that can help me.


Greetings

Sérgio Serra
 
I don't think changing CPU type will help with RAM consumption.
Your config looks fine except that you use the E1000 NIC (which is slow because fully emulated) and that your Min RAM is set too low. Keep in mind that ballooning doesn't care if the guests actually needs the RAM or not. Lets say you got 32MiB Min RAM and 22GiB Max RAM where 10 GiB is used by various processes, 10GiB for caching and 2GiB are free. Now your host exceeds 80% RAM utilization and ballooning kicks in. Ballooning will now slowly steal RAM from the guests until either host RAM drops below 80% again or until "Min RAM" of the guest is reached. With your config ballooning will slowly remove RAM from the VM and won'T stop until its down to 32MiB. First 10 GiB of stolen RAM your guest will drop its cache so that is all fine. But RAM still gets removed so your guest will start killing not so important services, then important services and finally your guest will completely crash as no OS (ok, except OpenWRT;) ) can run with just 32MiB of RAM.
So in short...your "Min RAM" should be atleast that big that your OS and all your services will fit in it at all times. Lets say your guest RAM usage varies between 12 and 16GiB of RAM if you don't count cache (so basically "total minus available" if you refer to free -m) then a reasonable "Min RAM" would be 16 GiB. RAM overcommitment is a bad thing and ballooning won't really help with that.
 
Okay thanks answers. As I understand it, the Host's RAM will always be high and only when it reaches 80% does the ballonig take effect, right?
What I would like to happen is the host ram is only used with what each kvm is using, is that possible?

Thanks
 
Last edited:
As I understand it, the Host's RAM will always be high
Cache does not show in the web GUI, so it will only be high if you run VMs that use much of your memory. KSM might be able reduce memory usage and you can configure it to start before 80% in /etc/ksmtuned.conf.
and only when it reaches 80% does the ballonig take effect, right?
Yes, that is hard-coded into the Proxmox VE code.
What I would like to happen is the host ram is only used with what each kvm is using, is that possible?
Not really. Proxmox need some memory, other services such as SSH need some memory, the Linux kernel needs some memory, LVM or ZFS needs some memory. Dropping caches continuously to prevent the system from working efficiently is never a good solution. What actual problem are you trying to solve?
 
The problem is I allocated a certain amount of memory from the kvm machines and that memory appears to be used on the host but the kvm machines are not using the total memory allocated.
 
the kvm machines are not using the total memory allocated.
Of course they are (with time). KVM memory is allocated at once if you do things like passthrough. Every OS uses ALL the available memory for caching/buffering. Free memory is the worst thing that can happen to a computer, therefore EVERY OS uses all. Windows (and others) just report it as "free", but a better name would be "available".

If you want to dedicate almost all memory to your system, you will need a strict type-1 hypervisor without any overhead in additional processes, filesystems and such, but you're then very limited with what you can do with such a system. Just go and buy more RAM, you cannot have enough.
 
Best rule for virtualization: assign only resources that the VM needs.
IMHO your VMs are too big for what they do. Dynamic memory ist great on paper but in reality it adds overhead. Ballooning can also be performance heavy due to swap out operations.
So always size to the lower limit!
This is the best what you can do.
Sometimes the graphs.indicate a VM needs more - check from within the VM if that is really the case.
All the best
 
Last edited:

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!