- 1 Memory and CPU Reservation in VMware
- 1.1 Memory Overcommitment VMWare
- 1.2 CPU Overcommitment VMWare
Memory and CPU Reservation in VMware
We are going to discuss memory and CPU reservation in VMWare virtual machines. As we all are aware that the main objective of the ESXi hypervisor is the distribution of physical server resources to virtual machines.
By default, you can allocate resources but those are not dedicated. ESXi cluster takes care of DRS and does allocation on-demand basis. But if you have some specific requirement of business to have more compute resources and capabilities because of business needs you have the option to dedicate resources.
That,s what is referred to as Reservations in VMware. Memory Reservations although not recommended in general as it takes those resources as dedicated and no other virtual machines can utilize those even it is not in use. Reservation simply means it is reserved for a specific virtual machine.
Memory Overcommitment VMWare
Memory Overcommitment makes sense many times as some virtual machine might be less overloaded and some other virtual machine may be fully loaded.
CPU Overcommitment VMWare
CPU Overcommitment becomes a necessity due to the extensive nature of processing especially for the production environment performing high CPU intensive operations.
For all administrators, it is mandatory to understand what exactly you are doing and what will be the outcome of your activity. So you just need to have a validation process how you can validate after the work completion.
Due to the intense use of command-line tools by Unix or Linux administrators they want to validate outcome via command line. So we will see how we can validate after work.
So let’s see how to set memory and CPU reservation in VMWare virtual machine.
How to set memory and CPU reservation in VMWare
1. Right Click on Virtual Machine and Select Edit Settings
2. You will have Virtual Machine Hardware Configuration Window.
3. Expand CPU Section. You will get like this.
4. CPU Reservation in VMWare Virtual Machine
Now consider you have to bump CPU capacity from 2 to eight and you have to reserve 8 CPU dedicated to this.
While reservation in VMware is not preferred to allow on-demand resource usages. In case your application moved from On-prem to Virtualization and your application needs more computing resources you will leave with no option because your application needs more CPU resources.
So you can find each CPU capacity using below. This calculation is needed to configure reservations. As you can simply increase CPU count.
# cat /proc/cpuinfo |egrep "model name|cpu MHz" model name : Intel(R) Xeon(R) Gold 6254 CPU @ 3.10GHz cpu MHz : 3092.734 model name : Intel(R) Xeon(R) Gold 6254 CPU @ 3.10GHz cpu MHz : 3092.734
Now you know your target CPU count will be eight. So you need 8×3092=24736 Mhz to be reserved for your VM. Obviously your infrastructure needs to have enough capacity to support these reservations as these resources will be no more shared.
5. Memory Reservation in VMWare Virtual Machine
In the case of memory reservation, you will get two options to configure memory reservations. As you can see below there is an option you can bump memory as per requirement.
But you will have two options for reserving memory either whole configured memory you can be reserved by ticking Reserve all guest memory(All locked) or you can reserve partial size of memory as per application requirements.
If you are not reserving memory it will show 0 MB because VMware Clusters other machines can use that memory on-demand basis if it is not in use by this VM. Once the memory is reserved you can consider physical or you can say dedicated memory to that specific virtual machine.
How to Check Reserved Memory in Linux Virtual Machine You can use vmware-toolbox-cmd command located in /usr/bin of virtual machine to check reserved memory.By default what ever amount of memory allocated to virtual machine it will show O MB. # vmware-toolbox-cmd stat memres 0 MB
6. Editing CPU & Reservation Configuration
Simply Select 8 CPU and put the calculated amount of CPU capacity under reservations. Please refer to the below snaps.
7. Finally, select OK to allow Reconfigure Virtual Machine to be done. Once Done. Please make sure the task is completed in the taskbar or in events related to the virtual machine.
8. Power on Virtual Machine. Login once it becomes accessible.
9. Please validate the change that the number of CPU is eight and the total computing capacity of the virtual machine is as expected what you have reserved.
How to check number of Processor in Linux # grep -c ^processor /proc/cpuinfo 8 How to Check Reserved CPU in Linux Virtual Machine # vmware-toolbox-cmd stat cpures 24736 MHz If you have configured memory to 32 GB and you have opted for Reserve all guest memory (All locked) you will get like below. How to Check Memory in Linux Virtual Machine # free -g total used free shared buff/cache available Mem: 31 0 29 0 1 30 Swap: 3 0 3 How to Check Reserved Memory in Linux Virtual Machine # vmware-toolbox-cmd stat memres 32768 MB
Thanks for going through this documentation about memory and cpu reservation in VMware. So we have seen how to reserve cpu and memory in a virtual machine. I hope it will be clear and concise. If you like it request you to share as much as you can.