What is vMotion?
VMware vMotion is a feature that allows virtual machines to live migrate between virtual hosts with little to no impact. This feature relies on the fact that the virtual hosts share a common file storage over SAN or a NAS.
What gets migrated over?
There are three main components in a virtual machine that gets transferred over. Mind you that the storage data is already shared across a common SAN/NAS.
- The virtual device state – CPU, network, disk, display adapters etc.
- External connections with devices – networking and SCSI devices
- Virtual Machines’s physical memory
How do the components get migrated over?
Virtual Devices State
Virtual device states of a virtual machine can be serialized – a process of translating data structures or object state into a format that can be stored. The data contents vary from 8MB to 128MB+ in size and can be quickly transferred to the target virtual machine over the network.
Networking and SCSI Device Connections
Virtual machines utilizes vNICs that contains unique mac addresses that are independent of the physical adapter. This allows for live network connections to be maintained during a migration providing the source and destinations hosts contain same subnets. After the migration is complete, the target host issues a RARP packet to the physical network switch which forces the switch to update it’s mac address tables with the new destination physical port.
As for storage devices, since vMotion requires the use of a common SAN or NAS, updates to the disk state is seamless and efficient.
The physical memory of a virtual machine is the largest component and varies based on the size of memory allocated to the virtual machine. Virtual machines memory vary based on use case and as memory is increased, the time to vMotion this data is also increased. In order to transparently migrate this data, the vMotion process for memory is split into three
Phase 1 – Guest Trace
Traces are placed on the guest memory pages to track for changes. There is a slight drop in workload output in this phase
Phase 2 – Precopy
This process involves several iterations. Firstly, the entire memory contents are copied over. During the subsequent attempts, only modifications to the memory pages are copied over. The number of iterations can vary based on the load and activity of the source virtual machine. This phase causes a slowdown in guest performance due to write traces.
Phase 3 – Switchover
At the final phase, the source virtual machine is quiesced so that the final memory page modifications are copied over. Once this is complete, the virtual machine on the target host is resumed causing only a brief pause. This last phase causes the largest impact to performance compared to the other phases but generally lasts no longer than 1 second.