Bobcares

KVM live migration to fix performance issues in a server virtualization solution

by | Mar 6, 2021

Need help with KVM live migration to fix performance? We can help you.

VPS providers rapidly adopt high-density server virtualization solutions to achieve maximum economies of scale. We attain this by hosting a maximum number of virtual machines in a physical server.

However, adding too many virtual machines may cause overload or affect the virtual machine performance.

As part of our Server Management Services, we assist our customers with several KVM queries.

Today, let us see how to use  KVM live migration to fix performance issues in a server virtualization solution.

 

What is migration?

To balance the resources in a virtual server environment to improve performance, we use migration. Here, we move a guest virtual machine from one host physical machine to another.

Live migration goes one step ahead and enables the VM to move while it runs. It enables moving a guest VM without affecting that VM in any manner.

Upon successful completion, the guest starts to run on the destination host. However, if the migration fails, the guest continues to run on the source host.

In migration, the state of the guest VM’s memory transfers from the source to the destination machine. This ensures that there is no noticeable change for users accessing the sites in that VM.

During migration, KVM monitors the source for any changes in pages of the guest VM it has already transferred. Live migration is therefore usually done during off-peak business hours when the changes in the guest VM is considerably less.

 

KVM live migration to fix performance issues

We perform the migration of VMs for our customers’ virtualization systems to achieve zero downtime in a variety of cases, such as:

  1. Capacity management to improve performance
  2. Hardware or software maintenance or upgrades
  3. Infrastructure management for cost efficiency

Recently we had a VPS provider hosting VPSs in a KVM server virtualization system. The VPSs were hosted in two KVM servers – KVM 01 and KVM 02. The customers in one server KVM 01 were often complaining of intermittent VPS slowness and then Bobcares came to help.

Upon checking, we could see that most of the resource-intensive VMs were running in the server KVM 01, causing it to be slow.

To improve the speed and responsiveness of the server virtualization system, we have to load balance the VPSs between the two servers.

 

Common issues during live migration

KVM live migration helps to solve capacity issues, infrastructure upgrades, etc with zero downtime for the VMs. But if careful consideration is not given, there can be VM downtime or even data loss.

  • Migration failure because of compatibility issues

If the configuration of host and destination servers are not proper or if there is a mismatch in time zone, network configuration, or KVM versions, the migration may fail.

To ensure a successful migration, we first chose the ideal candidates for migration. We do this after monitoring the performance of the VMs and considering their CPU utilization, their dependency on the host server, and the time required for migration.

To perform live migration in KVM, we ensure that the KVM versions and OS installation in both servers were compatible.

We install the libvirt service on both host and destination servers, both running with the same type of CPUs.

Then we configure the host and destination servers with the same network configuration and time zone settings to avoid synchronization issues.

  • Migration failure due to network interruptions

Since the VPSs host different businesses, each has a different OS in it – CentOS, Fedora, RHEL, etc. To enable a VM to work fine in the new server, its OS image should be available in the destination server also. However, migrating the OS image requires a lot of time and bandwidth.

The VM migration may fail or interrupt due to network failures. As a workaround, we store the OS images for all VPSs in a shared location and share them via NFS with the other server.

The OS image for this VPS store in the folder “/var/lib/libvirt/images” in the host server KVM 01. To share the OS image with the destination server, we configure the host as an NFS server and add the destination server as its NFS client.

The OS images folder configures in the file ‘/etc/exports’ for NFS sharing.

The nfs service restart in the host and the OS images folder was then mounted in the destination server KVM 02. The images folder mount on the same path on both servers.

root@KVM01:~# apt-get install nfs-kernel-server
root@KVM02:~# mount KVM01.cpiv.com:/var/lib/libvirt/images /var/lib/libvirt/images

As the OS image does not transfer over servers but is in a secure NFS location, it ensures better data security.

  • Virsh utility to perform the migration

To live migrate VMs between two servers, we configure virsh, a tool based on libvirt, to perform management tasks on VMs. We can configure it within custom scripts to perform various tasks such as migration and helps to automate the tasks easily.

Migration can also be done using virt-manager, the GUI for libvirt. We chose virsh to do the task in our design, as we could implement the tasks without any manual intervention.

We identify the resource-consuming VPSs in KVM 01 and migrate them to the second server KVM 02.

 

Live KVM migration with virsh

The first step in migration is to verify that the guest virtual machine is running:

root@KVM01:~# virsh list Id Name State —————————————————- 4 VPS-01 running

The next stage is to migrate the guest virtual machine from host to destination server.

Once the NFS share successfully mount and the server configurations are done, we successfully complete migration of the VM VPS-01 from our host to the destination server using virsh utility.

root@KVM01:~# virsh migrate --live VPS-01 qemu+ssh://KVM02.cpiv.com/system

The final stage is to verify the guest’s virtual machine arrival at the destination host. The VPS migrates in a few seconds to the new server and we verify that it is running fine in the destination server.

Once the live migration is complete, the migrated VM deactivates from the host server.

root@KVM02:~# virsh list
 Id Name State
----------------------------------------------------
 3 VPS-01 running

[Need help with live migration? We’d be happy to assist]

 

Conclusion

In short, load balancing is important in a server virtualization system to maintain server performance. Here is how our Support Techs use KVM live migration to achieve it.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF