Category Archives: Memory

Memory Compression

When a host’s memory becomes overcommitted, ESXi compresses virtual pages and stores them in memory. Because accessing compressed memory is faster than accessing memory that is swapped to disk, memory compression in ESXi allows you to overcommit memory without significantly hindering performance.

Pages that can be compressed to 2 KB or smaller are stored in the virtual machine’s compression cache, increasing the capacity of the host.
You can set the maximum size for the compression cache and disable memory compression using the Advanced Settings.

Procedure

1 In the vSphere Client, select the host in the inventory.
2 Click the Configuration tab.
3 Under Software, select Advanced Settings.
4 In the left pane, select Mem and locate Mem.MemZipEnable.

Memory compression is enable by default. No need to change this value. Just below this value shown below select Mem and locate Mem.MemZipMaxPct. The value of this attribute determines the maximum size of the compression cache for the virtual machine.
5 Enter the maximum size for the compression cache. By default it is configured as 50

This value is in percentage corresponding to configured memory size of virtual machine. This is maximum size Host can use to compress memory pages of VM.

6 Click OK.

SNAGHTML4e6579a

Swapping to Host Cache

Datastores that are created on solid state drives (SSD) can be used to allocate space for host cache. The host can reserves a certain amount of space for swapping to host cache. It is configurable as shown below

SNAGHTML2ed904c

 

image

The host cache is made up of files equally divide into 1 GB size.

SNAGHTML3066af2

ESXi uses this file as write back cache for virtual machine swap files. The cache is shared by all virtual machines running on the host.

If you analogy of storage which has both read and write cache, it applies to host cache. Here VMware has only enhanced this cache by using SSD disk for caching.

Therefore using swap to host cache is not the same as placing regular swap files on SSD-backed datastores. Even if you enable swap to host cache, the host still needs to create regular swap files. However, when you use swap to host cache, the speed of the storage where the host places regular swap files is less important.


Note Only SSD-backed datastores appear in the list of datastores on the Host Cache Configuration page.


SNAGHTML320c66a

Design considerations for swapping to host cache (SSD) is available at www.yellow-bricks.com

Bottom line is swapping to cache will happen only when there is severe memory pressure.

When ESXi host starts to swap

image

ESXi hosts will swap for all the above reasons and there might be more. But bottom line is ESX starts swapping when it feels it is short of memory.