Virtual machine data processing method and device

By identifying the storage location of virtual memory data and adopting a differentiated migration strategy, only hot data is transferred and the address mapping relationship of cold data is recorded, which solves the problem of low efficiency in virtual machine data migration and achieves more efficient resource utilization and rapid migration.

CN120631501APending Publication Date: 2025-09-12JINAN INSPUR DATA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510685198.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-26
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

In a cloud computing environment, virtual machine data migration suffers from low migration efficiency and waste of network resources due to the traditional full-data transmission method.

Method used

By identifying the storage location of virtual memory data, only the first type of memory data located in the physical memory space of the source physical machine is transferred, and the address mapping relationship of the second type of memory data located in the shared swap partition is recorded. A differentiated migration strategy is adopted to reduce network bandwidth and migration time.

Benefits of technology

It improves the efficiency of virtual machine data processing, reduces network bandwidth usage and migration time, optimizes resource usage, and can effectively manage virtual machine migration, especially in an over-memory environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120631501A_ABST
    Figure CN120631501A_ABST
Patent Text Reader

Abstract

The invention discloses a virtual machine data processing method and device, and the method comprises the steps: obtaining a virtual memory address of virtual machine memory data running on a source physical machine; based on the address increment of the preset storage unit and the initial address of the virtual memory address, traversing a memory address unit corresponding to each storage unit in the virtual memory address to obtain a target result; based on the target result, migrating a first type of memory data in a physical memory space in the virtual machine memory data to a target storage space, and transmitting an address mapping relationship of a second type of memory data in a shared exchange partition to the target storage space, the address mapping relationship comprises an association relationship among a virtual memory address, a virtual machine physical address and a shared address in the shared exchange partition. By means of the method, the technical problem that efficiency is low in the virtual machine data migration process is solved, and the technical effect of improving the migration efficiency of the virtual machine data is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method and device for processing virtual machine data. Background Art

[0002] In a cloud computing environment, in order to achieve dynamic resource allocation, load balancing, and fault recovery, virtual machines are usually allowed to migrate between different physical hosts. For example, all virtual machine data on the source physical machine is usually directly migrated to the destination physical machine.

[0003] However, to address the issue of insufficient memory capacity in cloud data centers, hot data in virtual machines is typically stored in the host's local physical memory, while cold data is stored in the shared swap partition of the host's high-performance disk. Traditional migration methods require iteratively copying both the hot data in local physical memory and the cold data in the shared swap partition to the destination. This full transfer consumes significant time and network resources, resulting in low migration efficiency during virtual machine data processing. Summary of the Invention

[0004] The present application provides a method and apparatus for processing virtual machine data to at least solve the problem of low efficiency in the virtual machine data processing process in the related art.

[0005] According to one aspect of an embodiment of the present application, a method for processing virtual machine data is provided, including: obtaining the virtual memory address of the virtual machine memory data running on a source physical machine; based on the address increment of a preset storage unit and the starting address of the virtual memory address, traversing the memory address unit corresponding to each storage unit in the virtual memory address to obtain a target result; based on the target result, migrating the first type of memory data located in the physical memory space in the virtual machine memory data to the target storage space, and transmitting the address mapping relationship of the second type of memory data located in the shared swap partition to the target storage space, wherein the address mapping relationship includes the association relationship between the virtual memory address, the virtual machine physical address and the shared address in the shared swap partition.

[0006] According to another aspect of an embodiment of the present application, a device for processing virtual machine data is also provided, including: a first acquisition unit, used to obtain the virtual memory address of the virtual machine memory data running on the source physical machine; a traversal unit, used to traverse the memory address unit corresponding to each storage unit in the virtual memory address based on the address increment of the preset storage unit and the starting address of the virtual memory address, to obtain a target result; a first processing unit, used to migrate the first type of memory data located in the physical memory space in the virtual machine memory data to the target storage space based on the target result, and transmit the address mapping relationship of the second type of memory data located in the shared swap partition to the target storage space, wherein the address mapping relationship includes the association relationship between the virtual memory address, the virtual machine physical address and the shared address in the shared swap partition.

[0007] According to another aspect of an embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the steps of any of the above-mentioned virtual machine data processing methods through the computer program.

[0008] According to another aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above-mentioned virtual machine data processing methods when running.

[0009] According to another aspect of an embodiment of the present application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps of any of the aforementioned methods for processing virtual machine data.

[0010] By using the above-described embodiments provided by this application, by identifying the storage location of virtual memory data, only the first type of memory data located in the physical memory space of the source physical machine is transmitted, while the address mapping relationship of the second type of memory data located in the shared swap partition is recorded, thus avoiding the redundant transmission of large amounts of cold data in the shared swap partition. In other words, by implementing hierarchical memory management during the virtual machine data migration process, a differentiated migration strategy for the two different types of memory data is implemented, reducing network bandwidth and the migration time of virtual machine memory data, thereby achieving the technical effect of improving the processing efficiency of virtual machine data. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0012] Figure 1 This is a schematic diagram of an application scenario of a method for processing virtual machine data according to an embodiment of the present application.

[0013] Figure 2 This is a flowchart of an optional method for processing virtual machine data according to an embodiment of the present application.

[0014] Figure 3 This is an overall schematic diagram of an optional method for processing virtual machine data according to an embodiment of the present application.

[0015] Figure 4 This is an optional explanation of technical data during virtual machine data migration according to an embodiment of the present application.

[0016] Figure 5 This is an overall flow chart of an optional method for processing virtual machine data according to an embodiment of the present application.

[0017] Figure 6 This is a structural block diagram of an optional virtual machine data processing device according to an embodiment of the present application. DETAILED DESCRIPTION

[0018] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0019] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.

[0020] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0021] According to one aspect of an embodiment of the present application, a method for processing virtual machine data is provided. Optionally, in this embodiment, the method for processing virtual machine data can be applied to, but is not limited to, Figure 1 In the hardware scenario shown, the server device may include one or more ( Figure 1 Only one is shown) a processor 102 (the processor 102 may include but is not limited to a microprocessor MCU or a programmable logic device FPGA and other processing devices) and a memory 104 for storing data, wherein the above-mentioned server device may also include a transmission device 106 for communication functions and an input and output device 108. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.

[0022] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for processing virtual machine data in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implementing the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories may be connected to a server device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0023] The transmission device 106 is used to receive or send data via a network. A specific example of the aforementioned network may include a wireless network provided by a communication provider of the server device. In one embodiment, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0024] The embodiments of the present application may be used in, but not limited to, the processing of virtual machine data. Specific examples of several application scenarios are given below:

[0025] (1) Dynamic resource adjustment in cloud computing environments: Dynamic resource allocation is extremely important in large-scale cloud computing deployments. The technical solution of this application optimizes the virtual machine migration process by efficiently processing hot and cold data in memory, enabling faster response to load changes and achieving immediate resource adjustment and reallocation. This is especially true in high-density virtualization environments, where physical memory resources are limited and virtual machine memory requirements are high. By effectively utilizing swap partitions, migration efficiency can be improved and resource adjustment can be accelerated.

[0026] (2) Data center load balancing: Data centers often need to optimize server utilization through load balancing to avoid overloading some servers while leaving others idle. Rapid virtual machine migration can be completed in seconds without delays caused by large amounts of data transmission. This allows data centers to quickly migrate virtual machines from highly loaded servers to less loaded servers, balancing resource usage, reducing the risk of downtime, and improving service quality.

[0027] (3) High-performance computing and large-scale data analysis: High-performance computing and large-scale data processing typically require a large amount of memory resources. Traditional virtual machine migration methods can be inefficient when handling such applications due to the large amount of memory data. The technical solution of this application avoids the direct migration of large amounts of swap partition SWAP file data by only transferring the mapping relationship for cold data, reducing data transfer time and improving the utilization efficiency of computing resources.

[0028] (4) Support for over-memory virtualization environments: When the total memory allocated to a virtual machine (local physical memory + SWAP files) exceeds the actual physical memory capacity of the physical machine, the advantages of the technical solution of this application become more apparent. By identifying and selectively transmitting hot data and restoring cold data on demand at the destination, the problem of over-memory is solved and the migration process is optimized, making it possible to effectively manage the migration of virtual machines in memory-constrained environments.

[0029] The method for processing virtual machine data according to the embodiment of the present application can be executed by a server device, or by the server device in combination with at least one of the terminal devices (also understood as the input / output device 108). The method for processing virtual machine data according to the embodiment of the present application can also be executed by a client installed on the terminal device.

[0030] Taking the method for processing virtual machine data in this embodiment executed by a server as an example, Figure 2 FIG. 1 is a flow chart of an optional method for processing virtual machine data according to an embodiment of the present application, such as Figure 2 As shown, the process of the method may include steps S202 to S206.

[0031] Step S202: obtaining a virtual memory address of memory data of a virtual machine running on the source physical machine.

[0032] Step S204, based on the address increment of the preset storage unit and the starting address of the virtual memory address, traverse the memory address unit corresponding to each storage unit in the virtual memory address to obtain the target result.

[0033] Step S206, based on the target result, migrate the first type of memory data in the virtual machine memory data located in the physical memory space to the target storage space, and transfer the address mapping relationship of the second type of memory data located in the shared swap partition to the target storage space, wherein the address mapping relationship includes the association relationship between the virtual memory address, the virtual machine physical address and the shared address in the shared swap partition.

[0034] In order to facilitate understanding of the technical solutions in the embodiments of the present application, the following is a brief introduction to the professional terms or terminology involved.

[0035] Virtual Machine (VM): This refers to, but is not limited to, an independent, hardware-decoupled software environment created on a physical machine through virtualization software. It can run its own operating system and applications and behave like a real physical computer.

[0036] Virtual machine migration, also known as virtual machine data migration, refers to the process of moving a virtual machine from one physical server to another. This involves the complete transfer of the virtual machine's configuration information, operating system, applications, and data, while minimizing disruption to the virtual machine's normal operation. After the migration is complete, the virtual machine can continue to run on the new physical server.

[0037] HVA (Host Virtual Address) refers to the virtual address used by the host operating system in a virtualized environment. The HVA is the virtual address of the memory area assigned by the host operating system to the virtual machine. It is managed by the host's memory management unit and is used to represent the virtual machine's memory in the host's virtual address space. The host includes the physical server or machine on the source side and the physical server or machine on the destination side.

[0038] GPA: Guest Physical Address, also known as guest physical address, is an important concept in a virtualization environment. It represents the physical address that a virtual machine "thinks" of and provides an isolated memory space for the virtual machine.

[0039] KVM (Kernel-Based Virtual Machine) is a kernel-based virtual machine. In this embodiment, KVM acts as a virtual machine monitor, providing virtualization infrastructure, managing and scheduling physical resources on the host machine to support the operation of multiple VMs. Each VM is an independent operating system instance with its own user space, root file system, and applications, isolated in its own virtual hardware environment by KVM.

[0040] QEMU (Quick Emulator) is a powerful emulator and virtualization tool that can simulate a variety of hardware platforms and support a variety of operating modes, from full system emulation to user-mode emulation. In a virtualized environment, QEMU is primarily used to create and manage virtual machines, providing hardware emulation and resource management capabilities for them.

[0041] Let's combine Figure 3 The overall schematic diagram shown explains the basic processing process of the virtual machine data processing method in the embodiment of the present application.

[0042] like Figure 3 As shown, in the process of migrating virtual machine data from a source physical machine (hereinafter referred to as the source physical machine) to a destination physical machine (hereinafter referred to as the target physical machine), it includes but is not limited to three core modules: a memory identification module, a migration control transmission module, and a page fault memory recovery module. Through the collaborative work of the three modules, rapid migration of the virtual machine is achieved.

[0043] The memory identification module accurately identifies whether a given memory address is located in local DRAM (Dynamic Random Access Memory) physical memory or a swap file on a swap partition. This module provides critical memory location information to the subsequent migration control transfer module, ensuring that the appropriate memory transfer strategy is selected based on the actual storage location of the memory data during the migration process.

[0044] The migration control transfer module is responsible for selecting the appropriate transfer strategy during virtual machine migration based on the memory location information provided by the memory identification module. When the memory data is located in the swap partition's SWAP file, the module only records the virtual machine's HVA–>GPA–>SWAP file offset mapping and transmits this mapping to the destination without transferring the memory data. When the memory data is located in local DRAM physical memory, the module iteratively copies the memory data to the destination over the network.

[0045] The page fault memory recovery module handles memory page fault events in KVM after all local DRAM memory data has been transferred to the destination through the migration control transmission module. Since virtual machine migration only transfers memory data located in local DRAM, a memory page fault exception will occur in KVM when the virtual machine accesses memory data in the SWAP file located in the swap partition. When a memory page fault exception occurs, the module will look up the offset of the SWAP file from the transmitted HVA–>GPA–>SWAP file offset mapping table, then read the memory data from the SWAP file, feedback it to the memory page fault exception event, and then fill the data into the virtual machine's memory, thereby completely recovering all memory data.

[0046] That is, in this embodiment, when the virtual machine runs on the source physical machine, the source physical machine allocates a virtual address of the memory area of ​​the virtual machine. The virtual address (HVA) is an address range or address interval, including a start address and an end address.

[0047] At the same time, the migration of virtual machine data in the embodiments of the present application is mainly aimed at the migration of virtual machine memory data. In actual application scenarios, in order to cope with the problem of insufficient memory capacity in cloud data centers, memory cold data (second type of memory data) is usually moved from the physical machine memory to the swap space SWAP file of the high-performance disk at the software level, freeing up the physical memory of the source physical machine for use by other processes, thereby achieving the total allocated memory of the virtual machine (local DRAM physical memory + SWAP file) exceeding the total physical memory, thereby achieving the purpose of memory over-division. This technical means is also called memory tiering.

[0048] When using memory tiering technology to swap a virtual machine's cold memory data to a SWAP file, if the virtual machine is migrated at this time, traditional virtual machine migration methods do not manage memory tiers and iteratively copy all memory data (whether located in local DRAM physical memory or in a SWAP file in the swap partition). When the memory address is located in a SWAP file, the memory data is first read from the SWAP file in the shared swap partition, transmitted to the peer end over the network, and then the next round of iterative copying is performed. Compared to reading data from local DRAM physical memory, reading memory data from a SWAP file takes longer. During this time-consuming data reading process, the virtual machine will generate dirty memory data, forming a vicious cycle. When processing large amounts of SWAP memory data, problems such as long migration times and high network bandwidth usage often occur, seriously affecting migration efficiency.

[0049] To address the above problem, the virtual addresses of the memory area allocated to the virtual machine by the source physical machine are usually traversed in sequence from the starting address of the virtual memory address (HVA address) using the address increment of a preset storage unit (for example, 4k).

[0050] For example, assuming that the source physical machine allocates a total of 256M virtual addresses to the memory area of ​​the virtual machine, then starting from the starting address of the virtual memory address, each 4K address range is traversed. Figure 3 The memory identification module shown can accurately identify whether the virtual memory address or virtual address currently being traversed is located in the local DRAM physical memory of the source physical machine or in the SWAP file of the shared swap partition (which can also be understood as the swap partition), and based on the identification result, through the migration control transmission module, copy the first type of memory data (hot data) located in the local DRAM physical memory of the source physical machine to the destination physical machine, and at the same time transmit the address mapping relationship of the second type of memory data (cold data) located in the shared swap partition to the destination physical machine.

[0051] Through the above traversal process, for each round of traversal results, iterative copying of the first type of memory data in the virtual machine memory data and transmission of the address mapping relationship of the second type of memory data are achieved.

[0052] Compared with hot data, cold data will not be copied directly to the target end, but only its address mapping relationship will be transmitted. The so-called address mapping relationship of the second type of memory data can be, but is not limited to, the HVA virtual address, GPA (virtual machine physical address), and the position offset of the cold data in the shared swap partition SWAP file. These mapping information are transmitted to the target end. The address relationship and meaning between the three can be referred to Figure 4 .

[0053] After the iterative copy is completed, the virtual memory addresses of the virtual machine memory data are traversed again to record the data status at the virtual memory addresses on the source physical machine of the final version and record it in the second data recording table (finish_copy_skip_tables). During the operation of the virtual machine on the destination physical machine, if there is a need to access the cold data in the SWAP file, based on the address mapping relationship in the second data recording table, at least part of the cold data in the SWAP file is restored to the destination physical machine to facilitate the normal operation of the virtual machine on the destination.

[0054] Cold data recovery can be done through, but is not limited to, Figure 3The page fault memory recovery module shown in the figure is implemented. After a virtual machine is migrated to the destination and restarted, if the virtual machine attempts to access cold data previously located in SWAP, this module will catch the page fault exception. It will find the location of the cold data in SWAP based on the mapping information transmitted by the migration control transfer module and then load the data into physical memory to meet the virtual machine's access needs.

[0055] It should be noted that the second data recording table can also be understood as the skip information table for ending the copy phase, that is, after the virtual machine data copy is completed, it records which memory data in the divided virtual memory addresses are copied normally (not skipped) and which are skipped and not copied.

[0056] The above-mentioned address mapping relationship of only transmitting hot data and cold data greatly reduces the amount of data transmitted over the network and improves the migration speed. By rationally utilizing the SWAP swap partition, even if the total amount of memory allocated to the virtual machine is greater than the actual capacity of the host machine's physical memory, it can still run on the host machine through memory tiering technology, saving physical memory resources. In addition, since cold data is not directly transmitted during the migration process, repeated data processing is avoided, reducing data redundancy processing during the migration process and improving the migration efficiency of virtual machine data.

[0057] In addition, the cold data loading mechanism triggered by page fault exceptions ensures that cold data will be loaded from SWAP to physical memory only when the virtual machine actually needs to access it, achieving the goal of loading cold data on demand and further optimizing resource usage.

[0058] In an exemplary embodiment, the above-mentioned traversal of the memory address units corresponding to each storage unit in the virtual memory address based on the address increment of the preset storage unit and the starting address of the virtual memory address includes: obtaining each memory address unit from the virtual memory address in turn as the current memory address unit based on the address increment and the starting address of the preset storage unit; querying the spatial position to which the current memory address unit belongs, and returning the current position identifier; when the current position identifier indicates that the current memory address unit is the local memory address of the source physical machine, determining that the current memory data in the current memory address unit is the first type of memory data, wherein the first type of memory data is the virtual machine memory Data with a higher access frequency in the data; migrating the first type of memory data in the current memory address unit to the target storage space, wherein the target storage space is the physical memory space on the target end physical machine; determining the current data volume of the remaining memory data in the virtual memory address, wherein the remaining memory data includes the memory data in the remaining memory addresses except the address area between the starting address and the current memory address unit in the virtual memory address; stopping the traversal when the current data volume is less than the target transmission threshold, wherein the target transmission threshold is determined based on the current network bandwidth and the pause duration after a round of traversal, and the pause duration is determined based on a pre-set default duration.

[0059] For the specific process of traversing the virtual memory address (HVA address) through the migration control module, please refer to Figure 5 As shown, Figure 5 The migration of virtual machine data shown is performed on the source physical machine, and steps S502 to S516 correspond to the iterative copy phase of memory data, and steps S518 to S528 correspond to the completion of the iterative copy and are used to generate a second data record table (finish_copy_skip_tables).

[0060] The following first explains the iterative copy process of virtual machine memory data.

[0061] S502, obtaining the starting address of the virtual machine;

[0062] When a virtual machine runs on a source physical machine, the source physical machine allocates a virtual address of a memory area to the virtual machine. The virtual address (HVA) is an address range or address interval, including a start address and an end address.

[0063] S504, traverse the virtual machine memory address with the starting address as HVA and 4K as increment;

[0064] based on Figure 3The migration control transport module shown here traverses the virtual machine's memory addresses. This module resides in QEMU. When the virtual machine's memory data begins to migrate, the migration control transport module traverses the virtual machine's memory address space in 4KB increments. It should be noted that the migration control transport module is deployed on both the source and destination ends.

[0065] The preset storage unit can be understood as a storage space of 4K in size, where 4K is only an example and is not limited thereto. For example, it can also be 8K, 16K, etc.

[0066] Figure 3 The migration control module shown sends a memory address location request to the memory identification module using the currently traversed HVA address as a request parameter.

[0067] For ease of understanding, the embodiments of the present application are explained using an address increment of 4K as an example.

[0068] S506, determining whether the HVA address belongs to the local DRAM or the SWAP file;

[0069] The memory identification module is located in the kernel's KVM layer and provides an IOCTL interface for QEMU. This interface receives the HVA address requested by QEMU and then calls the kernel's MM interface to check whether the address is from local DRAM or a shared swap partition SWAP file.

[0070] The IOCTL interface and the MM interface are two different interfaces related to virtual machine management and resource allocation. The IOCTL (Input / Output Control) interface is a system call used by device drivers to control devices. In virtualized environments, the IOCTL interface is often used to interact with kernel modules of virtualization platforms such as KVM.

[0071] The MM interface generally refers to an interface related to memory management. In a virtualized environment, the MM interface may involve functions such as memory allocation, mapping, and management of virtual machines.

[0072] S508, determine whether the value of the location field is local;

[0073] If it is local, execute step S510; otherwise, execute step S516.

[0074] It should be noted that when the address increment currently being traversed belongs to local DRAM, the location flag bit of the response message returned to QEMU is local, and the iterative copy will be performed according to the original migration strategy. When the address increment (for example, a 4KB memory address) belongs to a SWAP file, the location flag bit of the response message returned to QEMU is shared.

[0075] S510, copying memory data to the destination end;

[0076] What is copied here is the first type of memory data within the address range where the address increment is located to the destination end.

[0077] S512: After one copy is completed, the HVA address is updated to the sum of the current HVA address and the address increment of 4KB;

[0078] That is, after each iterative copy, the HVA address will change, and the change is equal to the value after the current address is incremented by 4K.

[0079] S514, determining whether the remaining memory is less than the transmission threshold;

[0080] If it is less, execute step S518; otherwise, jump to step S504.

[0081] At the end of each round of copying, the migration control module will determine whether the total amount of currently remaining memory is less than a threshold for a memory migration, that is, a target transfer threshold.

[0082] If the total amount of remaining memory is less than the target transfer threshold, it means that the iterative copying of memory can be ended, that is, the iterative copying is completed; otherwise, the address space where the next address increment adjacent to the current storage unit is located is continued to be traversed.

[0083] It should be noted that the total amount of remaining memory in the remaining memory address changes dynamically and is not completely determined directly by the transfer memory.

[0084] For example, assuming that the virtual machine memory service is suspended during the virtual machine memory data migration phase, the total amount of remaining memory in the remaining memory addresses (i.e., the current amount of remaining memory data) is equal to the total amount of data on the remaining memory addresses in the virtual memory addresses.

[0085] For example, assuming that the virtual memory address allocated by the source physical machine to the virtual machine is D1~D2, the address range of the first round of traversal is D1~D3, where D3=D1+4K, and D3 is between D1~D2; the address range of the second round is D3~D4, where D4=D3+4K, and D4 is between D1~D2; and so on, traversing the entire virtual memory address.

[0086] Assuming that the current round is the second round and the virtual machine business on the source side is suspended during the memory data migration process, the remaining memory addresses are addresses between D4 and D2, and the current amount of memory data in the remaining memory addresses is equal to the total amount of all data on the address space D4 to D2.

[0087] Assuming the current round is the second round, and the source VM service is not suspended during the memory data migration process, the remaining memory address cannot be directly equal to the total amount of data in address space D4-D2. This is because the VM memory service is still running during the data migration phase, and the data at addresses D1-D2 is dynamically changing. For example, as business processing continues, the data at addresses D1-D2 continues to increase. Or, as business processing continues, the data type of some data at addresses D1-D2 switches from hot data to cold data. In this case, the data that has been converted to cold data will be moved to the shared swap partition.

[0088] If the virtual machine service is not suspended and the data at addresses D1-D2 is changing dynamically, the data at the remaining address space D4-D2 is also changing dynamically. Therefore, the current amount of remaining memory data is equal to the total amount of memory data at address space D4-D2 at the current moment after the change.

[0089] The target transfer threshold (the threshold for a memory migration) also changes dynamically. For example, after each data copy, there is a short pause. Assuming that the system default pause time is 100ms, combined with the bandwidth size, the amount of data that can be transferred within 100ms is calculated to be 1M, then the target transfer threshold is 1M.

[0090] However, it should be noted that although the system default pause duration is 100ms, if it detects that the virtual machine is continuously processing data, the system will use the interface provided by the offset to automatically change the pause duration from the default 100ms to 300ms (this is just an example and can also be changed to 1s). In this case, the target transmission threshold may become 3M.

[0091] S516: When it is determined that the location of the address increment belongs to the SWAP file, the location flag bit of the response message returned to QEMU is share, and the address mapping relationship of the current address increment is recorded in the first data recording table.

[0092] It should be noted that the first data recording table (iteration_copy_skip_tables) records the process status during the data migration process (the iterative copy phase). During the iterative copy phase, the source VM may or may not have suspended business processing. Therefore, the number of data items in the first data recording table is greater than or equal to the number of data items in the second data recording table. This is because when the VM's business is not suspended, the first data recording table will additionally record the data processing status during business processing. In this case, the amount of data in the first data recording table is necessarily greater than the amount of data in the second data recording table.

[0093] Through intelligent memory data classification and differentiated transfer strategies, this technology effectively addresses the inefficiencies and resource waste inherent in traditional virtual machine migration. By accurately identifying hot and cold data, it migrates only the hot data and transmits the address mappings for the cold data, significantly reducing the amount of data to be migrated and network overhead. Dynamic migration termination conditions ensure efficient and flexible migration.

[0094] In addition, based on the above-mentioned differentiated transmission strategies, the technical solution of this application is particularly suitable for the rapid migration of resource-intensive applications in cloud environments, which can greatly improve the migration speed, optimize resource allocation, and enhance the overall performance and responsiveness of the system.

[0095] In an exemplary embodiment, the above method also includes: when the current position identifier indicates that the current memory address unit is a shared address in a shared swap partition, determining that the current memory data in the current memory address unit is second-type memory data, wherein the second-type memory data is data with a lower access frequency in the virtual machine memory data; recording the current mapping relationship between the current memory address unit of the current memory data, the current virtual machine physical address, and the current shared partition address in the shared swap partition to a first data record table, wherein the first data record table records data processing records during the virtual machine memory data migration process.

[0096] In this embodiment, by Figure 3 The memory identification module shown returns the query and location identification for each memory address unit. The system can accurately determine which data is cold data, that is, data located in the shared swap partition. This data is usually accessed less frequently and does not need to be directly migrated to the destination.

[0097] For example, when the memory identification module identifies that a memory address unit (for example, a 4KB memory address) is an address in the SWAP swap partition, the location flag bit of the response message returned to QEMU is share, and the migration control transfer module will skip the memory data and traverse the next 4KB memory address. At the same time, the GPA address corresponding to the address increment and the offset of the address increment in the SWAP file are found, that is, HVA–>GPA–>SWAP file offset, and the correspondence between the three is added to the first data record table (iteration_copy_skip_tables). The first data record table stores status data on which data is skipped and which data is not skipped during the iterative copy process.

[0098] According to the above, for the identified cold data, the system records its HVA, GPA and position offset information in the shared swap partition to form an address mapping relationship. This information (including the address mapping relationship) will be collected and saved in a special data structure file, namely the first data recording table.

[0099] The presence of the first data table facilitates subsequent processing of cold data, for example, for calibrating the second data table. For example, by verifying whether the data in the first data table contains all the data in the second data table, it is possible to determine whether there are data anomalies. In other words, if the data in the first data table does not contain the data in the second data table, then a data anomaly exists.

[0100] Through refined cold data processing, this technology significantly improves virtual machine migration. It not only avoids redundant cold data transmission and reduces network overhead, but also ensures timely recovery of cold data by recording address mappings, maintaining the integrity of the virtual machine. This strategy of differentiated management of different types of memory data effectively addresses the complex memory management and virtual machine migration requirements of cloud environments, providing a more efficient and flexible solution for resource management and dynamic scheduling.

[0101] By intelligently identifying and recording the address mappings of cold data rather than directly transferring it, network traffic during data migration is significantly reduced, while redundant processing of large amounts of inactive data is avoided, reducing overall migration time and energy consumption. This strategy ensures that hot data is transferred quickly and prioritized, while cold data is restored from the shared swap partition only when needed, maximizing resource utilization and enhancing the flexibility and responsiveness of virtual machine migration in cloud environments.

[0102] In an exemplary embodiment, when the current data volume is less than the target transmission threshold, after stopping the traversal, the above method also includes: suspending the processing of the virtual machine business; traversing the memory address units corresponding to each storage unit in the virtual memory address based on the address increment of the preset storage unit and the starting address of the virtual memory address to obtain the position identifier of each memory address unit; when the current position identifier indicates that the current memory address unit is the local memory address of the source physical machine, updating the current memory address unit to obtain an updated memory address unit, wherein the updated memory address unit is equal to the sum of the address increment of the current memory address unit and the preset storage unit; when the updated memory address unit exceeds the end address of the virtual memory address, ending the traversal.

[0103] Combined with the description in the above embodiment, it can be seen that after the iterative copy phase ends, the migration control transmission module re-traverses all address spaces of the virtual machine, searches for all memory locations located in the SWAP file, adds the offset mapping relationship of all traversed HVA->GPA->SWAP files to the finish_copy_skip_tables (end copy phase skip information table or second data record table), and transmits the table to the destination. Figure 5 Steps S518 to S526 are shown.

[0104] S518, starting with the HVA and incrementing by 4KB, traverse the virtual machine memory address;

[0105] When a virtual machine runs on a source physical machine, the source physical machine allocates a virtual address of a memory area to the virtual machine. The virtual address (HVA) is an address range or address interval, including a start address and an end address.

[0106] The starting address of the virtual machine is obtained, and based on the starting address and the preset storage unit, the memory address of the virtual machine is traversed again.

[0107] The preset storage unit can be understood as a storage space of 4K in size, where 4K is only an example and is not limited thereto. For example, it can also be 8K, 16K, etc.

[0108] S520, determining whether the HVA address belongs to the local DRAM or the SWAP file;

[0109] The memory identification module can be used, but is not limited to, to query whether a current 4KB address is from the local DRAM or the shared swap partition SWAP file.

[0110] S522, determine whether the value of the location field is local;

[0111] If it is local, execute step S524; otherwise, execute step S528.

[0112] It should be noted that when the current traversed 4K memory address belongs to the local DRAM, the location flag bit of the response message returned to QEMU is local, and the iterative copy will be performed according to the original migration strategy. When the current 4K memory address belongs to the SWAP file, the location flag bit of the response message returned to QEMU is shared.

[0113] S524: After one copy is completed, the HVA address is updated to the sum of the current HVA address and the address increment of 4KB;

[0114] That is, after each iterative copy, the HVA address will change, and the change is equal to the value after the current address is incremented by 4K.

[0115] S526, determining whether the iteratively updated HVA address exceeds the end position of the virtual machine memory address;

[0116] If exceeded, the traversal process ends; otherwise, jump to step S518.

[0117] S528 : When the location of the current 4K memory address belongs to the SWAP file, record the address mapping relationship of the current 4K memory address in the second data recording table.

[0118] The difference between the second data recording table and the first data recording table can be referred to the description in the above embodiment, which will not be repeated here.

[0119] It should be noted that after the virtual machine data migration is completed, if it is necessary to restore the data in the SWAP file during the operation of the virtual machine on the destination end, at least part of the second type of memory data in the swap partition SWAP file is restored on demand based on the address mapping relationship recorded in the second data record table.

[0120] After the iterative copy phase is completed, the virtual memory address is re-traversed to generate a second data record table that records the final data status information in the virtual memory address, and the table is transmitted to the destination end, so that according to the access requirements and the address mapping relationship in the table, at least part of the second type of memory data that matches the access requirements can be accurately restored, ensuring the accuracy of the migration results and the normal operation of the virtual machine on the destination physical machine.

[0121] In an exemplary embodiment, the above method also includes: when the current position identifier indicates that the current memory address unit is a shared address in a shared swap partition, determining that the current memory data in the current memory address unit is second type memory data; recording the current mapping relationship between the current memory address unit of the current memory data, the current virtual machine physical address, and the current shared partition address in the shared swap partition into a second data record table, wherein the second data record table records the final data status information in the virtual memory address, and the final data status information is the data status information in the virtual memory address after iterative copying of the first type memory data by traversing the virtual memory address is completed.

[0122] As can be seen from the description in the above embodiments, when the system traverses the virtual memory address, the memory identification module queries the actual storage location of each memory address unit, which can accurately identify the existence of cold data.

[0123] For confirmed cold data, the system only records its HVA, GPA, and position offset in the SWAP file in the second data recording table instead of directly transferring the data. This method of only recording the address mapping relationship instead of directly transferring the data greatly reduces the data transmission volume and network resource consumption during the migration process.

[0124] After the iterative copy and transfer of hot data is complete, the system re-traverses the virtual memory addresses and generates a second data record table, which records the final state of the virtual machine's memory data. This data table ensures data accuracy and provides a reliable basis for the subsequent page fault memory recovery module to restore cold data on demand, avoiding unnecessary data migration while ensuring data integrity. Furthermore, the existence of this record table facilitates system maintenance and troubleshooting.

[0125] By generating a second data record table after the iterative copy, the final state of the virtual machine memory is accurately recorded, providing precise information for on-demand recovery of cold data, avoiding the redundant transmission of unused or infrequently accessed data in traditional migration, thereby optimizing the migration strategy and enhancing the flexibility and efficiency of resource scheduling in the cloud environment.

[0126] In an exemplary embodiment, the above method also includes: transferring and caching the second data record table to the target physical machine; switching the running node of the virtual machine when it is determined that the memory data and configuration information of the virtual machine migrated to the target physical machine pass the verification conditions; running the virtual machine on the target physical machine; during the operation of the virtual machine, based on the data access request and the address mapping relationship, recovering at least part of the memory data that meets the data access request from the shared swap partition, wherein the second type of memory data includes at least part of the memory data.

[0127] When the memory code copying phase is completed, the migration control transmission module at the destination side receives the second data record table (finish_copy_skip_tables, end copy phase skip information table) and stores it in the destination side cache.

[0128] At this point, the virtual machine memory data and configuration information transferred to the target physical machine are verified to see if they meet the verification criteria. If they do, the virtual machine's running node switch is complete. The virtual machine is run on the target, while the virtual machine on the source is stopped and the virtual machine data on the source is released.

[0129] After receiving all the migration data, the target server verifies the integrity of the VM's memory data on the target server and ensures the consistency of the source and target VM memory data. Once verification passes, the system automatically switches the running node to the target physical machine, achieving seamless migration of the VM from the source to the target server.

[0130] After that, when the virtual machine is running on the target side, if the memory accessed by the virtual machine is located in the SWAP file, the KVM module will handle the page fault exception (the memory data is not in the local DRAM), and the page fault memory recovery module will capture the event.

[0131] The page fault memory recovery module uses the GPA address (client physical address, which can also be understood as the virtual machine physical address) as input and searches for the offset of the SWAP file from the cached finish_copy_skip_tables (end copy phase skip information table). Using the SWAP file offset, it reads the SWAP file of the shared swap partition, obtains the memory data, and returns it to the virtual machine. At the same time, it records the status of the GPA address as recovered to prevent repeated recovery of dirty data from the SWAP file in abnormal situations (data generated when the DRAM on the destination side fails and the local SWAP file is contaminated).

[0132] The above-mentioned on-demand recovery mechanism not only avoids the redundant transmission of cold data and reduces the network load, but also ensures the efficient operation of the virtual machine and maintains its functional integrity after migration.

[0133] By caching the second data record to the target end and combining it with the on-demand data recovery mechanism during virtual machine operation, efficient and flexible resource management is achieved. Specifically, the technical solution of this application can respond to data access needs immediately after virtual machine migration and automatically restore cold data from the shared exchange partition, avoiding unnecessary large-scale data transmission in the early stage, significantly reducing network bandwidth usage, while ensuring the continuity of virtual machine operation and data integrity, improving the success rate and efficiency of virtual machine migration in cloud environments, optimizing the resource allocation process, and enhancing the system's adaptability to dynamic business needs.

[0134] In an exemplary embodiment, the above-mentioned method of recovering at least part of the memory data that meets the data access request from the shared swap partition based on the data access requirement and the address mapping relationship includes: obtaining data missing exception information in response to the data access request; based on the data missing exception information and the virtual machine physical address, searching the second data record table for the target mapping relationship between the virtual machine physical address and the shared address in the shared swap partition; based on the target mapping relationship, recovering at least part of the memory data from the shared swap partition, and transmitting at least part of the memory data to the target end physical machine.

[0135] After the local DRAM memory data of the source end is transferred to the destination end (also known as the target end) through the migration control module, the memory page fault event in the KVM is processed, and data missing exception information is obtained through the memory page fault event.

[0136] This is because when migrating virtual machine memory data, only the memory data located in the local DRAM of the source end is transferred. When the virtual machine is running on the target end and the virtual machine needs to access the second type of memory data located in the SWAP file of the swap partition, KVM will have a memory page fault exception. Figure 3 The page fault memory recovery module shown captures this exception and obtains key missing data information (which can also be understood as data missing exception information) from it, including the virtual machine physical address (GPA) of the data access request, etc., providing a basis for subsequent data recovery.

[0137] Based on the GPA address in the missing data anomaly information, the system accesses the secondary data record table cached on the target device, searches for the address mapping associated with the GPA, and determines the exact location of the data in the shared swap partition (SWAP file offset). This search process ensures that the system can accurately locate the cold data to be recovered and is a critical step in the data recovery process.

[0138] After obtaining the target mapping relationship, the page fault memory recovery module reads the missing second type of memory data from the shared swap partition and transfers it to the local DRAM of the target physical machine to complete data recovery.

[0139] In other words, when a memory page fault occurs, the module looks up the SWAP file offset from the transmitted HVA–>GPA–>SWAP file offset mapping table, reads the memory data from the SWAP file, and reports it to the memory page fault event. The module then populates the virtual machine's memory with this data, completely restoring the memory data associated with the current data access request. This fills the data gap and ensures the timeliness and integrity of the virtual machine's data access.

[0140] By acquiring and responding to data loss anomalies during operation, on-demand recovery of cold data is achieved. When a virtual machine on the target physical machine triggers a page fault exception while accessing data in a swap file, the system can quickly locate and recover the required data from the shared swap partition, effectively avoiding redundant transmission of cold data and significantly reducing network bandwidth usage. This speeds up data access, ensuring high-performance operation of the virtual machine after migration and optimizing resource management and task execution efficiency in the cloud environment.

[0141] As can be seen from the description of the above embodiments, the embodiments of the present application provide a technical solution for fast virtual machine migration with memory tiering awareness. The main solution and the beneficial technical effects that can be achieved include at least one of the following:

[0142] (1) A memory tier-aware migration strategy is designed: by distinguishing whether the memory page (memory data) is located in the local DRAM memory or the swap partition's SWAP file, hot data and cold data can be treated differently.

[0143] Specifically, hot data (pages located in local DRAM) is selectively migrated, and cold data (pages located in SWAP files) is skipped, thereby improving migration efficiency.

[0144] (2) A two-level skip information table is designed: the first data record table and the second data record table. These two tables are used in the iterative copy stage and the final copy stage respectively. They can adapt to the changes in the virtual machine memory activity, thereby ensuring the accuracy of the migrated data.

[0145] (3) By setting up a cold data recovery mechanism driven by page fault exceptions, cold data can be restored on demand through the page fault exception mechanism after the virtual machine migration is completed, avoiding the transmission of a large amount of cold data that may never be accessed during the migration process, further improving the migration efficiency.

[0146] (4) Using a shared swap partition allows the source and destination to share data in the SWAP file. This way, data in the SWAP file can be saved during the migration process, and only read from the shared SWAP file when needed, reducing the amount of data to be migrated and network bandwidth consumption.

[0147] By adopting the above-mentioned embodiment provided by the present application, by accurately identifying whether the memory data is in the local RAM or the SWAP file of the shared storage pool, for the cold data located in the SWAP file, only its mapping relationship is transmitted instead of the actual data. This differentiated transmission strategy avoids unnecessary data transmission, improves transmission efficiency, shortens the overall migration time, and also reduces the network bandwidth usage in the system.

[0148] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.

[0149] According to another aspect of the embodiments of the present application, a device for processing virtual machine data is also provided. The device for processing virtual machine data can be used to implement the method for processing virtual machine data provided in the above embodiments. The details that have been described will not be repeated here. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.

[0150] Figure 6 is a structural block diagram of an optional virtual machine data processing device according to an embodiment of the present application, such as Figure 6 As shown in , the device for processing virtual machine data includes an acquisition unit 602 , a traversal unit 604 , and a first processing unit 606 .

[0151] A first obtaining unit 602 is configured to obtain a virtual memory address of memory data of a virtual machine running on a source physical machine;

[0152] A traversal unit 604 is configured to traverse the memory address unit corresponding to each storage unit in the virtual memory address based on the address increment of the preset storage unit and the starting address of the virtual memory address to obtain a target result;

[0153] The first processing unit 606 is used to migrate the first type of memory data located in the physical memory space in the virtual machine memory data to the target storage space based on the target result, and transmit the address mapping relationship of the second type of memory data located in the shared swap partition to the target storage space, wherein the address mapping relationship includes the association relationship between the virtual memory address, the virtual machine physical address and the shared address in the shared swap partition.

[0154] It should be noted that the first acquisition unit 60 in this embodiment can be used to execute the above step S202, the traversal unit 604 in this embodiment can be used to execute the above step S204, and the first processing unit 606 in this embodiment can be used to execute the above step S206.

[0155] In an exemplary embodiment, the traversal unit 604 includes: a first acquisition module for sequentially acquiring each memory address unit from the virtual memory address as the current memory address unit based on the address increment and the starting address of the preset storage unit; a query module for querying the spatial location to which the current memory address unit belongs and returning the current location identifier; a first processing module for determining that the current memory data in the current memory address unit is the first type of memory data when the current location identifier indicates that the current memory address unit is the local memory address of the source physical machine, wherein the first type of memory data is the data with a higher access frequency in the virtual machine memory data; a first migration module for converting the current memory address unit to the first type of memory data; The first type of memory data in the previous memory address unit is migrated to the target storage space, wherein the target storage space is the physical memory space on the target end physical machine; the second processing module is used to determine the current data amount of the remaining memory data in the virtual memory address, wherein the remaining memory data includes the memory data in the remaining memory addresses except the address area between the starting address and the current memory address unit in the virtual memory address; the third processing module is used to stop traversal when the current data amount is less than the target transmission threshold, wherein the target transmission threshold is determined based on the current network bandwidth and the pause duration after a round of traversal, and the pause duration is determined based on a pre-set default duration.

[0156] In an exemplary embodiment, the apparatus further includes: a second processing unit, configured to, when the current location identifier indicates that the current memory address unit is a shared address in a shared swap partition, determine that current memory data in the current memory address unit is second-type memory data, wherein the second-type memory data is data with a lower access frequency in the virtual machine memory data;

[0157] The first recording unit is used to record the current mapping relationship between the current memory address unit of the current memory data, the current virtual machine physical address and the current shared partition address in the shared swap partition into a first data recording table, wherein the first data recording table records the data processing records during the virtual machine memory data migration process.

[0158] In an exemplary embodiment, the above-mentioned device also includes: a pause unit, which is used to stop the traversal and suspend the processing of the virtual machine business when the current data volume is less than the target transmission threshold; a third processing unit, which is used to traverse the memory address units corresponding to each storage unit in the virtual memory address based on the address increment of the preset storage unit and the starting address of the virtual memory address, and obtain the position identifier of each memory address unit; an update unit, which is used to update the current memory address unit when the current position identifier indicates that the current memory address unit is the local memory address of the source physical machine, and obtain an updated memory address unit, wherein the updated memory address unit is equal to the sum of the address increment of the current memory address unit and the preset storage unit; a fourth processing unit, which is used to end the traversal when the updated memory address unit exceeds the end address of the virtual memory address.

[0159] In an exemplary embodiment, the apparatus further includes: a fifth processing unit, configured to determine that current memory data in the current memory address unit is second-type memory data when the current location identifier indicates that the current memory address unit is a shared address in the shared swap partition;

[0160] The second recording unit is used to record the current mapping relationship between the current memory address unit of the current memory data, the current virtual machine physical address and the current shared partition address in the shared swap partition into a second data recording table, wherein the second data recording table records the final data status information in the virtual memory address, and the final data status information is the data status information in the virtual memory address after iterative copying of the first type of memory data is completed by traversing the virtual memory address.

[0161] In an exemplary embodiment, the above-mentioned device also includes: a transmission unit, which is used to transmit and cache the second data record table to the target physical machine; a switching unit, which is used to switch the running node of the virtual machine when it is determined that the virtual machine memory data and configuration information migrated to the target physical machine pass the verification conditions; an operation unit, which is used to run the virtual machine on the target physical machine; and a recovery unit, which is used to recover at least part of the memory data that meets the data access request from the shared swap partition based on the data access request and the address mapping relationship during the operation of the virtual machine, wherein the second type of memory data includes at least part of the memory data.

[0162] In an exemplary embodiment, the above-mentioned recovery unit includes: a second acquisition module, used to obtain data missing exception information in response to a data access request; a search module, used to search for a target mapping relationship between the virtual machine physical address and the shared address in the shared swap partition from a second data record table based on the data missing exception information and the virtual machine physical address; a fourth processing module, used to recover at least part of the memory data from the shared swap partition based on the target mapping relationship, and transmit at least part of the memory data to the target end physical machine.

[0163] By applying the above-mentioned device to a method for processing virtual machine data, the storage location of virtual memory data is identified, and only the first type of memory data located in the physical memory space of the source physical machine is transmitted. The address mapping relationship of the second type of memory data located in the shared swap partition is simultaneously recorded, thereby avoiding the redundant transmission of large amounts of cold data in the shared swap partition. In other words, by implementing hierarchical memory management during the virtual machine data migration process, a differentiated migration strategy for the two different types of memory data is implemented, reducing network bandwidth and the migration time of virtual machine memory data, thereby achieving the technical effect of improving the processing efficiency of virtual machine data.

[0164] It should be noted that the above modules can be implemented through software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0165] According to another aspect of an embodiment of the present application, an electronic device is also provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any of the above-mentioned virtual machine data processing method embodiments.

[0166] According to another aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above-mentioned virtual machine data processing method embodiments when running.

[0167] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.

[0168] According to another aspect of the embodiments of the present application, a computer program product is further provided. The computer program product includes a computer program. When the computer program is executed by a processor, the steps of any of the above-mentioned virtual machine data processing method embodiments are implemented.

[0169] An embodiment of the present application also provides another computer program product, including a non-volatile computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps of any of the above-mentioned virtual machine data processing method embodiments.

[0170] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0171] The above is a detailed introduction to a method for processing virtual machine data provided by this application. Specific examples are used herein to illustrate the principles and implementation methods of this application. The description of the above embodiments is only intended to help understand the method and core ideas of this application. It should be pointed out that, for ordinary technicians in this technical field, without departing from the principles of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the scope of protection of the claims of this application.

Claims

1. A method for processing virtual machine data, characterized in that: include: Get the virtual memory address of the virtual machine memory data running on the source physical machine; Based on the address increment of the preset storage unit and the starting address of the virtual memory address, traverse the memory address unit corresponding to each storage unit in the virtual memory address to obtain the target result; Based on the target result, the first type of memory data located in the physical memory space in the virtual machine memory data is migrated to the target storage space, and the address mapping relationship of the second type of memory data located in the shared swap partition is transmitted to the target storage space, wherein the address mapping relationship includes the association relationship between the virtual memory address, the virtual machine physical address and the shared address in the shared swap partition.

2. The method according to claim 1, characterized in that The step of traversing the memory address unit corresponding to each storage unit in the virtual memory address based on the address increment of the preset storage unit and the starting address of the virtual memory address includes: Based on the address increment of the preset storage unit and the starting address, sequentially obtaining each memory address unit from the virtual memory address as a current memory address unit; Query the spatial location to which the current memory address unit belongs, and return the current location identifier; In a case where the current location identifier indicates that the current memory address unit is a local memory address of the source physical machine, determining that the current memory data in the current memory address unit is the first type of memory data, wherein the first type of memory data is data with a higher access frequency in the virtual machine memory data; Migrating the first type of memory data in the current memory address unit to the target storage space, wherein the target storage space is a physical memory space on a target-end physical machine; Determine a current data amount of remaining memory data in the virtual memory address, wherein the remaining memory data includes memory data in remaining memory addresses excluding an address region between the start address and the current memory address unit in the virtual memory address; When the current data volume is less than a target transmission threshold, the traversal is stopped, wherein the target transmission threshold is determined based on the current network bandwidth and the pause duration after a round of traversal is completed, and the pause duration is determined based on a preset default duration.

3. The method according to claim 2, characterized in that The method further comprises: In a case where the current location identifier indicates that the current memory address unit is a shared address in a shared swap partition, determining that current memory data in the current memory address unit is second-type memory data, wherein the second-type memory data is data with a lower access frequency in the virtual machine memory data; The current mapping relationship between the current memory address unit of the current memory data, the current virtual machine physical address and the current shared partition address in the shared swap partition is recorded in a first data recording table, wherein the first data recording table records the data processing records during the virtual machine memory data migration process.

4. The method according to claim 2, characterized in that When the current data volume is less than the target transmission threshold, after stopping the traversal, the method further includes: Suspend the processing of virtual machine services; Based on the address increment of the preset storage unit and the starting address of the virtual memory address, traverse the memory address unit corresponding to each storage unit in the virtual memory address to obtain a position identifier of each memory address unit; In a case where the current location identifier indicates that the current memory address unit is a local memory address of the source physical machine, updating the current memory address unit to obtain an updated memory address unit, wherein the updated memory address unit is equal to the sum of the current memory address unit and the address increment of the preset storage unit; When the updated memory address unit exceeds the end address of the virtual memory address, the traversal is terminated.

5. The method according to claim 4, characterized in that The method further comprises: In a case where the current location identifier indicates that the current memory address unit is a shared address in a shared swap partition, determining that current memory data in the current memory address unit is second-type memory data; The current mapping relationship between the current memory address unit of the current memory data, the current virtual machine physical address and the current shared partition address in the shared swap partition is recorded in a second data recording table, wherein the second data recording table records the final data status information in the virtual memory address, and the final data status information is the data status information in the virtual memory address after iteratively copying the first type of memory data by traversing the virtual memory address.

6. The method according to claim 5, characterized in that The method further comprises: Transmitting and caching the second data record table to the target end physical machine; If it is determined that the memory data and configuration information of the virtual machine migrated to the target physical machine pass the verification conditions, switching the running node of the virtual machine; Running the virtual machine on the target physical machine; During the operation of the virtual machine, at least part of the memory data that meets the data access request is recovered from the shared swap partition based on the data access request and the address mapping relationship, wherein the second type of memory data includes the at least part of the memory data.

7. The method according to claim 6, characterized in that The recovering at least part of the memory data that meets the data access request from the shared swap partition based on the data access requirement and the address mapping relationship includes: Responding to the data access request, obtaining data missing exception information; Based on the data missing exception information and the virtual machine physical address, searching the second data record table for a target mapping relationship between the virtual machine physical address and the shared address in the shared swap partition; Based on the target mapping relationship, at least part of the memory data is recovered from the shared swap partition, and at least part of the memory data is transmitted to the target-end physical machine.

8. A device for processing virtual machine data, characterized in that: include: A first acquiring unit is configured to acquire a virtual memory address of memory data of a virtual machine running on a source physical machine; A traversal unit, configured to traverse the memory address unit corresponding to each storage unit in the virtual memory address based on the address increment of the preset storage unit and the starting address of the virtual memory address to obtain a target result; The first processing unit is used to migrate the first type of memory data located in the physical memory space in the virtual machine memory data to the target storage space based on the target result, and transmit the address mapping relationship of the second type of memory data located in the shared swap partition to the target storage space, wherein the address mapping relationship includes the association relationship between the virtual memory address, the virtual machine physical address and the shared address in the shared swap partition.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method for processing virtual machine data according to any one of claims 1 to 7.

10. An electronic device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the method for processing virtual machine data according to any one of claims 1 to 7 when executing the computer program.