Method, system, terminal and storage medium for generating snapshot of process data

By maintaining a memory region table, especially a binary search tree structure, in the storage system to generate process data snapshots, the problems of untimely and incomplete information acquisition in existing technologies are solved, achieving more comprehensive real-time information acquisition and efficient snapshot generation.

CN117216003BActive Publication Date: 2025-12-19INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311263947.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-27
Publication Date
2025-12-19
Estimated Expiration
2043-09-27

AI Technical Summary

Technical Problem

Existing technologies cannot fully cover the real-time data and business logs of the storage system without affecting the normal operation of the business, resulting in untimely and incomplete information acquisition.

Method used

By maintaining a memory region table, particularly a binary search tree structure, temporary memory and general data information of the process are saved, and snapshots are generated based on this information, including traversing memory regions, calculating required capacity, allocating storage locations, generating and transferring snapshots.

Benefits of technology

It enables real-time information acquisition during storage system development, testing, or customer site visits, improving the comprehensiveness and timeliness of information, increasing the efficiency and accuracy of snapshot generation, and optimizing memory utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117216003B_ABST
    Figure CN117216003B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of servers, and specifically provides a method, a system, a terminal and a storage medium for generating a snapshot for process data, which comprises the following steps: saving first storage information and second storage information of a process to a memory area table, the first storage information comprising temporary memory area information of the process, the temporary memory being used for storing instant service data, and the second storage information comprising general data storage information of the process; querying the first storage information and the second storage information of a target process from the memory area table, and generating a snapshot for general data and instant service data of the target process based on the first storage information and the second storage information and storing the snapshot. In the running scene of a storage system development, testing or customer site, the present application can capture the instantaneous state, that is, acquire instant information of each module of the process and dump the information in the form of a snapshot. The acquired information is more comprehensive and has better timeliness, and the development debugging and problem positioning are facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of servers, and particularly relates to a method, system, terminal and storage medium for generating snapshots for process data. BACKGROUND

[0002] In the context of massive storage, big data and AI, the demand for storage services of various industries is growing, and storage systems need to be upgraded in business and performance while optimizing debugging means. In the running scenarios of development, testing or customer sites, the storage system will capture the real-time data as needed. Currently, the means are to capture system information and business logs and other dump information without affecting the normal operation of the business.

[0003] However, system information and business logs and other information often cannot meet the immediacy and cannot cover the information of all current business modules. SUMMARY

[0004] In view of the above deficiencies of the prior art, the application provides a method, system, terminal and storage medium for generating snapshots for process data to solve the above technical problems.

[0005] In a first aspect, the application provides a method for generating snapshots for process data, comprising:

[0006] Saving first storage information and second storage information of the process to a memory area table, the first storage information comprising temporary memory area information of the process, the temporary memory being used for storing real-time business data, and the second storage information comprising general data storage information of the process;

[0007] Querying the first storage information and the second storage information of the target process from the memory area table, and generating snapshots for the general data and the real-time business data of the target process based on the first storage information and the second storage information and storing the snapshots.

[0008] In an optional embodiment, saving the first storage information and the second storage information of the process to the memory area table comprises:

[0009] Traversing the area information of the temporary memory of all processes, the area information comprising a start address, an end address and a length;

[0010] Inserting the area information into the memory area table in the form of a node, the node comprising a start address, an end address, a length, a dump location and check information, the dump location and the check information being blank parameter items.

[0011] In an optional embodiment, the data structure of the memory area table is a binary sort tree.

[0012] In an optional implementation, the first storage information and the second storage information of the process are saved to the memory region table, including:

[0013] receiving a trigger instruction for generating a snapshot, obtaining a BSS data segment and a data data segment of a target process of the trigger instruction;

[0014] saving the BSS data segment and the data data segment of the target process to a target node of the memory region table, the target node having a corresponding relationship with the target process.

[0015] In an optional implementation, receiving a trigger instruction for generating a snapshot, obtaining a BSS data segment and a data data segment of a target process of the trigger instruction, includes:

[0016] defining a first global variable and a second global variable, the first global variable being uninitialized or initialized to 0, and the second global variable being initialized to a non-0;

[0017] when searching for the BSS data segment, obtaining a first address of the first global variable that is uninitialized or initialized to 0;

[0018] traversing an address space of the process to find a first memory region containing the first address, and obtaining a start address, an end address and a length of the first memory region;

[0019] when searching for the data data segment of the process, obtaining a second address of the second global variable;

[0020] traversing the address space of the process to find a second memory region containing the second address, and obtaining a start address, an end address and a length of the second memory region, to obtain memory region information of the data data segment.

[0021] In an optional implementation, the first storage information and the second storage information of the target process are queried from the memory region table, and a snapshot of general data and instant service data of the target process is generated based on the first storage information and the second storage information, and the snapshot is stored, including:

[0022] calculating a general data amount and an instant service data amount based on the first storage information and the second storage information, and taking a sum of the general data amount and the instant service data amount as a required capacity;

[0023] extracting all start addresses in the memory region table, and sorting the start addresses in ascending order to obtain an address array;

[0024] obtaining an allocatable region of the memory and a length of the allocatable region based on the lengths corresponding to the start addresses;

[0025] allocate a dispensable area matching the length with the required capacity as a target storage location to the target process;

[0026] generate a snapshot for the general data and the instant service data indicated by the first storage information and the second storage information respectively;

[0027] save the snapshot and the information of the memory area table to the target storage location, generate a check value of the snapshot and save the check value to a check information parameter item of a corresponding node in the memory area table, and save the target storage location to a dump location parameter item of the corresponding node in the memory area table;

[0028] traverse the memory area table, take a node with non-empty check information as a target node, extract the snapshot from the dump location of the target node, and save the snapshot in the form of a compressed file package to a specified path and delete the snapshot in the memory.

[0029] In an optional embodiment, the method further comprises:

[0030] if there are multiple target processes, a maintenance thread is created for each target process, and the maintenance thread generates a snapshot for the general data and the instant service data of the target process based on the target process and stores the snapshot.

[0031] In a second aspect, the application provides a system for generating a snapshot for process data, comprising:

[0032] a list maintenance module for saving first storage information and second storage information of a process to a memory area table, the first storage information comprising temporary memory area information of the process, and the temporary memory being used for storing instant service data, and the second storage information comprising general data storage information of the process;

[0033] a snapshot generation module for querying the first storage information and the second storage information of a target process from the memory area table, and generating a snapshot for the general data and the instant service data of the target process based on the first storage information and the second storage information and storing the snapshot.

[0034] In an optional embodiment, the list maintenance module comprises:

[0035] a process traversal unit for traversing area information of a temporary memory of all processes, the area information comprising a start address, an end address and a length;

[0036] an information saving unit for inserting the area information into the memory area table in the form of a node, the node comprising a start address, an end address, a length, a dump location and check information, the dump location and the check information being blank parameter items.

[0037] In an optional implementation, the data structure of the memory region table is a binary sort tree.

[0038] In an optional implementation, the list maintenance module comprises:

[0039] The data acquisition unit is configured to receive a trigger instruction for generating a snapshot, and acquire a BSS data segment and a data data segment of a target process of the trigger instruction.

[0040] The data storage unit is configured to save the BSS data segment and the data data segment of the target process to a target node of the memory region table, the target node having a corresponding relationship with the target process.

[0041] In an optional implementation, the data acquisition unit comprises:

[0042] The variable definition subunit is configured to define a first global variable and a second global variable, the first global variable being not initialized or initialized as 0, and the second global variable being initialized as non-0.

[0043] The first acquisition subunit is configured to acquire a first address of the first global variable that is not initialized or initialized as 0 when searching for the BSS data segment.

[0044] The first search subunit is configured to traverse an address space of the process, find a first memory region containing the first address, and acquire a start address, an end address and a length of the first memory region.

[0045] The second acquisition subunit is configured to acquire a second address of the second global variable when searching for the data data segment of the process.

[0046] The second search subunit is configured to traverse the address space of the process, find a second memory region containing the second address, and acquire a start address, an end address and a length of the second memory region, to obtain memory region information of the data data segment.

[0047] In an optional implementation, the snapshot generation module comprises:

[0048] The capacity calculation unit is configured to calculate a general data amount and an instant service data amount based on the first storage information and the second storage information, and take a sum of the general data amount and the instant service data amount as the demand capacity.

[0049] The array generation unit is configured to extract all start addresses in the memory region table, and sort the start addresses in ascending order to obtain an address array.

[0050] The memory calculation unit is configured to acquire an allocable region of memory and a length of the allocable region based on lengths corresponding to the start addresses.

[0051] a memory allocation unit configured to allocate a target storage location to the target process as a memory region with a length matching the required capacity;

[0052] a snapshot generation unit configured to generate snapshots for the general data and the real-time service data indicated by the first storage information and the second storage information, respectively;

[0053] an information updating unit configured to save the snapshots and information of the memory region table to the target storage location, generate a check value of the snapshots and save the check value to a check information parameter item of a corresponding node in the memory region table, and save the target storage location to a dump location parameter item of the corresponding node in the memory region table;

[0054] a snapshot dump unit configured to traverse the memory region table, take a node with non-empty check information as a target node, extract the snapshots from the dump location of the target node, save the snapshots in the form of a compressed file package to a specified path, and delete the snapshots in the memory.

[0055] In an optional embodiment, the system further comprises:

[0056] a concurrent processing module configured to create a maintenance thread for each target process if there are multiple target processes, and the maintenance thread generates snapshots for the general data and the real-time service data of the target process based on the target process and dumps the snapshots.

[0057] In a third aspect, a terminal is provided, comprising:

[0058] a processor and a memory, wherein,

[0059] the memory is configured to store a computer program,

[0060] the processor is configured to call and run the computer program from the memory, so that the terminal executes the method of the terminal described above.

[0061] In a fourth aspect, a computer storage medium is provided, and the computer readable storage medium stores instructions, when the instructions are run on a computer, the computer executes the method described in the above aspects.

[0062] The method, system, terminal and storage medium provided by the present application can capture the instantaneous state, i.e. acquire the real-time information of each module of the process and dump in the form of snapshots, in the running scene of storage system development, testing or customer site, etc. The acquired information is more comprehensive and has better timeliness, which facilitates development and debugging and problem positioning.

[0063] The application can quickly query the data address and perform memory capacity calculation based on the data address and fast query of target data requiring to generate a snapshot by maintaining the memory area table of the binary sorting tree structure, thereby improving the snapshot generation efficiency and accuracy.

[0064] The application improves the accuracy of the required capacity by performing memory capacity calculation based on the first storage information and the second storage information in the memory area table, and further improves the memory utilization by matching the length of the memory allocable area with the required capacity, thereby avoiding the small capacity area of the memory from being unable to be utilized.

[0065] In addition, the application has reliable design principles, simple structure and very wide application prospects. BRIEF DESCRIPTION OF DRAWINGS

[0066] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, for those of ordinary skill in the art, other drawings can also be obtained without creative labor based on these drawings.

[0067] Figure 1 is a schematic flow chart of the method of an embodiment of the present application.

[0068] Figure 2 is another schematic flow chart of the method of an embodiment of the present application.

[0069] Figure 3 is a schematic block diagram of the system of an embodiment of the present application.

[0070] Figure 4 is a structural schematic diagram of a terminal provided by an embodiment of the present application. DETAILED DESCRIPTION

[0071] In order to make the person skilled in the art better understand the technical solutions in the present application, the following will combine the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor should belong to the protection scope of the present application.

[0072] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs. The terms used in the specification of the present application are only for the purpose of describing the specific embodiments and are not intended to limit the present application.

[0073] The following explains the key terms appearing in the present application.

[0074] BSS segment refers to a memory area used to store global variables and static variables in a program that are not initialized or initialized to 0.

[0075] Data segment refers to a memory area used to store initialized global variables in a program.

[0076] Binary sort tree (Binary Sort Tree), also known as binary search tree (Binary Search Tree), is a kind of data structure. In general, the query efficiency is higher than that of linked list structure.

[0077] Snapshot, also known as snapshot technology, is widely used in backup. It has been applied to arrays and hosts for a long time, mainly using the copy on write algorithm, and is usually based on volumes and processed at the block level. About a complete copy of a specified data set, the copy includes the image of the corresponding data at a certain time point (the time point when the copy starts). The snapshot can be a copy of the data it represents, or a replica of the data. Snapshot actually refers to a reference mark or pointer to the data saved in the storage device. In other words, it is the status of the data at a certain time, and the core of its working principle is to establish a pointer list to indicate the address of the read data, and provide an instantaneous image of the data. When the data changes, it is copied again. Snapshot is roughly divided into two types: one is called copy-on-write snapshot, which is also commonly known as pointer-type snapshot, and VSS belongs to this type; the other is called split-mirror snapshot, which is commonly known as mirror-type snapshot. Pointer-type snapshot occupies less space and has less impact on system performance, but if there is no backup and the original data disk is damaged, the data cannot be recovered; while mirror-type snapshot is actually a full mirror of the data at that time, which will cause a certain load on the system performance, but even if the original data is damaged, it will not have much impact, but it will occupy an equal amount of space.

[0078] The method for generating a snapshot of process data provided by the embodiment of the application is executed by a computer device, and accordingly, the system for generating a snapshot of process data runs in the computer device.

[0079] Figure 1 is a schematic flowchart of the method of an embodiment of the application. In the flowchart, Figure 1 The execution subject can be a system for generating a snapshot of process data. According to different requirements, the order of steps in the flowchart can be changed, and some steps can be omitted.

[0080] AsFigure 1 The method comprises the following steps:

[0081] In step 110, first storage information and second storage information of the process are saved to a memory area table, the first storage information comprising temporary memory area information of the process, the temporary memory being used for storing instant service data, and the second storage information comprising general data storage information of the process.

[0082] In step 120, the first storage information and the second storage information of the target process are queried from the memory area table, and a snapshot is generated for the general data and the instant service data of the target process based on the first storage information and the second storage information, and the snapshot is stored.

[0083] In order to facilitate the understanding of the present application, the method for generating a snapshot of process data provided by the present application is further described below in the principle of the present application as a method for generating a snapshot of process data, in combination with the process of generating a snapshot of process data in the embodiments.

[0084] Specifically, please refer to Figure 2 The method for generating a snapshot of process data comprises the following steps:

[0085] S1, first storage information and second storage information of the process are saved to a memory area table, the first storage information comprising temporary memory area information of the process, the temporary memory being used for storing instant service data, and the second storage information comprising general data storage information of the process.

[0086] S101, the method for maintaining the first storage information in the memory area table is as follows:

[0087] The region information of the temporary memory of all processes is traversed, the region information comprising a start address, an end address and a length; the region information is inserted into the memory area table in the form of a node, the node comprising a start address, an end address, a length, a dump location and check information, the dump location and the check information being blank parameter items.

[0088] For example, the process defines various data structures, and part or all of the data information can be put into the process data snapshot during the process initialization or running phase. The process maintains a memory area table, and the data structure of the table can be a binary sort tree. Each element in the memory area table is used to describe the information of a memory area, and each memory area mainly has five members: start_address, end_address, length, lrc, and file_position. The start_address is the start memory address of the memory area, the end_address is the end memory address of the memory area, the length is the length of the memory area, the lrc is the check information of the data of the memory area, and the file_position is the position of the memory area in the file during dumping. Each memory area information is inserted into the binary sort tree in the form of a node. When the process captures the real-time data in its own memory, the memory area table is referred to.

[0089] During the process initialization or running process, the real-time data information that needs to be captured is added to the memory area table in the form of a memory area. During the program running process, the data in the memory has address and length information, and the lrc and file_position are not assigned at this time, and are filled with 0 first, because the snapshot has not been generated.

[0090] S102, the method for maintaining the second storage information in the memory area table comprises:

[0091] A trigger instruction for generating a snapshot is received, and a BSS data segment and a data segment of a target process of the trigger instruction are obtained. The BSS data segment and the data segment of the target process are saved to a target node of the memory area table, and the target node has a corresponding relationship with the target process.

[0092] The method for obtaining the BSS data segment and the data segment comprises: defining a first global variable and a second global variable, the first global variable being not initialized or initialized to 0, and the second global variable being initialized to a non-0; when searching for the BSS data segment, a first address of the first global variable that is not initialized or initialized to 0 is obtained; the address space of the process is traversed, a first memory area containing the first address is found, and the start address, the end address, and the length of the first memory area are obtained; when searching for the data segment of the process, a second address of the second global variable is obtained; the address space of the process is traversed, a second memory area containing the second address is found, and the start address, the end address, and the length of the second memory area are obtained, and the memory area information of the data segment is obtained.

[0093] For example, when the process receives an instruction to generate a data snapshot, the BSS data segment and the data segment of the process are first put into a memory area table. A kernel module is added for searching the BSS data segment and the data segment of the process. The method is that the BSS data segment is a global data memory area that is not initialized or initialized to 0 in the process, and the data segment is a global data memory area that has been initialized. Two global variables are defined, one of which is not initialized or initialized to 0, and the other of which is initialized to a non-0. When searching the BSS data segment, the address of the global variable that is not initialized or initialized to 0 is passed to the kernel module for searching the BSS data segment and the data segment of the process, which traverses the address space of the process to find the memory area containing the address, and returns the start_address, end_address, length of the area, so that the memory area information of the BSS data segment is known. Similarly, when searching the data segment of the process, the address of the global variable that is initialized to a non-0 is passed to the kernel module for searching the BSS data segment and the data segment of the process, and the memory area information of the data segment is obtained.

[0094] S2, querying the first storage information and the second storage information of the target process from the memory area table, and generating a snapshot for the general data and the instant service data of the target process based on the first storage information and the second storage information and storing the snapshot.

[0095] S201, calculating the general data amount and the instant service data amount based on the first storage information and the second storage information, and taking the sum of the general data amount and the instant service data amount as the demand capacity.

[0096] The sum of the memory area length in the first storage information and the memory area length in the second storage information is the demand capacity.

[0097] S202, allocating memory based on the demand capacity.

[0098] Extracting all start addresses in the memory area table, and sorting the start addresses in ascending order to obtain an address array; based on the length corresponding to each start address, obtaining the allocable area of the memory and the length of the allocable area; and allocating the allocable area with a length matching the demand capacity to the target process as the target storage location.

[0099] Specifically, because the snapshot is equivalent to a photo of the process memory data, i.e. records the instantaneous state of the process. The snapshot first exists in the memory, and after completion, a special thread will dump the snapshot to the file for persistent storage. If the memory area table is not an ordered data structure, it also needs to be sorted; if it is an ordered data structure, the memory area table is converted into a one-dimensional array form, and the memory areas in the array are arranged in ascending order according to the starting address of the memory area. The memory size required to generate the snapshot is actually the length of all memory areas in the snapshot memory area table, plus the size of the one-dimensional array form of the memory area table. In the system, a memory area of this size is temporarily allocated to save the process data snapshot.

[0100] S203, generate a snapshot.

[0101] The snapshot of the general data and the real-time service data indicated by the first storage information and the second storage information respectively is generated; the snapshot and the information of the memory area table are saved to the target storage location, a check value of the snapshot is generated and saved to a check information parameter item of a corresponding node in the memory area table, and the target storage location is saved to a dump location parameter item of the corresponding node in the memory area table; the memory area table is traversed, a node with non-empty check information is taken as a target node, the snapshot is extracted from the dump location of the target node, and the snapshot is saved to a specified path in the form of a compressed file package and deleted from the memory.

[0102] Specifically, all memory area data in the memory area table and the information of the memory area table are copied to the temporary memory for saving the process data snapshot. First, the one-dimensional array form of the memory area table is written to the start address of the temporary memory for saving the process data snapshot, then according to the start_address and length of the first memory area in the memory area table, the data of the area is read and written to the subsequent address of the temporary memory for saving the process data snapshot, and the address and the data check information of the first memory area are filled into the file_position and lrc fields in the first memory area information in the memory area table that has been written. Similarly, the second and third memory areas are the same. Finally, the writing of all memory areas is completed, i.e. the generation of the process data snapshot is completed. Of course, this process can also be executed in a multi-thread concurrent form. If concurrent execution exists, a maintenance thread is created for each target process, and the maintenance thread generates a snapshot of the general data and the real-time service data of the target process based on the target process. Finally, the snapshot is written to a file in a specified path, and the snapshot is deleted to release the memory occupied by the snapshot.

[0103] In some embodiments, the system for generating snapshot for process data can include a plurality of functional modules composed of computer program segments. The computer programs of each program segment in the system for generating snapshot for process data can be stored in the memory of the computer device and executed by at least one processor to perform the functions (see Figure 1 described) for generating snapshot for process data.

[0104] In this embodiment, the system for generating snapshot for process data can be divided into a plurality of functional modules according to the functions it performs, as shown in Figure 3 The functional modules of the system 300 can include a list maintenance module 310 and a snapshot generation module 320. The module referred to by the present application refers to a series of computer program segments that can be executed by at least one processor and can complete a fixed function, which are stored in the memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.

[0105] The list maintenance module is configured to save the first storage information and the second storage information of the process to the memory area table, the first storage information including temporary memory area information of the process, the temporary memory being used to store instant service data, and the second storage information including general data storage information of the process.

[0106] The snapshot generation module is configured to query the first storage information and the second storage information of the target process from the memory area table, and generate snapshots for the general data and the instant service data of the target process based on the first storage information and the second storage information and store the snapshots.

[0107] Optionally, as an embodiment of the present application, the list maintenance module includes:

[0108] The process traversal unit is configured to traverse the region information of the temporary memory of all processes, the region information including a start address, an end address, and a length.

[0109] The information saving unit is configured to insert the region information into the memory area table in the form of a node, the node including a start address, an end address, a length, a dump location, and check information, the dump location and the check information being blank parameter items.

[0110] Specifically, the process defines various data structures, and part or all of the data information can be put into the process data snapshot during the process initialization or running phase. The process maintains a memory area table, and the data structure of the table can be a binary sort tree. Each element in the memory area table is used to describe the information of a memory area, and each memory area mainly has five members: start_address, end_address, length, lrc, and file_position. The start_address is the start memory address of the memory area, the end_address is the end memory address of the memory area, the length is the length of the memory area, the lrc is the check information of the data of the memory area, and the file_position is the position of the memory area in the file during dumping. Each memory area information is inserted into the binary sort tree in the form of a node. The process refers to the memory area table when capturing the real-time data in the memory.

[0111] During the process initialization or running process, the real-time data information that needs to be captured is added to the memory area table in the form of a memory area. During the program running process, the data in the memory has address and length information, and the lrc and file_position are not assigned values, and are filled with 0 first, because the snapshot has not been generated.

[0112] Optionally, as an embodiment of the present application, the data structure of the memory area table is a binary sort tree.

[0113] Optionally, as an embodiment of the present application, the list maintenance module comprises:

[0114] The data acquisition unit is configured to receive a trigger instruction for generating a snapshot, and acquire the BSS data segment and the data data segment of a target process of the trigger instruction.

[0115] The data storage unit is configured to save the BSS data segment and the data data segment of the target process to a target node of the memory area table, and the target node has a corresponding relationship with the target process.

[0116] Optionally, as an embodiment of the present application, the data acquisition unit comprises:

[0117] The variable definition subunit is configured to define a first global variable and a second global variable, the first global variable is not initialized or is initialized to 0, and the second global variable is initialized to a non-0 value.

[0118] The first obtaining subunit is configured to obtain a first address of a first global variable that is not initialized or initialized as 0 when searching for a BSS data segment.

[0119] The first searching subunit is configured to traverse the address space of the process, find a first memory region containing the first address, and obtain a start address, an end address and a length of the first memory region.

[0120] The second obtaining subunit is configured to obtain a second address of a second global variable when searching for a data segment of the process.

[0121] The second searching subunit is configured to traverse the address space of the process, find a second memory region containing the second address, and obtain a start address, an end address and a length of the second memory region, to obtain the memory region information of the data segment.

[0122] Optionally, as an embodiment of the present application, the snapshot generation module comprises:

[0123] The capacity calculation unit is configured to calculate the general data volume and the instant service data volume based on the first storage information and the second storage information, and take the sum of the general data volume and the instant service data volume as the demand capacity.

[0124] The array generation unit is configured to extract all start addresses in the memory region table, and sort the start addresses in ascending order to obtain an address array.

[0125] The memory calculation unit is configured to obtain the allocable region of the memory and the length of the allocable region based on the length corresponding to each start address.

[0126] The memory allocation unit is configured to allocate the allocable region with the length matching the demand capacity to the target process as a target storage location.

[0127] The snapshot generation unit is configured to generate snapshots for the general data and the instant service data indicated by the first storage information and the second storage information, respectively.

[0128] The information updating unit is configured to save the snapshot and the information of the memory region table to the target storage location, generate a check value of the snapshot and save the check value to a check information parameter item of a corresponding node in the memory region table, and save the target storage location to a dump location parameter item of a corresponding node in the memory region table.

[0129] The snapshot dump unit is configured to traverse the memory region table, take a node with non-empty check information as a target node, extract the snapshot from the dump location of the target node, save the snapshot in the form of a compressed file package to a specified path, and delete the snapshot in the memory.

[0130] Optionally, as one embodiment of the present application, the system further comprises:

[0131] The concurrent processing module is configured to create a maintenance thread for each target process if there are multiple target processes, and the maintenance thread generates a snapshot of the general data and the real-time service data of the target process based on the target process and stores the snapshot.

[0132] The above process data snapshot generation system can capture the instantaneous state, i.e., obtain the real-time information of each module of the process and dump the information in the form of a snapshot, in the running scenarios such as storage system development, testing or customer site, so that the obtained information is more comprehensive and has better timeliness, facilitating development and debugging and problem positioning.

[0133] The present application can quickly query the data address and perform memory capacity calculation based on the snapshot requirement and fast query of the target data to be generated, thereby improving the snapshot generation efficiency and accuracy.

[0134] The present application improves the accuracy of the requirement capacity by performing memory capacity calculation based on the first storage information and the second storage information in the memory region table, and further improves the memory utilization by matching the length of the memory allocatable region with the requirement capacity, thereby avoiding the small capacity region of the memory from being unable to be utilized.

[0135] Figure 4 A structure schematic diagram of a terminal 400 is provided for the embodiment of the present application, and the terminal 400 can be used to execute the process data snapshot generation method provided by the embodiment of the present application.

[0136] The terminal 400 can include a processor 410, a memory 420 and a communication unit 430. These components communicate through one or more buses, and those skilled in the art can understand that the structure of the server shown in the figure does not constitute a limitation on the present application, which can be a bus structure or a star structure, and can include more or fewer components than shown in the figure, or combine some components or different component arrangements.

[0137] The memory 420 can be used to store the execution instructions of the processor 410, and the memory 420 can be implemented by any type of volatile or non-volatile storage terminal or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk. When the execution instructions in the memory 420 are executed by the processor 410, the terminal 400 can execute part or all of the steps in the following method embodiments.

[0138] The processor 410 is the control center of the storage terminal, connects all parts of the electronic terminal through various interfaces and lines, executes the software programs and / or modules stored in the memory 420, and calls the data stored in the memory, so as to execute various functions of the electronic terminal and / or process data. The processor can be composed of an integrated circuit (IC), for example, can be composed of a single packaged IC, or can be composed of a plurality of packaged ICs with the same function or different functions. For example, the processor 410 can only include a central processing unit (CPU). In the embodiment of the application, the CPU can be a single operation core or can include multiple operation cores.

[0139] The communication unit 430 is used to establish a communication channel, so that the storage terminal can communicate with other terminals. The user data sent by other terminals is received or the user data is sent to other terminals.

[0140] The application also provides a computer storage medium, wherein the computer storage medium can store a program, and the program can include part or all of the steps in each embodiment provided by the application when executed. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0141] Therefore, in the running scene of the storage system development, test or customer site, the application can capture the instantaneous state, that is, obtain the real-time information of each module of the process and dump in the form of snapshot. The obtained information is more comprehensive and has better timeliness, which is convenient for development and debugging and problem positioning. The technical effects that can be achieved by the embodiment can be referred to the description in the foregoing, and will not be described here.

[0142] Those skilled in the art can clearly understand that the technical solutions in the embodiments of the present application can be implemented by means of software plus necessary universal hardware platforms. Based on such an understanding, the technical solutions in the embodiments of the present application can be embodied in the form of a software product, which can be stored in a storage medium, such as a USB flash disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and the like, and includes a plurality of instructions for causing a computer terminal (which can be a personal computer, a server, or a second terminal, a network terminal, or the like) to execute all or part of the steps of the methods described in the embodiments of the present application.

[0143] In the present specification, the same or similar parts among various embodiments can be referred to each other. In particular, for the terminal embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description in the method embodiments.

[0144] In several embodiments provided in the present application, it should be understood that the disclosed system and method can be implemented in other ways. For example, the system embodiments described above are merely schematic, for example, the division of the modules is only a logical function division, and actual implementation can have another division manner, for example, a plurality of modules or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed modules can be indirect coupling or communication connection through some interfaces, systems or modules, and can be electrical, mechanical or other forms.

[0145] The modules described as separate components can or can not be physically separated, and the components displayed as modules can or can not be physical modules, that is, they can be located in one place, or can be distributed on a plurality of network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the embodiments.

[0146] In addition, each functional module in the various embodiments of the present application can be integrated in one processing module, or each module can exist physically separately, or two or more modules can be integrated in one module.

[0147] Although the present application has been described in detail with reference to the preferred embodiments, it should be understood that the application is not limited to those preferred embodiments. Various equivalent modifications or changes in the application can be made all of which fall within the scope of the present application. Any modifications or changes in the application should be construed as falling within the scope of the present application. The scope of the application should be determined by the appended claims.

Claims

1. A method of generating a snapshot for process data, characterized by, The method comprises the following steps: saving first storage information and second storage information of a process to a memory area table, wherein the first storage information comprises temporary memory area information of the process, and the temporary memory is used for storing instant service data, and the second storage information comprises general data storage information of the process; inquiring the first storage information and the second storage information of a target process from the memory area table, and generating snapshots for general data and instant service data of the target process based on the first storage information and the second storage information and storing the snapshots; saving first storage information and second storage information of a process to a memory area table, comprising: traversing area information of temporary memories of all processes, wherein the area information comprises a start address, an end address and a length; inserting the area information into the memory area table in the form of a node, wherein the node comprises the start address, the end address, the length, a dump location and check information, and the dump location and the check information are blank parameter items; inquiring the first storage information and the second storage information of a target process from the memory area table, and generating snapshots for general data and instant service data of the target process based on the first storage information and the second storage information and storing the snapshots, comprising: calculating the amount of general data and the amount of instant service data based on the first storage information and the second storage information, and taking the sum of the amount of general data and the amount of instant service data as a required capacity; extracting all start addresses in the memory area table, and sorting the start addresses in ascending order to obtain an address array; obtaining an allocable area of the memory and the length of the allocable area based on the length corresponding to each start address; allocating an allocable area with a length matched with the required capacity to the target process as a target storage location; generating snapshots for general data and instant service data indicated by the first storage information and the second storage information respectively; saving the snapshots and the information of the memory area table to the target storage location, generating a check value of the snapshots and saving the check value to the check information parameter item of the corresponding node in the memory area table, and saving the target storage location to the dump location parameter item of the corresponding node in the memory area table; traversing the memory area table, taking a node with non-empty check information as a target node, extracting the snapshots from the dump location of the target node, and saving the snapshots in the form of a compressed file package to a specified path and deleting the snapshots in the memory.

2. The method of claim 1, wherein, The data structure of the memory area table is a binary sort tree.

3. The method of claim 1, wherein, The method of saving first storage information and second storage information of a process to a memory area table comprises: receiving a trigger instruction for generating snapshots, and obtaining a BSS data segment and a data data segment of a target process of the trigger instruction; saving the BSS data segment and the data data segment of the target process to a target node of the memory area table, wherein the target node has a corresponding relationship with the target process.

4. The method of claim 3, wherein, The method of receiving a trigger instruction for generating snapshots, and obtaining a BSS data segment and a data data segment of a target process of the trigger instruction comprises: defining a first global variable and a second global variable, wherein the first global variable is not initialized or is initialized to 0, and the second global variable is initialized to a non-0 value. When searching for a BSS data segment, a first address of a first global variable that is not initialized or initialized to 0 is obtained; An address space of the process is traversed to find a first memory region containing the first address, and a start address, an end address and a length of the first memory region are obtained; When searching for a data segment of the process, a second address of a second global variable is obtained; An address space of the process is traversed to find a second memory region containing the second address, and a start address, an end address and a length of the second memory region are obtained to obtain memory region information of the data segment.

5. The method of claim 1, wherein, The method further comprises: If there are multiple target processes, a maintenance thread is created for each target process, and the maintenance thread generates a snapshot of general data and instant service data of the target process based on the target process and stores the snapshot.

6. A system for generating a snapshot of process data, the system comprising: It comprises: A list maintenance module is configured to save first storage information and second storage information of a process to a memory region table, the first storage information comprising temporary memory region information of the process, and the temporary memory being used to store instant service data, and the second storage information comprising general data storage information of the process; A snapshot generation module is configured to query the first storage information and the second storage information of a target process from the memory region table, and generate a snapshot of general data and instant service data of the target process based on the first storage information and the second storage information and store the snapshot; Saving first storage information and second storage information of a process to a memory region table comprises: Traversing region information of temporary memories of all processes, the region information comprising a start address, an end address and a length; Inserting the region information into the memory region table in the form of a node, the node comprising a start address, an end address, a length, a dump location and check information, the dump location and the check information being blank parameter items; Querying the first storage information and the second storage information of a target process from the memory region table, and generating a snapshot of general data and instant service data of the target process based on the first storage information and the second storage information and storing the snapshot comprises: Calculating a general data amount and an instant service data amount based on the first storage information and the second storage information, and taking a sum of the general data amount and the instant service data amount as a required capacity; Extracting all start addresses in the memory region table, and sorting the start addresses in ascending order to obtain an address array; Obtaining an allocatable region of the memory and a length of the allocatable region based on the length corresponding to each start address; Allocating an allocatable region with a length matching the required capacity to the target process as a target storage location; Generating a snapshot of general data and instant service data indicated by the first storage information and the second storage information, respectively; Saving the snapshot and information of the memory region table to the target storage location, generating a check value of the snapshot and saving the check value to a check information parameter item of a corresponding node in the memory region table, and saving the target storage location to a dump location parameter item of a corresponding node in the memory region table; Traverse the memory region table, take the node with non-empty check information as a target node, extract a snapshot from a dump location of the target node, save the snapshot in the form of a compressed file package to a specified path, and delete the snapshot in the memory.

7. A terminal, characterized by comprising: Comprise: a memory for storing a program for generating a snapshot for process data; a processor for implementing the steps of the method for generating a snapshot for process data according to any one of claims 1-5 when executing the program for generating a snapshot for process data.

8. A computer readable storage medium storing a computer program, characterized in that, The readable storage medium has stored thereon a program for generating a snapshot for process data, and the program for generating a snapshot for process data implements the steps of the method for generating a snapshot for process data according to any one of claims 1-5 when executed by a processor.

Citation Information

Patent Citations

  • Method and device for collecting memory snapshot of application process and medium

    CN115617521A

  • Transactional key-value store

    US20170371912A1