Closed davidjumani closed 3 years ago
@PaulAngus @andrijapanicsb or any other functional eyes on this (@weizhouapache, @wido maybe from your camp), This one raises a question about billing, should an operator be able to see both memory used by the vm and by the containing process for their accounting? what is the best un-ambiguous way to define this?
This issue jumps between FREE memory and USED memory - which one are we talking about here?
the reported issue is about how free mem is calculated but the real issue is whether used memory as used by the VM-process as opposed to the memory used inside the vm should be attributed to the user or reported in some way at all
thanks. can we change the title to match the problem please. Anyone looking back through commits will be misled.
I don't think that the overhead to run a VM is the end-users problem, I think that if I created a VM with 8GB RAM, I would expect to get charged for 8GB.
@PaulAngus I agree. Overhead is something the operator should take into account. We at PCextreme do that. We take a safety margin on top of all the memory we allocate to VMs and which we then reserve for the Operating System, buffers and overhead.
So yes, the end-user should never be aware of the RSS on the hypervisor.
VMs using Ceph for example have a much higher overhead to due librados and librbd consuming memory under the hood.
agree with Paul and Wido.
I agree as well so I gather that we have a consensus on it. The other issue is that the memoryintfreekbs
parameter returns the wrong result (the rss instead) and it might not be possible to retrieve the free memory in the VM. What would be a good approach to go about handling it ? @PaulAngus @wido @andrijapanicsb @DaanHoogland
Inside the VM depends on the hypervisor I guess. With KVM for example you have the Qemu Guest Agent which is needed to look inside the VM and get these results.
I don't think we can safely fetch that information from inside the VM.
+1 on what Wido said, as this is public cloud people will be (mostly/soemtimes) running, so it's impossible to ensure specific hypervisor tools are running. I don't see the value of monitoring the amount of RAM used inside the VM - let me user monitor his own VMs if needed (not the operator) using whatever tools they use.
thanks. can we change the title to match the problem please. Anyone looking back through commits will be misled.
I don't think that the overhead to run a VM is the end-users problem, I think that if I created a VM with 8GB RAM, I would expect to get charged for 8GB.
Totally agree.
by the way, there is a way to get accurate memory usage: memory ballooning. see https://libvirt.org/formatdomain.html#memory-balloon-device
<devices>
<memballoon model='virtio'>
<stats period='10'/>
</memballoon>
</devices>
we could add a global setting to enable/disable it.
ok, i will not make a point of this but as an enterprise cloud operator I am not at all interested in the memory usage of a vm/user, only in the amount of memory it costs me/the company. I understand public cloud wins here.
So since the field's docs mention that it is the free memory inside the VM, guessing the docs should be changed or set to zero for KVM ? Right now it is greater than the total configured memory and used in the new UI while displaying the VM details
thanks. can we change the title to match the problem please. Anyone looking back through commits will be misled. I don't think that the overhead to run a VM is the end-users problem, I think that if I created a VM with 8GB RAM, I would expect to get charged for 8GB.
Totally agree.
by the way, there is a way to get accurate memory usage: memory ballooning. see https://libvirt.org/formatdomain.html#memory-balloon-device
<devices> <memballoon model='virtio'> <stats period='10'/> </memballoon> </devices>
we could add a global setting to enable/disable it.
Personally I'm not really a fan of all the global settings we are introducing in CloudStack. The list gets longer and longer.
That said, virtio ballooning is also something which needs to be supported by the guest. Linux does this, but Windows or BSD won't always do this.
So since the field's docs mention that it is the free memory inside the VM, guessing the docs should be changed or set to zero for KVM ? Right now it is greater than the total configured memory and used in the new UI while displaying the VM details
I would set it to 0 for KVM indeed. We can't reliably get this data.
Added a fix to set memoryintfreekbs
to zero if it is greater than memorykbs
thanks. can we change the title to match the problem please. Anyone looking back through commits will be misled. I don't think that the overhead to run a VM is the end-users problem, I think that if I created a VM with 8GB RAM, I would expect to get charged for 8GB.
Totally agree. by the way, there is a way to get accurate memory usage: memory ballooning. see https://libvirt.org/formatdomain.html#memory-balloon-device
<devices> <memballoon model='virtio'> <stats period='10'/> </memballoon> </devices>
we could add a global setting to enable/disable it.
Personally I'm not really a fan of all the global settings we are introducing in CloudStack. The list gets longer and longer.
yep. but cloudstack is a open source project. There are some features which are used by some users but not used by other users. They might use different setting. It is the certain result if more features and improvements are added.
That said, virtio ballooning is also something which needs to be supported by the guest. Linux does this, but Windows or BSD won't always do this.
@wido true. In windows, user have to install virtio driver for memory ballooning. If the driver is installed incorrectly, vm might be frozen after migration.
The
memoryintfreekbs
retuned by listVirtualMachines for KVM is always greater than the total memory allocated for the VM. This is because it returns the RSS of the process running the VM (https://libvirt.org/manpages/virsh.html#dommemstat) The RSS shows how much memory is allocated to that process and is in RAM. It is returned bymemoryStats
over at https://github.com/apache/cloudstack/blob/master/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java#L3712-L3718 when trying to fetch the free memory insteadNeed to discuss how to handle this as well as the impact on usage
ISSUE TYPE
CLOUDSTACK VERSION
OS / ENVIRONMENT
KVM
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS