"free -m" on KVM VPS


New Member
I have a 512MB KVM VPS, and "free -m" shows a different number each time I reboot it.  Here's the latest run:

total used free shared buffers cached
Mem: 479 59 420 0 8 26
-/+ buffers/cache: 23 455
Swap: 91 0 91

Earlier runs have shown these values in place of what is shown as 479 above: 433, 495, 495, 492, 486, 482.

I'm not really familiar with KVM, so I don't know if this is normal or not?


New Member
So that doesn't get accounted for in the "used" column, it's directly deducted from the "total"?

Also it looks like it changes over time, not just after a reboot.  Looked again after a few minutes and it went from 479 to 492.


New Member
Well, this is perfect for this:
That's funny, because I was going to link to that to say this isn't a "linux ate my ram" problem!

I'm not complaining about the used/free values...I understand how cache works.  What I don't understand is why the TOTAL amount of memory available is fluctuating.  Since this is a 512MB VPS, I would expect the TOTAL value to be at/near 512MB no matter how many or how few applications I have running, and not to fluctuate from minute to minute (it's at 414 right now).


The Irrational One
Retired Staff
Oh ok then yeah sorry about that my bad!  

And yeah now that you've pointed out that it's the total, it does sound like ballooning...  


New Member
Looks like that may have been it.  After doing an rmmod virtio_balloon it went up to 495 and stopped fluctuating.  Adding virtio_balloon to blacklist.conf and rebooting also shows 495 without fluctuation (so far anyway).  Still not the 512 I was expecting to see, but it's better than seeing 414!

I guess follow-up question is whether this may cause a problem?  My 30 second crash course after Googling virtio ballooning would indicate that this benefits the host, not the guest, so should be no drawback for me?


Article Submitter
Verified Provider
The host and the vm will keep moving the memory back and forth from the node to the vm as ballooning states. "With KSM we're able to improve virtual machine density by as much as 300% without impacting performance." This article can explain more. The main thing is that the memory will keep switching back and forth, that way you can over allocate the memory according to some by 300% the more you allocate the higher your cpu will work as it will keep moving the ram around. Some say you can't see a difference in the vm as long as the cpu of the node can keep up with 300% over your total ram. I have tested this in a dev and can say that if the cpu is strong enough you can go 100-250% over your ram total and not have an issue depending on the processors.


Active Member
I was about to test it on a proxmox node too.

You can set a max and a min for the memory so it will stay between those parameters.

I would suggest put min the total ram you have physically available for the VMs and the max about the double.

In a real world own dedi scenario it may be better or worse as I am not sure how caching works in these conditions on the VM as well as the host.

In a real world provider scenario, this is not usable since the CPU is the bottleneck on big memory machines, most of the time adding more ram will not increase the number of machines you can sell since the CPU with buckle under the load, even without balooning, but it may improve caching in some situations.

I can imagine an offer with "burst" ram on KVM, though, where you should stay below the limit but for a while can go above, for example in installing centos from iso on a 256 ram KVM or importing large databases, or something.