# A Novel Hybrid-Copy Algorithm for Live Migration of Virtual Machine
## 1 Introduction  
Cloud computing [1] has become one of the most dominant features in the field of computing. In cloud environments, dynamic resource scheduling [2] is a key problem. The live migration [3] of virtual machine is an important approach for dynamic resource scheduling in cloud environments. With the help of live migration, virtual machine (VM) can be transferred from a host to another host while the services provided by the VM are still available. It is useful in several of scenarios, such as load balancing [4], online maintenance [5], fault tolerance [6], and energy conservation [7]. The key to VM migration is how to handle the resources associated with the migrating VM. The main resources related to VM migration are as follows: memory data, network connecting, CPU state, virtual devices, and storage. In practice, the storage of a VM is always stored in a network-attached storage device (NAS) [8]. The NAS mechanism can avoid the migration of storage because the NAS is accessible to all hosts in the datacenter. In this situation, memory data becomes the main transferred data in the migration process. There are many approaches to migrate a VM from a host to another host. However, downtime and total migration time should be considered when the migrated VM is in working condition [3]. On the one hand, we need to minimize the downtime in which period the service is totally unavailable. On the other hand, the source host may be shut down at any time, and the performance of the VM is seriously affected during the migration process. So, the total migration time should be shortened. Many live migration algorithms have been proposed to minimize both downtime and total migration time. In terms of the memory data transfer order, live migration algorithms can be classified into threecategories: the pre-copy algorithm [3; 9; 10; 11; 12], the post-copy algorithm [13; 14; 15], and the hybrid-copy algorithm [16; 17; 18]. The hybrid-copy algorithm is an excellent algorithm that combine the pre-copy algorithm with the post-copy algorithm to remedy the defects of the pre-copy and post-copy algorithms. The hybrid-copy algorithm consists of two phases: the pre-copy phase and the post-copy phase. In the pre-copy phase, all memory pages are transferred from the source to the destination in advance. Therefore, the page faults occurring in the post-copy phase can be effectively reduced. Currently, the hybrid-copy algorithm copies all memory pages only once in advance. In a write-intensive workload, copying memory pages once may be enough. However, more copy behavior can significantly reduce the page faults in a read-intensive workload. The page faults always incur a significant performance loss [13; 14; 15], sometimes page faults can even cause the services in migrated VM to be totally unavailable. In this paper, we propose a novel hybrid-copy algorithm. The main target is to improve the performance of hybrid-copy algorithm by reducing the number of page faults, while keeping the migration time at the same level. A new parameter named the switched decision factor (SDF) is proposed to decide the moment to switch from the pre-copy phase to the post-copy phase in the hybrid-copy algorithm. It helps reduce the number of page faults and minimize the downtime caused by page faults in the migration process. A Markov model is used in our novel hybrid-copy algorithm to reduce invalid transfers. This ensures that the migration time will not be increased. We implemented the novel hybrid-copy algorithm based on Xen virtualization software and ran experiments on a write-intensive workload and a read-intensive workload. Through extensive evaluations, we demonstrate that the novel hybrid-copy algorithm can significantly reduce page faults in read-intensive workloads while achieving the same level of total migration time. In write-intensive workloads, we also keep the good performance of original hybrid-copy algorithm.