You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mem.overprovisioning not working as expected. #7529
mem.overprovisioning.factor -- set to 5
vm.min.memory.equals.memory.divided.by.mem.overprovisioning.factor - set to true
But still unable to create VMs more then actual Memory on hypervisor.
Even if can create more then that it not reflecting on VM and ..vm dumpxml shows assign memory devided by total assigned/over provisioning ratio.
We want over provisioning to work in a way where if we login to guest should show actual assigned value and we should be able to create VMs with value more than actual available memory similar like VMWare.
Please guide through global setting tuning if any to make it work ...
For example ..My hyp have actual mem ory 126GB ...So when i create a VM with 96GB where overprovisioing set to 10 ...VM shows memory in free-g output only 9GB.
@yashi4engg This looks like a bug to me, CloudStack shouldn't set a lower value for the memory configs in the KVM instead it should use auto ballooning. CC @harikrishna-patnala
KVM balloning feature on at Host side but concern here is if we use mem.overprovisioing its not showing assigned memory at VM side and its shows only assigned mem/overprovisioing-ratio .
In the previous conjuncture, when ACS was deploying a VM, it would define a minimum memory|CPU to the VM based on a calculation through the overprovisioning (defined mem|cpu speed / overprovisioning factor); Therefore, it would define a range of memory/CPU, even if it did not use scalable (dynamic) service offerings.
To workaround this situation, configurations vm.min.memory.equals.memory.divided.by.mem.overprovisioning.factor and vm.min.cpu.speed.equals.cpu.speed.divided.by.cpu.overprovisioning.factor were introduced (with PR #4722), to allow operators decide if they want the minimum memory|CPU to be different from the allocated value when the overprovisioning's configurations are different than 1. By default these configurations are true, to keep the initial behavior; however, in your case, you should mark those configurations as false, so the memory|speed allocated to the VM is the actual defined in the offering.
Could you apply the suggestion and make some tests?
Yes, But our use case is what ever memory we allocate should be shown in VM using free command but it should allow overprovisioning as well so we can get benefited with Memory balooning. Where user want more memory to be allocated for VM but actual use is very less or most of time VM stay ideal.
@yashi4engg do you have memory balloon feature disabled; if you're using KVM do you have vm.memballoon.disable set to true or false (or not defined) in your agent.properties?
@rohityadavcloud - I tried to follow that but after that seems baloonning not working and host is not reclaiming free memory and keep on showing memory as used what VM had used max at any point .. ex - VM used 90% of Mem at a particular point So host not able to release that memory even after one day if current use on VM is less then 10% of aloocated Mem.
Also disabled below one from global setting for cluster :- mem.overprovisioning.factor - 2 vm.min.memory.equals.memory.divided.by.mem.overprovisioning.factor - false
@yashi4engg
I am able to reproduce the issue.
However, I think it is not a bug. As far as I know, qemu/kvm does NOT automatically reclaim unused memory from guest VMs, unless you reduce the memory of guest VMs.
Here are the steps I did
created 4 VMs with 1GiB memory
check memory usage of kvm host, it increased around 1.5GiB
run memory tests to use 512MB memory in each VM
check memory usage of kvm host, it increased around 1.8GiB
stop the memory tests, and wait for a hour
check memory usage of kvm host, it did not change
reduce the memory of guest VMs to 512MiB
check memory usage of kvm host, it decreased around 1.2GiB
increase the memory of guest VMs to 1GiB
check memory usage of kvm host, it did not change
Some commands
check memory usage of kvm host: free -mh
memory tests inside vm: head -c 512m /dev/zero | tail
reduce memory of guest VMs on host : virsh setmem <vm-name> 524288
check memory of guest VMs on host: virsh dommemstat <vm-name>
@DaanHoogland - But its not a Prod use case where its not possbile to reduce and increase memory of VM frequently ...Memory Ballooning should work so free memory should auto relaesed to allocate for other VM if uses increase on another VM .. See below use case -
1 - We are using Memory overprovisoining
2 - ex- we have deployed 20 VM totale actual memory 128GB and allocated is 200GB due to overporivisoining
3 - 4-5 at any point uses their max memory example 80GB and after few minuted memory uses on tjose again reduced .
4 - Here whats happening even if actual uses is less but still Host showing Memeory uses high and impacting other VMs if they need some memeory for their uses.
3 - 4-5 at any point uses their max memory example 80GB and after few minuted memory uses on tjose again reduced .
@yashi4engg
from what I have tested, the output of virsh dommemstat on kvm host is consistent with the free command inside vm.
The problem is, how to automatically reclaim allocated but unused memory from guest VMs. You might ask qemu/kvm if it is possible.
(a script to monitor memory usage and reduce/increase memory should work)
btw: from my experience, it is a bad practise to use memory overprovisioning in kvm production environments.
Hi @yashi4engg I've reviewed the comments and supporting data, this isn't a CloudStack bug. Overprovisioning shouldn't be confused with memory ballooning feature or dynamic reclaming. KSM enabled in an env will try to reduce memory consumption, but it's been clearly stated in kvm/libvirt docs that memory ballooning may not be dynamic. Agree with Wei's comments, you shouldn't use memory over provisioning in KVM env if you're not observing gains. The cons of using memory overprovisioning could end up crashing your guest VMs (or host).
Activity
yashi4engg commentedon May 12, 2023
Backend env -
Hypervisor - OEL9
Guests - OEL7
cloudstack version 4.18
rajujith commentedon May 22, 2023
@yashi4engg This looks like a bug to me, CloudStack shouldn't set a lower value for the memory configs in the KVM instead it should use auto ballooning. CC @harikrishna-patnala
yadvr commentedon Jun 15, 2023
Need review/testing, was KVM ballooning feature on? cc @DaanHoogland @rajujith
rajujith commentedon Jun 15, 2023
@rohityadavcloud @DaanHoogland please refer to the same issue #7430
yashi4engg commentedon Jun 19, 2023
KVM balloning feature on at Host side but concern here is if we use mem.overprovisioing its not showing assigned memory at VM side and its shows only assigned mem/overprovisioing-ratio .
rajujith commentedon Jun 20, 2023
@yashi4engg the 'memory unit' in the domain definition should not be changed based on the over provisioning ratio but cloudstack does that currently.
GutoVeronezi commentedon Jul 20, 2023
Hello @yashi4engg,
In the previous conjuncture, when ACS was deploying a VM, it would define a minimum memory|CPU to the VM based on a calculation through the overprovisioning (
defined mem|cpu speed/overprovisioning factor); Therefore, it would define a range of memory/CPU, even if it did not use scalable (dynamic) service offerings.To workaround this situation, configurations
vm.min.memory.equals.memory.divided.by.mem.overprovisioning.factorandvm.min.cpu.speed.equals.cpu.speed.divided.by.cpu.overprovisioning.factorwere introduced (with PR #4722), to allow operators decide if they want the minimum memory|CPU to be different from the allocated value when the overprovisioning's configurations are different than 1. By default these configurations aretrue, to keep the initial behavior; however, in your case, you should mark those configurations asfalse, so the memory|speed allocated to the VM is the actual defined in the offering.Could you apply the suggestion and make some tests?
Best regards
yashi4engg commentedon Jul 20, 2023
Yes, But our use case is what ever memory we allocate should be shown in VM using free command but it should allow overprovisioning as well so we can get benefited with Memory balooning. Where user want more memory to be allocated for VM but actual use is very less or most of time VM stay ideal.
yadvr commentedon Aug 3, 2023
@yashi4engg do you have memory balloon feature disabled; if you're using KVM do you have
vm.memballoon.disableset to true or false (or not defined) in your agent.properties?9 remaining items
weizhouapache commentedon Aug 15, 2023
@rohityadavcloud @DaanHoogland
any ideas ?
DaanHoogland commentedon Aug 15, 2023
I'll have another shot at reproducing this
weizhouapache commentedon Aug 21, 2023
@yashi4engg @DaanHoogland
I will test this scenario.
weizhouapache commentedon Aug 21, 2023
@yashi4engg
I am able to reproduce the issue.
However, I think it is not a bug. As far as I know, qemu/kvm does NOT automatically reclaim unused memory from guest VMs, unless you reduce the memory of guest VMs.
Here are the steps I did
Some commands
free -mhhead -c 512m /dev/zero | tailvirsh setmem <vm-name> 524288virsh dommemstat <vm-name>weizhouapache commentedon Aug 21, 2023
@DaanHoogland @yashi4engg
mark it as a minor issue
yashi4engg commentedon Aug 21, 2023
@DaanHoogland - But its not a Prod use case where its not possbile to reduce and increase memory of VM frequently ...Memory Ballooning should work so free memory should auto relaesed to allocate for other VM if uses increase on another VM .. See below use case -
1 - We are using Memory overprovisoining
2 - ex- we have deployed 20 VM totale actual memory 128GB and allocated is 200GB due to overporivisoining
3 - 4-5 at any point uses their max memory example 80GB and after few minuted memory uses on tjose again reduced .
4 - Here whats happening even if actual uses is less but still Host showing Memeory uses high and impacting other VMs if they need some memeory for their uses.
weizhouapache commentedon Aug 21, 2023
@yashi4engg
from what I have tested, the output of
virsh dommemstaton kvm host is consistent with thefreecommand inside vm.The problem is, how to automatically reclaim allocated but unused memory from guest VMs. You might ask qemu/kvm if it is possible.
(a script to monitor memory usage and reduce/increase memory should work)
btw: from my experience, it is a bad practise to use memory overprovisioning in kvm production environments.
weizhouapache commentedon Aug 23, 2023
@yashi4engg
I think this is out of our scope. do you have other issues ? if not, I am going to close this issue.
yadvr commentedon Aug 25, 2023
Hi @yashi4engg I've reviewed the comments and supporting data, this isn't a CloudStack bug. Overprovisioning shouldn't be confused with memory ballooning feature or dynamic reclaming. KSM enabled in an env will try to reduce memory consumption, but it's been clearly stated in kvm/libvirt docs that memory ballooning may not be dynamic. Agree with Wei's comments, you shouldn't use memory over provisioning in KVM env if you're not observing gains. The cons of using memory overprovisioning could end up crashing your guest VMs (or host).
bhouse-nexthop commentedon Dec 4, 2025
See #11932