Contributor
Contributor

Memory management question

Maybe i am rusty,  but even though i was reading about it, i am still confused about how memory management was done by vsphere.

 

We use vSphere 6.7clusters and my question is:

1. In a default configuration, When i configuring for example  32gb RAM for Windows or Linux server vm,

does the esxi allocate all the 32gb memory to the vm immidiatly , or can use the unused memory of this vm for other vm's

that need it in a point of time?

2. in a situation when i have spare physical memory on the esxi host that dosn't configured in any vm,

does the hypervisor can take RAM from this unused free RAM pool and give it to vms that almost run out of memory?

 

Thank you very much,

Randi

 

 

0 Kudos
5 Replies
Enthusiast
Enthusiast

Ad.1

It does not allocate all the memory immediately. It only allocates the memory that is demanded by the VM.

Unfortunately modern OSes are very aggressively demanding the memory during the initialization.

As such unused memory in the VM does not really exists.

Ad. 2

No. Hypervisor does not increase size of the configured memory on the VM on it's own.

Hot Shot
Hot Shot

Hi @randahan,

In addition to what @ZibiM said. If you "reserve" the memory on the VM, all of the memory is provided to the VM, which means other VM's cannot use it (if the VM with the reservation used up all resources reserved for it).

See the following tekst from the Resource Management Guide:

Memory Reservation

Is a guaranteed lower bound on the amount of physical RAM that the host
reserves for the virtual machine, even when memory is overcommitted. Set
the reservation to a level that ensures the virtual machine has sufficient
memory to run efficiently without excessive paging.
After a virtual machine consumes all of the memory within its reservation, it
is allowed to retain that amount of memory and this memory is not
reclaimed, even if the virtual machine becomes idle. Some guest operating
systems (for example, Linux) might not access all of the configured memory
immediately after booting. Until the virtual machines consumes all of the
memory within its reservation, VMkernel can allocate any unused portion of
its reservation to other virtual machines. However, after the guest’s workload
increases and the virtual machine consumes its full reservation, it is allowed
to keep this memory.

Visit my blog at https://vcloudvision.com!
Contributor
Contributor

Thanks a lot for the help

Sorry, i still didnt understand if in a situation that i am not using memory reservation for the vm, and  the vm dosn't consume all of it, if there is any mechanism that can use the "free" memory of the vm to another vm or vm's?

 

 

0 Kudos
Hot Shot
Hot Shot

Hi @randahan,

I somehow deleted my first post to this topic once I edited it, here it is again:

In addition to the other replies here, spare memory does get used by other VM's on the system, but if you use a reservation it might not be available to be used by other VM's once it's used by the VM that has the reservation. See the below piece of information from the Resource Management Guide.

Memory Reservation:

Is a guaranteed lower bound on the amount of physical RAM that the host reserves for the virtual machine, even when memory is overcommitted Set the reservation to a level that ensures the virtual machine has sufficient memory to run efficientlyǰ without excessive paging. After a virtual machine consumes all of the memory within its reservation, it is allowed to retain that amount of memory and this memory is not reclaimed, even if the virtual machine becomes idle. Some guest operating systems (for example, Linux) might not access all of the configured memory immediately after booting. Until the virtual machines consumes all of the memory within its reservation, VMkernel can allocate any unused portion of its reservation to other virtual machines. However, after the guest’s workload increases and the virtual machine consumes its full reservation, it is allowed to keep this memory.

Visit my blog at https://vcloudvision.com!