Saturday, 14 January 2017

How Limit, Shares and Reservation works in VMware?

Or, Understanding Limit, Reservation and Shares in VMware.
Or, How to use VMware Virtual Machine’s resources features Limit, Shares and Reservations

Descriptions: For small VMware Infrastructure, these features may not be so important to consider but in large scale VMware Infrastructures these features play very crucial roles in managing different type of Servers and applications depending on their nature criticality and availability commitments.

Virtualization is a platform where we forget about most of limitations that exist at hardware level, but it means not that we should forget about limitations of Virtualization.

In Virtualization, we over provision the resources being it CPU or RAM and just to keep your critical applications and servers safe from over provisioning caused contention scenarios, these features of resources allocation come in to the picture.

Let’s see this example below:




In the above, example you have One ESXi Server, with 40 Logical CPUs after enabling HT on the Physical CPU and you have 20 Virtual Machines each having 4 vCPUs allocated. So, now if you will calculate the total allocation of vCPUs, its 20*4=80. Imagine, you have only 40 logical CPUs at ESXi Host level but you have allocated just double number of vCPUs to your Virtual Machines.

Its real that, all of these Virtual Machines will work well as per the Virtualization concept, but the Situation will be just opposite if in case at any point of time, all VMs demand their complete allocations. ESXi host going to be dead due to contentions.. J

So, here my friends you still have a chance to keep your CRITICAL VMs alive if this situation occurs in your environment. Yes, you are right... You have to use the Reservation, Shares and Limit features here…

Let’s see how…….

Limit: Limit means Limit...that a Virtual Machine can be entitled for. You can define limit at both CPU or Memory level. Memory limit defines the maximum capacity of physical memory that a Virtual Machine can use. Same way, CPU limits defines the maximum capacity of CPU can be used by a VM.

Memory Limit: Be careful while settings up memory limit as setting it up wrongly may drastically decrease the performance of the Virtual Machine.

Example: If you have allocated 8GB RAM to a VM, and have set the limit of 4GB, this VM is going to give you very slow performance as it will not be able to get required resources when in need.  Inside Guest OS, its 8GB RAM but on top of it its only 4GB what ESXi will allow this VM to use.
Now, this VM will create ballooning and multiple vMotions among available hosts.

CPU Limit: Likewise, RAM limit, CPU limits also limits the CPU resources that a VM can use. Even if the Resources are available on the base ESXi host, the Virtual Machines sets with certain limits can’t go beyond the defined limit for them. In some cases, its useful but in most of the cases ESXi is intelligent enough to manage how much resources should be given to which VMs.

You can use this method more practically on Development of Test Servers where you may need to assign more CPU account to a VM but can limit the usage of allocated CPUs when work test/development is done.

Share: By default, Shares are equally distributed among Virtual Machines. The reason shares are equally distributed is, VMware does not know which Virtual Machine is important for you. So, it treated all your Virtual Machines equally important.. J
Shares defines, which Virtual Machine is going to have priority to be kept alive with enough resource allocation in any kind of contentions in VMware Infrastructure.

Example: If you have two VMs (VM-1 and VM-2) and both having shares value 1000, means the ESXi host will allow both of them to use 50% of available resources in case of any contention.
If there is no contention and no VMs are struggling for resources, no shares will come in to the picture. Shares are to prioritize the VMs resources availability in case of resources crunch.

Let’s see the below calculations, how shares will work in case of contentions if two VMs are struggling for resources on the same ESXi Host.











Reservations: Reservation defines the amount of resources that remains reserved forever for the Virtual Machine. This is majorly used in most CRITICAL VMs where you can’t compromise to slow down the performance of the Virtual Machine in any case.

Reservation helps a VM to reserve the specified amount or resources whether it’s being used or not. Even if contention situation pop-ups, the Virtual Machine will be having its reserved resources.

Example: If you have a VM with 8GB memory and you have set the reservation of 4GB, This VM will reserve 4GB memory always. When contention occurs, this VM will have at least 4GB of memory to ensure the applications in this server are having enough compute to perform well.

If there is no contention and this VM requires 8GB of memory, it can use it. Because, the allocated memory size of the Virtual Machine is 8GB.

Cheers, please write me back if you have any query or feedback on this...

No comments:

Post a comment