Unveiling VM Migration: Understanding the basics

Unveiling VM Migration: Understanding the basics

Β·

5 min read

Introduction

Virtualization is a technology that allows you to create multiple virtual instances of physical hardware resources, such as servers, storage devices, or networks, on a single physical machine. These virtual instances, known as virtual machines (VMs) operate independently of each other and share the underlying physical resources efficiently.

At its core, virtualization abstracts physical hardware resources and presents them in a way that makes them appear as if they are multiple separate entities. This abstraction is achieved through a software layer called a hypervisor or virtual machine monitor (VMM), which sits between the physical hardware and the virtual machines.

Virtualization has become an integral part of modern IT infrastructure, enabling organizations to maximize resource utilization, enhance flexibility, and reduce costs. One of the key aspects of managing virtual machines (VMs) is the ability to migrate them from one physical host to another. In this blog post, we'll explore the need for VM migration and the detailed process of how it works.

Overloading and Underloading

Overloaded - Jackie Chan Why? Meme Generator

  • Overloading

    It occurs when a virtual machine (VM) is given more tasks or workload than it can handle with its available CPU and RAM resources.

    Imagine a single-lane road suddenly flooded with an overwhelming number of cars. The road becomes congested, and cars move slowly or come to a complete stop. Similarly, when a VM experiences overloading, its CPU and RAM become overwhelmed by the incoming traffic, leading to slowdowns or system crashes. Generally, the Upper Threshold (UT) or maximum loading capacity without failure is 80%.

  • Underloading

    It happens when a VM is not given enough tasks or workload to fully utilize its available CPU and RAM resources.

    Think of a highway with only a few cars traveling on it. Despite having the capacity to accommodate more traffic, the highway remains underutilized. Similarly, when a VM is underloaded, its CPU and RAM resources are not fully utilized, resulting in wasted potential and inefficiency. In general, the Lower Threshold (LT) is 10%.

How do you migrate the VM? πŸ€”

Story about Mass migration of SLD / VLAN's / IP Pool / Wifi Mesh Loop /  Rectification of Bonjour mDNS using Parallel Topologies | Syed Jahanzaib -  Personal Blog to Share Knowledge !

1.Finding the Target Physical Machine 🎯

Before migrating a VM, it's essential to identify a suitable target physical machine. Factors to consider include available resources (CPU, RAM, storage), compatibility with the VM's operating system and applications, and network connectivity. Tools such as VMware vMotion and Microsoft Live Migration can assist in selecting an appropriate target host.

2.Reservation of the Physical Machine πŸ’»

Once a target physical machine is identified, resources need to be reserved to accommodate the migrating VM. This involves ensuring that the target host has sufficient CPU, RAM, and storage capacity to meet the VM's requirements. Virtualization platforms like VMware vSphere and Microsoft Hyper-V provide tools for reserving resources and managing host capacity.

3.Iterative Pre-Copy πŸ“„

Iterative pre-copy is a migration technique used to transfer the memory state of a VM from the source host to the target host while the VM continues to run. This technique aims to minimize downtime and data loss during migration by iteratively copying memory pages from the source using the concept of Shadow Page Tables to the target host until convergence is achieved.

Image source: Distributed and Cloud Computing (Kai Hwang, Geoffrey C. Fox, Jack J. Dongarra)

While the initial memory copy is in progress, the hypervisor iteratively performs additional memory copies to transfer the dirty pages to the target host. Each iteration involves identifying and transferring the modified memory pages to ensure that the memory state on the target host remains consistent with the source host.

4.Suspend the VM and Copy the Last Portion of Data

During this step, the migrating VM's execution is suspended once the last round's memory data is transferred. Now, an ARP ( Address Resolution Protocol ) is generated to redirect the traffic to the new target IP address. Alongside memory data, other non-memory data such as CPU and network states are also copied. This temporary suspension halts the VM's applications, resulting in a brief period of unavailability known as "downtime." Minimizing downtime is crucial to ensure negligible impact on applications.

5.Commit and Activate the New Host βœ…

Once all necessary data is copied to the destination host, the VM reloads its states and resumes the execution of programs. Services provided by the VM continue seamlessly on the new host. Network connections are redirected to the migrated VM, and dependencies on the source host are cleared. The migration process concludes with the release of the resources acquired by the original VM to their respective physical system.

Image source: Distributed and Cloud Computing (Kai Hwang, Geoffrey C. Fox, Jack J. Dongarra)

Post-Migration Considerations

Following VM migration, it's essential to perform testing and validation to ensure that the migrated VM performs as expected on the new host. Performance optimization may be necessary to fine-tune resource allocation and configuration settings for optimal performance. Documentation of the migration process and any issues encountered is also critical for future reference and troubleshooting.

Challenges and Best Practices

VM migration can pose challenges such as compatibility issues, network latency, and downtime impact. However, following best practices such as thorough planning, resource reservation, and testing can help mitigate these challenges and ensure a smooth migration process. Additionally, leveraging advanced migration technologies such as AWS Database Migration Service ( AWS DMS ), Azure Migrate can simplify and automate the migration process, reducing the risk of errors and downtime.

Conclusion

VM migration is a crucial aspect of virtualization management, enabling organizations to optimize resource utilization, enhance flexibility, and ensure high availability of their IT infrastructure.

In this blog post, we've covered the fundamentals of VM migration, including the concepts of overloading and underloading, the steps involved in migrating VMs, post-migration considerations, and best practices for successful migration.

Β