December 26, 2019
VM Migration with VMware vMotion: How Does It Work?
No matter what kind of business you are running, even a short amount of downtime can cost your company a fortune. Unexpected downtime is nearly impossible to avoid, but you can still get prepared for a wide range of scenarios that are likely to happen occasionally. These include such downtime causes as maintenance, moves, planned power outages, and so on. To help you avoid downtime, VMware offers vSphere vMotion. This technology allows for live migration of virtual machines (VMs) without interruption in their availability. This turns VMware vMotion into a solid element for creating a dynamic, automated datacenter with self-optimization capabilities.
Download the Full-Featured Free Trial of NAKIVO Backup & Replication and see its features in action. Our product offers a set of tools to let you protect your VMware-based infrastructure. These include VM Replication and Site Recovery, features that can help you handle the process of data center migration. You can create a replica, i.e. an exact copy of your VM, and then use it to migrate workloads to a new server, thus avoiding interruptions in your business-critical operations.
What Is vMotion and How Can It Be Used?
VMware vMotion can be used for several purposes. These include:
Live migration of workloads
You can perform live migration of your VMs from one physical host to another, without any downtime. This technology allows the VM processes to keep running throughout the migration process. Simply for reference, VMware supports cold migration mode, too, which means that migration can be performed when the VM is turned off or suspended. As live migration is performed, the VM retains its current memory content, network identity and connections, and all additional information that defines it. On a gigabit Ethernet network, the process of migration takes less than two seconds, according to VMware documentation.
Overall, live migration of workloads gives you the following advantages:
- Automatic allocation and optimization of the VMs within your resource pool;
- Hardware maintenance with no need to schedule downtime or disrupt business operations;
- Preventive migration of VMs away from failing or underperforming hosts.
Automatization and scheduling
To reduce the need for manual effort, you can automate and schedule the migration of your VMs. This is possible thanks to the Distributed Resource Scheduler, one of vSphere’s basic automatization features. The migration details can be set up via the Migrate Virtual Machine wizard. Depending on your needs, you can schedule the migration process to run either once or multiple times. Additionally, VMware vMotion can help you find an appropriate destination host within seconds, thus eliminating the need to do this manually.
If you are running a large infrastructure that spans across multiple locations or countries, VMware offers functionality for migrating VMs over large distances. Available since the vSphere 6.0 release, Long Distance vMotion allows for migrations between hosts separated by high network round-trip latency times. RTT, or round-trip time, is the length of time required for a signal or data packet to travel from a starting point to its destination and back again. With VMware vMotion, this is about 150 milliseconds or less. The RTT has been increased by almost 10 times, which means you can easily perform migration of live workloads between datacenters located on different continents.
Migration to new datastore
Apart from changing the host on which your VM is running, with VMware vMotion you can change the VM’s datastore. In case you only need to change the host, the entire VM’s state is moved to a new host, but the virtual disk remains in the same location that the two hosts share. If you prefer to change the host and the datastore, both the state of the VM and the virtual disk are moved. The VM’s virtual disk and configuration files can be placed in either single or separate locations.
Migration can be performed between hosts, clusters, or data centers without shared storage. This functionality, officially known as Storage vMotion, allows you to simplify the maintenance and upgrading of your VMs, optimize disks for performance, or convert disk types. It is available in VMware vSphere 5.1 and later versions.
How vMotion Works
First and foremost, you should pay attention to the list of setup vMotion requirements. Namely, you need to properly configure network interfaces on the source and target hosts. It is also recommended that you provide the required bandwidth, provision at least one additional network interface controller for the case of failover, and use jumbo frames (Ethernet frames with more than 1500 bytes of payload) for enhanced performance.
To perform live migration of a VM from one physical host to another, VMware vMotion relies on three technologies:
1. First of all, the feature encapsulates the entire state of the VM. It includes memory, registers, and network connections. This is possible with the collection of files that are stored on a shared storage space, for example, Fibre Channel or iSCSI Storage Area Network (SAN) or Network Attached Storage (NAS).
The VMFS (Virtual Machine File System), or the VMware’s clustered file system developed to store disk images of virtual machines, provides a way for multiple installations of VMware servers to simultaneously access the same files of the VM.
2. After that, the VM’s state information is copied to the destination host. This includes the active memory of the VM and its precise execution parameters. Data is transferred over a high-speed network, which is why the process takes just a few seconds to complete. VMware vMotion keeps track of the ongoing memory transactions in a bitmap. Upon completion of the data transfer, vMotion suspends the source VM, copies the bitmap to the target host, and resumes the VM’s activities. The entire process is performed in such a manner so as to ensure transaction integrity.
3. Since the networks used as the migration is performed are all virtualized, it is possible to preserve the VM’s network identity and active connections. As a part of the process, VMware vMotion manages the virtual MAC address. Just for reference, MAC stands for media access control. VMware software ensures that each VM is assigned a unique MAC address in a given host system. After the target host is activated, vMotion pings the network router, thus making sure that the router is aware of the new physical location of the virtual MAC address.