[Openstack-operators] Memory usage of guest vms, ballooning and nova

Jay Pipes jaypipes at gmail.com
Mon Mar 27 17:10:36 UTC 2017


On 03/23/2017 01:01 PM, Jean-Philippe Methot wrote:
> Hi,
>
> Lately, on my production openstack Newton setup, I've ran into a
> situation that defies my assumptions regarding memory management on
> Openstack compute nodes and I've been looking for explanations.
> Basically, we had a VM with a flavor that limited it to 96 GB of ram,
> which, to be quite honest, we never thought we could ever reach. This is
> a very important VM where we wanted to avoid running out of memory at
> all cost. The VM itself generally uses about 12 GB of ram.
>
> We were surprised when we noticed yesterday that this VM, which has been
> running for several months, was using all its 96 GB on the compute host.
> Despite that, in the guest, the OS was indicating a memory usage of
> about 12 GB. The only explanation I see to this is that at some point in
> time, the host had to allocate all the 96GB of ram to the VM process and
> it never took back the allocated ram. This prevented the creation of
> more guests on the node as it was showing it didn't have enough memory
> left.
>
> Now, I was under the assumption that memory ballooning was integrated
> into nova and that the amount of allocated memory to a specific guest
> would deflate once that guest did not need the memory. After
> verification, I've found blueprints for it, but I see no trace of any
> implementation anywhere.
>
> I also notice that on most of our compute nodes, the amount of ram used
> is much lower than the amount of ram allocated to VMs, which I do
> believe is normal.
>
> So basically, my question is, how does openstack actually manage ram
> allocation? Will it ever take back the unused ram of a guest process?
> Can I force it to take back that ram?

Basically, you are using a hammer as a screwdriver.

The tool that Nova gives you to prevent other VMs from consuming memory 
allocated to another VM is called the ram_allocation_ratio. By default, 
this is set to 1.5, meaning that if you have 100GB of RAM on a compute 
host, you can allocate VMs that would consume up to 150GB of RAM.

For your VM that has 12GB of RAM used but 96GB allocated, you do not 
want to do that. Instead, give that VM around 16GB of memory, set your 
compute host's ram_allocation_ratio (in nova.conf) to 1.0 and then 
instances on that compute host will not be able to consume more RAM than 
is available on the host.

Best,
-jay



More information about the OpenStack-operators mailing list