Disaster recovery memory management method and device of virtual machine, computer equipment and medium

By generating a target loop list of the loop data structure, the disaster recovery memory allocation is dynamically adjusted according to the IO pressure of the target disk, which solves the problem of unbalanced allocation of disaster recovery memory in the virtual machine and improves the efficiency of disaster recovery memory usage.

CN118939426APending Publication Date: 2024-11-12ZHENGZHOU INSPUR DATA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410996345.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-23
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

During the disaster recovery process of virtual machines, the difference in IO pressures of different disks lead to unbalanced allocation of disaster recovery memory, resulting in waste of disk resources at low IO pressure, and insufficient disk resources at high IO pressure, affecting IO efficiency.

Method used

By obtaining the data transmission status of the target disk, a target loop list of the loop data structure is generated, and the memory address is selected in the disaster recovery memory according to the IO data size and physical address to save it, and information is recorded in the loop list to achieve the allocation of capacity on demand Disaster memory.

Benefits of technology

It improves the efficiency of disaster recovery memory usage of virtual machines, ensures that disks with high IO pressure can obtain more memory resources, and realizes the reasonable allocation and release of disaster recovery memory.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939426A_ABST
    Figure CN118939426A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of storage services, and discloses a disaster-tolerant memory management method and device of a virtual machine, computer equipment and a medium. The disaster-tolerant memory management method comprises the steps that the data transmission state of a target disk in target equipment is acquired; generating a target loop list of a loop data structure according to the data transmission state of the target disk; according to target IO data issued by the target virtual machine to the target disk, a target memory address is selected from the disaster recovery memory to be stored, and issued data information is written into the target circulation list; and issuing the target IO data stored in the target memory address to the physical address of the target disk. According to the scheme, the disk with high IO pressure can naturally apply for more memories for disaster recovery, distribution of the disaster recovery memories according to needs in the disaster recovery process is achieved, and each disk can achieve normal issuing of IO data in the disaster recovery memories according to the data in the target cycle list of the disk. And the use efficiency of the disaster-tolerant memory of the virtual machine is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of storage services, and in particular to a method, device, computer equipment and medium for managing a disaster recovery memory of a virtual machine. Background Art

[0002] For IT, a disaster recovery system is an environment that can cope with various disasters for computer information systems. In other words, in addition to the production site, users can also establish another redundant site. When the production site is damaged, the disaster recovery site can allow users to process business normally.

[0003] During the working process of the virtual machine, the IO (Input / Output) data can be efficiently obtained from the process of the virtual machine through the memory, and the IO data can be cached in the memory. Then the memory writes the cached IO data to the corresponding disk to realize the disaster recovery operation. When different disk IOs are written to the disaster recovery memory, it is necessary to apply for storage space from the disaster recovery memory to cache the corresponding IO data. However, in actual scenarios, the IO pressures of different disks are different. Allocating the same disaster recovery memory to different disks can easily cause a waste of the disaster recovery memory corresponding to the low IO pressure disk, and the disaster recovery memory corresponding to the high IO pressure disk may be insufficient, affecting the IO efficiency. Therefore, there is an urgent need for a management method for the disaster recovery memory of a virtual machine. Summary of the invention

[0004] In view of this, the present invention provides a method, apparatus, computer equipment and medium for managing disaster recovery memory of a virtual machine, so as to improve the utilization efficiency of the disaster recovery memory of the virtual machine.

[0005] In a first aspect, the present invention provides a method for disaster recovery memory management of a virtual machine, the method comprising:

[0006] Acquire the data transmission status of the target disk in the target device; the target disk is the disk of the disaster recovery task corresponding to the target virtual machine in the target device;

[0007] Generate a target circular list of a circular data structure according to the data transmission status of the target disk;

[0008] According to the target IO data sent by the target virtual machine to the target disk, a target memory address is selected in the disaster recovery memory for storage, and the sent data information is written into the target circular list; the sent data information includes the target memory address, the data size of the target IO data, and the physical address where the target IO data is sent;

[0009] The target IO data stored in the target memory address is sent to the physical address of the target disk.

[0010] The present invention provides a method for managing virtual machine disaster recovery memory, which has the following advantages:

[0011] When a target virtual machine with disaster recovery turned on is running in the target device, the disk of the disaster recovery task corresponding to the target virtual machine can be obtained, and its data transmission status can be determined, and a target loop list of the production loop data structure can be listed; at this time, when the target virtual machine needs to send target IO data to the target disk, the target virtual machine first selects the target memory address in the disaster recovery memory for storage, and writes relevant information in the target loop list at the same time, that is, the target memory address where the target IO data is stored, the data size of the target IO data, and the physical address to which the target IO data is about to be sent to the target disk; then the target virtual machine can send the IO data stored in the target memory address to the physical address of the target disk according to the target loop list. In the above scheme, each disk will generate its corresponding target circular list, and each circular list records the target memory address occupied in the disaster recovery memory. That is, each disk will apply for the target memory address from the disaster recovery memory only when it needs to send IO data, and record the information in its own target circular list. Therefore, disks with high IO pressure will naturally apply for more memory for disaster recovery, realizing the on-demand allocation of disaster recovery memory during the disaster recovery process, and each disk can realize the normal sending of IO data in the disaster recovery memory according to the data in its own target circular list. Therefore, the above scheme significantly improves the utilization efficiency of the disaster recovery memory of the virtual machine.

[0012] In a possible implementation, the method further includes:

[0013] When the target IO data stored in the target memory address is sent to the physical address of the target disk, the sent data information in the target circulation list is deleted.

[0014] After the target IO data is sent to the physical address of the target disk, the sent data information in the target circular list can be deleted, and this part of the storage space of the target circular list can be used cyclically to store information corresponding to other IO data.

[0015] In a possible implementation, the step of selecting a target memory address in a disaster recovery memory for storage according to the target IO data sent by the target virtual machine to the target disk includes:

[0016] Determine the data volume of the target IO data sent by the target disk;

[0017] Determine the free memory address of the disaster recovery memory from the target dirty page;

[0018] A target memory address corresponding to the data amount of the target IO data is determined in the free memory address, and the target IO data sent by the target disk is saved.

[0019] Data recovery in shared memory mainly relies on the dirty page mechanism. The bitmap value corresponding to the storage location in the disaster recovery memory where the data that has been sent to the disk with a lower speed is set to 0. This can not only recycle the shared storage space, but also determine in real time which memory space is available for disaster recovery memory.

[0020] In a possible implementation, the target dirty page includes a plurality of bitmap values; the plurality of bitmap values ​​respectively correspond to the storage status of each memory unit in the disaster recovery memory; the disaster recovery memory is the memory allocated by the target device to the target virtual machine for disaster recovery;

[0021] The step of determining the free memory address from the target dirty page of the target disk according to the data volume of the target IO data includes:

[0022] The memory address of the memory unit corresponding to the bitmap value of the target number of bits in the target dirty page being 0 is determined as the free memory address.

[0023] In a possible implementation, determining the memory address of the memory unit corresponding to the bitmap value of 0 in the target dirty page as the free memory address includes:

[0024] Each bitmap value in the target dirty page is traversed from the beginning, and the memory address of the memory unit with a bitmap value of 0 is selected as the free memory address.

[0025] In a possible implementation, when there are multiple free memory addresses;

[0026] The step of determining the free memory address from the target dirty page of the target disk according to the data volume of the target IO data includes:

[0027] Determine the target number of bits according to the data volume of the target IO data;

[0028] Each bitmap value in the target dirty page is traversed from the beginning, and the memory addresses of the memory units whose bitmap values ​​of the target number of bits are 0 are selected as the multiple free memory addresses.

[0029] In a possible implementation, the method further includes:

[0030] When the target IO data sent by the target disk is stored at the target memory address, the bitmap value corresponding to the target memory address in the target dirty page is set to 1.

[0031] In a possible implementation, the method further includes:

[0032] After the target IO data stored in the target memory address is sent to the physical address of the target disk, the target IO data is deleted from the target memory address, and the bitmap value corresponding to the target memory address in the target dirty page is set to 0.

[0033] In a possible implementation manner, the data transmission status of the target disk is the data transmission volume of the target disk within a specified time period.

[0034] In a possible implementation, generating a target circular list of a circular data structure according to the data transmission state of the target disk includes:

[0035] Determine the size of the first list according to the data transfer volume of the target disk within a specified time period;

[0036] A target circular list of a circular data structure of a first list size is generated.

[0037] That is, the size of the target circular list of each disk may be different, for example, it may be determined according to the IO pressure of the target disk, that is, the amount of data transferred within a specified time period.

[0038] In a possible implementation, generating a target circular list of a circular data structure according to the data transmission state of the target disk includes:

[0039] If the data transmission state of the target disk within the specified time period satisfies the first condition, a target circular list of a circular data structure with a second list size is generated.

[0040] In a possible implementation, the first condition is that the data transmission volume of the target disk within a specified time period is greater than a first threshold.

[0041] In a possible implementation, generating a target circular list of a circular data structure of a second list size includes:

[0042] Get the disaster recovery memory size requested by the target virtual machine;

[0043] The second list size of the target circular list is determined according to the size of the disaster recovery memory.

[0044] The size of the target circular list of each disk may be the same, that is, the second list size, and the second list size may be determined according to the current disaster recovery memory size, thereby ensuring that the target circular list can cover all disaster recovery memories.

[0045] In a possible implementation, the method further includes:

[0046] If the data transmission volume of the target disk within the specified time period is less than or equal to the first threshold, the target IO data sent by the target virtual machine to the target disk is sent to the cache disk, and the writing result is returned;

[0047] The target IO data in the cache disk is sent to the target disk.

[0048] In a possible implementation, the method further includes:

[0049] When it is detected that the occupancy rate of the disaster recovery memory is greater than a first occupancy threshold, an application is made to the target device for a backup disaster recovery memory of a specified size, and a bit map of the backup disaster recovery memory is generated accordingly.

[0050] In a possible implementation, the method further includes:

[0051] When it is detected that the occupancy rate of the disaster recovery memory is less than the second occupancy threshold, the memory corresponding to the specified number of bitmaps at the rear of the target dirty page in the disaster recovery memory is released, and part of the bitmaps is deleted accordingly.

[0052] That is, when the disaster recovery memory is too large (greater than the first occupancy threshold) or too small (less than the second occupancy threshold), the target virtual machine can apply for new backup disaster recovery memory or release excess disaster recovery memory, thereby improving the memory usage efficiency of the target device.

[0053] In a second aspect, the present invention provides a disaster recovery memory management device for a virtual machine, the device being arranged in a target virtual machine that starts disaster recovery; the target virtual machine running in a target device, the device comprising:

[0054] An acquisition module, used to acquire the data transmission status of a target disk in a target device; the target disk is a disk in the target device corresponding to a disaster recovery task of a target virtual machine;

[0055] A list module, used for generating a target circular list of a circular data structure according to the data transmission status of the target disk;

[0056] A writing module is used to select a target memory address in the disaster recovery memory for storage according to the target IO data sent by the target virtual machine to the target disk, and write the sent data information in the target circular list; the sent data information includes the target memory address, the data size of the target IO data and the physical address where the target IO data is sent;

[0057] The sending module is used to send the target IO data stored in the target memory address to the physical address of the target disk.

[0058] The present invention provides a virtual machine disaster recovery memory management device, which has the following advantages:

[0059] When a target virtual machine with disaster recovery turned on is running in the target device, the disk of the disaster recovery task corresponding to the target virtual machine can be obtained, and its data transmission status can be determined, and a target loop list of the production loop data structure can be listed; at this time, when the target virtual machine needs to send target IO data to the target disk, the target virtual machine first selects the target memory address in the disaster recovery memory for storage, and writes relevant information in the target loop list at the same time, that is, the target memory address where the target IO data is stored, the data size of the target IO data, and the physical address to which the target IO data is about to be sent to the target disk; then the target virtual machine can send the IO data stored in the target memory address to the physical address of the target disk according to the target loop list. In the above scheme, each disk will generate its corresponding target circular list, and each circular list records the target memory address occupied in the disaster recovery memory. That is, each disk will apply for the target memory address from the disaster recovery memory only when it needs to send IO data, and record the information in its own target circular list. Therefore, disks with high IO pressure will naturally apply for more memory for disaster recovery, realizing the on-demand allocation of disaster recovery memory during the disaster recovery process, and each disk can realize the normal sending of IO data in the disaster recovery memory according to the data in its own target circular list. Therefore, the above scheme significantly improves the utilization efficiency of the disaster recovery memory of the virtual machine.

[0060] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the disaster recovery memory management method for a virtual machine of the above-mentioned first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0061] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the disaster recovery memory management method for a virtual machine of the first aspect or any corresponding embodiment thereof.

[0062] In a fifth aspect, the present invention provides a computer program product, including computer instructions, which are used to enable a computer to execute the disaster recovery memory management method for a virtual machine of the above-mentioned first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0064] Figure 1 It is a schematic flow chart of a method for disaster recovery memory management of a virtual machine provided by an embodiment of the present invention;

[0065] Figure 2 A schematic diagram showing a correspondence relationship between a virtual memory address space and a virtual machine physical memory address involved in an embodiment of the present application is shown;

[0066] Figure 3 It is a flow chart of another method for disaster recovery memory management of a virtual machine provided by an embodiment of the present invention;

[0067] Figure 4 A schematic diagram showing a corresponding relationship between a dirty page and a disaster recovery memory involved in an embodiment of the present application is shown;

[0068] Figure 5 A schematic diagram of the architecture of a data description list involved in an embodiment of the present application is shown;

[0069] Figure 6 The embodiment of the present application provides a disaster recovery memory management device for a virtual machine;

[0070] Figure 7 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0071] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0072] Data disaster recovery system is a system that ensures the recovery of computer information systems and reduces data and information loss when a disaster occurs. In a broad sense, all business continuity-related content is included in disaster recovery. For IT, it provides a computing system that prevents user business systems from being affected and damaged by various disasters. In a narrow sense, it means that in addition to the production site, the user has established a redundant site. When a disaster occurs and the production site is damaged, the disaster recovery site can take over the user's normal business to achieve the purpose of business continuity. Data disaster recovery system is the highest level of data storage and backup. CDP (Continuous Data Protection) is a method that can independently capture or track data modifications to primary data and save changes, thereby realizing recovery from any non-preset point in the past. Its biggest advantage is that the protection of data is continuous and can be quickly restored, which fundamentally solves the inherent weaknesses of low recovery capabilities and non-precise time strategies in traditional backups. CDP technical principle: First, continuous or interval assignment strategies are used to achieve continuous replication of data including system data in the user system to ensure that when a disaster occurs, the data is restored to the latest time point. At the same time, the replication time point snapshot technology is used to continuously generate multiple fixed images at time points. These images are not only time-refined, but also directly available snapshots that can be directly mounted and used. For a large number of failures, such as virus invasion, manual operation errors, software DBUG, etc., as long as the image is found and simple spatial relocation is performed, the damaged data will be reproduced. CDP technology requires a full backup of a certain disk, and then records all IO data after the full backup. The image file at the corresponding moment can be obtained by integrating the full backup and the IO data of a specific time period. Therefore, the first condition for implementing CDP technology is to ensure that all IO changes after the full backup of the disk can be recorded.

[0073] An important part of a disaster recovery strategy process is to use memory reasonably to efficiently obtain IO data from the qemu process without affecting the operation of the original virtual machine. Since these IO data may come from different devices, the large amount of IO data obtained from the qemu process needs to be classified and managed in an orderly manner.

[0074] In the embodiment of the present application, qemu (Quick Emulator) is a general and open source simulator and virtual machine management program. Qemu can simulate a complete system, including hardware components such as CPU, storage, network interface, etc., thereby allowing users to run multiple different operating systems on a host system.

[0075] The qemu process refers to the process started by qemu at runtime. Specifically, when qemu is used to start a virtual machine, the qemu process will be responsible for performing the following tasks: 1. CPU simulation, qemu can simulate a variety of different CPU architectures, such as x86, ARM, MIPS, etc. This makes it possible to run virtual machines of different architectures on a physical host. 2. Memory management, qemu manages the memory allocation of virtual machines, including the mapping of physical memory and virtual memory. 3. Device simulation, qemu can simulate various hardware devices, such as network adapters, hard disk controllers, graphics cards, etc. These devices can be identified and used through the BIOS (Basic Input Output System) or firmware of the virtual machine. 4. System management, the qemu process is responsible for managing the startup, suspension, resumption and shutdown of the virtual machine. 5. I / O virtualization, qemu handles the input and output operations of the virtual machine, such as disk reading and writing, network communication, etc.

[0076] In the embodiment of the present application, the virtual machine may perform disaster recovery operations on multiple disks, and the IO pressure of each disk may vary greatly. Analogously, the Linux process manages the virtual memory of each process and uses a competitive mode of memory allocation. All disk IOs are sent to a storage location (disaster recovery memory). The proportion of disaster recovery memory used by each disk is dynamically adjusted according to the changes in the IO sending pressure of each disk, so that precious memory resources can be better utilized.

[0077] To solve the above problems, an embodiment of the present invention provides a disaster recovery memory management mechanism for virtual machines. The virtual machine may perform disaster recovery operations on multiple disks, and the IO pressure of each disk may be very different. Analogously to the Linux process managing the virtual memory of each process, a competitive mode memory allocation method is used, and all disk IOs are sent to a storage location (disaster recovery memory). The proportion of each disk using disaster recovery memory is dynamically adjusted according to the change in the IO sending pressure of each disk, so that precious memory resources can be better utilized. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system (computer device) including, for example, a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.

[0078] In this embodiment, a method for managing the disaster recovery memory of a virtual machine is provided, which can be used for the above-mentioned terminal devices, such as mobile phones, tablet computers, etc. Figure 1The present invention provides a flow chart of a method for managing virtual machine disaster recovery memory, which is used to start a target virtual machine for disaster recovery. The target virtual machine runs in a target device. Optionally, the target device may be a PC (Personal Computer), a tablet computer, a mobile phone, or other terminal device that can deploy a virtual machine. Optionally, the target device may also be a server that can deploy a virtual machine. Figure 1 As shown, the process includes the following steps.

[0079] Step S101, obtaining the data transmission status of a target disk in a target device, wherein the target disk is a disk in the target device corresponding to a disaster recovery task of a target virtual machine.

[0080] In a disaster recovery system, the target device is usually a server running a virtual machine, and the target disk is the disk of the virtual machine, which stores data related to the disaster recovery task.

[0081] Optionally, the target device can obtain the current disk usage by monitoring the data transfer status (such as read / write rate, I / O load, latency) of the target disk. Specifically, this can be achieved through a monitoring tool provided by the operating system or a customized monitoring script.

[0082] Step S102: Generate a target circular list of a circular data structure according to the data transmission status of the target disk.

[0083] In an embodiment of the present application, in order to efficiently manage disk I / O operations, a circular list data structure can be used to optimize memory allocation and release. For example, the target virtual machine can initialize a circular list of appropriate size according to the data transfer status of the target disk. Each node in the circular list represents a memory location for storing data information of the upcoming I / O operation.

[0084] The circular data structure adopted in the embodiment of the present application is a special type of data structure, in which the elements are arranged in a certain order and form a closed loop, that is to say, the first element can be directly accessed from the last element. Specifically, the circular data structure can be a circular linked list, a circular queue and a circular array, etc. Taking the circular list as an example, it can specifically include a one-way circular linked list and a two-way circular linked list. In a one-way circular linked list, the pointer of the last node of the linked list points to the first node, rather than NULL. In this way, traversing the linked list from any node will eventually return to the starting node. In a two-way circular linked list, each node has two pointers, one pointing to the next node and the other pointing to the previous node. The next pointer of the last node points to the first node, and the previous pointer of the first node points to the last node.

[0085] In the embodiment of the present application, the specific location information of the disk IO in the disaster recovery memory is represented by a circular list data structure, so that the variable used to describe the memory location can be used cyclically to reduce the operation of releasing memory.

[0086] In a possible implementation, the size of the target circular list is fixed. For example, the size of the target circular list may be determined according to the size of the applied disaster recovery memory.

[0087] In another possible implementation, the target virtual machine can also dynamically adjust the size of the circular list according to the real-time I / O load. If the disk I / O load increases, the circular list can be expanded; if the load decreases, the circular list can be reduced.

[0088] Step S103, according to the target IO data sent by the target virtual machine to the target disk, a target memory address is selected in the disaster recovery memory for storage, and the sent data information is written into the target circular list.

[0089] The sent data information includes the target memory address, the data size of the target IO data, and the physical address where the target IO data is sent.

[0090] Memory is a precious hardware resource. In some disaster recovery solutions, memory applications are large in number. Using a reasonable memory management method can improve the efficiency of using disaster recovery memory to a certain extent. When different disk IOs are written to disaster recovery memory, it is necessary to apply for storage space from the disaster recovery memory to cache IO data. In actual usage scenarios, some disaster recovery disk IOs are issued frequently and the data volume is large, so more disaster recovery memory storage space needs to be applied for, while some disk IOs are issued in small quantities and only a small amount of disaster recovery memory storage space is needed. Therefore, allocating memory on demand is a reasonable way to use disaster recovery memory.

[0091] For the entire disaster recovery virtual machine, apply for reasonable memory capacity and allocate memory on demand according to the IO pressure of each disk, and dynamically release it according to the processing progress, leaving space for the disaster recovery of disks with greater pressure; use a circular list data structure to represent the specific location information of disk IO in the disaster recovery memory, so that the variables used to describe the memory location can be used cyclically to reduce memory release operations.

[0092] In an embodiment of the present application, a dirty page mechanism is used to describe the usage of the entire disk, so that there is a basis for applying for IO memory cache space. At the same time, the dirty page is updated in real time when IO data is requested and memory is released.

[0093] Step S104: Send the target IO data stored in the target memory address to the physical address of the target disk.

[0094] To ensure data persistence, the I / O data in memory needs to be written to the target disk. After the write operation is completed, the memory address and the status in the loop list are updated to mark the memory address as available for reuse. At the same time, the completion of the write is recorded to ensure data consistency.

[0095] Optionally, if the write operation fails, a corresponding error handling mechanism can be triggered to ensure that data is not lost or corrupted.

[0096] Please refer to Figure 2 , which shows a schematic diagram of the correspondence between a virtual memory address space and a virtual machine physical memory address involved in an embodiment of the present application. Figure 2 As shown, in the embodiment of the present application, the target device establishes a target virtual machine through the qemu process, and the physical memory address corresponding to the target virtual machine corresponds to the virtual memory address space of the qumu process. In the embodiment of the present application, physical memory can be applied according to the principle that the virtual memory is greater than 1 for the disaster recovery cache.

[0097] To summarize, when a target virtual machine with disaster recovery turned on is running in the target device, the disk of the disaster recovery task corresponding to the target virtual machine can be obtained, and its data transmission status can be determined, and a target loop list of the production loop data structure can be generated; at this time, when the target virtual machine needs to send target IO data to the target disk, the target virtual machine first selects the target memory address in the disaster recovery memory for storage, and at the same time writes relevant information in the target loop list, that is, the target memory address where the target IO data is stored, the data size of the target IO data, and the physical address to which the target IO data is about to be sent to the target disk; then the target virtual machine can send the IO data stored in the target memory address to the physical address of the target disk according to the target loop list. In the above scheme, each disk will generate its corresponding target circular list, and each circular list records the target memory address occupied in the disaster recovery memory. That is, each disk will apply for the target memory address from the disaster recovery memory only when it needs to send IO data, and record the information in its own target circular list. Therefore, disks with high IO pressure will naturally apply for more memory for disaster recovery, realizing the on-demand allocation of disaster recovery memory during the disaster recovery process, and each disk can realize the normal sending of IO data in the disaster recovery memory according to the data in its own target circular list. Therefore, the above scheme significantly improves the utilization efficiency of the disaster recovery memory of the virtual machine.

[0098] The basic logic of the virtual machine sending IO to the storage is that the virtual machine driver converts the address of the IO data to be sent to the qemu process. In essence, it is the conversion of the virtual machine physical address to the physical machine virtual address. Because the running memory of the virtual machine is essentially applied from the host's memory, in some disaster recovery strategies, in order not to affect the performance of the original virtual IO, the strategy of storage for performance is used to apply for memory to store these data, sacrificing high-speed storage space to quickly cache these IO data, and then these IOs are dropped to the destination disaster recovery disk after caching. According to the previous description, memory can be applied based on the principle that the ratio of virtual memory to disaster recovery cache is greater than 1. On this basis, the amount of memory applied can be said to be in G units. In other words, it is a considerable amount of storage. Therefore, it is very necessary to manage the considerable amount of memory.

[0099] Therefore, a disaster recovery memory management method for a virtual machine is provided in an embodiment of the present application, which can be used for the above-mentioned terminals, such as mobile phones, tablet computers, etc., or servers, such as cloud servers. Figure 3 FIG. 1 is a flow chart of another method for managing a virtual machine's disaster recovery memory provided by an embodiment of the present invention. Figure 3 As shown, the method specifically includes the following steps:

[0100] Step S301, obtaining the data transmission status of the target disk in the target device;

[0101] The target disk is a disk in the target device that corresponds to the disaster recovery task of the target virtual machine.

[0102] Optionally, in an embodiment of the present application, the target device includes several disks, and the target virtual machine can select some of the disks as target disks to perform disaster recovery operations.

[0103] Step S302: Generate a target circular list of a circular data structure according to the data transmission status of the target disk.

[0104] In a possible implementation, the data transmission status of the target disk is the data transmission volume of the target disk within a specified time period.

[0105] In this case, the target virtual machine may determine the first list size according to the data transfer volume of the target disk within a specified time period; and generate a target circular list of a circular data structure of the first list size.

[0106] That is to say, there may be multiple target disks in the target device for disaster recovery operations. For each target disk, the target virtual machine can determine the size of the target circular list according to the data transmission volume of the target disk in a specified time period, that is, the IO pressure of the target disk. The target circular list is used to record the relevant information of the IO data sent (including the occupancy information of the disaster recovery memory). Therefore, the size of the target circular list determines the amount of disaster recovery memory that the target disk can occupy. Through this solution, the target disk with greater transmission pressure occupies more disaster recovery memory.

[0107] In another possible implementation, if the data transmission state of the target disk within the specified time period satisfies the first condition, a target circular list of a circular data structure with a second list size is generated.

[0108] At this time, the first condition is that the data transmission volume of the target disk within the specified time period is greater than a first threshold.

[0109] That is to say, for each target disk, the target virtual machine can obtain its data transmission status within a specified time period, that is, the IO pressure, and determine whether the IO pressure of the target disk requires the execution of the management scheme shown in the embodiment of the present application. If the IO pressure is large, the disaster recovery memory management method shown in the embodiment of the present application is used to use the disaster recovery memory to send IO data.

[0110] Furthermore, in another possible implementation method of the embodiment of the present application, if the data transmission volume of the target disk within a specified time period is less than or equal to a first threshold, the target IO data sent by the target virtual machine to the target disk is sent to the cache disk, and the write result is returned; the target virtual machine sends the target IO data in the cache disk to the target disk.

[0111] That is, when the IO pressure of the target disk is relatively small, you can select other disks other than the target disk as cache disks. The target virtual machine first writes data to the cache disk and returns the write result. The target virtual machine then sends the target IO data in the cache disk to the target disk. In this solution, the cache disk can replace the role of the disaster recovery memory, thereby sacrificing part of the IO sending speed in exchange for the memory of the target device. Although the target virtual machine may save files for a long time, it is difficult for users to perceive it when the IO pressure is relatively small. It can free up part of the disaster recovery memory so that it can be used to process other tasks.

[0112] In another possible implementation, before generating the target circular list of the circular data structure of the second list size, the virtual machine obtains the disaster recovery memory size requested by the target virtual machine; and determines the second list size of the target circular list according to the disaster recovery memory size.

[0113] Step S303 , according to the target IO data sent by the target virtual machine to the target disk, a target memory address is selected in the disaster recovery memory for storage, and the sent data information is written into the target circular list.

[0114] The sent data information includes the target memory address, the data size of the target IO data, and the physical address where the target IO data is sent.

[0115] In a possible implementation of the embodiment of the present application, the memory applied for disaster recovery must first be divided into blocks, that is, the entire storage space must be divided into basic management units. According to the rule of the IO data size sent by qemu, the IO data size is generally a multiple of 256B, so the size of the basic unit can be set to 256B, and then there must be an object that describes the overall memory usage status, namely the dirty page, and each bit represents whether a basic unit is used. With this information, we can reasonably apply for the memory to be used; with the overall memory description, we want to use this data in a circular list mode, and we need to create a data structure. The data structure describes the description of the IO data cache sent by the qemu process for each disk. The basic information should include: the address of the IO sent to the disk, the size of the data sent by IO, and the address position of the IO sent data in the shared memory. With these three pieces of information, the data content to be written to the target address can be basically described. This is the information of the IO data sent once. For the information of multiple IO data sent, multiple circular columns can be created to represent the representation of the sent data.

[0116] Dirty pages are a concept in operating system memory management, referring to memory pages that have been modified but not yet written back to disk. Dirty pages are a bridge between memory management and persistent storage, and are critical to ensuring data consistency and system performance. The operating system divides memory into fixed-size blocks called memory pages (usually 4KB). These memory pages are used to store running programs and data. When the system is low on memory, the operating system writes some memory pages to disk to make room for memory. These pages written to disk are called swap pages. When these pages are needed, the system reloads them from disk to memory. When the data in a memory page is modified (for example, new data is written by a program), the operating system marks the page as a dirty page. This means that the content of the page is no longer consistent with the data on disk and needs to be written back to disk at the appropriate time.

[0117] In the embodiment of the present application, a target dirty page is defined to be composed of various bitmap values, and each bitmap value represents whether the memory of each memory address has been occupied and the data has not been written to the disk. If the memory of the memory address has been occupied, the bitmap value corresponding to the memory address is set to 1, indicating that the memory cannot be used to store other IO data at this time; if the data in the memory has been written to the disk, the data in the memory is cleared at this time, and the bitmap value corresponding to the corresponding memory address will be reset to 0, indicating that the memory can be reused to store the IO data sent.

[0118] In one possible implementation, the data volume of the target IO data sent by the target disk is determined; the free memory address of the disaster recovery memory is determined from the target dirty page; the target memory address corresponding to the data volume of the target IO data is determined in the free memory address, and the target IO data sent by the target disk is saved.

[0119] From the above structure of disaster recovery memory, it can be seen that the disaster recovery memory is divided into basic management units. At this time, each basic management unit has its corresponding memory address, and the target virtual machine generates a target dirty page for the disaster recovery memory. The data in the target dirty page can represent whether the basic management unit corresponding to each memory address stores data. If there is no data, the memory address is an idle memory address.

[0120] Therefore, when the target disk sends the target IO data, the target virtual machine needs to determine how many basic management units it needs to occupy according to the data size of the target IO data, and select an available memory address (that is, a free memory address) in the target dirty page to save the target IO data sent by the target disk.

[0121] In a possible implementation, the target dirty page includes multiple bitmap values; the multiple bitmap values ​​respectively correspond to the storage status of each memory unit in the disaster recovery memory; the disaster recovery memory is the memory allocated by the target device to the target virtual machine for disaster recovery; the target virtual machine determines the memory address of the memory unit corresponding to the bitmap value of the target bit number in the target dirty page being 0 as the free memory address.

[0122] In an embodiment of the present application, the target dirty page includes multiple bitmap values, each bitmap value corresponds to a memory unit (that is, a basic management unit) of a memory address, and when the bitmap value is 0, it represents that the memory unit of the memory address is idle; when the bitmap value is 1, it represents that data is stored in the memory unit of the memory address.

[0123] In a possible implementation, each bitmap value in the target dirty page is traversed from the beginning, and the memory address of the memory unit with a bitmap value of 0 is selected as the free memory address.

[0124] In the embodiment of the present application, if it is necessary to obtain a free memory address, each bitmap value in the target dirty page can be traversed from the beginning, and the memory address of the memory unit corresponding to the bitmap value of 0 can be selected. Through this scheme, the target virtual machine can give priority to using the memory unit corresponding to the bitmap value of the front part of the target dirty page. Since in the embodiment of the present application, the continuous bitmap values ​​in the target dirty page correspond to the continuous memory addresses in the disaster recovery memory, the target virtual machine can actually give priority to using a certain part of the disaster recovery memory to implement IO data delivery, so that if the disaster recovery memory requested by the target virtual machine is too large, the unused part of the memory can be directly released very conveniently, thereby improving the target device's memory usage efficiency.

[0125] In a possible implementation, when there are multiple free memory addresses, each bitmap value in the target dirty page is traversed from the beginning, and the memory addresses of the memory units whose bitmap values ​​of the target bits are 0 are selected as the multiple free memory addresses.

[0126] If the IO data delivery needs to occupy the target number of free memory addresses, then the bitmap values ​​in the target dirty page can be traversed from the beginning, and the memory addresses of the memory units with the target number of bits and the bitmap value of 0 can be selected in turn.

[0127] In a possible implementation, when the target IO data sent by the target disk is stored at the target memory address, the bitmap value corresponding to the target memory address in the target dirty page is set to 1.

[0128] In an embodiment of the present application, after a free memory address corresponding to a bitmap value of 0 is selected as the target memory address, if the target memory address stores the target IO data sent to the target disk, the corresponding bitmap value in the target dirty page can be temporarily set to 1, thereby indicating that the target memory address has been occupied.

[0129] Please refer to Figure 4 , which shows a schematic diagram of the correspondence between a dirty page and a disaster recovery memory involved in an embodiment of the present application. Figure 4 As shown, for a dirty page (dirty map), there are multiple bitmap values, and a bitmap value of 0 represents that the corresponding part of the disaster recovery memory is idle; and a bitmap value of 1 represents that the corresponding part of the disaster recovery memory stores IO data.

[0130] Step S304: Send the target IO data stored in the target memory address to the physical address of the target disk.

[0131] Please refer to Figure 5 , which shows a schematic diagram of the architecture of a data description list involved in an embodiment of the present application. Figure 5As shown, the data description list is the target loop list of the loop data structure. The various data in the target loop list are used to describe the memory size, memory address and other information occupied by the IO data. Specifically, there is also a corresponding description of the data to be processed list in the present application, which is used to record in real time the position of the data content updated each time in the loop list.

[0132] Step S305, after the target IO data stored in the target memory address is sent to the physical address of the target disk, the sent data information in the target circulation list is deleted.

[0133] That is, after the target IO data stored in the target memory address is sent to the physical address of the target disk, the target memory address needs to be recycled so that other IO data can use the target memory address for cache.

[0134] In a possible implementation, after the target IO data stored in the target memory address is sent to the physical address of the target disk, the target IO data is deleted from the target memory address, and the bitmap value corresponding to the target memory address in the target dirty page is set to 0.

[0135] Data recovery in shared memory mainly relies on the dirty page mechanism. The bitmap value corresponding to the storage location in the disaster recovery memory of the data that has been sent to the lower-speed disk is set to 0. This can recycle the shared storage space. Secondly, we need a list to record those data updates. The position of the data content in the circular list needs to be recorded in real time each time the data is updated. The processed data also needs to be deleted from these data lists. These are the data in the shared memory that need to be updated when they fall into the cache storage pool.

[0136] In a possible implementation, when it is detected that the occupancy rate of the disaster recovery memory is greater than a first occupancy threshold, a request is made to the target device for a backup disaster recovery memory of a specified size, and a bit map of the backup disaster recovery memory is generated accordingly.

[0137] In a possible implementation, when it is detected that the occupancy rate of the disaster recovery memory is less than the second occupancy threshold, the memory corresponding to the specified number of bitmaps behind the target dirty page in the disaster recovery memory is released, and part of the bitmaps is deleted accordingly.

[0138] In the embodiment of the present application, the size of the disaster recovery memory can be changed in real time, and its change can be determined according to the occupancy rate of the disaster recovery memory. For example, when the occupancy rate of the disaster recovery memory is large and greater than the first occupancy threshold (for example, 90%), it means that the previously applied disaster recovery memory is almost occupied. At this time, in order to avoid affecting the disaster recovery process, the target virtual machine can apply for more memory as a backup disaster recovery memory, and generate corresponding dirty pages to record the status of the backup memory. Correspondingly, when the occupancy rate of the disaster recovery memory is small, it means that the previously applied disaster recovery memory is too much, and the disaster recovery of the target virtual machine does not need such a large scale of disaster recovery memory, and because the target memory address was previously selected in the disaster recovery memory, it was obtained by traversing the target dirty page from the beginning, so the part of the memory in the disaster recovery memory corresponding to the bitmap at the back of the target dirty page should not be occupied in theory, so the part of the memory can be directly released, and the part of the bitmap in the target dirty page can be deleted accordingly.

[0139] That is to say, if the disaster recovery memory applied is also applied in batches, in other words, applied according to the overall IO pressure, use the first applied shared memory as the start of traversing the shared memory linked list, so that we have a variable that describes the batch application of shared memory. With this descriptive variable, we can realize hot release and addition of memory according to IO pressure, realize flexible memory occupation, and return the memory to the host when the IO pressure is small for other programs.

[0140] Therefore, it can be seen from the above steps that the embodiment of the present application proposes a disaster recovery memory management mechanism for virtual machine disaster recovery. Different circular data structures are used for different disks to describe the data of the IO they send, and a dirty page mechanism is used to describe the use of the entire memory. When the virtual machine sends IO, it applies for appropriate disaster recovery memory space according to the dirty page status to save the sent IO data and update the dirty page and record the location of the circular data structure where the sent IO data is located. Its execution logic is as follows:

[0141] 1. Apply for shared memory for the virtual machine with disaster recovery enabled, allocate a piece of data as the shared memory status information data, and initialize the bitmap;

[0142] The virtual machine applies for a shared memory segment to store disaster recovery related data. This shared memory segment will be accessed by multiple processes or virtual machine instances, and a portion of the shared memory is allocated to store disaster recovery status information. This status information may include data consistency flags, error status, and other metadata related to disaster recovery. The bitmap is used to track the usage and dirty page status of memory pages. Initializing the bitmap usually means clearing all bits to zero, indicating that all pages in memory are clean (unmodified).

[0143] 2. For the disks with disaster recovery enabled, create a ring data structure based on the number of disks to save data information in the disaster recovery memory location, including the shared memory address where the memory data is stored and the address where the data will be written to the disk.

[0144] The ring data structure is a cyclic data structure used to store and manage memory data. In the ring data structure, the storage location of the memory data (shared memory address) and the target disk write location are recorded, which helps to efficiently manage data transmission and synchronization.

[0145] 3. Traverse the dirty pages from the beginning according to the proximity principle, check the memory status, and apply for memory.

[0146] The virtual machine traverses the memory pages from the beginning, checks which pages are dirty pages (modified but not yet written back to disk), and checks the memory status. Specifically, it can determine which memory pages are dirty pages through bitmap or other memory management structures, and apply for these memories for subsequent data processing.

[0147] 4. Put the IO data into the space applied for in the disaster recovery memory and record the location in the ring data structure, update the list describing the usage of the ring data structure, and update the bitmap information describing the overall memory usage.

[0148] The virtual machine puts the IO data that needs to be written to the disk into the previously applied disaster recovery memory space and records the location. Specifically, the location of this data is recorded in the ring data structure, including the memory address and the target disk address. The virtual machine then updates the ring data structure list, that is, maintains a list to describe the usage of each buffer in the ring data structure. Finally, the virtual machine also needs to update the bitmap information to mark which memory pages have been used or written to the disk.

[0149] 5. After the data stored in the requested memory is consumed, the bitmap information and the list describing the acceptance and usage of the ring data are updated in a timely manner.

[0150] When the data in the memory is written to disk or consumed by other processes, the memory is released and the bitmap is updated to mark these memory pages as free or clean. Finally, the virtual machine needs to update the ring data structure list and adjust the usage list of the ring data structure to reflect which buffers have been released.

[0151] 6. Use memory in a circular manner.

[0152] The virtual machine repeats the above steps and cyclically uses memory pages and ring data structures to ensure data consistency and efficient transmission between memory and disk.

[0153] Through the above solution, the disaster recovery memory is used in a competitive mode for the entire virtual machine, and the storage is used reasonably according to the IO pressure of each disk. The dirty page mechanism is used to more reasonably supervise the use of each disk, and the memory can be dynamically hot-expanded. For the dynamically expanded memory, its address space can be put into the managed address variable for management, so that the corresponding dirty page can be found according to the address, and then the application and release can be realized.

[0154] To summarize, when a target virtual machine with disaster recovery turned on is running in the target device, the disk of the disaster recovery task corresponding to the target virtual machine can be obtained, and its data transmission status can be determined, and a target loop list of the production loop data structure can be generated; at this time, when the target virtual machine needs to send target IO data to the target disk, the target virtual machine first selects the target memory address in the disaster recovery memory for storage, and at the same time writes relevant information in the target loop list, that is, the target memory address where the target IO data is stored, the data size of the target IO data, and the physical address to which the target IO data is about to be sent to the target disk; then the target virtual machine can send the IO data stored in the target memory address to the physical address of the target disk according to the target loop list. In the above scheme, each disk will generate its corresponding target circular list, and each circular list records the target memory address occupied in the disaster recovery memory. That is, each disk will apply for the target memory address from the disaster recovery memory only when it needs to send IO data, and record the information in its own target circular list. Therefore, disks with high IO pressure will naturally apply for more memory for disaster recovery, realizing the on-demand allocation of disaster recovery memory during the disaster recovery process, and each disk can realize the normal sending of IO data in the disaster recovery memory according to the data in its own target circular list. Therefore, the above scheme significantly improves the utilization efficiency of the disaster recovery memory of the virtual machine.

[0155] In this embodiment, a disaster recovery memory management device for a virtual machine is also provided, and the device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0156] The present application embodiment provides a disaster recovery memory management device for a virtual machine, such as Figure 6 The device is provided in a target virtual machine with disaster recovery enabled; the target virtual machine runs in a target device, and the device includes:

[0157] The acquisition module 601 is used to acquire the data transmission status of the target disk in the target device; the target disk is the disk of the disaster recovery task corresponding to the target virtual machine in the target device;

[0158] List module 602, used for generating a target circular list of a circular data structure according to the data transmission status of the target disk;

[0159] The writing module 603 is used to select a target memory address in the disaster recovery memory for storage according to the target IO data sent by the target virtual machine to the target disk, and write the sent data information in the target circular list; the sent data information includes the target memory address, the data size of the target IO data, and the physical address where the target IO data is sent;

[0160] The sending module 604 is used to send the target IO data stored in the target memory address to the physical address of the target disk.

[0161] In a possible implementation, the sending module 604 is further configured to delete the sent data information in the target circular list after the target IO data stored in the target memory address is sent to the physical address of the target disk.

[0162] After the target IO data is sent to the physical address of the target disk, the sent data information in the target circular list can be deleted, and this part of the storage space of the target circular list can be used cyclically to store information corresponding to other IO data.

[0163] In a possible implementation, the writing module 603 is further used to determine the data volume of the target IO data sent by the target disk;

[0164] Determine the free memory address of the disaster recovery memory from the target dirty page;

[0165] A target memory address corresponding to the data amount of the target IO data is determined in the free memory address, and the target IO data sent by the target disk is saved.

[0166] Data recovery in shared memory mainly relies on the dirty page mechanism. The bitmap value corresponding to the storage location in the disaster recovery memory where the data that has been sent to the disk with a lower speed is set to 0. This can not only recycle the shared storage space, but also determine in real time which memory space is available for disaster recovery memory.

[0167] In a possible implementation, the target dirty page includes a plurality of bitmap values; the plurality of bitmap values ​​respectively correspond to the storage status of each memory unit in the disaster recovery memory; the disaster recovery memory is the memory allocated by the target device to the target virtual machine for disaster recovery;

[0168] The writing module 603 is further configured to determine the memory address of the memory unit corresponding to the bitmap value of the target number of bits in the target dirty page being 0 as the free memory address.

[0169] In a possible implementation, the writing module 603 is further configured to traverse each bitmap value in the target dirty page from the beginning, and select the memory address of the memory unit with a bitmap value of 0 as the free memory address.

[0170] In a possible implementation, when there are multiple free memory addresses;

[0171] The step of determining the free memory address from the target dirty page of the target disk according to the data volume of the target IO data includes:

[0172] Determine the target number of bits according to the data volume of the target IO data;

[0173] Each bitmap value in the target dirty page is traversed from the beginning, and the memory addresses of the memory units whose bitmap values ​​of the target number of bits are 0 are selected as the multiple free memory addresses.

[0174] In a possible implementation, the writing module 603 is further configured to set a bitmap value corresponding to the target memory address in the target dirty page to 1 when the target IO data sent by the target disk is saved at the target memory address.

[0175] In one possible implementation, the sending module 604 is also used to delete the target IO data stored in the target memory address after sending the target IO data to the physical address of the target disk, and set the bitmap value corresponding to the target memory address in the target dirty page to 0.

[0176] In a possible implementation manner, the data transmission status of the target disk is the data transmission volume of the target disk within a specified time period.

[0177] In a possible implementation, the list module 602 is further used to determine the first list size according to the data transfer volume of the target disk within a specified time period;

[0178] A target circular list of a circular data structure of a first list size is generated.

[0179] That is, the size of the target circular list of each disk may be different, for example, it may be determined according to the IO pressure of the target disk, that is, the amount of data transferred within a specified time period.

[0180] In a possible implementation, the list module 602 is further configured to generate a target circular list of a circular data structure of a second list size if the data transmission status of the target disk within a specified time period satisfies a first condition.

[0181] In a possible implementation, the first condition is that the data transmission volume of the target disk within a specified time period is greater than a first threshold.

[0182] In a possible implementation, the list module 602 is further used to obtain the disaster recovery memory size requested by the target virtual machine;

[0183] The second list size of the target circular list is determined according to the size of the disaster recovery memory.

[0184] The size of the target circular list of each disk may be the same, that is, the second list size, and the second list size may be determined according to the current disaster recovery memory size, thereby ensuring that the target circular list can cover all disaster recovery memories.

[0185] In a possible implementation, the sending module 604 is further configured to:

[0186] If the data transmission volume of the target disk within the specified time period is less than or equal to the first threshold, the target IO data sent by the target virtual machine to the target disk is sent to the cache disk, and the writing result is returned;

[0187] The target IO data in the cache disk is sent to the target disk.

[0188] In a possible implementation, the list module 602 is also used to apply for a backup disaster recovery memory of a specified size from the target device when it is detected that the occupancy rate of the disaster recovery memory is greater than a first occupancy threshold, and to generate a bit map of the backup disaster recovery memory accordingly.

[0189] In one possible implementation, the list module 602 is also used to release the memory corresponding to the specified number of bit maps at the rear of the target dirty page in the disaster recovery memory when it is detected that the occupancy rate of the disaster recovery memory is less than a second occupancy threshold, and delete part of the bit maps accordingly.

[0190] That is, when the disaster recovery memory is too large (greater than the first occupancy threshold) or too small (less than the second occupancy threshold), the target virtual machine can apply for new backup disaster recovery memory or release excess disaster recovery memory, thereby improving the memory usage efficiency of the target device.

[0191] The disaster recovery memory management device of the virtual machine in this embodiment is presented in the form of a functional module, where the module refers to an application specific integrated circuit (ASIC), a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0192] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0193] In an embodiment of the present invention, when a target virtual machine with disaster recovery turned on is running in a target device, the disk of the disaster recovery task corresponding to the target virtual machine can be obtained, and its data transmission status can be determined, and a target loop list of the production loop data structure can be generated according to it; at this time, when the target virtual machine needs to send target IO data to the target disk, the target virtual machine first selects the target memory address in the disaster recovery memory for storage, and at the same time writes relevant information in the target loop list, that is, the target memory address where the target IO data is stored, the data size of the target IO data, and the physical address to which the target IO data is about to be sent to the target disk; then the target virtual machine can send the IO data stored in the target memory address to the physical address of the target disk according to the target loop list. In the above scheme, each disk will generate its corresponding target circular list, and each circular list records the target memory address occupied in the disaster recovery memory. That is, each disk will apply for the target memory address from the disaster recovery memory only when it needs to send IO data, and record the information in its own target circular list. Therefore, disks with high IO pressure will naturally apply for more memory for disaster recovery, realizing the on-demand allocation of disaster recovery memory during the disaster recovery process, and each disk can realize the normal sending of IO data in the disaster recovery memory according to the data in its own target circular list. Therefore, the above scheme significantly improves the utilization efficiency of the disaster recovery memory of the virtual machine.

[0194] The embodiment of the present invention also provides a computer device having the above Figure 6 A disaster recovery memory management device for a virtual machine is shown.

[0195] See also Figure 7 , Figure 7 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 7 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 7A processor 10 is taken as an example.

[0196] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0197] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0198] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the use of a computer device based on the presentation of a small program landing page, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer 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.

[0199] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0200] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 7 The example of connecting through bus is taken in the following.

[0201] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.

[0202] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0203] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0204] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for managing a virtual machine's disaster recovery memory, characterized in that: The method is used to start a target virtual machine for disaster recovery; the target virtual machine runs in a target device, and the method includes: Acquire the data transmission status of the target disk in the target device; the target disk is the disk of the disaster recovery task corresponding to the target virtual machine in the target device; Generate a target circular list of a circular data structure according to the data transmission status of the target disk; According to the target IO data sent by the target virtual machine to the target disk, a target memory address is selected in the disaster recovery memory for storage, and the sent data information is written into the target circular list; the sent data information includes the target memory address, the data size of the target IO data, and the physical address where the target IO data is sent; The target IO data stored in the target memory address is sent to the physical address of the target disk.

2. The method according to claim 1, characterized in that: The method further comprises: When the target IO data stored in the target memory address is sent to the physical address of the target disk, the sent data information in the target circulation list is deleted.

3. The method according to claim 2, characterized in that The step of selecting a target memory address in a disaster recovery memory for storage according to the target IO data sent by the target virtual machine to the target disk includes: Determine the data volume of the target IO data sent by the target disk; Determine the free memory address of the disaster recovery memory from the target dirty page; A target memory address corresponding to the data amount of the target IO data is determined in the free memory address, and the target IO data sent by the target disk is saved.

4. The method according to claim 3, characterized in that The target dirty page includes a plurality of bitmap values; the plurality of bitmap values ​​respectively correspond to the storage status of each memory unit in the disaster recovery memory; The disaster recovery memory is the memory allocated by the target device to the target virtual machine for disaster recovery; The step of determining the free memory address from the target dirty page of the target disk according to the data volume of the target IO data includes: The memory address of the memory unit corresponding to the bitmap value of the target number of bits in the target dirty page being 0 is determined as the free memory address.

5. The method according to claim 4, characterized in that The step of determining the memory address of the memory unit corresponding to the bitmap value of 0 in the target dirty page as the free memory address comprises: Each bitmap value in the target dirty page is traversed from the beginning, and the memory address of the memory unit with a bitmap value of 0 is selected as the free memory address.

6. The method according to claim 5, characterized in that When there are multiple free memory addresses; The step of determining the free memory address from the target dirty page of the target disk according to the data volume of the target IO data includes: Determine the target number of bits according to the data volume of the target IO data; Each bitmap value in the target dirty page is traversed from the beginning, and the memory addresses of the memory units whose bitmap values ​​of the target number of bits are 0 are selected as the multiple free memory addresses.

7. The method according to claim 4, characterized in that The method further comprises: When the target IO data sent by the target disk is stored at the target memory address, the bitmap value corresponding to the target memory address in the target dirty page is set to 1.

8. The method according to claim 7, characterized in that The method further comprises: After the target IO data stored in the target memory address is sent to the physical address of the target disk, the target IO data is deleted from the target memory address, and the bitmap value corresponding to the target memory address in the target dirty page is set to 0.

9. The method according to any one of claims 1 to 8, characterized in that: The data transmission status of the target disk is the data transmission volume of the target disk within a specified time period.

10. The method according to claim 9, characterized in that The step of generating a target circular list of a circular data structure according to the data transmission state of the target disk comprises: Determine the size of the first list according to the data transfer volume of the target disk within a specified time period; A target circular list of a circular data structure of a first list size is generated.

11. The method according to any one of claims 1 to 8, characterized in that: The step of generating a target circular list of a circular data structure according to the data transmission state of the target disk comprises: If the data transmission state of the target disk within the specified time period satisfies the first condition, a target circular list of a circular data structure with a second list size is generated.

12. The method according to claim 11, characterized in that The first condition is that the data transmission volume of the target disk within a specified time period is greater than a first threshold.

13. The method according to claim 12, characterized in that A target circular list of a circular data structure of a second list size is generated, comprising: Get the disaster recovery memory size requested by the target virtual machine; The second list size of the target circular list is determined according to the size of the disaster recovery memory.

14. The method according to claim 12, characterized in that The method further comprises: If the data transmission volume of the target disk within the specified time period is less than or equal to the first threshold, the target IO data sent by the target virtual machine to the target disk is sent to the cache disk, and the writing result is returned; The target IO data in the cache disk is sent to the target disk.

15. The method according to any one of claims 1 to 8, characterized in that: The method further comprises: When it is detected that the occupancy rate of the disaster recovery memory is greater than a first occupancy threshold, an application is made to the target device for a backup disaster recovery memory of a specified size, and a bit map of the backup disaster recovery memory is generated accordingly.

16. The method according to any one of claims 1 to 8, characterized in that: The method further comprises: When it is detected that the occupancy rate of the disaster recovery memory is less than the second occupancy threshold, the memory corresponding to the specified number of bitmaps at the rear of the target dirty page in the disaster recovery memory is released, and part of the bitmaps is deleted accordingly.

17. A disaster recovery memory management device for a virtual machine, characterized in that: The device is set in a target virtual machine that starts disaster recovery; the target virtual machine runs in a target device, and the device includes: An acquisition module, used to acquire the data transmission status of a target disk in a target device; the target disk is a disk in the target device corresponding to a disaster recovery task of a target virtual machine; A list module, used for generating a target circular list of a circular data structure according to the data transmission status of the target disk; A writing module is used to select a target memory address in the disaster recovery memory for storage according to the target IO data sent by the target virtual machine to the target disk, and write the sent data information in the target circular list; the sent data information includes the target memory address, the data size of the target IO data and the physical address where the target IO data is sent; The sending module is used to send the target IO data stored in the target memory address to the physical address of the target disk.

18. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the disaster recovery memory management method for a virtual machine according to any one of claims 1 to 16 by executing the computer instructions.

19. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the disaster recovery memory management method for a virtual machine according to any one of claims 1 to 16.

20. A computer program product, characterized in that The method comprises computer instructions, wherein the computer instructions are used to enable a computer to execute the disaster recovery memory management method for a virtual machine according to any one of claims 1 to 16.