Wednesday, July 10, 2013

Memory Compression

With Memory Compression, ESXi stores pages, which would otherwise be swapped out to disk through host swapping, in a compression cache located in the main memory. Memory compression overtakes host swapping because access to the compressed page only need a page decompression, which is faster than the disk access, which involves a disk I/O. ESXi determines if a page can be compressed by checking the compression ratio for the page. Memory compression occurs when the page’s compression ratio is greater than 50%. Otherwise, the page is swapped out.
Only pages that would otherwise be swapped out to disk are chosen as candidates for memory compression. This means ESXi will not proactively compress guest pages when host swapping is not necessary; so we can say that memory compression does not affect workload performance when host memory is undercommitted. With memory compression, a swap candidate page (4K) is compressed and stored using 2k of space in a per-virtual machine compression cache.
Note: For more efficient usage of the compression cache, if a page’s compression ratio is larger than 75%, ESXi will store the compressed page using a 1KB quarter-page space.
Managing Per-VM Compression Cache
Compression cache is accounted for by the VM’s guest memory usage, a large compression cache may waste VM memory and unnecessarily create host memory pressure especially  when most compressed pages would not be used in future. The compression cache size starts with zero when host memory is undercommitted and grows when the VM starts to be swapped out.
If the compression cache is full, One compressed page must be replaced for a new compressed page. The page which has not been accessed for the longest time will be decompressed and swapped out. ESXi will not swap out compressed pages.
The maximum compression cache size is important for maintaining good VM performance.  The default maximum compression cache size (Mem.MemZipMaxPct) is set to 10% of configured VM memory size.
Configure Maximum Compression Cache Size in vSphere Client.

Thanks to VMware, Information is from the white paper provided by VMware.
    

0 comments:

Post a Comment