VMware Cloud Community
Lajosh
Contributor
Contributor
Jump to solution

RAM reservations

Hello,

I wanted to clarify about RAM reservations.

Does reservation setup/removal apply on powered on VMs? Not speaking about removing swap file, only about reserving the memory for given amount of time and then removing the reservation.

Also, if I setup reservation for a running VM, does it mean the hypervisor will immediately make the physical RAM reserved for this VM or only at the time its requested by the VM?

Given example:

host has 64GB RAM free for VMs

VM1 is configured with 32GB, actually consumes 20GB RAM but no reservation.

VM2 is configured with 16GB, consumes 16GB RAM with reservation to 16GB.

At this point I setup VM1 reservation to 32GB.

Thats 48GB reserved, 16GB free

VM3 is started with 32GB RAM configured but no reservation.

Assuming VM1 still only asks for 20GB RAM - can VM3 ever get more than 16GB physical RAM or it will automatically swap to disk after 16GB is consumed?

thanks a lot

Leos

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
dbalcaraz
Expert
Expert
Jump to solution

Hello Lajosh,

First of all, bear in mind that swap file = configured memory – memory reservation.

Then, once you set a reservation for a VM the ESXi will guarantee access to physical memory for this VM.

About when is applied this reservation, as I am aware, the swap file (.vswp) will change once you power off and power on the VM (at it is created and deleted).

Talking about your example:

ESXi has 64 GB RAM

VM1= Configured 32 GB - Consuming 20 GB - No reservation

VM2= Configured 16 GB - Consuming 16 GB - 16 GB Reserved

Then you change VM1 to:

VM1= Configured 32 GB - Consuming 20 GB -32 GB Reserved

Now ESXi has 64 GB RAM, 48 GB reserved, 16 GB free.

VM3 start configured with 32 GB RAM - no reservation.

Response: As 48 GB of RAM are reserved for other VMs, even if they are not using it, VM3 will only be able to use 16 GB of RAM and then it will swap to disk as no reservation is not configured.

Remember that the swapfile for VM3 will be 32 GB as memory reservation is not configured.

More information: CPU/MEM Reservation Behavior - Yellow Bricks

-------------------------------------------------------- "I greet each challenge with expectation"

View solution in original post

0 Kudos
6 Replies
dbalcaraz
Expert
Expert
Jump to solution

Hello Lajosh,

First of all, bear in mind that swap file = configured memory – memory reservation.

Then, once you set a reservation for a VM the ESXi will guarantee access to physical memory for this VM.

About when is applied this reservation, as I am aware, the swap file (.vswp) will change once you power off and power on the VM (at it is created and deleted).

Talking about your example:

ESXi has 64 GB RAM

VM1= Configured 32 GB - Consuming 20 GB - No reservation

VM2= Configured 16 GB - Consuming 16 GB - 16 GB Reserved

Then you change VM1 to:

VM1= Configured 32 GB - Consuming 20 GB -32 GB Reserved

Now ESXi has 64 GB RAM, 48 GB reserved, 16 GB free.

VM3 start configured with 32 GB RAM - no reservation.

Response: As 48 GB of RAM are reserved for other VMs, even if they are not using it, VM3 will only be able to use 16 GB of RAM and then it will swap to disk as no reservation is not configured.

Remember that the swapfile for VM3 will be 32 GB as memory reservation is not configured.

More information: CPU/MEM Reservation Behavior - Yellow Bricks

-------------------------------------------------------- "I greet each challenge with expectation"
0 Kudos
Lajosh
Contributor
Contributor
Jump to solution

Hello dbalcaraz,

yes I am aware about the swap size and that its only applied during power cycle Smiley Happy

Just wanted to clarify on the points of on-fly changes and memory assignment so thanks for the answer.

cheers L

0 Kudos
Lajosh
Contributor
Contributor
Jump to solution

Hey man,

reading the article you shared, it says:

However, if the VM accesses only 500 MB of vRAM, only 500 MB of pRAM are allocated (or granted) to it. Other VMs could use 2500 MB of RAM that you would think is part of the reservation. They cannot reserve that 2500 MB however. As soon as the VM accesses 3 GB of vRAM and so has 3 GB of pRAM backing it, no other VMs can use that 3 GB of pRAM even if the VM never touches it again, because that pRAM is now protected by the 3 GB Reservation.

So this does not comply with your answer that VM3 will only be able to access 16GB of RAM. It will be able to access more until VM1 asks for it.

In that case Im wondering about what happens. If VM3 will consume 18GB of pRAM and VM1 will ask for it, hypervisor will have to swap the 2GB pRAM from VM3 to disk, which takes some time, no?

0 Kudos
dbalcaraz
Expert
Expert
Jump to solution

There is another part of the article that says that the vRAM is reserved even if the VM is not using it.

If you want, I can do the test on Friday.

But yes, If VM3 consumes 18 GB of RAM and then VM1 asks for more RAM, it will put VM3 to swap and VM1 with the physical resource.

-------------------------------------------------------- "I greet each challenge with expectation"
0 Kudos
Lajosh
Contributor
Contributor
Jump to solution

Your right, I did a quick test. its not possible to setup a reservation and "steal" from other VMs even if they are without reservation.

thanks

0 Kudos
dbalcaraz
Expert
Expert
Jump to solution

Thanks Lajoshfor the information.

I hope now everything is clear! Smiley Happy

Regards!

-------------------------------------------------------- "I greet each challenge with expectation"
0 Kudos