Labels

Showing posts with label VMWare. Show all posts
Showing posts with label VMWare. Show all posts

Friday, July 29, 2011

Understanding How Memory is managed in VMware

How memory is allocated to a virtual machine?

When we create a new virtual machine through vsphere client the wizard asks us how much memory the virtual machine should have

The amount of memory we allocate on this screen is the amount of the guest operating system will see.
Example:. Assume we have given 1 GB of memory to virtual machine. the virtual machine will never able to use more than 1 GB.
Let us assume 4 GB of physical RAM avail to run the virtual machine.
Requirements: Need to create the 4 virtual machine with 1 GB RAM each.
First virtual machine will run with 1GB and leaving the 3GB to the other virtual machines
After  configured  3 more virtual machine with 1GB each. Upto now all the machines will run as normal.
What happens when we launch a fifth machine ? will it run ?  The answer is yes.

There are 3 technologies used to manage the memory.They are
  • Idle page reclamation
  • Transparent page sharing
  • Balloon driver
Idle page reclamation:
Using this technology, ESX/ESXi will reclaim memory pages that are not being actively used by the virtual machine, clean-up the reclaimed pages and reallocate those memory pages to the other virtual machines.

Transparent page sharing:
In this technology, where the identical memory pages are shared among virtual machines to reduce the total number of memory pages need.

Balloon driver:
This driver will comes with VMware Tools. In this technology the driver forces a VM to use less memory than its configured maximum. The balloon driver requests memory from the guest operating system within virtual machine and then passes that memory back to the hyper-visor for use by other virtual machine

How Balloon driver works?
This driver is a part of the vmware Tools, It is a guest operating system specific driver, meaning that Linux VM’s would have a Linux-based balloon driver, Windows VMs would have a Windows-based balloon driver, and so.
When the ESX/ESXi host is running low on physical memory, the hyper-visor will signal the balloon driver to grow. To do this the balloon driver will request memory from the guest operating system. This causes the balloon driver’s memory footprint to grow. The memory that is granted to the balloon driver is then passed back to the hyper-visor. The hyper-visor can use these memory pages to  supply memory for the other virtual machines, which reducing the need to swap and minimizing the performance impact of the memory. When the memory pressure on the host get cleared, the balloon driver will return memory to the guest operating system.

Controlling Memory Allocation
ESX/ESXi provides some additional settings in the virtual machines configuration that affect memory allocation and memory management..On the Resources tab of a virtual machine’s properties dialog box we can see three options for controlling how a virtual machine uses the memory assigned to it.
  • Reservation
  • Limit
  • Shares
The following are the steps to edit the reservation, limit,or shares of a virtual machine
  •  Use the vSphere Client to connect to a vCenter Server or directly to an ESX/ESXi 
  • Scroll down through the inventory to find the virtual machine to be edited 
  • Right click the virtual machine, and select the Edit Settings option 

  • Click Resources tab
  • On the Resources tab, select the CPU or Memory options from the Settings list on the left
  • Adjust the Shares, Reservation and Limit values as needed





The memory reservation is optional settings for each virtual machine. The memory reservation amount specified on the Resouces tab of the virtual machine settings is the amount of actual, real physical memory that the ESX/ESXi host provide to this virtual machine for the virtual machine to power on..
The default is 0MB. 0 MB means the ESX/ESXi host does not have to provide the virtual machine with any physical memory.
 A virtual machine with a reservation is guaranteed the amount of RAM configured in its Reservation settings.

If ESX/ESXi host is not required to provide actual RAM to the virtual machine, then how the virtual machine get its memory? The answer is that it provides swap, or more specifically something called VMkernel swap
VMkernel swap is a file created when a virtual machine is powered on  with a .vswp extension. The pre-virtual machine swap files created by the VMkernel reside by default in the same data store location as the virtual machine’s configuration file and virtual disk files. By default this file will be equal to the size of the RAM that you configured the virtual machine.
Note: If the virtual machine configured with a reservation or a limit, the VMkernel swap file could differ.





Here you may get doubt.  Does a virtual machine will get all of its memory from swap when ESX/ESXi host RAM is available? NO. ESX/ESXi will attempt to provide each virtual machine with all the memory it request, upto the maximum amount configured for the virtual machine.

Example: A virtual machine configured with only 1GB of RAM cannot request more than 1GB of RAM. However when an ESX/ESXi host does not have enough RAM available to satisfy the memory needs of the virtual machines it is hosting. The technologies such as transparent page sharing, idle page reclamation and the balloon driver aren’t enough, the VMkernel is forces to page some of each virtual machine’s memory out to the individual virtual machine’s memory out to the individual virtual machine’s VMkernel swap file.

Did we can control how much of an individual virtual machine’s memory allocation can provided by swap and how much must be provided by real physical RAM? Yes. This is where a memory reservation comes into picture. By default a virtual machine has a memory reservation of 0MB, which means that potentially all of the virtual machine has a memory pages out to the VMkernel swap file if necessary.


 

Thursday, July 21, 2011

Setting Multipathing Policies for LUNs


The following multipathing policies are currently supported:
Fixed — The ESX Server host always uses the preferred path to the disk when that path is available. If it cannot access the disk through the preferred path, then it tries the alternate paths. Fixed is the default policy for active/active storage devices.
Most Recently Used — The ESX Server host uses the most recent path to the disk until this path becomes unavailable. That is, the ESX Server host does not automatically revert back to the preferred path. Most Recently Used is the default policy for active/passive storage devices and is required for those devices.
The ESX Server host automatically sets the multipathing policy according to the make and model of the array it detects. If the detected array is not supported, it is treated as active/active. For a list of supported arrays, see the SAN Compatibility Guide.

Note: Manually changing Most recently used to Fixed is not recommended.

To Set the Multipathing Polices 
  • Log into the VMware VI Client, and select a server from the inventory panel.
  • Click the Configuration tab, and click Storage (SCSI, SAN, and NFS) under hardware.
  • From the list of configured datastores, select the datastore whose paths you want to view or configure, and click Properties.
The Volume Properties dialog box for this datastore opens.
  • The Extent Device panel includes information on the status of each path to the storage device. The following path information appears:
          Active- The path is working and is the current path being used for transferring data.
          Disabled – The path has been disabled and no data can be transferred.
          Standby – The path is working but is not currently being used for transferring data.
          Dead-  The software cannot connect to the disk through this path.
  • Click Manage Paths to open the Manage Paths wizard.
If you are using path policy Fixed, you can see which path is the preferred path. The preferred path is marked with an asterisk (*) in the fourth column.

The Manage Paths wizard shows the list of different paths to the disk, with the multipathing policy for the disk and the connection status for each path. It also shows the preferred path to the disk.  
 
  • Under the policy Click change
 
Select one of the following options:
  • Fixed
  • Most RecentlyUsed
Click OK, and click Close to save your settings and return to the Configuration page.