- vSphere High Performance Cookbook(Second Edition)
- Kevin Elder Christopher Kusek Prasenjit Sarkar
- 432字
- 2021-07-02 20:59:56
Memory ballooning
Memory ballooning tells the guest operating system that it does not have enough memory from the host so that the guest operating system could free some of its memory. When there is a memory crisis, the hypervisor tells the balloon driver to request some number of megabytes from the guest operating system. The hypervisor knows that pages occupied by the balloon driver will never store data, so the pages of pRAM requested by the balloon driver can then be reallocated safely to other VMs. It is the guest operating system's call to decide which pages of vRAM it should allocate to the balloon driver, and it will start with free pages. If it has plenty of free or idle guest physical memory, inflating the balloon will induce no guest-level paging and thus it will not affect guest performance. However, in the case of memory contention within the guest, the VM OS decides which guest physical pages are to be paged out to the virtual swap device in order to satisfy the balloon driver's allocation requests.
The balloon driver reclaims the guest operating system's allocated memory using Idle Memory Tax (IMT). IMT may reclaim up to 75 percent of idle memory. A guest operating system page file is necessary in order to prevent guest operating system kernel starvation. The vmmemctl driver should aggressively reclaim memory due to severe host contention (make sure that the guest operating system page file is at least 65 percent of the configured vRAM). Even here, the guest operating system can make intelligent guesses about which pages of data are least likely to be requested in future. (You'll see this in contrast with hypervisor-level swapping, which is discussed next.) Look at the following pictorial representation of memory page mapping to host memory:

Host-level swapping in ESXi is not sufficient to reclaim memory during TPS and ballooning. To support this, when you start a VM, the hypervisor creates a separate swap file for the VM. This is primarily because if it frees pRAM for other VMs, the hypervisor can directly swap out vRAM with the swap file.
Swapping is a guaranteed technique to reclaim a specific amount of memory within a specific amount of time. However, you should be concerned about host-level swapping because it can severely penalize guest performance. This occurs when the hypervisor has no knowledge about which guest physical pages should be swapped, and the swapping might cause unintended interactions with the native memory management policies in the guest operating system. The following is a pictorial representation of host-level memory page swapping:

- DB2 V9權威指南
- 觸·心:DT時代的大數據精準營銷
- jQuery EasyUI網站開發實戰
- Arduino開發實戰指南:LabVIEW卷
- 樂高機器人設計技巧:EV3結構設計與編程指導
- 技術領導力:程序員如何才能帶團隊
- R語言編程指南
- AngularJS深度剖析與最佳實踐
- 人人都是網站分析師:從分析師的視角理解網站和解讀數據
- C#程序設計基礎:教程、實驗、習題
- 琢石成器:Windows環境下32位匯編語言程序設計
- 搞定J2EE:Struts+Spring+Hibernate整合詳解與典型案例
- 玩轉.NET Micro Framework移植:基于STM32F10x處理器
- Scratch編程從入門到精通
- HTML5程序開發范例寶典