Memory snapshot creation method, device, equipment and readable storage medium

By obtaining dirty data page addresses and writing them to persistent memory during the virtual machine creation cycle, the problem of memory snapshot creation in the existing technology is solved, and the effect of shortening the virtual machine suspend time and avoiding business interruptions is achieved. .

CN113641446BActive Publication Date: 2025-02-07FIBERHOME TELECOMMUNICATION TECHNOLOGIES CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110790639.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-13
Publication Date
2025-02-07
Estimated Expiration
2041-07-13

AI Technical Summary

Technical Problem

In the prior art, it takes a long time to create memory snapshots, resulting in an extended virtual machine hang time and affecting business continuity.

Method used

Get the dirty data page address at each preset moment of the creation cycle, and write its corresponding memory content to persistent memory, and finally create a memory snapshot at the end of the creation cycle.

Benefits of technology

By reducing the time spent in memory snapshot creation, the virtual machine hang time is shortened and business interruptions are avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113641446B_ABST
    Figure CN113641446B_ABST
Patent Text Reader

Abstract

The present invention provides a memory snapshot creation method, device, equipment and readable storage medium. The method comprises: obtaining the dirty data page address recorded in the corresponding sub-period at each preset moment in the creation cycle; writing the memory content corresponding to the dirty data page address obtained each time into the persistent memory; at the last moment of the creation cycle, creating a memory snapshot corresponding to the creation cycle according to all the memory content written into the persistent memory during the creation cycle. Through the present invention, the time required for creating a memory snapshot is reduced, thereby shortening the suspension time of the virtual machine when creating a whole machine snapshot, and avoiding business interruption on the virtual machine.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of virtual machine technology, and in particular to a memory snapshot creation method, device, equipment and readable storage medium. Background Art

[0002] With the widespread use of virtualization technology, more and more traditional applications are gradually migrated to cloud platforms. The use of virtual machines is becoming more and more diverse, and the requirements for virtualization performance and reliability are also constantly increasing. The corresponding virtualization technology is becoming more and more abundant and perfect. In order to adapt to the diverse usage scenarios and meet the needs of different scenarios, virtualization is constantly surpassing physical machines with the help of the characteristics of out-of-band management of virtual machines while benchmarking physical machines. For example, virtualization snapshot technology is a virtual machine backup technology that is continuously optimized from the backup of physical machines. The technology of automatically restoring a failed virtual machine using snapshots is something that physical machines cannot achieve.

[0003] Currently, there are two main implementation forms of virtual machine snapshots: one is a storage snapshot that only backs up storage data, and the other is a whole machine snapshot that combines storage and memory snapshots. Storage snapshots are used in scenarios where only data needs to be backed up, while storage + memory snapshots can retain the business status at the snapshot time. The basic implementation process of snapshots is: suspend the virtual machine → create a snapshot → restore the virtual machine. After the virtual machine is suspended, the internal business of the virtual machine is interrupted, and the business is restored after the virtual machine is restored. Since the virtual machine cannot provide services normally during the creation of a snapshot, each virtualization platform tries to shorten the virtual machine suspension time. The storage snapshot currently takes a very short time and there is little room for improvement. Therefore, how to optimize the time taken to create a memory snapshot and thus reduce the virtual machine suspension time is a technical problem that needs to be solved urgently. Summary of the invention

[0004] The main purpose of the present invention is to provide a memory snapshot creation method, device, equipment and readable storage medium, aiming to solve the technical problem that it takes a long time to create a memory snapshot in the prior art.

[0005] In a first aspect, the present invention provides a method for creating a memory snapshot, the method comprising:

[0006] At each preset time in the creation cycle, obtain the dirty data page address recorded in the corresponding sub-cycle;

[0007] Write the memory content corresponding to the dirty data page address obtained each time into the persistent memory;

[0008] At the end time of the creation cycle, a memory snapshot corresponding to the creation cycle is created according to all memory contents written into the persistent memory during the creation cycle.

[0009] Optionally, when the creation cycle is the first creation cycle, before the step of acquiring the dirty data page address recorded in the corresponding sub-cycle at each preset time in the creation cycle, the method further includes:

[0010] Applying for a first persistent memory space in the persistent memory, wherein the size of the first persistent memory space is consistent with the memory size of the virtual machine;

[0011] After the first persistent memory space is successfully applied for, the corresponding relationship between the virtual machine memory address and the first persistent memory space address is recorded.

[0012] Optionally, when the creation cycle is the first creation cycle, the step of writing the memory content corresponding to the dirty data page address obtained each time into the persistent memory includes:

[0013] Based on the corresponding relationship, the memory content corresponding to the dirty data page address obtained each time is overwritten and written into the storage area corresponding to the dirty data page address obtained each time in the first persistent memory space.

[0014] Optionally, when the creation cycle is not the first creation cycle and the memory snapshot chain depth value is 1, the step of writing the memory content corresponding to the dirty data page address obtained each time into the persistent memory includes:

[0015] Based on the corresponding relationship, the memory content corresponding to the dirty data page address obtained each time is overwritten and written into the storage area corresponding to the dirty data page address obtained each time in the first persistent memory space.

[0016] Optionally, when the creation cycle is not the first creation cycle, and the memory snapshot chain depth value is N, where N is a positive integer greater than 1, the step of writing the memory content corresponding to the dirty data page address obtained each time into the persistent memory includes:

[0017] When the number of created memory snapshots is less than N, a new persistent memory space is applied for in the persistent memory according to the size of the memory content corresponding to the dirty data page address obtained each time, and the size of the new persistent memory space is greater than or equal to the size of the memory content corresponding to the dirty data page address obtained each time;

[0018] After applying for a new persistent memory space successfully, the memory content corresponding to the dirty data page address obtained each time is written into the new persistent memory space.

[0019] Optionally, the step of writing the memory content corresponding to the dirty data page address obtained each time into the persistent memory further includes:

[0020] When the number of created memory snapshots is equal to N, the earliest created memory snapshot is merged with the second earliest created memory snapshot to release all persistent memory space applied in the second creation cycle;

[0021] Applying for a new persistent memory space in the persistent memory according to the size of the memory content corresponding to the dirty data page address obtained each time, wherein the size of the new persistent memory space is greater than or equal to the size of the memory content corresponding to the dirty data page address obtained each time;

[0022] After applying for a new persistent memory space successfully, the memory content corresponding to the dirty data page address obtained each time is written into the new persistent memory space.

[0023] Optionally, the memory snapshot creation method further includes:

[0024] When a virtual machine system crashes, the virtual machine is restored using each created memory snapshot in order from the last to the first creation sequence until the recovery is successful.

[0025] In a second aspect, the present invention further provides a memory snapshot creation device, the memory snapshot creation device comprising:

[0026] An acquisition module, used to acquire the dirty data page address recorded in the corresponding sub-cycle at each preset time in the creation cycle;

[0027] The writing module is used to write the memory content corresponding to the dirty data page address obtained each time into the persistent memory;

[0028] The creation module is used to create a memory snapshot corresponding to the creation cycle at the end time of the creation cycle according to all memory contents written into the persistent memory during the creation cycle.

[0029] In a third aspect, the present invention also provides a memory snapshot creation device, the memory snapshot creation device comprising a processor, a memory, and a memory snapshot creation program stored in the memory and executable by the processor, wherein when the memory snapshot creation program is executed by the processor, the steps of the memory snapshot creation method as described above are implemented.

[0030] In a fourth aspect, the present invention further provides a readable storage medium, on which a memory snapshot creation program is stored, wherein when the memory snapshot creation program is executed by a processor, the steps of the memory snapshot creation method as described above are implemented.

[0031] In the present invention, the dirty data page address recorded in the corresponding sub-period is obtained at each preset moment in the creation cycle; the memory content corresponding to the dirty data page address obtained each time is written into the persistent memory; at the last moment of the creation cycle, a memory snapshot corresponding to the creation cycle is created according to all the memory contents written into the persistent memory during the creation cycle. Through the present invention, the time required for creating a memory snapshot is reduced, thereby shortening the suspension time of the virtual machine when creating a whole machine snapshot, and avoiding business interruption on the virtual machine. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 A schematic diagram of the hardware structure of a memory snapshot creation device involved in an embodiment of the present invention;

[0033] Figure 2 A schematic diagram of a process flow of an embodiment of a method for creating a memory snapshot according to the present invention;

[0034] Figure 3 A schematic diagram of writing data to a persistent memory in an embodiment of a method for creating a memory snapshot of the present invention;

[0035] Figure 4 A schematic diagram of applying for persistent memory space in an embodiment of a method for creating a memory snapshot of the present invention;

[0036] Figure 5 A schematic diagram of applying for persistent memory space in another embodiment of the memory snapshot creation method of the present invention;

[0037] Figure 6 This is a schematic diagram of functional modules of an embodiment of a memory snapshot creation device of the present invention.

[0038] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0039] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0040] In a first aspect, an embodiment of the present invention provides a memory snapshot creation device, which may be a device having a data processing function, such as a personal computer (PC), a notebook computer, or a server.

[0041] Reference Figure 1 , Figure 1The hardware structure diagram of the memory snapshot creation device involved in the embodiment of the present invention. In the embodiment of the present invention, the memory snapshot creation device may include a processor 1001 (e.g., a central processing unit, CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components; the user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard); the network interface 1004 may optionally include a standard wired interface, a wireless interface (such as a wireless fidelity WIreless-FIdelity, WI-FI interface); the memory 1005 may be a high-speed random access memory (random access memory, RAM), or a stable memory (non-volatile memory), such as a disk storage, and the memory 1005 may optionally be a storage device independent of the aforementioned processor 1001. Those skilled in the art will understand that Figure 1 The hardware structure shown in the figure does not constitute a limitation of the present invention, and may include more or less components than those shown in the figure, or combine certain components, or arrange the components differently.

[0042] Continue to refer to Figure 1 , Figure 1 The memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a memory snapshot creation program. The processor 1001 may call the memory snapshot creation program stored in the memory 1005 and execute the memory snapshot creation method provided in the embodiment of the present invention.

[0043] In a second aspect, an embodiment of the present invention provides a method for creating a memory snapshot.

[0044] In one embodiment, referring to Figure 2 , Figure 2 FIG. 1 is a flow chart of an embodiment of a method for creating a memory snapshot according to the present invention. Figure 2 As shown, the memory snapshot creation method includes:

[0045] Step S10, obtaining the dirty data page address recorded in the corresponding sub-cycle at each preset time in the creation cycle;

[0046] In this embodiment, the length of the creation cycle and the length of the sub-cycle within the creation cycle are planned in advance according to the specific usage scenarios of the virtual machine, such as the memory specifications of the computing node, the CPU performance, the density of the virtual machine, the business characteristics of the virtual machine, etc. Each preset moment in the creation cycle is the end moment of each sub-cycle. For example, the length of the creation cycle is t, and the length of the sub-cycle is There are 3 sub-cycles in a creation cycle, and the end time of each sub-cycle is each preset time, totaling 3 preset times. Then, in a creation cycle, the dirty data page address recorded in the first sub-cycle is obtained at the first preset time, the dirty data page address recorded in the second sub-cycle is obtained at the second preset time, and the dirty data page address recorded in the third sub-cycle is obtained at the third preset time. It should be noted that this is only a schematic description, and the ratio between the length of the sub-cycle and the length of the creation cycle is set according to actual needs and is not limited here. Among them, the dirty data page address is the address of the memory whose content in the virtual machine memory has changed.

[0047] Step S20, writing the memory content corresponding to the dirty data page address obtained each time into the persistent memory;

[0048] In this embodiment, the length of the creation cycle is t, and the length of the sub-cycle is For example, after obtaining the dirty data page address recorded in the first sub-cycle at the first preset time in a cycle, the memory content corresponding to the dirty data page address is written into the persistent memory, and so on, the memory content corresponding to the dirty data page address obtained at each preset time is written into the persistent memory. Among them, the persistent memory is PMEM (Persistent Memory), which has the performance advantage of short reading and writing time. Figure 3 , Figure 3 Schematic diagram of writing data to persistent memory in an embodiment of a memory snapshot creation method of the present invention. Figure 3 As shown, when allocating physical memory to a virtual machine, apply for PMEM memory of the same specification. During the operation of the virtual machine, the physical memory corresponding to the virtual machine is written, and the dirty data page address is periodically written to the bitmap according to the sub-cycle. The dirty data page address in the bitmap is periodically read, and the memory content corresponding to the dirty data page address is written to the PMEM memory. The record in the bitmap is cleared at the end of the sub-cycle.

[0049] Step S30, at the end time of the creation cycle, creating a memory snapshot corresponding to the creation cycle according to all memory contents written into the persistent memory during the creation cycle.

[0050] In this embodiment, at the end time of a creation cycle, a memory snapshot corresponding to the creation cycle can be created according to all memory contents written into the persistent memory during the creation cycle.

[0051] In this embodiment, the memory snapshot mainly saves the content that has changed in the virtual machine memory. The usual saving method is to save it to a file on the computing node hard disk or the internal disk of the virtual machine. Based on the exploration of the principle of virtual machine memory management by VMM (Virtual Machine Monitor), it is found that the intermediate time consumption mainly comes from reading the memory to be saved and writing it to the disk. Based on this discovery, this embodiment proposes to optimize the writing process in combination with persistent memory, thereby reducing the time consumption of reading the memory to be saved and writing it to the disk, thereby reducing the time consumption required to create a memory snapshot.

[0052] In this embodiment, the dirty data page address recorded in the corresponding sub-period is obtained at each preset moment in the creation cycle; the memory content corresponding to the dirty data page address obtained each time is written into the persistent memory; at the last moment of the creation cycle, a memory snapshot corresponding to the creation cycle is created according to all the memory content written into the persistent memory during the creation cycle. Through this embodiment, the time required to create a memory snapshot is reduced, thereby shortening the suspension time of the virtual machine when creating a snapshot of the entire machine, and avoiding business interruption on the virtual machine.

[0053] Furthermore, in one embodiment, when the creation cycle is the first creation cycle, before step S10, the following steps are further included:

[0054] Step S01, applying for a first persistent memory space in the persistent memory, wherein the size of the first persistent memory space is consistent with the size of the virtual machine memory;

[0055] In this embodiment, after creating or starting a virtual machine, when the VMM allocates HPA (Host Physical Address) memory to the virtual machine, the first persistent memory space is applied for in the persistent memory, wherein the size of the first persistent memory space is consistent with the size of the virtual machine memory. For example, if the virtual machine memory size is 2G, the VMM will allocate 2G physical memory HPA to the virtual machine for directly storing the contents of the virtual machine memory. At this stage, applying for a storage space of 2G in the persistent memory is applying for the first persistent memory space.

[0056] Step S02: after successfully applying for the first persistent memory space, record the correspondence between the virtual machine memory address and the first persistent memory space address.

[0057] In this embodiment, after the first persistent memory space is successfully applied, the correspondence between the virtual machine memory address and the first persistent memory space address is recorded. For example, the virtual machine memory address is recorded as X1, X2, X3...Xm, and the first persistent memory space address is recorded as C1, C2, C3...Cm. The recorded correspondence is X1 corresponds to C1, X2 corresponds to C2, X3 corresponds to C3...Xm corresponds to Cm. Subsequently, in the first creation cycle, if the dirty data page address is X3 or X7, the memory contents corresponding to X3 and X7 can be written to C3 and C7 in the first persistent memory space respectively.

[0058] Further, in one embodiment, based on the previous embodiment, when the creation cycle is the first creation cycle, step S20 includes:

[0059] Based on the corresponding relationship, the memory content corresponding to the dirty data page address obtained each time is overwritten and written into the storage area corresponding to the dirty data page address obtained each time in the first persistent memory space.

[0060] In this embodiment, the length of the creation cycle is t, and the length of the sub-cycle is Take X2 as an example. In the first creation cycle, if the dirty data page address obtained for the first time is X2, the content in X2 is written to C2 in the first persistent memory space; if the dirty data page address obtained for the second time is X1 and X3, the content in X1 and X3 is written to C1 and C3 in the first persistent memory space respectively; if the dirty data page address obtained for the third time is X2, the content in X2 at this time is written to C2 in the first persistent memory space, that is, overwriting the content in X2 written to C2 for the first time. That is, each time the memory content corresponding to the obtained dirty data page address is written to the corresponding storage area in the first persistent memory space, if there is no data in the storage area, it is written directly; if there is data in the storage area, the original data is overwritten while writing the data.

[0061] Further, in one embodiment, based on the previous embodiment, when the creation cycle is not the first creation cycle and the memory snapshot chain depth value is 1, step S20 includes:

[0062] Based on the corresponding relationship, the memory content corresponding to the dirty data page address obtained each time is overwritten and written into the storage area corresponding to the dirty data page address obtained each time in the first persistent memory space.

[0063] In this embodiment, the depth value of the memory snapshot chain is determined in advance based on the specific usage scenario of the virtual machine, such as the memory specification of the computing node, the CPU performance, the virtual machine density, and the internal business characteristics of the virtual machine.

[0064] When the creation cycle is not the first creation cycle and the memory snapshot chain depth value is 1, for example, in the second creation cycle, each time the memory content corresponding to the acquired dirty data page address is written to the corresponding storage area in the first persistent memory space, if there is no data in the storage area, it is written directly; if there is data in the storage area, the original data is overwritten while writing the data.

[0065] Further, in one embodiment, when the creation cycle is not the first creation cycle, and the memory snapshot chain depth value is N, where N is a positive integer greater than 1, step S20 includes:

[0066] Step S201: when the number of created memory snapshots is less than N, applying for a new persistent memory space in the persistent memory according to the size of the memory content corresponding to the dirty data page address obtained each time, the size of the new persistent memory space being greater than or equal to the size of the memory content corresponding to the dirty data page address obtained each time;

[0067] In this embodiment, when the creation cycle is not the first creation cycle, and the memory snapshot chain depth value is N, N is a positive integer greater than 1, for example, N is set to 5. Figure 4 , Figure 4 Schematic diagram of applying for persistent memory space in an embodiment of a memory snapshot creation method of the present invention. Figure 4 As shown, in the third creation cycle, after the dirty data page address recorded in the corresponding sub-cycle is obtained at the first preset time, it is detected that the number of currently created memory snapshots is 2 (the memory snapshot corresponding to the first creation cycle and the memory snapshot corresponding to the second creation cycle), then a new persistent memory space is applied for in the persistent memory according to the size of the memory content corresponding to the dirty data page address recorded in the corresponding sub-cycle obtained at the first preset time. For example, if the size of the memory content corresponding to the dirty data page address recorded in the corresponding sub-cycle obtained at the first preset time is 300M, then a new persistent memory space of 3*128M is applied for in the persistent memory; similarly, if the size of the memory content corresponding to the dirty data page address recorded in the corresponding sub-cycle obtained at the second preset time is 500M, then a new persistent memory space of 4*128M is applied for in the persistent memory, and so on, that is, the size of the new persistent memory space applied for each time is a multiple of 128M and is larger than the size of the memory content to be written.

[0068] Step S202, after successfully applying for a new persistent memory space, write the memory content corresponding to the dirty data page address obtained each time into the new persistent memory space.

[0069] In this embodiment, if the size of the memory content corresponding to the dirty data page address recorded in the corresponding sub-period obtained at the first preset moment is 300M, a new persistent memory space of 3*128M is applied for in the persistent memory, and after the application is successful, the memory content of 300M is written into the new persistent memory space of 3*128M; similarly, if the size of the memory content corresponding to the dirty data page address recorded in the corresponding sub-period obtained at the second preset moment is 500M, a new persistent memory space of 4*128M is applied for in the persistent memory, and after the application is successful, the memory content of 500M is written into the new persistent memory space of 4*128M, and so on.

[0070] Furthermore, in one embodiment, based on the previous embodiment, step S20 further includes:

[0071] Step S203: when the number of created memory snapshots is equal to N, merge the earliest created memory snapshot with the second earliest created memory snapshot, and release all persistent memory space applied in the second creation cycle;

[0072] In this embodiment, when the creation cycle is not the first creation cycle, and the memory snapshot chain depth value is N, N is a positive integer greater than 1, for example, N is set to 5. Figure 5 , Figure 5 This is a schematic diagram of applying for persistent memory space in another embodiment of the memory snapshot creation method of the present invention. Figure 5 As shown, in the sixth creation cycle, after the dirty data page address recorded in the corresponding sub-cycle is obtained at the first preset time, it is detected that the number of memory snapshots currently created is 5 (the memory snapshot corresponding to the first creation cycle, the memory snapshot corresponding to the second creation cycle, the memory snapshot corresponding to the third creation cycle, the memory snapshot corresponding to the fourth creation cycle, and the memory snapshot corresponding to the fifth creation cycle). At this time, the earliest created memory snapshot is merged with the second earliest created memory snapshot. The specific method of the merger is to write the data in all persistent memory spaces applied for in the second creation cycle (i.e., the second persistent memory space) into the first persistent memory space, and release all persistent memory spaces applied for in the second creation cycle.

[0073] Step S204, applying for a new persistent memory space in the persistent memory according to the size of the memory content corresponding to the dirty data page address obtained each time, wherein the size of the new persistent memory space is greater than or equal to the size of the memory content corresponding to the dirty data page address obtained each time;

[0074] Step S205, after successfully applying for a new persistent memory space, the memory content corresponding to the dirty data page address obtained each time is written into the new persistent memory space.

[0075] In this embodiment, the specific implementation of step S204 to step S205 is similar to the above-mentioned step S201 and step S202, and will not be described in detail here.

[0076] Through this embodiment, it is possible to control the number of memory snapshots on demand.

[0077] Furthermore, in one embodiment, the memory snapshot creation method further includes:

[0078] When a virtual machine system crashes, the virtual machine is restored using each created memory snapshot in order from the last to the first creation sequence until the recovery is successful.

[0079] In this embodiment, when the virtual machine system crashes, the virtual machine is first restored through the last created memory snapshot. If the recovery fails, the virtual machine is restored through the second to last created memory snapshot. If the recovery fails, the virtual machine is restored through the third to last created memory snapshot, and so on, until the virtual machine is successfully restored.

[0080] In the prior art, the time required to create a content snapshot is prolonged, and the long time it takes to interrupt the virtual machine's business makes it impossible to create memory snapshots frequently in actual operations. This will cause a large gap between the virtual machine's business state restored by the memory snapshot and the business state before the virtual machine system crashed. In the present embodiment, the time required to create a content snapshot is shortened. Therefore, the creation cycle can be shorter than the cycle of creating a memory snapshot in the prior art. That is, compared with the prior art, the present embodiment can create memory snapshots at a higher frequency, so that the memory snapshots generated at a later time can be used to restore the virtual machine to the state close to the system crash, thereby minimizing the virtual machine's business interruption time.

[0081] In a third aspect, an embodiment of the present invention further provides a memory snapshot creation device.

[0082] Reference Figure 6 , Figure 6 This is a schematic diagram of functional modules of an embodiment of a memory snapshot creation device of the present invention.

[0083] In one embodiment, the memory snapshot creation device includes:

[0084] An acquisition module 10 is used to acquire the dirty data page address recorded in the corresponding sub-cycle at each preset time in the creation cycle;

[0085] A writing module 20 is used to write the memory content corresponding to the dirty data page address obtained each time into the persistent memory;

[0086] The creation module 30 is used to create a memory snapshot corresponding to the creation cycle at the end time of the creation cycle according to all memory contents written into the persistent memory during the creation cycle.

[0087] Furthermore, in one embodiment, when the creation cycle is the first creation cycle, the memory snapshot creation device further includes an application module, which is used to:

[0088] Applying for a first persistent memory space in the persistent memory, wherein the size of the first persistent memory space is consistent with the memory size of the virtual machine;

[0089] After the first persistent memory space is successfully applied for, the corresponding relationship between the virtual machine memory address and the first persistent memory space address is recorded.

[0090] Further, in one embodiment, when the creation cycle is the first creation cycle, the writing module 20 is used to:

[0091] Based on the corresponding relationship, the memory content corresponding to the dirty data page address obtained each time is overwritten and written into the storage area corresponding to the dirty data page address obtained each time in the first persistent memory space.

[0092] Further, in one embodiment, when the creation cycle is not the first creation cycle and the memory snapshot chain depth value is 1, the writing module 20 is used to:

[0093] Based on the corresponding relationship, the memory content corresponding to the dirty data page address obtained each time is overwritten and written into the storage area corresponding to the dirty data page address obtained each time in the first persistent memory space.

[0094] Further, in one embodiment, when the creation cycle is not the first creation cycle and the memory snapshot chain depth value is N, where N is a positive integer greater than 1, the writing module 20 is used to:

[0095] When the number of created memory snapshots is less than N, a new persistent memory space is applied for in the persistent memory according to the size of the memory content corresponding to the dirty data page address obtained each time, and the size of the new persistent memory space is greater than or equal to the size of the memory content corresponding to the dirty data page address obtained each time;

[0096] After applying for a new persistent memory space successfully, the memory content corresponding to the dirty data page address obtained each time is written into the new persistent memory space.

[0097] Furthermore, in one embodiment, the writing module 20 is used to:

[0098] When the number of created memory snapshots is equal to N, the earliest created memory snapshot is merged with the second earliest created memory snapshot to release all persistent memory space applied in the second creation cycle;

[0099] Applying for a new persistent memory space in the persistent memory according to the size of the memory content corresponding to the dirty data page address obtained each time, wherein the size of the new persistent memory space is greater than or equal to the size of the memory content corresponding to the dirty data page address obtained each time;

[0100] After applying for a new persistent memory space successfully, the memory content corresponding to the dirty data page address obtained each time is written into the new persistent memory space.

[0101] Furthermore, in one embodiment, the memory snapshot creation device further includes a recovery module, which is used to:

[0102] When a virtual machine system crashes, the virtual machine is restored using each created memory snapshot in order from the last to the first creation sequence until the recovery is successful.

[0103] The functional implementation of each module in the above-mentioned memory snapshot creation device corresponds to each step in the above-mentioned memory snapshot creation method embodiment, and its functions and implementation processes are not described one by one here.

[0104] In a fourth aspect, an embodiment of the present invention further provides a readable storage medium.

[0105] The readable storage medium of the present invention stores a memory snapshot creation program, wherein when the memory snapshot creation program is executed by a processor, the steps of the memory snapshot creation method described above are implemented.

[0106] The method implemented when the memory snapshot creation program is executed may refer to the various embodiments of the memory snapshot creation method of the present invention, and will not be described in detail here.

[0107] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0108] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0109] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device to execute the methods described in each embodiment of the present invention.

[0110] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A memory snapshot creation method, characterized in that: The memory snapshot creation method comprises: At each preset time in the creation cycle, the dirty data page address recorded in the corresponding sub-cycle is obtained, where the dirty data page address is the address of the memory whose content in the virtual machine memory has changed; Write the memory content corresponding to the dirty data page address obtained each time into the persistent memory; At the end time of the creation cycle, a memory snapshot corresponding to the creation cycle is created according to all memory contents written into the persistent memory during the creation cycle; When the creation cycle is the first creation cycle, before the step of acquiring the dirty data page address recorded in the corresponding sub-cycle at each preset time in the creation cycle, the method further includes: Apply for a first persistent memory space in the persistent memory, where the size of the first persistent memory space is consistent with the memory size of the virtual machine; After successfully applying for the first persistent memory space, record the correspondence between the virtual machine memory address and the first persistent memory space address; When the creation cycle is the first creation cycle, the step of writing the memory content corresponding to the dirty data page address obtained each time into the persistent memory includes: Based on the corresponding relationship, the memory content corresponding to the dirty data page address obtained each time is overwritten and written into the storage area corresponding to the dirty data page address obtained each time in the first persistent memory space.

2. The memory snapshot creation method according to claim 1, characterized in that: When the creation cycle is not the first creation cycle and the memory snapshot chain depth value is 1, the step of writing the memory content corresponding to the dirty data page address obtained each time into the persistent memory includes: Based on the corresponding relationship, the memory content corresponding to the dirty data page address obtained each time is overwritten and written into the storage area corresponding to the dirty data page address obtained each time in the first persistent memory space.

3. The memory snapshot creation method according to claim 1, characterized in that: When the creation cycle is not the first creation cycle, and the memory snapshot chain depth value is N, where N is a positive integer greater than 1, the step of writing the memory content corresponding to the dirty data page address obtained each time into the persistent memory includes: When the number of created memory snapshots is less than N, a new persistent memory space is applied for in the persistent memory according to the size of the memory content corresponding to the dirty data page address obtained each time, and the size of the new persistent memory space is greater than or equal to the size of the memory content corresponding to the dirty data page address obtained each time; After applying for a new persistent memory space successfully, the memory content corresponding to the dirty data page address obtained each time is written into the new persistent memory space.

4. The memory snapshot creation method according to claim 3, characterized in that: The step of writing the memory content corresponding to the dirty data page address obtained each time into the persistent memory also includes: When the number of created memory snapshots is equal to N, the earliest created memory snapshot is merged with the second earliest created memory snapshot to release all persistent memory space applied in the second creation cycle; Applying for a new persistent memory space in the persistent memory according to the size of the memory content corresponding to the dirty data page address obtained each time, wherein the size of the new persistent memory space is greater than or equal to the size of the memory content corresponding to the dirty data page address obtained each time; After applying for a new persistent memory space successfully, the memory content corresponding to the dirty data page address obtained each time is written into the new persistent memory space.

5. The memory snapshot creation method according to any one of claims 1 to 4, characterized in that: The memory snapshot creation method further includes: When a virtual machine system crashes, the virtual machine is restored using each created memory snapshot in order from the last to the first creation sequence until the recovery is successful.

6. A memory snapshot creation device, characterized in that: The memory snapshot creation device comprises: An acquisition module is used to acquire the dirty data page address recorded in the corresponding sub-cycle at each preset time in the creation cycle, where the dirty data page address is the address of the memory whose content in the virtual machine memory has changed; The writing module is used to write the memory content corresponding to the dirty data page address obtained each time into the persistent memory; A creation module, configured to create a memory snapshot corresponding to the creation cycle at the end of the creation cycle according to all memory contents written into the persistent memory during the creation cycle; When the creation cycle is the first creation cycle, the memory snapshot creation device further includes an application module for: Apply for a first persistent memory space in the persistent memory, where the size of the first persistent memory space is consistent with the memory size of the virtual machine; After successfully applying for the first persistent memory space, record the correspondence between the virtual machine memory address and the first persistent memory space address; When the creation cycle is the first creation cycle, write the module to: Based on the corresponding relationship, the memory content corresponding to the dirty data page address obtained each time is overwritten and written into the storage area corresponding to the dirty data page address obtained each time in the first persistent memory space.

7. A memory snapshot creation device, characterized in that: The memory snapshot creation device includes a processor, a memory, and a memory snapshot creation program stored in the memory and executable by the processor, wherein when the memory snapshot creation program is executed by the processor, the steps of the memory snapshot creation method according to any one of claims 1 to 5 are implemented.

8. A readable storage medium, characterized in that: The readable storage medium stores a memory snapshot creation program, wherein when the memory snapshot creation program is executed by a processor, the steps of the memory snapshot creation method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Virtual machine snapshot creation method and device and computer readable storage medium

    CN111857966A