Vm memory usage wrong

What does free -m tell you inside the VM? free tells me 2GB used 3GB buff/cache, which is 5GB total according to Proxmox which tell the difference from the outside. Did you install qemu-guest-agent? It could also be KSM, which might not show up.
 
total used free shared buff/cache available
Mem: 32114 2356 12711 138 17046 29156
used (2.3GB) + buff/cache (16.65GB) = 19GB like Proxmox is telling you. I think this is correct, as Proxmox cannot see the difference in usage. What is the problem?
PS: Possibly both are correct at the same time: 59% of memory is in actual use by program and cache. Also, a large part of it can be quickly released and reused inside the VM, but apparently 12% cannot. It just depends how the various tools look at it. Proxmox cannot release or reuse that (large) part of memory, so it counts it as used.
 
Last edited:
buff cached for what? htop is also telling me 2.4Gb used against 32Gb yet the colored bar is showing me the 58%. I dont like caches if i cant control it.

running
echo 1 > /proc/sys/vm/drop_caches

frees that cache and everything runs to normal. I know its temporary and i should probably let it go...
 
buff cached for what? htop is also telling me 2.4Gb used against 32Gb yet the colored bar is showing me the 58%. I dont like caches if i cant control it.

running
echo 1 > /proc/sys/vm/drop_caches

frees that cache and everything runs to normal. I know its temporary and i should probably let it go...
It is the read/write file cache. Please have a look at Linux ate my ram! Memory is fast and expensive but unused and wasted while it is "free", IMHO.
 
Memory is fast and expensive but unused and wasted while it is "free", IMHO.
I get your point for bare metal installations but in virtual environments that caching is really annoying. I'm really missing a option to limit the cache size to a fixed value (like the ZFS ARC) but linux isn't offering this. Only way to prevent this is to assign the RAM as small as possible so the VMs got enough RAM to run under normal circumstances but may then run into problems and start swapping or OOM killing is kicking in if a software suddenly needs alot of RAM and you don't expect that.
I thought balloning may help for that so VMs could share a little bit of RAM (overcommiting) to prevent such unexpected situations but it doesn't, because the algorithm is stupid and doesn't allocate the RAM to guests who really need it. It it just using fixed ratios no matter how much RAM is really used or free by each VM.
Would all be fine if balloning would lower the RAM of VMs with alot of cached data and would give to to VMs which are low on usable RAM. But that is unfortunately not how it works...
So overcommiting the RAM isn't really possible but would be very helpful if you already maxed out your RAM slots and the hosts RAM is always running at the limit. And because of that the VMs RAM don't got alot of margin and some VMs can run into OOM while other VMs are wasting 10GB and more by caching stuff...

buff cached for what? htop is also telling me 2.4Gb used against 32Gb yet the colored bar is showing me the 58%. I dont like caches if i cant control it.

running
echo 1 > /proc/sys/vm/drop_caches

frees that cache and everything runs to normal. I know its temporary and i should probably let it go...
If your VM only needs 2.4GB RAM you shouldn't assign 32GB or linux will "waste" all the space until the 32GB are full. Only way to prevent this is to run echo 1 > /proc/sys/vm/drop_caches every several minutes by cron but that way no caching will be used and your system will get really slow because everything will have to be loaded from the slow HDD/SDD instead of the fast RAM. It looks like there is no way to limit that caching so the most important files would be cached but not everything so not many GBs of RAM would be wasted.
You could try to reduce the RAM to 8 GB. That way your VM will always be at 95% RAM usage but atleast the cache can't be bigger then 5GB if your system and programs only need 2.4GB. By doing that you save 11GB or moe of RAM that won't be used for caching so your other VMs can use it instead.
 
Last edited:
Code:
If your VM only needs 2.4GB RAM you shouldn't assign 32GB or linux will "waste" all the space until the 32GB are full.

Its a new server (week old) by the time im done with it it will probably in use for 60% like it is now (maybe more), so it was planned. And its not that i dont want linux to use the cache, but give me real numbers instead of interface 1: 12% interface 2: 58% interface 3: well its 12% but the progressbar is showing 58%.
 

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!