CN106970824B - A bandwidth-aware virtual machine migration compression method and system - Google Patents
A bandwidth-aware virtual machine migration compression method and system Download PDFInfo
- Publication number
- CN106970824B CN106970824B CN201710129704.2A CN201710129704A CN106970824B CN 106970824 B CN106970824 B CN 106970824B CN 201710129704 A CN201710129704 A CN 201710129704A CN 106970824 B CN106970824 B CN 106970824B
- Authority
- CN
- China
- Prior art keywords
- compression
- migration
- speed
- virtual machine
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/485—Task life-cycle, e.g. stopping, restarting, resuming execution
- G06F9/4856—Task life-cycle, e.g. stopping, restarting, resuming execution resumption being on a different machine, e.g. task migration, virtual machine migration
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/563—Data redirection of data network streams
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/4557—Distribution of virtual machine instances; Migration and load balancing
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Environmental & Geological Engineering (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Abstract
本发明公开了一种基于带宽感知的虚拟机迁移压缩方法及系统,属于计算机虚拟化领域。本发明方法以预设的频率检测网络带宽,利用带宽和压缩策略表中的每对压缩率和压缩速度计算迁移速度,选择最大迁移速度所对应的压缩方法进行压缩迁移,在进行内存数据压缩前先将多个内存页合并为一个数据包,再对数据包进行整体压缩迁移,直到完成压缩迁移;同时本发明还提供了一种基于带宽感知的虚拟机迁移压缩系统,本发明技术方案根据带宽动态调整压缩方法使迁移系统获得更大的迁移速度,从而获得更短的迁移时间,同时减少数据传输量,节省网络资源。
The invention discloses a virtual machine migration and compression method and system based on bandwidth perception, belonging to the field of computer virtualization. The method of the present invention detects the network bandwidth at a preset frequency, uses the bandwidth and each pair of compression rate and compression speed in the compression policy table to calculate the migration speed, and selects the compression method corresponding to the maximum migration speed for compression migration. Before performing memory data compression First, multiple memory pages are combined into one data packet, and then the entire data packet is compressed and migrated until the compression migration is completed; at the same time, the present invention also provides a bandwidth-aware virtual machine migration and compression system. The technical solution of the present invention is based on bandwidth The dynamic adjustment of the compression method enables the migration system to obtain a greater migration speed, thereby obtaining a shorter migration time, reducing the amount of data transmission, and saving network resources.
Description
技术领域technical field
本发明属于计算机虚拟化领域,更具体地,涉及一种基于带宽感知的虚拟机迁移压缩方法及系统。The invention belongs to the field of computer virtualization, and more specifically relates to a method and system for virtual machine migration and compression based on bandwidth perception.
背景技术Background technique
近年来,随着云计算以及虚拟化技术的发展,虚拟机正在越来越广泛地被部署于数据中心以及集群环境中。由于虚拟机可以对计算机资源进行抽象模拟,可以在已有的计算机硬件资源基础上,模拟出虚拟硬件资源,因此它具有模拟不同平台、提高计算机资源利用率、便于管理、应用隔离等众多优点。In recent years, with the development of cloud computing and virtualization technologies, virtual machines are being more and more widely deployed in data centers and cluster environments. Since the virtual machine can abstractly simulate computer resources and simulate virtual hardware resources on the basis of existing computer hardware resources, it has many advantages such as simulating different platforms, improving computer resource utilization, easy management, and application isolation.
虚拟机迁移,是指在保证虚拟机中服务正常运行的同时,虚拟机在不同的物理主机之间进行迁移。为了保证迁移过程中虚拟机服务的可用性,迁移过程仅有非常短暂的停机时间。由于停机切换的时间非常短暂,用户感觉不到服务的中断,因而迁移过程对用户是透明的。虚拟机迁移适用于数据中心的负载均衡、节能以及系统维护等诸多场景,因此是虚拟化技术的一个非常重要的特性。Virtual machine migration refers to the migration of virtual machines between different physical hosts while ensuring the normal operation of services in the virtual machine. In order to guarantee the availability of virtual machine services during the migration process, the migration process has only a very short downtime. Since the downtime switching time is very short, users do not feel service interruption, so the migration process is transparent to users. Virtual machine migration is applicable to many scenarios such as data center load balancing, energy saving, and system maintenance, so it is a very important feature of virtualization technology.
虚拟机迁移通常是在本地局域网内进行的,这种环境中虚拟机是采用共享存储的方式访问外存,因此只需要迁移虚拟机的内存数据以及虚拟cpu等设备状态即可,并且虚拟机内存占了所需迁移数据的绝大部分。预拷贝方式是被各个虚拟化平台广泛采用的最主要的迁移算法。预拷贝的迁移过程是首先拷贝完整的虚拟机内存镜像到目标主机。在此过程中,由于虚拟机仍在运行,其一部分内存页会被修改,这些被修改过的内存脏页需要在下一轮迭代中再次传输到目标主机。此后每一轮迭代过程中产生的脏页都需要在下一轮重新传输,从而保证内存状态的一致性。经过多轮迭代,最终剩余的脏页数量比较少,达到预设的阈值时,就可以进行停机拷贝,结束迭代拷贝的过程。Virtual machine migration is usually carried out in the local area network. In this environment, the virtual machine uses shared storage to access the external memory. Therefore, it is only necessary to migrate the memory data of the virtual machine and the status of virtual cpu and other devices, and the memory of the virtual machine Accounts for the vast majority of the data that needs to be migrated. The pre-copy method is the most important migration algorithm widely adopted by various virtualization platforms. The pre-copy migration process is to first copy the complete virtual machine memory image to the target host. During this process, since the virtual machine is still running, some of its memory pages will be modified, and these modified memory dirty pages need to be transferred to the target host again in the next iteration. After that, the dirty pages generated in each round of iteration need to be retransmitted in the next round, so as to ensure the consistency of the memory state. After multiple rounds of iterations, the number of remaining dirty pages is relatively small, and when the preset threshold is reached, the shutdown copy can be performed to end the iterative copy process.
现有的预拷贝迁移方式虽然可以实现较短的停机时间,但是存在以下问题:由于内存数据需要多轮的迭代传输,其网络传输数据量较大,迁移时间也较长;此外,如果虚拟机中运行的负载是写内存密集型的,那么虚拟机内存被写脏的速度可能会过快,这时预拷贝的迁移方式便无法正常收敛进入停机拷贝阶段,也就无法正常地完成迁移过程。这些问题大大影响了虚拟机迁移的性能,导致在数据中心中使用虚拟机迁移技术时不能达到预期的效果。Although the existing pre-copy migration method can achieve short downtime, there are the following problems: because the memory data needs multiple rounds of iterative transmission, the network transmission data volume is large, and the migration time is also long; in addition, if the virtual machine If the load running in the virtual machine is memory-intensive, the virtual machine memory may become dirty too quickly. At this time, the pre-copy migration method cannot converge normally and enter the shutdown copy stage, and the migration process cannot be completed normally. These problems have greatly affected the performance of virtual machine migration, resulting in that the expected effect cannot be achieved when using the virtual machine migration technology in the data center.
发明内容Contents of the invention
针对现有技术的以上缺陷或改进需求,本发明提供了一种基于带宽感知的虚拟机迁移压缩方法及系统,其目的在于先检测多种压缩方法分别用于多种典型负载的压缩率和压缩速度,建立压缩索策略表,再以预定的频率感知带宽,计算当前带宽下各个压缩方法所对应的迁移速度,利用最大迁移速度所对应的压缩方法进行压缩迁移,由此解决常规压缩迁移技术问题。In view of the above defects or improvement needs of the prior art, the present invention provides a bandwidth-aware virtual machine migration compression method and system, the purpose of which is to first detect the compression ratio and compression ratio of various compression methods for various typical loads. Speed, establish a compression cable strategy table, and then perceive the bandwidth at a predetermined frequency, calculate the migration speed corresponding to each compression method under the current bandwidth, and use the compression method corresponding to the maximum migration speed to perform compression migration, thereby solving the problem of conventional compression migration technology .
为实现上述目的,按照本发明的一个方面,提供了一种基于带宽感知的虚拟机迁移压缩方法,该方法以预设的频率检测网络带宽,利用带宽和压缩策略表中的每对压缩率和压缩速度计算迁移速度,选择最大迁移速度所对应的压缩方法对虚拟机当前内存数据进行压缩迁移。In order to achieve the above object, according to one aspect of the present invention, a virtual machine migration and compression method based on bandwidth awareness is provided. The method detects the network bandwidth at a preset frequency, and utilizes each pair of compression ratio and Compression speed calculates the migration speed, and selects the compression method corresponding to the maximum migration speed to compress and migrate the current memory data of the virtual machine.
进一步地,本发明方法具体包含以下步骤:Further, the method of the present invention specifically includes the following steps:
(1)监测网络带宽,获得虚拟机迁移可以利用的实时网络带宽St;(1) Monitor the network bandwidth to obtain the real-time network bandwidth St available for virtual machine migration;
(2)利用压缩策略表中各种压缩方法所对应的压缩率ρi和压缩速度Sci计算迁移速度Smgti,(2) Using the compression rate ρ i and the compression speed Sc i corresponding to various compression methods in the compression strategy table to calculate the migration speed Smgt i ,
Smgti=min(Sci,St×ρi),Smgt i =min(Sc i ,St×ρ i ),
得到多个迁移速度,对比得出最大的迁移速度;Get multiple migration speeds, and compare them to get the maximum migration speed;
(3)找出得到最大迁移速度的压缩率和压缩速度,用其在压缩策略表中对应的压缩方法对虚拟机当前内存数据进行压缩迁移。(3) Find out the compression rate and compression speed to obtain the maximum migration speed, and use the corresponding compression method in the compression policy table to compress and migrate the current memory data of the virtual machine.
进一步地,所述压缩策略表预先采用以下方法得到:Further, the compression strategy table is pre-obtained by the following method:
在数据中心运行环境下选取多个典型负载依次运行于虚拟机中,并分别用多种压缩方法进行内存数据的压缩检测,每种压缩方法得到一对压缩率和压缩速度,所有压缩方法和其对应的压缩率和压缩速度组成压缩策略表。In the data center operating environment, select multiple typical loads to run in the virtual machine in sequence, and use various compression methods to perform compression detection of memory data. Each compression method obtains a pair of compression ratio and compression speed. All compression methods and other The corresponding compression rate and compression speed form a compression strategy table.
进一步地,所述获得压缩策略表的方法具体包括以下子步骤:Further, the method for obtaining the compression strategy table specifically includes the following sub-steps:
(31)选取一种数据中心中的典型负载,运行于虚拟机中;(31) Select a typical load in a data center and run it in a virtual machine;
(32)选取一种压缩方法进行压缩迁移,并在每一轮压缩后将所有的内存页都设置为脏页,并更换另一种压缩方法进行压缩迁移,m种压缩方式共迭代m轮;记录每轮压缩所需压缩总时间和压缩后数据大小;(32) Select a compression method for compression migration, and set all memory pages as dirty pages after each round of compression, and replace another compression method for compression migration, m compression methods iterate m rounds in total; Record the total compression time required for each round of compression and the size of the compressed data;
(33)更换另一种典型负载,返回步骤(31),直到n种数据中心中的典型负载压缩完成;(33) replace another kind of typical load, and return to step (31), until the typical load compression in n kinds of data centers is completed;
(34)计算第i种压缩方法对于第j种负载的压缩率ρij,(34) Calculate the compressibility ρ ij of the i-th compression method for the j-th load,
ρij=压缩前数据大小/压缩后数据大小,ρ ij = data size before compression/data size after compression,
计算第i种压缩方法对于第j种负载的压缩速度Scij,Calculate the compression speed Sc ij of the i-th compression method for the j-th load,
Scij=压缩前数据大小/压缩总时间;Sc ij = data size before compression/total compression time;
其中,1≤i≤m;1≤j≤n;Among them, 1≤i≤m; 1≤j≤n;
(35)计算第i种压缩方法对于n种负载的平均压缩率ρi,(35) Calculate the average compression ratio ρ i of the i-th compression method for n types of loads,
ρi=(ρi1+ρi2+…+ρin)/n,ρ i =(ρ i1 +ρ i2 +...+ρ in )/n,
计算第i种压缩方法对于n种负载的平均压缩速度Sci,Calculate the average compression speed Sc i of the i-th compression method for n types of loads,
Sci=(Sci1+Sci2+…+Scin)/nSc i =(Sc i1 +Sc i2 +...+Sc in )/n
一共得到m种压缩方法所对应的m对平均压缩率ρi和平均压缩速度Sci,压缩方法和所对应的平均压缩率及平均压缩速度共同构成压缩策略表。A total of m pairs of average compression ratio ρ i and average compression speed Sc i corresponding to m compression methods are obtained, and the compression method and the corresponding average compression ratio and average compression speed together constitute a compression strategy table.
进一步地,本发明方法还包括一个合并步骤:Further, the inventive method also includes a merging step:
合并步骤:进行内存数据压缩前先将多个内存页合并为一个数据包,再对数据包进行整体压缩。Combining step: Before performing memory data compression, multiple memory pages are combined into one data package, and then the data package is compressed as a whole.
按照本发明的另一方面,提供了一种基于带宽感知的虚拟机迁移压缩系统,该系统用于以预设的频率检测网络带宽,利用带宽和压缩策略表中的每对压缩率和压缩速度计算迁移速度,选择最大迁移速度所对应的压缩方法对虚拟机当前内存数据进行压缩迁移。According to another aspect of the present invention, a virtual machine migration compression system based on bandwidth awareness is provided, the system is used to detect network bandwidth at a preset frequency, and utilize each pair of compression ratio and compression speed in the bandwidth and compression policy table Calculate the migration speed, and select the compression method corresponding to the maximum migration speed to compress and migrate the current memory data of the virtual machine.
进一步地,本发明系统具体包含以下部分:Further, the system of the present invention specifically includes the following parts:
带宽检测模块,用于监测网络带宽,获得虚拟机迁移可以利用的实时网络带宽St;The bandwidth detection module is used to monitor the network bandwidth and obtain the real-time network bandwidth St available for virtual machine migration;
迁移速度计算模块,用于利用压缩策略表中各种压缩方法所对应的压缩率ρi和压缩速度Sci计算迁移速度Smgti,The migration speed calculation module is used to calculate the migration speed Smgt i using the compression rate ρ i and the compression speed Sc i corresponding to various compression methods in the compression strategy table,
Smgti=min(Sci,St×ρi),Smgt i =min(Sc i ,St×ρ i ),
得到多个迁移速度,对比得出最大的迁移速度;Get multiple migration speeds, and compare them to get the maximum migration speed;
压缩迁移模块,用于找出得到最大迁移速度的压缩率和压缩速度,用其在压缩策略表中对应的压缩方法对虚拟机当前内存数据进行压缩迁移。The compression migration module is used to find out the compression rate and compression speed for obtaining the maximum migration speed, and use the corresponding compression method in the compression policy table to perform compression migration on the current memory data of the virtual machine.
进一步地,所述压缩策略表预先采用以下模块得到:Further, the compression strategy table is obtained by using the following modules in advance:
压缩策略表模块,用于在数据中心运行环境下选取多个典型负载依次运行于虚拟机中,并分别用多种压缩方法进行内存数据的压缩检测,每种压缩方法得到一对压缩率和压缩速度,所有压缩方法和其对应的压缩率和压缩速度组成压缩策略表。The compression strategy table module is used to select multiple typical loads to run in the virtual machine in turn in the data center operating environment, and use various compression methods to perform compression detection of memory data. Each compression method obtains a pair of compression ratio and compression Speed, all compression methods and their corresponding compression ratios and compression speeds form the compression strategy table.
进一步地,所述压缩策略表模块具体包括以下部分:Further, the compression policy table module specifically includes the following parts:
负载运行单元,用于选取一种数据中心中的典型负载,运行于虚拟机中;The load running unit is used to select a typical load in the data center and run it in the virtual machine;
迭代压缩单元,用于选取一种压缩方法进行压缩迁移,并在每一轮压缩后将所有的内存页都设置为脏页,并更换另一种压缩方法进行压缩迁移,m种压缩方式共迭代m轮;记录每轮压缩所需压缩总时间和压缩后数据大小;The iterative compression unit is used to select a compression method for compression migration, and set all memory pages as dirty pages after each round of compression, and replace another compression method for compression migration, m compression methods are iterated m rounds; record the total compression time required for each round of compression and the size of the compressed data;
更换负载单元,用于更换另一种典型负载,返回负载运行单元,直到n种数据中心中的典型负载压缩完成;Replace the load unit for another type of typical load, return to the load running unit until the compression of the typical load in n types of data centers is completed;
计算单元,用于计算第i种压缩方法对于第j种负载的压缩率ρij,A calculation unit, used to calculate the compression rate ρ ij of the i-th compression method for the j-th load,
ρij=压缩前数据大小/压缩后数据大小,ρ ij = data size before compression/data size after compression,
计算第i种压缩方法对于第j种负载的压缩速度Scij,Calculate the compression speed Sc ij of the i-th compression method for the j-th load,
Scij=压缩前数据大小/压缩总时间;Sc ij = data size before compression/total compression time;
其中,1≤i≤m;1≤j≤n;Among them, 1≤i≤m; 1≤j≤n;
策略表构建单元,用于计算第i种压缩方法对于n种负载的平均压缩率ρi,The strategy table construction unit is used to calculate the average compression rate ρ i of the i-th compression method for n types of loads,
ρi=(ρi1+ρi2+…+ρin)/n,ρ i =(ρ i1 +ρ i2 +...+ρ in )/n,
计算第i种压缩方法对于n种负载的平均压缩速度Sci,Calculate the average compression speed Sc i of the i-th compression method for n types of loads,
Sci=(Sci1+Sci2+…+Scin)/nSc i =(Sc i1 +Sc i2 +...+Sc in )/n
一共得到m种压缩方法所对应的m对平均压缩率ρi和平均压缩速度Sci,压缩方法和所对应的平均压缩率及平均压缩速度共同构成压缩策略表。A total of m pairs of average compression ratio ρ i and average compression speed Sc i corresponding to m compression methods are obtained, and the compression method and the corresponding average compression ratio and average compression speed together constitute a compression strategy table.
进一步地,本发明系统还包括合并模块:Further, the system of the present invention also includes a merge module:
合并模块,用于在内存数据压缩前先将多个内存页合并为一个数据包,再对数据包进行整体压缩。The merging module is used for merging multiple memory pages into a data package before compressing the memory data, and then compressing the data package as a whole.
总体而言,通过本发明所构思的以上技术方案与现有技术相比,具有以下技术特征及有益效果:Generally speaking, compared with the prior art, the above technical solution conceived by the present invention has the following technical characteristics and beneficial effects:
(1)本发明根据迁移实时带宽动态调整压缩方法,同使用单一固定的压缩方法相比,可以获得更短的迁移时间,当网络带宽较高时,本发明会选择快速而压缩率较低的压缩方法;反之,当带宽较低时,会选择慢速而压缩率较高的压缩方法,这样的动态调整过程可以使迁移系统获得更大的吞吐率,从而获得更短的迁移时间;(1) The present invention dynamically adjusts the compression method according to the real-time bandwidth of the migration. Compared with using a single fixed compression method, a shorter migration time can be obtained. When the network bandwidth is higher, the present invention will select the fast and lower compression method. Compression method; on the contrary, when the bandwidth is low, a slow compression method with a high compression rate will be selected. Such a dynamic adjustment process can enable the migration system to obtain a greater throughput rate, thereby obtaining a shorter migration time;
(2)由于不同负载运行于虚拟机中时,虚拟机内存中的数据内容差异很大,因此同一种压缩方法在压缩不同负载的内存时,所得到的压缩率和压缩速度有一定差异,本发明通过若干典型负载而获得平均压缩率和压缩速度,从而组成压缩策略表的方法,避免了对不同负载采用不同的压缩策略表,这使得本发明的具体实施更为可行和简便;(2) Since the data content in the memory of the virtual machine differs greatly when different loads are running in the virtual machine, the compression rate and speed obtained by the same compression method are different when compressing the memory of different loads. Invention obtains the average compression ratio and compression speed through several typical loads, thus forms the method of compression strategy table, avoids adopting different compression strategy tables for different loads, which makes the specific implementation of the present invention more feasible and convenient;
(3)本发明将多个虚拟机内存页打包进行压缩的方法,挖掘了压缩算法的压缩窗口远大于单个内存页的特点,压缩算法是在压缩窗口的范围内寻找冗余数据从而进行压缩,因此本发明提出的更大的压缩粒度可以进一步提升内存数据的压缩率,从而减少数据传输量,节省网络资源。(3) The present invention packs a plurality of virtual machine memory pages and compresses the method, excavated the compression window of the compression algorithm is much larger than the characteristics of a single memory page, and the compression algorithm is to look for redundant data in the scope of the compression window so as to compress, Therefore, the larger compression granularity proposed by the present invention can further improve the compression rate of memory data, thereby reducing the amount of data transmission and saving network resources.
附图说明Description of drawings
图1是本发明方法的流程示意图;Fig. 1 is a schematic flow sheet of the inventive method;
图2是本发明方法实施例的系统结构图;Fig. 2 is the system structural diagram of the method embodiment of the present invention;
图3是LZ4压缩算法的压缩率和压缩速度的变化曲线示意图;Fig. 3 is a schematic diagram of the change curve of the compression rate and the compression speed of the LZ4 compression algorithm;
图4a是采用本发明方法和现有预拷贝迁移的迁移时间对比示意图;Figure 4a is a schematic diagram of the migration time comparison between the method of the present invention and the existing pre-copy migration;
图4b是采用本发明方法和现有预拷贝迁移的迁移数据量对比示意图。Fig. 4b is a schematic diagram of a comparison of the migration data volume between the method of the present invention and the existing pre-copy migration.
具体实施方式Detailed ways
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本发明,并不用于限定本发明。此外,下面所描述的本发明各个实施方式中所涉及到的技术特征只要彼此之间未构成冲突就可以相互组合。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not constitute a conflict with each other.
如图1所示,本发明方法以预设的频率检测网络带宽,利用带宽和压缩策略表中的每对压缩率和压缩速度计算迁移速度,选择最大迁移速度所对应的压缩方法对虚拟机当前内存数据进行压缩迁移;在迁出端,压缩前先将多个内存页合并为一个数据包,再对数据包进行整体压缩;在迁入端,将接收到的网络数据包解压,从而获得虚拟机的内存页。As shown in Figure 1, the method of the present invention detects the network bandwidth at a preset frequency, calculates the migration speed by using each pair of compression rate and compression speed in the bandwidth and compression strategy table, and selects the compression method corresponding to the maximum migration speed for the current virtual machine. Memory data is compressed and migrated; at the migration-out end, multiple memory pages are combined into one data packet before compression, and then the data packet is compressed as a whole; at the migration-in end, the received network data packets are decompressed to obtain a virtual machine memory pages.
具体分为以下子步骤:Specifically divided into the following sub-steps:
(1)监测网络带宽,获得虚拟机迁移可以利用的实时网络带宽St;(1) Monitor the network bandwidth to obtain the real-time network bandwidth St available for virtual machine migration;
(2)利用压缩策略表中各种压缩方法所对应的压缩率ρi和压缩速度Sci计算迁移速度Smgti,(2) Using the compression rate ρ i and the compression speed Sc i corresponding to various compression methods in the compression strategy table to calculate the migration speed Smgt i ,
Smgti=min(Sci,St×ρi),Smgt i =min(Sc i ,St×ρ i ),
得到多个迁移速度,对比得出最大的迁移速度;Get multiple migration speeds, and compare them to get the maximum migration speed;
(3)找出得到最大迁移速度的压缩率和压缩速度,用其在压缩策略表中对应的压缩方法对虚拟机当前内存数据进行压缩迁移;(3) Find out the compression ratio and the compression speed that obtain the maximum migration speed, and use its corresponding compression method in the compression strategy table to compress and migrate the current memory data of the virtual machine;
在迁出端,设置一个缓冲区,将要传输的虚拟机内存页首先拷贝到该缓冲区中,当缓冲区满后,将整个缓冲区进行一次压缩,将压缩后的数据包传输到迁入端;At the migration end, set a buffer, and copy the virtual machine memory pages to be transferred to the buffer first. When the buffer is full, compress the entire buffer once, and transfer the compressed data packets to the migration end. ;
在迁入端,设置一个和迁出端中同样大小的缓冲区,将接收到的数据包解压后得到的内存页放入该缓冲区,然后再把每一个内存页放置到对应的虚拟机地址空间中;On the migration-in side, set a buffer with the same size as the migration-out side, put the memory pages obtained after decompressing the received data packets into the buffer, and then put each memory page into the corresponding virtual machine address in space;
这样选择出来的压缩方法是当前阶段使得迁移速度最大的一个;根据网络带宽动态调整压缩方法使得在整个迁移过程的各个阶段都使用现阶段吞吐率最大的压缩方法,从而显著缩短了迁移时间。The compression method selected in this way is the one that maximizes the migration speed at the current stage; the compression method is dynamically adjusted according to the network bandwidth so that the compression method with the highest throughput at the current stage is used at all stages of the entire migration process, thereby significantly shortening the migration time.
以上内容中所述压缩策略表预先采用以下方法得到:在数据中心运行环境下选取多个典型负载依次运行于虚拟机中,并分别用多种压缩方法进行内存数据的压缩检测,每种压缩方法得到一对压缩率和压缩速度,所有压缩方法和其对应的压缩率和压缩速度组成压缩策略表The compression strategy table mentioned in the above content is pre-obtained by the following method: select multiple typical loads to run in the virtual machine in sequence in the data center operating environment, and use various compression methods to perform compression detection of memory data. Each compression method Get a pair of compression ratio and compression speed, all compression methods and their corresponding compression ratio and compression speed form a compression strategy table
具体分为以下步骤:Specifically divided into the following steps:
(31)选取一种数据中心中的典型负载,运行于虚拟机中;(31) Select a typical load in a data center and run it in a virtual machine;
(32)选取一种压缩方法进行压缩迁移,在压缩前,设置一个缓冲区,将要传输的虚拟机内存页首先拷贝到该缓冲区中,当缓冲区满后,将整个缓冲区进行一次压缩,并在每一轮压缩后将所有的内存页都设置为脏页,并更换另一种压缩方法进行压缩迁移,m种压缩方式共迭代m轮;记录每轮压缩所需压缩总时间和压缩后数据大小;(32) Select a compression method for compression migration. Before compression, set a buffer, and first copy the virtual machine memory pages to be transferred to the buffer. When the buffer is full, compress the entire buffer once. And after each round of compression, set all memory pages as dirty pages, and replace another compression method for compression migration. m compression methods iterate m rounds in total; record the total compression time required for each round of compression and the post-compression data size;
这样对预拷贝迁移的修改可以使虚拟机地址空间中所有的内存页进行多轮传输,而在每一轮传输时选用一种压缩方法来测得压缩率和压缩速度,从而只需进行一次迁移操作就可以测得所有压缩方法对某一负载的压缩率和压缩速度,这简化了获得压缩策略表的过程;In this way, the modification of the pre-copy migration can make all the memory pages in the virtual machine address space undergo multiple rounds of transmission, and in each round of transmission, a compression method is selected to measure the compression rate and compression speed, so that only one migration is required Operation can measure the compression rate and compression speed of all compression methods for a certain load, which simplifies the process of obtaining the compression strategy table;
具体到实施例中,采用LZ4算法,选取了16个不同的LZ4加速值,分别是1,3,5,7……31,这样构成了16种压缩方法,因为相邻两个LZ4加速值(比如1和2)产生的压缩率和压缩速度差异较小,因此本实施例选择采用以2为步数来选择加速值;Specifically in the embodiment, the LZ4 algorithm is adopted, and 16 different LZ4 acceleration values are selected, which are 1, 3, 5, 7...31 respectively, thus forming 16 compression methods, because two adjacent LZ4 acceleration values ( Such as 1 and 2) the compression rate and the compression speed difference produced are small, so this embodiment chooses to use 2 as the number of steps to select the acceleration value;
(33)更换另一种典型负载,返回步骤(31),直到n种数据中心中的典型负载压缩完成;(33) replace another kind of typical load, and return to step (31), until the typical load compression in n kinds of data centers is completed;
(34)计算第i种压缩方法对于第j种负载的压缩率ρij,(34) Calculate the compressibility ρ ij of the i-th compression method for the j-th load,
ρij=压缩前数据大小/压缩后数据大小,ρ ij = data size before compression/data size after compression,
计算第i种压缩方法对于第j种负载的压缩速度Scij,Calculate the compression speed Sc ij of the i-th compression method for the j-th load,
Scij=压缩前数据大小/压缩总时间;Sc ij = data size before compression/total compression time;
其中,1≤i≤m;1≤j≤n;Among them, 1≤i≤m; 1≤j≤n;
(35)计算第i种压缩方法对于n种负载的平均压缩率ρi,(35) Calculate the average compression ratio ρ i of the i-th compression method for n types of loads,
ρi=(ρi1+ρi2+…+ρin)/n,ρ i =(ρ i1 +ρ i2 +...+ρ in )/n,
计算第i种压缩方法对于n种负载的平均压缩速度Sci,Calculate the average compression speed Sc i of the i-th compression method for n types of loads,
Sci=(Sci1+Sci2+…+Scin)/nSc i =(Sc i1 +Sc i2 +...+Sc in )/n
一共得到m种压缩方法所对应的m对平均压缩率ρi和平均压缩速度Sci,压缩方法和所对应的平均压缩率及平均压缩速度共同构成压缩策略表。A total of m pairs of average compression ratio ρ i and average compression speed Sc i corresponding to m compression methods are obtained, and the compression method and the corresponding average compression ratio and average compression speed together constitute a compression strategy table.
如图2所示,在本实施例中,本发明实施例是在KVM/QEMU开源虚拟化平台上进行实现的,在迁出端,带宽监测模块以1秒1次的频率获得当前迁移网络带宽,提交给带宽感知压缩模块;压缩模块得到网络带宽后,利用压缩策略表来动态调整压缩方法;同时,在迁出端,设置一个缓冲区,将要传输的虚拟机内存页首先拷贝到该缓冲区中,当缓冲区满后,对缓冲区中的数据进行打包压缩;将压缩后的数据包传输到迁入端;迁入端将打包压缩的数据接收入缓冲区后,解压模块对其进行解压,将得到的内存页提交到对应的虚拟机地址空间中。As shown in Figure 2, in this embodiment, the embodiment of the present invention is implemented on the KVM/QEMU open source virtualization platform, and at the migration end, the bandwidth monitoring module obtains the current migration network bandwidth once per second , submitted to the bandwidth-aware compression module; after the compression module obtains the network bandwidth, it uses the compression strategy table to dynamically adjust the compression method; at the same time, at the migration end, a buffer is set, and the virtual machine memory page to be transferred is first copied to the buffer In the process, when the buffer is full, pack and compress the data in the buffer; transmit the compressed data packets to the inbound end; after the inbound end receives the packed and compressed data into the buffer, the decompression module decompresses it , and submit the obtained memory page to the corresponding virtual machine address space.
本发明提出的根据迁移实时带宽动态调整压缩方法可以大大提升迁移系统的吞吐率,从而显著缩短迁移时间。不同的压缩算法压缩率和压缩速度各不相同,一般而言,压缩率高的压缩算法压缩速度较低,反之亦然;此外许多压缩算法提供参数供用户选择,从而在压缩率和压缩速度之间做调整。以本发明具体实施时采用的LZ4压缩算法为例,该算法提供一个加速值参数,图3是采用不同加速值时,LZ4对虚拟机内存的压缩效果的变化。随着加速值的变大,压缩速度不断提升,并以压缩率的不断降低为代价。The method for dynamically adjusting the compression according to the real-time migration bandwidth proposed by the present invention can greatly improve the throughput rate of the migration system, thereby significantly shortening the migration time. Different compression algorithms have different compression ratios and compression speeds. Generally speaking, compression algorithms with high compression ratios have lower compression speeds, and vice versa; in addition, many compression algorithms provide parameters for users to choose, so that the difference between compression ratio and compression speed make adjustments. Taking the LZ4 compression algorithm used in the actual implementation of the present invention as an example, the algorithm provides an acceleration value parameter. FIG. 3 shows the change of the compression effect of LZ4 on the virtual machine memory when different acceleration values are used. As the acceleration value becomes larger, the compression speed is continuously increased, at the expense of a continuous decrease in the compression ratio.
由此可见,在某一带宽下,在迁移中使用压缩率和压缩速度不同的压缩方法,在本实施例中,即是使用加速值不同的LZ4算法,其系统迁移的速度是不同的。本发明提出的方法能够找出某一带宽下可以给迁移系统带来最大迁移速度的压缩方法,并随着带宽的变化,动态选择最优的压缩方法,从而获得最短的迁移时间。It can be seen that under a certain bandwidth, compression methods with different compression ratios and compression speeds are used in the migration. In this embodiment, the LZ4 algorithm with different acceleration values is used, and the system migration speeds are different. The method proposed by the invention can find out the compression method that can bring the maximum migration speed to the migration system under a certain bandwidth, and dynamically select the optimal compression method as the bandwidth changes, so as to obtain the shortest migration time.
本发明通过若干典型负载而获得平均压缩率和压缩速度,从而组成压缩策略表的方法,避免了对不同负载采用不同的压缩策略表,使得本发明的具体实施更为简便可行。当虚拟机中运行不同负载时,其内存中的数据内容是不同的,因此用某一加速值的LZ4压缩不同负载的内存时,所得到的压缩率和压缩速度有一定差异,从而所带来的系统的迁移速度也不相同。然而,我们的实验表明,不同的负载会在相同或邻近的加速值处取得最大的系统迁移速度。因此,本发明提出选取若干典型负载,测出它们在不同压缩方法下的压缩率和压缩速度后,对这些数据取平均值,得到平均压缩速度和压缩率,组成压缩策略表,计算得出某一带宽下的最优压缩方法。实验表明,如此得出的压缩策略表在一定误差范围内适用于所有负载。这使得本发明在实施时只需存储一组压缩策略表即可,简化了系统实现,提升了本发明的可行性。The present invention obtains the average compression ratio and compression speed through several typical loads, thereby composes the compression strategy table, avoids the use of different compression strategy tables for different loads, and makes the specific implementation of the present invention more convenient and feasible. When different loads are running in the virtual machine, the data content in the memory is different. Therefore, when using LZ4 with a certain acceleration value to compress the memory of different loads, the obtained compression ratio and compression speed are different, which brings The migration speed of different systems is also different. However, our experiments show that different loads achieve the maximum system migration speed at the same or close to the acceleration value. Therefore, the present invention proposes to select some typical loads, measure their compression ratio and compression speed under different compression methods, average these data, obtain the average compression speed and compression ratio, form a compression strategy table, and calculate a certain Optimal compression method under a bandwidth. Experiments show that the compression strategy table thus obtained is suitable for all loads within a certain error range. This makes the present invention only need to store a set of compression policy tables during implementation, which simplifies system implementation and improves the feasibility of the present invention.
如图4a所示,采用本发明方法和现有预拷贝迁移的迁移时间对比,本发明方法完成迁移用时更少;As shown in Figure 4a, compared with the migration time of the existing pre-copy migration using the method of the present invention, the method of the present invention takes less time to complete the migration;
和图4b所示,采用本发明方法和现有预拷贝迁移的迁移数据量对比,本发明方法完成迁移传输数据量更小。As shown in FIG. 4 b , compared with the migration data volume of the existing pre-copy migration using the method of the present invention, the migration and transmission data volume of the method of the present invention is smaller.
以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present invention should be included in the protection of the present invention. within range.
Claims (4)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710129704.2A CN106970824B (en) | 2017-03-07 | 2017-03-07 | A bandwidth-aware virtual machine migration compression method and system |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710129704.2A CN106970824B (en) | 2017-03-07 | 2017-03-07 | A bandwidth-aware virtual machine migration compression method and system |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN106970824A CN106970824A (en) | 2017-07-21 |
| CN106970824B true CN106970824B (en) | 2019-12-17 |
Family
ID=59329092
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201710129704.2A Active CN106970824B (en) | 2017-03-07 | 2017-03-07 | A bandwidth-aware virtual machine migration compression method and system |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN106970824B (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108469982B (en) * | 2018-03-12 | 2021-03-26 | 华中科技大学 | Online migration method for container |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102609361A (en) * | 2012-01-16 | 2012-07-25 | 北京邮电大学 | Method and device for transferring storage data of virtual machine |
| CN103353850A (en) * | 2013-06-13 | 2013-10-16 | 华为技术有限公司 | Virtual machine thermal migration memory processing method, device and system |
| CN103685256A (en) * | 2013-12-06 | 2014-03-26 | 华为技术有限公司 | Virtual machine migration management method, device and system |
| CN105302494A (en) * | 2015-11-19 | 2016-02-03 | 浪潮(北京)电子信息产业有限公司 | Compression strategy selecting method and device |
| US9336042B1 (en) * | 2015-11-19 | 2016-05-10 | International Business Machines Corporation | Performing virtual machine live migration within a threshold time by adding available network path in multipath network |
| CN106293870A (en) * | 2015-06-29 | 2017-01-04 | 联发科技股份有限公司 | Computer system and policy-oriented compression method thereof |
-
2017
- 2017-03-07 CN CN201710129704.2A patent/CN106970824B/en active Active
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102609361A (en) * | 2012-01-16 | 2012-07-25 | 北京邮电大学 | Method and device for transferring storage data of virtual machine |
| CN103353850A (en) * | 2013-06-13 | 2013-10-16 | 华为技术有限公司 | Virtual machine thermal migration memory processing method, device and system |
| CN103685256A (en) * | 2013-12-06 | 2014-03-26 | 华为技术有限公司 | Virtual machine migration management method, device and system |
| CN106293870A (en) * | 2015-06-29 | 2017-01-04 | 联发科技股份有限公司 | Computer system and policy-oriented compression method thereof |
| CN105302494A (en) * | 2015-11-19 | 2016-02-03 | 浪潮(北京)电子信息产业有限公司 | Compression strategy selecting method and device |
| US9336042B1 (en) * | 2015-11-19 | 2016-05-10 | International Business Machines Corporation | Performing virtual machine live migration within a threshold time by adding available network path in multipath network |
Non-Patent Citations (2)
| Title |
|---|
| Petter Svärd,et,al.Evaluation of Delta Compression Techniques for Efficient Live Migration of Large Virtual Machines.《Proceedings of the 7th ACM SIGPLAN/SIGOPS international conference on Virtual execution environments》.2011,Pages 111-120. * |
| 云计算环境下虚拟机在线迁移优化;马路路等;《信息技术》;20141130(第11期);全文 * |
Also Published As
| Publication number | Publication date |
|---|---|
| CN106970824A (en) | 2017-07-21 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US9645756B2 (en) | Optimization of in-memory data grid placement | |
| CN103763383B (en) | Integrated cloud storage system and its storage method | |
| CN103353850B (en) | Virtual machine thermal migration memory processing method, device and system | |
| US9632839B2 (en) | Dynamic virtual machine consolidation | |
| CN102523234B (en) | A kind of application server cluster implementation method and system | |
| CN103858157B (en) | System and method for dynamic discovery and configuration of resource servers in a traffic director environment | |
| Wang et al. | Ada-Things: An adaptive virtual machine monitoring and migration strategy for internet of things applications | |
| CN102609361B (en) | Method and device for transferring storage data of virtual machine | |
| US11206706B2 (en) | Method and apparatus for web browsing on multihomed mobile devices | |
| CN103957237A (en) | Architecture of elastic cloud | |
| CN108200124A (en) | A kind of High Availabitity application architecture and construction method | |
| CN103888501A (en) | Virtual machine migration method and device | |
| CN104331253A (en) | Calculation method for object migration in object storage system | |
| US9462521B2 (en) | Data center network provisioning method and system thereof | |
| CN114625474A (en) | Container migration method and device, electronic equipment and storage medium | |
| CN104202349B (en) | The method of scheduling distributed buffer resources, Apparatus and system | |
| CN106970824B (en) | A bandwidth-aware virtual machine migration compression method and system | |
| CN110597598B (en) | A control method for virtual machine migration in cloud environment | |
| CN113242434B (en) | A video compression method and related device | |
| JP2019121333A (en) | Data dynamic migration method and data dynamic migration device | |
| Pu et al. | An environment-aware and dynamic compression-based approach for edge computing service migration | |
| US11755244B2 (en) | System and method for smart NVMeOF disk array enclosure deep background data reduction offload | |
| CN115941694A (en) | A method and device for dynamic load balancing based on Nginx | |
| CN112291326B (en) | Load balancing method, load balancing device, storage medium and electronic equipment | |
| US20230251887A1 (en) | Data migration system, data migration method, non-transitory computer-readable medium for data migration program |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |