[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [virt-tools-list] KVM/qemu memory/currentMemory



On Tue, Jan 04, 2011 at 01:48:22PM -0700, Phil Meyer wrote:
> 
> We have been experimenting with and trying to understand how to
> 'balloon' memory inside a KVM VM.
> 
> Part of my problem was that over 15 years of experience managing
> Solaris based systems has set my assumptions incorrectly for Linux
> administration.
> 
> Observations:
> 
> 1.  Our first tests using Fedora 13 as the guest OS and RHEL 5.5 as
> the server showed that the VM lost 200MB from currentMemory if
> currentMemory was set less than memory.
> 
> 2.  Later tests indicated that the issue had gone away, and we
> assumed that moving the server to RHEL 6 was the difference.  But
> that was not the case.  At the same time, we upgraded our guest
> install to Fedora 14, and that turned out to be the difference.
> 
> 3.  We determined to learn how setting memory greater than
> currentMemory affected different OSes and OS versions.
> 
> here is the Tally:
> 
> Fedora 14 guest -- OK
> 
> Centos 5.5 guest -- missing 200MB.
> 
> Ubuntu 10.04 -- missing 200MB when it worked, but in 4 out of ten
> cases, used all 8GB even though memory was set to 8GB and
> currentMemory was set to 512MB.
> 
> Windows 2k3 Used 4GB even though memory was set to 8GB and
> currentMemory was set to 512MB.
> 
> Windows 2k8r2 -- used 7.8GB even though memory was set to 8GB and
> currentMemory was set to 512MB.
> 
> These numbers were confirmed both inside the guest and on the server
> as 'resident set size' of the qemu process.
> 
> My conclusion is:
> 
> The ability to predict qemu-kvm 'balloon' memory usage is client OS
> dependent.
> 
> Is this correct?

Memory usage is a rather complex issue and I'm not sure
what you're really measuring in these values you report.

The 'memory' setting sets the total logical amount of RAM
allocated to the guest at boot time. The guest can never
use more than this. currentMemory defaults to match 'memory'
but can be lowered (and later raised) anywhere between 0
and the initial 'memory' value. This is setting the balloon
target. The guest OS does not have to honour these requests.
If there is no balloon driver it will ignore it.

Unless using explicit hugepages for the guest, KVM will
*not* initially allocate all RAM from the host OS. Each
page of RAM is only allocated when the guest OS touches
that page. So if you set memory=8G and currentMemory=4G,
although you might expect resident usage of KVM on the
host to be 4 G, it can in fact be pretty much any value
between 0 and 4 GB depending on whether the guest OS
has touched the memory pages, or as much as 8 GB if the
guest OS has no balloon driver and touches all memory
immediately.

Daniel


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]