Movatterモバイル変換


[0]ホーム

URL:


CN113641446A - Memory snapshot creating method, device and equipment and readable storage medium - Google Patents

Memory snapshot creating method, device and equipment and readable storage medium
Download PDF

Info

Publication number
CN113641446A
CN113641446ACN202110790639.4ACN202110790639ACN113641446ACN 113641446 ACN113641446 ACN 113641446ACN 202110790639 ACN202110790639 ACN 202110790639ACN 113641446 ACN113641446 ACN 113641446A
Authority
CN
China
Prior art keywords
memory
creation
snapshot
dirty data
data page
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110790639.4A
Other languages
Chinese (zh)
Other versions
CN113641446B (en
Inventor
刘丽萍
刘亚敏
梁华
赵丹
黄杉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fiberhome Telecommunication Technologies Co Ltd
Original Assignee
Fiberhome Telecommunication Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fiberhome Telecommunication Technologies Co LtdfiledCriticalFiberhome Telecommunication Technologies Co Ltd
Priority to CN202110790639.4ApriorityCriticalpatent/CN113641446B/en
Publication of CN113641446ApublicationCriticalpatent/CN113641446A/en
Application grantedgrantedCritical
Publication of CN113641446BpublicationCriticalpatent/CN113641446B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

The invention provides a memory snapshot creating method, a memory snapshot creating device, memory snapshot creating equipment and a readable storage medium. The method comprises the following steps: acquiring a dirty data page address recorded in a corresponding sub-period at each preset moment in a creation period; writing the memory content corresponding to the dirty data page address acquired each time into a persistent memory; and at the last moment of the creation period, creating a memory snapshot corresponding to the creation period according to all memory contents written into the persistent memory in the creation period. By the method and the device, time consumption for creating the memory snapshot is reduced, so that the suspension time of the virtual machine when the snapshot of the whole machine is created is shortened, and service interruption on the virtual machine is avoided.

Description

Memory snapshot creating method, device and equipment and readable storage medium
Technical Field
The present invention relates to the field of virtual machine technologies, and in particular, to a method, an apparatus, a device, and a readable storage medium for creating a memory snapshot.
Background
With the common application of virtualization technology, more and more traditional applications are gradually migrated to a cloud platform, the application fields of virtual machines are more and more abundant, the requirements on virtualization performance, reliability and the like are also continuously improved, and the corresponding virtualization technology is more and more abundant and perfect. In order to adapt to diversified use scenes and meet requirements under different scenes, the virtualization continuously surpasses a physical machine by virtue of the out-of-band management characteristic of the virtual machine while aiming at the target physical machine. Such as: the virtual snapshot technology is a virtual machine backup technology which is derived from backup of a physical machine and is continuously optimized, and the technology of automatically recovering a fault virtual machine by utilizing a snapshot is not realized by the physical machine.
At present, virtual machine snapshots mainly have two implementation forms, one is a storage snapshot only for backing up stored data, and the other is a complete machine snapshot combining storage and memory snapshots. The storage snapshot is used for a scene only needing data backup, and the storage + memory snapshot can preserve a service state at the snapshot time. The basic implementation flow of the snapshot is as follows: suspend virtual machine → create snapshot → resume virtual machine. After the virtual machine is suspended, the internal service of the virtual machine is interrupted to run, and the service is recovered after the virtual machine is recovered. Since the virtual machine cannot normally provide services during snapshot creation, each virtualization platform tries to shorten the virtual machine hang time. At present, the storage snapshot consumes very little time and the promotion space is too small, so how to optimize the memory snapshot creation time and reduce the virtual machine suspension time is a technical problem to be solved urgently at present.
Disclosure of Invention
The invention mainly aims to provide a memory snapshot creating method, a memory snapshot creating device, memory snapshot creating equipment and a readable storage medium, and aims to solve the technical problem that creating a memory snapshot in the prior art is long in time.
In a first aspect, the present invention provides a memory snapshot creating method, where the memory snapshot creating method includes:
acquiring a dirty data page address recorded in a corresponding sub-period at each preset moment in a creation period;
writing the memory content corresponding to the dirty data page address acquired each time into a persistent memory;
and at the end time of the creation period, creating a memory snapshot corresponding to the creation period according to all memory contents written into the persistent memory in the creation period.
Optionally, when the creating period is the first creating period, before the step of obtaining the dirty data page address recorded in the corresponding sub-period at each preset time in the creating period, the method further includes:
applying for a first persistent memory space in a persistent memory, wherein the size of the first persistent memory space is consistent with the size of a virtual machine memory;
and recording the corresponding relation between the memory address of the virtual machine and the address of the first persistent memory space after the first persistent memory space is successfully applied.
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:
and based on the corresponding relation, overwriting the memory content corresponding to the dirty data page address obtained each time into the storage area corresponding to the dirty data page address obtained each time in the first persistent memory space.
Optionally, when the creation cycle is not the first creation cycle and the depth value of the memory snapshot chain is 1, the step of writing the memory content corresponding to the dirty data page address obtained each time into the persistent memory includes:
and based on the corresponding relation, overwriting the memory content corresponding to the dirty data page address obtained each time into the storage area corresponding to the dirty data page address obtained each time in the first persistent memory space.
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:
when the number of the 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, 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;
and after a new persistent memory space is successfully applied, writing the memory content corresponding to the dirty data page address acquired each time into the new persistent memory space.
Optionally, the step of writing the memory content corresponding to the dirty data page address obtained each time into the persistent memory further includes:
when the number of the created memory snapshots is equal to N, merging the memory snapshot created earliest and the memory snapshot created second earliest, and releasing all persistent memory spaces applied in the second creation period;
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 acquired each time, wherein the size of the new persistent memory space is larger than or equal to the size of the memory content corresponding to the dirty data page address acquired each time;
and after a new persistent memory space is successfully applied, writing the memory content corresponding to the dirty data page address acquired each time into the new persistent memory space.
Optionally, the memory snapshot creating method further includes:
when the virtual machine system crashes, the virtual machine is restored by using the created memory snapshots in sequence from back to front according to the creation sequence until the restoration is successful.
In a second aspect, the present invention further provides a memory snapshot creating apparatus, where the memory snapshot creating apparatus includes:
the acquisition module is used for acquiring the dirty data page address recorded in the corresponding sub-period at each preset moment in the creation period;
the write-in module is used for writing the memory content corresponding to the dirty data page address acquired each time into the persistent memory;
and the creating module is used for creating the memory snapshot corresponding to the creating period according to all the memory contents written into the persistent memory in the creating period at the finishing time of the creating period.
In a third aspect, the present invention further provides a memory snapshot creating device, where the memory snapshot creating device includes a processor, a storage, and a memory snapshot creating program that is stored on the storage and can be executed by the processor, where when the memory snapshot creating program is executed by the processor, the steps of the memory snapshot creating method are implemented.
In a fourth aspect, the present invention further provides a readable storage medium, where a memory snapshot creating program is stored on the readable storage medium, where the memory snapshot creating program, when executed by a processor, implements the steps of the memory snapshot creating method described above.
In the invention, dirty data page addresses recorded in corresponding sub-periods are obtained at each preset moment in a creation period; writing the memory content corresponding to the dirty data page address acquired each time into a persistent memory; and at the last moment of the creation period, creating a memory snapshot corresponding to the creation period according to all memory contents written into the persistent memory in the creation period. By the method and the device, time consumption for creating the memory snapshot is reduced, so that the suspension time of the virtual machine when the snapshot of the whole machine is created is shortened, and service interruption on the virtual machine is avoided.
Drawings
Fig. 1 is a schematic hardware structure diagram of a memory snapshot creating device according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a method for creating a memory snapshot according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating a method for writing data into a persistent memory according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating a persistent memory space application according to an embodiment of a method for creating a memory snapshot in the present invention;
FIG. 5 is a diagram illustrating a persistent memory space application in another embodiment of a method for creating a memory snapshot in accordance with the present invention;
fig. 6 is a functional module diagram of an embodiment of a memory snapshot creating apparatus according to the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
In a first aspect, an embodiment of the present invention provides a memory snapshot creating apparatus, where the memory snapshot creating apparatus may be an apparatus having a data processing function, such as a Personal Computer (PC), a notebook computer, or a server.
Referring to fig. 1, fig. 1 is a schematic diagram of a hardware structure of a memory snapshot creating device according to an embodiment of the present invention. In this embodiment of the present invention, the memory snapshot creating apparatus may include a processor 1001 (e.g., a Central Processing Unit, CPU), acommunication bus 1002, auser interface 1003, anetwork interface 1004, and astorage 1005. Thecommunication bus 1002 is used for realizing connection communication among the components; theuser interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard); thenetwork interface 1004 may optionally include a standard wired interface, a WIreless interface (e.g., a WI-FI interface, WI-FI interface); thememory 1005 may be a Random Access Memory (RAM) or a non-volatile memory (non-volatile memory), such as a magnetic disk memory, and thememory 1005 may optionally be a storage device independent of theprocessor 1001. Those skilled in the art will appreciate that the hardware configuration depicted in FIG. 1 is not intended to be limiting of the present invention, and may include more or less components than those shown, or some components in combination, or a different arrangement of components.
With continued reference to fig. 1, thememory 1005 of fig. 1, which is a type of computer storage medium, may include an operating system, a network communication module, a user interface module, and a memory snapshot creation program therein. Theprocessor 1001 may call a memory snapshot creating program stored in thestorage 1005, and execute the memory snapshot creating method provided in the embodiment of the present invention.
In a second aspect, an embodiment of the present invention provides a memory snapshot creating method.
In an embodiment, referring to fig. 2, fig. 2 is a flowchart illustrating an embodiment of a memory snapshot creating method according to the present invention. As shown in fig. 2, the memory snapshot creating method includes:
step S10, acquiring dirty data page address recorded in corresponding sub-period at each preset time in the creation period;
in this embodiment, the length of the creation period and the length of the sub-period in the creation period are planned in advance according to a specific use scenario of the virtual machine, for example, a memory specification of a computing node, a CPU performance, a density of the virtual machine, an internal service characteristic of the virtual machine, and the like, and each preset time in the creation period is an end time of each sub-period. For example, the creation period has a length t and the sub-periods have a length t
Figure BDA0003160969220000051
If there are 3 sub-periods in a creation period, the ending time of each sub-period is each preset time, and there are 3 preset times in total, then in a creation period, the dirty data page address recorded in the first sub-period is obtained at the first preset time, the dirty data page address recorded in the second sub-period is obtained at the second preset time, and the dirty data page address recorded in the third sub-period is obtained at the third preset time. It should be noted that, this is only an illustrative example, and the ratio between the length of the sub-period and the length of the creation period is set according to actual needs, and is not limited herein. The dirty data page address is an address of a memory with changed contents in the memory of the virtual machine.
Step S20, writing the memory content corresponding to the dirty data page address acquired each time into a persistent memory;
in this embodiment, the length of the creation period is t, and the length of the sub-period is t
Figure BDA0003160969220000052
For example, after the dirty data page address recorded in the first sub-cycle is obtained at the first preset time in one cycle, the memory content corresponding to the dirty data page address is written into the persistent memory, and so on, the dirty data page address pair obtained at each preset time is pairedAnd writing the corresponding memory content into the persistent memory. The persistent memory is PMEM (persistent memory), and PMEM has the performance advantage of short read-write time consumption. Referring to fig. 3, fig. 3 is a schematic diagram illustrating writing data into a persistent memory according to an embodiment of the memory snapshot creating method of the present invention. As shown in fig. 3, when a physical memory is allocated to a virtual machine, a PMEM memory of the same specification is applied, the physical memory corresponding to the virtual machine is written in the running process of the virtual machine, dirty data page addresses are periodically written into a bitmap according to a sub-period, the dirty data page addresses in the bitmap are periodically read, memory contents corresponding to the dirty data page addresses are written into the PMEM memory, and records in the bitmap are cleared when the sub-period is over.
Step S30, at the end of the creation cycle, creating a memory snapshot corresponding to the creation cycle according to all memory contents written into the persistent memory in the creation cycle.
In this embodiment, at the end of the creation period, the memory snapshot corresponding to the creation period may be created according to all the memory contents written in the persistent memory in the creation period.
In this embodiment, the memory snapshot mainly stores contents that change in a memory of a Virtual Machine, a common storage method is to store the contents into a hard disk of a computing node or a file on an internal disk of the Virtual Machine, and discovery of an intermediate time consumption based on a principle of Virtual Machine memory management by a VMM (Virtual Machine Monitor) is mainly to read a memory to be stored and write the memory to the disk.
In the embodiment, a dirty data page address recorded in a corresponding sub-period is acquired at each preset time in a creation period; writing the memory content corresponding to the dirty data page address acquired each time into a persistent memory; and at the last moment of the creation period, creating a memory snapshot corresponding to the creation period according to all memory contents written into the persistent memory in the creation period. Through the embodiment, the time consumption for creating the memory snapshot is reduced, so that the suspension time of the virtual machine when the snapshot of the whole machine is created is shortened, and the service interruption on the virtual machine is avoided.
Further, in an embodiment, when the creation cycle is the first creation cycle, before step S10, the method further includes:
step S01, applying for a first persistent memory space in the persistent memory, where the size of the first persistent memory space is consistent with the size of the virtual machine memory;
in this embodiment, after the virtual machine is created or started, when the VMM allocates an HPA (Host physical address) memory to the virtual machine, a first persistent memory space may be applied in the persistent memory, where a size of the first persistent memory space is consistent with a size of a memory of the virtual machine. For example, the size of the memory of the virtual machine is 2G, the VMM allocates a 2G physical memory HPA to the virtual machine to directly store the content of the memory of the virtual machine, and at this stage, the storage space with the size of 2G is applied in the persistent memory, that is, the first persistent memory space is applied.
Step S02, after applying for the first persistent memory space successfully, record the corresponding relationship between the virtual machine memory address and the first persistent memory space address.
In this embodiment, after the first persistent memory space is successfully applied, the corresponding relationship between the memory address of the virtual machine and the address of the first persistent memory space is recorded. For example, the virtual machine memory addresses are denoted as X1, X2, X3... Xm, the first persistent memory space addresses are denoted as C1, C2, C3... Cm, and the recorded correspondence relationship is that X1 corresponds to C1, X2 corresponds to C2, and X3 corresponds to C3... Xm corresponds to Cm. Subsequently, in the first creation cycle, if the dirty data page addresses are X3 and X7, the memory contents corresponding to X3 and X7 may be written into C3 and C7 in the first persistent memory space, respectively.
Further, in an embodiment, based on the previous embodiment, when the creation cycle is the first creation cycle, step S20 includes:
and based on the corresponding relation, overwriting the memory content corresponding to the dirty data page address obtained each time into the storage area corresponding to the dirty data page address obtained each time in the first persistent memory space.
In this embodiment, the length of the creation period is t, and the length of the sub-period is t
Figure BDA0003160969220000071
For example. In a first creation cycle, if the address of the dirty data page acquired for the first time is X2, writing the content in X2 into C2 in a first persistent memory space; if the dirty data page addresses obtained for the second time are X1 and X3, writing the contents in X1 and X3 into 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 into C2 in the first persistent memory space, i.e., the content in X2 which is written into C2 for the first time is overwritten. When the memory content corresponding to the acquired dirty data page address is written into the corresponding storage area in the first persistent memory space, if the storage area has no data, the data is directly written, and if the storage area has data, the original data is covered while the data is written.
Further, in an 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:
and based on the corresponding relation, overwriting the memory content corresponding to the dirty data page address obtained each time into the storage area corresponding to the dirty data page address obtained each time in the first persistent memory space.
In this embodiment, the depth value of the memory snapshot chain is determined in advance according to a specific use scenario of the virtual machine, for example, a memory specification of a compute node, a CPU performance, a density of the virtual machine, and an internal service characteristic of the virtual machine.
When the creation cycle is not the first creation cycle and the memory snapshot chain depth value is 1, for example, in the 2 nd creation cycle, each time the memory content corresponding to the acquired dirty data page address is written into the corresponding storage area in the first persistent memory space, if the storage area has no data, the data is directly written, and if the storage area has data, the original data is overwritten while the data is written.
Further, in an 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:
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, where 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;
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. Referring to fig. 4, fig. 4 is a schematic diagram illustrating a persistent memory space application in an embodiment of a memory snapshot creating method according to the present invention. As shown in fig. 4, after acquiring the dirty data page address recorded in the corresponding sub-period at the first preset time in the 3 rd creation period, detecting that the number of the currently created memory snapshots is 2 (the memory snapshot corresponding to the first creation period and the memory snapshot corresponding to the second creation period), 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 recorded in the corresponding sub-period acquired at the first preset time, for example, applying for a new persistent memory space with a size of 3 × 128M in the persistent memory when the size of the memory content corresponding to the dirty data page address recorded in the corresponding sub-period acquired at the first preset time is 300M; similarly, if the size of the memory content corresponding to the dirty data page address recorded in the corresponding sub-period is acquired at the second preset time is 500M, applying for a new persistent memory space with a size of 4 × 128M in the persistent memory, and so on, that is, the size of the new persistent memory space applied each time is a multiple of 128M and is larger than the size of the memory content to be written.
Step S202, after applying for a new persistent memory space successfully, writing the memory content corresponding to the dirty data page address obtained each time into the new persistent memory space.
In this embodiment, if the size of the memory content corresponding to the dirty data page address recorded in the corresponding sub-period is 300M at the first preset time, a new persistent memory space with a size of 3 × 128M is applied in the persistent memory, and after the application is successful, the memory content of 300M is written into the new persistent memory space with a size of 3 × 128M; similarly, if the size of the memory content corresponding to the dirty data page address recorded in the corresponding sub-period is acquired at the second preset time and is 500M, a new persistent memory space with the size of 4 × 128M is applied in the persistent memory, and after the application is successful, the memory content of 500M is written into the new persistent memory space with the size of 4 × 128M, and so on.
Further, in an embodiment, based on the previous embodiment, step S20 further includes:
step S203, merging the memory snapshot created earliest and the memory snapshot created second earliest when the number of the created memory snapshots is equal to N, and releasing all persistent memory spaces applied in the second creation period;
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. Referring to fig. 5, fig. 5 is a schematic diagram illustrating a persistent memory space application in another embodiment of the memory snapshot creation method of the present invention. As shown in fig. 5, in the 6 th creation cycle, after obtaining the dirty data page address recorded in the corresponding sub-cycle at the first preset time, it is detected that the number of the currently created memory snapshots 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 in a specific manner of writing data in all persistent memory spaces (i.e., the second persistent memory space) applied in the second creation cycle into the first persistent memory space, and releasing all persistent memory spaces applied in the second creation cycle.
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 acquired each time, wherein the size of the new persistent memory space is larger than or equal to the size of the memory content corresponding to the dirty data page address acquired each time;
step S205, after applying for a new persistent memory space successfully, writing the memory content corresponding to the dirty data page address obtained each time into the new persistent memory space.
In this embodiment, the specific embodiment of steps S204 to S205 is similar to that of steps S201 and S202, and is not described herein again.
By the embodiment, the quantity of the memory snapshots is controlled as required.
Further, in an embodiment, the memory snapshot creating method further includes:
when the virtual machine system crashes, the virtual machine is restored by using the created memory snapshots in sequence from back to front according to the creation sequence until the restoration is successful.
In this embodiment, when the virtual machine system crashes, the virtual machine is first restored through the last created memory snapshot, if the restoration is unsuccessful, the virtual machine is restored through the penultimate created memory snapshot, and so on until the virtual machine is successfully restored.
In the prior art, due to the fact that time consumption for creating the content snapshot is long, due to the fact that the virtual machine service interruption time is long, the memory snapshot cannot be created frequently in actual operation, the difference between the service state of the virtual machine recovered through the memory snapshot and the service state before the virtual machine system crashes is large, and the time consumption for creating the content snapshot is shortened in the embodiment, so that the creating period can be shorter than the period for creating the memory snapshot in the prior art, namely the memory snapshot can be created at a higher frequency compared with the embodiment in the prior art, the virtual machine can be recovered to the state close to the system crash by using the memory snapshot generated at a later time, and the service interruption time of the virtual machine is reduced to the maximum extent.
In a third aspect, an embodiment of the present invention further provides a memory snapshot creating apparatus.
Referring to fig. 6, fig. 6 is a functional module schematic diagram of a memory snapshot creating apparatus according to an embodiment of the present invention.
In one embodiment, the memory snapshot creating apparatus includes:
an obtainingmodule 10, configured to obtain, at each preset time in a creation cycle, a dirty data page address recorded in a corresponding sub-cycle;
a write-in module 20, configured to write memory content corresponding to the dirty data page address obtained each time into a persistent memory;
a creatingmodule 30, configured to create, at the end of the creating period, a memory snapshot corresponding to the creating period according to all memory contents written in the persistent memory in the creating period.
Further, in an embodiment, when the creation cycle is the first creation cycle, the memory snapshot creation apparatus further includes an application module configured to:
applying for a first persistent memory space in a persistent memory, wherein the size of the first persistent memory space is consistent with the size of a virtual machine memory;
and recording the corresponding relation between the memory address of the virtual machine and the address of the first persistent memory space after the first persistent memory space is successfully applied.
Further, in an embodiment, when the creation cycle is the first creation cycle, thewriting module 20 is configured to:
and based on the corresponding relation, overwriting the memory content corresponding to the dirty data page address obtained each time into the storage area corresponding to the dirty data page address obtained each time in the first persistent memory space.
Further, in an embodiment, when the creation cycle is not the first creation cycle and the memory snapshot chain depth value is 1, thewriting module 20 is configured to:
and based on the corresponding relation, overwriting the memory content corresponding to the dirty data page address obtained each time into the storage area corresponding to the dirty data page address obtained each time in the first persistent memory space.
Further, in an 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, thewriting module 20 is configured to:
when the number of the 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, 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;
and after a new persistent memory space is successfully applied, writing the memory content corresponding to the dirty data page address acquired each time into the new persistent memory space.
Further, in an embodiment, thewriting module 20 is configured to:
when the number of the created memory snapshots is equal to N, merging the memory snapshot created earliest and the memory snapshot created second earliest, and releasing all persistent memory spaces applied in the second creation period;
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 acquired each time, wherein the size of the new persistent memory space is larger than or equal to the size of the memory content corresponding to the dirty data page address acquired each time;
and after a new persistent memory space is successfully applied, writing the memory content corresponding to the dirty data page address acquired each time into the new persistent memory space.
Further, in an embodiment, the memory snapshot creating apparatus further includes a recovery module, configured to:
when the virtual machine system crashes, the virtual machine is restored by using the created memory snapshots in sequence from back to front according to the creation sequence until the restoration is successful.
The function implementation of each module in the memory snapshot creation apparatus corresponds to each step in the memory snapshot creation method embodiment, and the function and implementation process thereof are not described in detail here.
In a fourth aspect, the embodiment of the present invention further provides a readable storage medium.
The readable storage medium of the present invention stores a memory snapshot creating program, wherein when the memory snapshot creating program is executed by a processor, the steps of the memory snapshot creating method are implemented.
The method implemented when the memory snapshot creating program is executed may refer to each embodiment of the memory snapshot creating method of the present invention, and details are not described here.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for causing a terminal device to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

Translated fromChinese
1.一种内存快照创建方法,其特征在于,所述内存快照创建方法包括:1. a memory snapshot creation method, is characterized in that, described memory snapshot creation method comprises:在创建周期中的每个预设时刻获取对应子周期内记录的脏数据页地址;Obtain the address of the dirty data page recorded in the corresponding sub-cycle at each preset moment in the creation cycle;将每次获取的脏数据页地址对应的内存内容写入持久化内存;Write the memory content corresponding to the address of the dirty data page obtained each time into the persistent memory;在所述创建周期的结束时刻时,根据所述创建周期内写入持久化内存中的所有内存内容创建所述创建周期对应的内存快照。At the end of the creation period, a memory snapshot corresponding to the creation period is created according to all the memory contents written into the persistent memory during the creation period.2.如权利要求1所述的内存快照创建方法,其特征在于,当创建周期为第一个创建周期,在所述在创建周期中的每个预设时刻获取对应子周期内记录的脏数据页地址的步骤之前,还包括:2. The method for creating a memory snapshot according to claim 1, wherein when the creation cycle is the first creation cycle, the dirty data recorded in the corresponding sub-cycle is obtained at each preset moment in the creation cycle Before the page address steps, also include:在持久化内存中申请第一持久化内存空间,所述第一持久化内存空间的大小与虚拟机内存大小一致;Applying for a first persistent memory space in the persistent memory, where the size of the first persistent memory space is the same as that of the virtual machine memory;申请第一持久化内存空间成功后,记录虚拟机内存地址与第一持久化内存空间地址的对应关系。After the application for the first persistent memory space is successful, the correspondence between the virtual machine memory address and the address of the first persistent memory space is recorded.3.如权利要求2所述的内存快照创建方法,其特征在于,当创建周期为第一个创建周期,所述将每次获取的脏数据页地址对应的内存内容写入持久化内存的步骤包括:3. The method for creating a memory snapshot according to claim 2, wherein when the creation cycle is the first creation cycle, the step of writing the memory content corresponding to the address of the dirty data page obtained each time into the persistent memory include:基于所述对应关系,将每次获取的脏数据页地址对应的内存内容覆盖写入所述第一持久化内存空间中每次获取的脏数据页地址对应的存储区域。Based on the corresponding relationship, the memory content corresponding to the address of the dirty data page obtained each time is overwritten into the storage area corresponding to the address of the dirty data page obtained each time in the first persistent memory space.4.如权利要求3所述的内存快照创建方法,其特征在于,当创建周期不为第一个创建周期,且内存快照链深度值为1,所述将每次获取的脏数据页地址对应的内存内容写入持久化内存的步骤包括:4. The method for creating a memory snapshot according to claim 3, wherein when the creation period is not the first creation period, and the memory snapshot chain depth value is 1, the address corresponding to the dirty data page obtained each time is described. The steps of writing the contents of the memory to persistent memory include:基于所述对应关系,将每次获取的脏数据页地址对应的内存内容覆盖写入所述第一持久化内存空间中每次获取的脏数据页地址对应的存储区域。Based on the corresponding relationship, the memory content corresponding to the address of the dirty data page obtained each time is overwritten into the storage area corresponding to the address of the dirty data page obtained each time in the first persistent memory space.5.如权利要求1所述的内存快照创建方法,其特征在于,当创建周期不为第一个创建周期,且内存快照链深度值为N,N为大于1的正整数,所述将每次获取的脏数据页地址对应的内存内容写入持久化内存的步骤包括:5. The method for creating a memory snapshot according to claim 1, wherein when the creation period is not the first creation period, and the memory snapshot chain depth value is N, where N is a positive integer greater than 1, the The steps of writing the memory content corresponding to the address of the dirty data page obtained for the second time to the persistent memory include:当已创建的内存快照的数量小于N时,根据每次获取的脏数据页地址对应的内存内容的大小在持久化内存中申请新的持久化内存空间,所述新的持久化内存空间的大小大于或等于每次获取的脏数据页地址对应的内存内容的大小;When the number of created memory snapshots is less than N, apply for a new persistent memory space in the persistent memory according to the size of the memory content corresponding to the address of the dirty data page obtained each time, and the size of the new persistent memory space Greater than or equal to the size of the memory content corresponding to the address of the dirty data page obtained each time;申请新的持久化内存空间成功后,将所述每次获取的脏数据页地址对应的内存内容写入所述新的持久化内存空间。After successfully applying for a new persistent memory space, the memory content corresponding to the address of the dirty data page obtained each time is written into the new persistent memory space.6.如权利要求5所述的内存快照创建方法,其特征在于,所述将每次获取的脏数据页地址对应的内存内容写入持久化内存的步骤还包括:6. The method for creating a memory snapshot according to claim 5, wherein the step of writing the memory content corresponding to the address of the dirty data page obtained each time into the persistent memory further comprises:当已创建的内存快照的数量等于N时,将最早创建的内存快照与次早创建的内存快照合并,释放第二个创建周期内申请的所有持久化内存空间;When the number of created memory snapshots is equal to N, the earliest created memory snapshot is merged with the next earliest created memory snapshot to release all persistent memory space applied for in the second creation cycle;根据每次获取的脏数据页地址对应的内存内容的大小在持久化内存中申请新的持久化内存空间,所述新的持久化内存空间的大小大于或等于每次获取的脏数据页地址对应的内存内容的大小;Apply for a new persistent memory space in the persistent memory according to the size of the memory content corresponding to the address of the dirty data page acquired each time, and the size of the new persistent memory space is greater than or equal to the address of the dirty data page acquired each time. the size of the memory contents;申请新的持久化内存空间成功后,将所述每次获取的脏数据页地址对应的内存内容写入所述新的持久化内存空间。After successfully applying for a new persistent memory space, the memory content corresponding to the address of the dirty data page obtained each time is written into the new persistent memory space.7.如权利要求1至6中任一项所述的内存快照创建方法,其特征在于,所述内存快照创建方法还包括:7. The method for creating a memory snapshot according to any one of claims 1 to 6, wherein the method for creating a memory snapshot further comprises:当虚拟机系统崩溃时,按照创建顺序从后到前的顺序,依次使用各个已创建的内存快照对虚拟机进行恢复,直至恢复成功。When the virtual machine system crashes, restore the virtual machine by using the created memory snapshots in sequence from back to front until the restoration succeeds.8.一种内存快照创建装置,其特征在于,所述内存快照创建装置包括:8. A device for creating a memory snapshot, wherein the device for creating a memory snapshot comprises:获取模块,用于在创建周期中的每个预设时刻获取对应子周期内记录的脏数据页地址;an acquisition module, used to acquire the address of the dirty data page recorded in the corresponding sub-cycle at each preset moment in the creation cycle;写入模块,用于将每次获取的脏数据页地址对应的内存内容写入持久化内存;The writing module is used to write the memory content corresponding to the address of the dirty data page obtained each time into the persistent memory;创建模块,用于在所述创建周期的结束时刻时,根据所述创建周期内写入持久化内存中的所有内存内容创建所述创建周期对应的内存快照。The creation module is configured to, at the end of the creation period, create a memory snapshot corresponding to the creation period according to all the memory contents written in the persistent memory during the creation period.9.一种内存快照创建设备,其特征在于,所述内存快照创建设备包括处理器、存储器、以及存储在所述存储器上并可被所述处理器执行的内存快照创建程序,其中所述内存快照创建程序被所述处理器执行时,实现如权利要求1至7中任一项所述的内存快照创建方法的步骤。9. A memory snapshot creation device, wherein the memory snapshot creation device comprises a processor, a memory, and a memory snapshot creation program stored on the memory and executable by the processor, wherein the memory When the snapshot creation program is executed by the processor, the steps of the memory snapshot creation method according to any one of claims 1 to 7 are implemented.10.一种可读存储介质,其特征在于,所述可读存储介质上存储有内存快照创建程序,其中所述内存快照创建程序被处理器执行时,实现如权利要求1至7中任一项所述的内存快照创建方法的步骤。10. A readable storage medium, characterized in that, a memory snapshot creation program is stored on the readable storage medium, and when the memory snapshot creation program is executed by a processor, it realizes any one of claims 1 to 7. The steps of the memory snapshot creation method described in item.
CN202110790639.4A2021-07-132021-07-13 Memory snapshot creation method, device, equipment and readable storage mediumActiveCN113641446B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202110790639.4ACN113641446B (en)2021-07-132021-07-13 Memory snapshot creation method, device, equipment and readable storage medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202110790639.4ACN113641446B (en)2021-07-132021-07-13 Memory snapshot creation method, device, equipment and readable storage medium

Publications (2)

Publication NumberPublication Date
CN113641446Atrue CN113641446A (en)2021-11-12
CN113641446B CN113641446B (en)2025-02-07

Family

ID=78417247

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202110790639.4AActiveCN113641446B (en)2021-07-132021-07-13 Memory snapshot creation method, device, equipment and readable storage medium

Country Status (1)

CountryLink
CN (1)CN113641446B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN114138424A (en)*2022-02-072022-03-04苏州浪潮智能科技有限公司 A method, device and electronic device for generating a virtual machine memory snapshot
WO2023151352A1 (en)*2022-02-092023-08-17苏州浪潮智能科技有限公司Memory snapshot management method and apparatus, and device and medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20100299309A1 (en)*2009-05-212010-11-25Hitachi, Ltd.Backup management method
US20140223126A1 (en)*2011-10-122014-08-07Huawei Technologies Co., Ltd.Method, Apparatus, and System for Generating and Recovering Memory Snapshot of Virtual Machine
CN107291883A (en)*2017-06-202017-10-24郑州云海信息技术有限公司The Snapshot Method and device of a kind of distributed memory system
US20180276081A1 (en)*2015-11-302018-09-27Huawei Technologies Co., Ltd.Method and Apparatus for Generating Virtual Machine Snapshot
CN110515774A (en)*2019-08-282019-11-29北京百度网讯科技有限公司 Method, device, electronic device and storage medium for generating memory snapshot
CN111290836A (en)*2020-03-042020-06-16平安科技(深圳)有限公司Virtual machine snapshot creating method and device, storage medium and computer equipment
CN111857966A (en)*2020-07-282020-10-30山东海量信息技术研究院Virtual machine snapshot creating method and device and computer readable storage medium
US20210073079A1 (en)*2019-09-052021-03-11Robin Systems, Inc.Creating Snapshots of a Storage Volume in a Distributed Storage System

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20100299309A1 (en)*2009-05-212010-11-25Hitachi, Ltd.Backup management method
US20140223126A1 (en)*2011-10-122014-08-07Huawei Technologies Co., Ltd.Method, Apparatus, and System for Generating and Recovering Memory Snapshot of Virtual Machine
US20180276081A1 (en)*2015-11-302018-09-27Huawei Technologies Co., Ltd.Method and Apparatus for Generating Virtual Machine Snapshot
CN107291883A (en)*2017-06-202017-10-24郑州云海信息技术有限公司The Snapshot Method and device of a kind of distributed memory system
CN110515774A (en)*2019-08-282019-11-29北京百度网讯科技有限公司 Method, device, electronic device and storage medium for generating memory snapshot
US20210073079A1 (en)*2019-09-052021-03-11Robin Systems, Inc.Creating Snapshots of a Storage Volume in a Distributed Storage System
CN111290836A (en)*2020-03-042020-06-16平安科技(深圳)有限公司Virtual machine snapshot creating method and device, storage medium and computer equipment
CN111857966A (en)*2020-07-282020-10-30山东海量信息技术研究院Virtual machine snapshot creating method and device and computer readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN114138424A (en)*2022-02-072022-03-04苏州浪潮智能科技有限公司 A method, device and electronic device for generating a virtual machine memory snapshot
WO2023151352A1 (en)*2022-02-092023-08-17苏州浪潮智能科技有限公司Memory snapshot management method and apparatus, and device and medium

Also Published As

Publication numberPublication date
CN113641446B (en)2025-02-07

Similar Documents

PublicationPublication DateTitle
US11789823B2 (en)Selective processing of file system objects for image level backups
US9823877B2 (en)Virtual machine backup from storage snapshot
EP2840495B1 (en)Container-based processing method and apparatus
US11397648B2 (en)Virtual machine recovery method and virtual machine management device
US8738883B2 (en)Snapshot creation from block lists
US9348827B1 (en)File-based snapshots for block-based backups
CN103019890B (en)Block-level disk data protection system and method thereof
CN102594849A (en)Data backup and recovery method and device, virtual machine snapshot deleting and rollback method and device
CN106357703B (en)Cluster switching method and device
CN103605588A (en)Disk backup method of virtue machine
KR101674176B1 (en)Method and apparatus for fsync system call processing using ordered mode journaling with file unit
CN104216801A (en)Data copying method oriented to virtual environment and data copying system oriented to virtual environment
CN104536852B (en) Data recovery method and device
US20150379036A1 (en)Method and apparatus of per-block-group journaling for ordered mode journaling file system
CN113641446A (en)Memory snapshot creating method, device and equipment and readable storage medium
CN102799798A (en)Method for not restoring write-ins in overall restoring condition of computer system
WO2017016139A1 (en)System recovery method and apparatus
CN110287064B (en)Method and device for restoring disk data and electronic equipment
KR101552580B1 (en)Method for system recovery including mobile device and backup supporting multi operation system
CN111399774B (en)Data processing method and device based on snapshot under distributed storage system
US10061659B1 (en)Direct access to backup copy
CN113868016A (en)Data backup method and equipment based on pooling sectional type random storage
CN119179605B (en) A method and related device for saving and restoring snapshots of electromagnetic transient simulation operation state
CN114035897B (en) Method, device and storage medium for securely deleting virtual machine image files
CN112667358A (en)Management method of virtual machine snapshot, electronic device and computer readable medium

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp