niceguy001
Enthusiast
Enthusiast

VM memory reclamation

Jump to solution

currently analyzing how VMs' reclamation work in production environment(primarily vSphere 6.7) to prevent service down time.

I'm reading the document:https://docs.vmware.com/en/VMware-vSphere/6.7/vsphere-esxi-vcenter-server-67-resource-management-gui...

but still got some doubts that need to be clarified.

1. if a VM(allocated 16GB memory) is experiencing the memory ballooning of 6GB from ESXi, then what will the guest OS see its memory status? will the OS show that there's at least 6GB memory "used" or something?

2. setting VM's "sched.mem.maxmemctl" parameter to 0 meaning that ESXi can no longer balloon memory from that VM? is it logically a way to reserve memory for VM?

3. is there any parameters to set on the VM to prevent ESXi reclaim memory via swapping file? I don't see related configurations in the document.

4. does the VM "memory reservation" function always occupy ESXi's memory beforehand even that VM is not power on?

0 Kudos
1 Solution

Accepted Solutions
scott28tt
VMware Employee
VMware Employee

I'm wondering about whether there's other parameters/configurations to adjust the balloon memory size except for "sched.mem.maxmemctl"???

Don‘t install VMware Tools in the guest OS. Set a memory reservation. I don’t know of anything else.

if I reboot a memory ballooned VM, what kind of situation will make this VM's memory stay in ballooned status?

I don’t think that can happen as the guest OS would release/reset/reinitialise the memory during the shutdown and boot process. Where are you seeing that “status”? And do you just mean a reboot of the guest OS or a power off and on of the VM?

if a VM got 32GB memory and the memory reservation is 32GB, then this indicates that the swap file will be 0 and memory ballooning will not happen.(assume in normal condition)

but if the VM's memory reservation is 10GB only, then the max. memory balloon shall be 32-10=22GB? the max. ballooned memory size is always equal to swap file size and this principle applies to latest ESXi version?

No, I meant the VM swapfile would be that size - that has nothing to do with the guest OS and therefore nothing to do with the balloon driver. If you reserve all the allocated memory for a VM it will always be given physical RAM, so in that instance there would be no need for a VM swap file and that VM would never be selected for ballooning.

Could I ask WHY you are asking all these questions?


-------------------------------------------------------------------------------------------------------------------------------------------------------------
VMware Training & Certification blog

View solution in original post

5 Replies
scott28tt
VMware Employee
VMware Employee

1. if a VM(allocated 16GB memory) is experiencing the memory ballooning of 6GB from ESXi, then what will the guest OS see its memory status? will the OS show that there's at least 6GB memory "used" or something?

The balloon driver will have applied memory pressure on the guest OS, which will have moved 6GB of data from guest memory to guest page/swap file.

2. setting VM's "sched.mem.maxmemctl" parameter to 0 meaning that ESXi can no longer balloon memory from that VM? is it logically a way to reserve memory for VM?

Yes, as per this:  VMware Knowledge Base

If ESXi cannot balloon a particular VM, it is more likely to trigger ballooning in other VMs. If you want to reserve memory for a VM setting a memory reservation is the better method.

3. is there any parameters to set on the VM to prevent ESXi reclaim memory via swapping file? I don't see related configurations in the document.

Set a memory reservation for the VM, consider this formula:

swap file size = allocated memory - reserved memory

4. does the VM "memory reservation" function always occupy ESXi's memory beforehand even that VM is not power on?

No, only when the VM is powered on, and you would not be able to power on the VM if the reserved memory size could not be provided by the host or cluster.


-------------------------------------------------------------------------------------------------------------------------------------------------------------
VMware Training & Certification blog
0 Kudos
niceguy001
Enthusiast
Enthusiast

scott28tt​ that's solid answers! thank you so much~~

regarding to the memory ballooning problem,

I'm wondering about whether there's other parameters/configurations to adjust the balloon memory size except for "sched.mem.maxmemctl"???

if I reboot a memory ballooned VM, what kind of situation will make this VM's memory stay in ballooned status?

(my opinionn is: after this VM rebooted, the OS memory status at the beginning shall be normal but if ESXi reclaims for memory consistently, then the OS's memory will start to balloon immediately. Therefore the ESXi will display that the VM's memory start to balloon from 0 after VM rebooted.)

regarding to the relationship between memory balloning and swap file,

if a VM got 32GB memory and the memory reservation is 32GB, then this indicates that the swap file will be 0 and memory ballooning will not happen.(assume in normal condition)

but if the VM's memory reservation is 10GB only, then the max. memory balloon shall be 32-10=22GB? the max. ballooned memory size is always equal to swap file size and this principle applies to latest ESXi version?

0 Kudos
scott28tt
VMware Employee
VMware Employee

I'm wondering about whether there's other parameters/configurations to adjust the balloon memory size except for "sched.mem.maxmemctl"???

Don‘t install VMware Tools in the guest OS. Set a memory reservation. I don’t know of anything else.

if I reboot a memory ballooned VM, what kind of situation will make this VM's memory stay in ballooned status?

I don’t think that can happen as the guest OS would release/reset/reinitialise the memory during the shutdown and boot process. Where are you seeing that “status”? And do you just mean a reboot of the guest OS or a power off and on of the VM?

if a VM got 32GB memory and the memory reservation is 32GB, then this indicates that the swap file will be 0 and memory ballooning will not happen.(assume in normal condition)

but if the VM's memory reservation is 10GB only, then the max. memory balloon shall be 32-10=22GB? the max. ballooned memory size is always equal to swap file size and this principle applies to latest ESXi version?

No, I meant the VM swapfile would be that size - that has nothing to do with the guest OS and therefore nothing to do with the balloon driver. If you reserve all the allocated memory for a VM it will always be given physical RAM, so in that instance there would be no need for a VM swap file and that VM would never be selected for ballooning.

Could I ask WHY you are asking all these questions?


-------------------------------------------------------------------------------------------------------------------------------------------------------------
VMware Training & Certification blog

View solution in original post

niceguy001
Enthusiast
Enthusiast

@scott28tt 

I was debating the VM memory usage issues with a system engineer, we are evaluating a datacenter with intensive APP/workloads which are quite possible to drain the host memories off.

we were arguing about how to prevent insufficient memories for VMs and the doubts went funny on the basic ESXi memory management. that's the reason why this stupid question thread exist: what is the trade-off? just smaller VMs/workloads or precise memory policies/design?

I'm so fortunate that a VMware employee, you, just clarified that the memory reclamation methods and their principle shouldn't be mixed up.

thank you  scott!!!

0 Kudos
scott28tt
VMware Employee
VMware Employee

You didn’t ask any stupid questions, I just wondered what your use case was.


-------------------------------------------------------------------------------------------------------------------------------------------------------------
VMware Training & Certification blog
0 Kudos