Книга: Mastering VMware® Infrastructure3
Exploring VMotion
Разделы на этой странице:
We've defined the VMware VMotion feature as the ability to perform a hot migration of a virtual machine from one ESX Server host to another without service interruption. This is an extremely effective tool for load-balancing virtual machines across ESX Server hosts. Additionally, if an ESX Server host needs to be powered off for hardware maintenance or some other function that would take it out of production, VMotion can be used to migrate all active virtual machines from the host going offline to another host without waiting for a hardware maintenance window since the virtual machines will remain available to the users that need them.
Table 9.1: Virtual Machine Memory Overhead
Virtual CPUs | Memory Assigned (MB) | Overhead for 32-bit | Overhead for 64-bit |
---|---|---|---|
Virtual machine (MB) | Virtual machine (MB) | ||
1 | 256 | 79 | 174 |
1 | 512 | 79 | 176 |
1 | 1024 | 84 | 180 |
1 | 2048 | 91 | 188 |
1 | 4096 | 107 | 204 |
1 | 8192 | 139 | 236 |
1 | 16384 | 203 | 300 |
2 | 256 | 97 | 288 |
2 | 512 | 101 | 292 |
2 | 1024 | 101 | 300 |
2 | 2048 | 125 | 316 |
2 | 4096 | 157 | 349 |
2 | 8192 | 221 | 413 |
2 | 16384 | 349 | 541 |
4 | 256 | 129 | 511 |
4 | 512 | 133 | 515 |
4 | 1024 | 141 | 523 |
4 | 2048 | 157 | 540 |
4 | 4096 | 189 | 572 |
4 | 8192 | 222 | 605 |
4 | 16384 | 350 | 734 |
VMotion works by copying the contents of virtual machine memory from one ESX host to another and then transferring control of the virtual machines' disk files to the target host.
VMotion operates in the following sequence of steps:
1. An administrator initiates a migration of a running virtual machine (VM1) from one ESX Server (Silo104) to another (Silo105), shown in Figure 9.20.
Figure 9.20 Step 1 in a VMotion migration: invoking a migration while the virtual machine is powered on.
2. The source hosts (Silo104) begins copying the active memory pages VM1 has in host memory to the destination host (Silo105). During this time, the virtual machine still services clients on the source (Silo104). As the memory is copied from the source host to the target, pages in memory could be changed. ESX Server handles this by keeping a log of changes that occur in the memory of the virtual machine on the source host after that memory address has been copied to the target host. This log is called a memory bitmap as shown in Figure 9.21.
The Memory Bitmap
The memory bitmap does not include the contents of the memory address that has changed; it simply includes the addresses of the memory that has changed — often referred to the “dirty memory.”
3. Once the entire contents of RAM for the virtual machine being migrated have been transferred to the target host (SILO105), then VM1 on the source ESX Server (SILO104) is quiesced. This means that it is still in memory but is no longer servicing client requests for data. The memory bitmap file is then transferred to the target (Silo105). See Figure 9.22.
4. The target host (SILO105) reads the addresses in the memory bitmap file and requests the contents of those addresses from the source (SILO104). See Figure 9.23.
Figure 9.21 Step 2 in a VMotion migration: starting the memory copy and adding a memory bitmap
Figure 9.22 Step 3 in a VMotion migration: quiescing VM1 and transferring the memory bitmap file from the source ESX host to the destination ESX host
Figure 9.23 Step 4 in a VMotion migration: fetching the actual memory listed in the bitmap file from the source to the destination (dirty memory)
5. Once the contents of the memory referred to in the memory bitmap file have been transferred to the target host, the virtual machine starts on that host. Note that this is not a reboot — the virtual machine's state is in RAM, so the host simply enables it. This will cause a Reverse Address Resolution Protocol (RARP) from the host to register its MAC address against the physical switch port the target ESX server is plugged into. This process enables the switch infrastructure to send network packets to the appropriate ESX host from the clients who are attached to the virtual machine that just moved. See Figure 9.24.
6. Once the virtual machine is successfully operating on the target host, the memory the virtual machine was using on the source host is deleted. This memory becomes available to the VMkernel to use as appropriate. See Figure 9.25.
Try It with PING -t
Following the previous procedure carefully, you'll note there will be a time when the virtual machine being moved is not running on either the source host or the target host. This is typically a very short period of time. Testing has shown a continuous ping (ping -t) of the virtual machine being moved might, on a bad day, result in the loss of one ping packet. Most client-server applications are built to withstand the loss of more than a packet or two before the client is notified of a problem.
Figure 9.24 Step 5 in a VMotion migration: enabling the virtual machine on the target host and registering with the network infrastructure
Figure 9.25 Step 6 in a VMotion migration: deleting the virtual machine from the source ESX host