A method, device, electronic device and storage medium for analyzing business memory data
By constructing a multi-tree and merging node information, the problem of unclear database memory usage is solved, and the efficiency and cost reduction of database memory management are achieved.
Patent Information
- Application Number
- CN202410841012.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2044-06-26
AI Technical Summary
The business memory data stored in the database continues to increase with business development. Data that is not cleaned in time leads to an increase in memory capacity, reduced management efficiency, increased operating costs, and it is difficult to clarify the memory capacity usage.
By obtaining the key and attribute information of business memory data, construct a multi-tree, merge node information, determine the memory occupation path, display a visual graphical interface to display the memory occupation information, and improve the efficiency of database management.
Clearly understand the database memory distribution, optimize memory management, reduce operating costs, and improve data management efficiency.
Smart Images

Figure CN118394801B
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a business memory data analysis method, device, electronic device and storage medium. Background Art
[0002] In order to manage the business memory data of each business, the business memory data of each business is usually stored in a database. When storing business memory data in a database, a corresponding key can be set for each business memory data, and the corresponding relationship between the key (key) and the business memory data (value) is stored in the database in the form of a key-value pair. For example, Redis is a key-value pair cache database that can store each business memory data in the form of a key-value pair.
[0003] With the development and iteration of business, the amount of business memory data stored in the database is increasing, and the memory capacity occupied by the database is also increasing. However, the database may store some business memory data that has not been cleaned up in time, such as test data, expired data, and business memory data of some abandoned business functions. In this case, if the staff does not analyze the memory occupied by the business memory data of each business and expand the database without clarifying the memory capacity occupancy of the database, it will not only fail to improve the management efficiency of the database, but also increase the operating costs of the database. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a business memory data analysis method, device, electronic device and storage medium to analyze the memory usage information corresponding to the business memory data of each business in the database, thereby improving the database management efficiency. The specific technical solution is as follows:
[0005] In a first aspect, an embodiment of the present application provides a method for analyzing business memory data, the method comprising:
[0006] Obtaining a key of each business memory data and attribute information of each key, wherein the key of the business memory data is generated based on a key template of the business memory data, and the attribute information includes the memory occupied by the business memory data corresponding to the key;
[0007] Constructing a multi-branch tree based on the key of each business memory data, wherein each node of the multi-branch tree represents a field included in the key, and the field includes at least a business identifier of the business memory data;
[0008] Based on the node name of each node in the multi-branch tree and the correspondence between the preset node name and the business type identifier, determine the target business type identifier of each node, and determine the business node identifier of each node according to the metadata of each node and the corresponding target business type identifier, wherein the metadata of the node includes the node level, depth and corresponding key data type, and the depth is the number of fields after the key corresponding to the node is split according to the preset segmentation rule;
[0009] Merge the target nodes with the same preceding nodes and the same business node identifier in the multi-branch tree, and record the node information of the merged nodes, wherein the node information includes the number of target nodes corresponding to the merged nodes and the memory occupied by the business memory data corresponding to the corresponding target nodes;
[0010] Determine each node path from the root node to each terminal node in the multi-branch tree, and determine the memory occupancy information corresponding to the business memory data of each business based on the node information corresponding to each node path.
[0011] Optionally, the method further includes:
[0012] Displaying a visual graphical interface based on the memory usage information corresponding to the business memory data of each business;
[0013] Among them, the visual graphic interface includes the memory occupied by the business memory data of the target business displayed in a graphic, and / or, the memory occupancy rate of the business memory data displayed in a graphic ranked top a preset number of businesses; the target business is the business whose memory occupancy rate of the corresponding business memory data is higher than the preset value.
[0014] Optionally, the step of constructing a multi-branch tree based on the key of each business memory data includes:
[0015] For each key, split the key according to the key structure and the preset splitting rule to obtain the field sequence of the key;
[0016] Taking each field in each field sequence as a node, and determining the parent-child relationship of the nodes corresponding to each field according to the order of each field in each field sequence;
[0017] Starting from the root node of the node sequence corresponding to each field sequence, traverse the node sequences, merge the same root nodes into one root node, and merge the nodes with the same name, corresponding key data type, level and preceding node into one node to obtain a multi-branch tree.
[0018] Optionally, the step of determining the service node identifier of each node according to the metadata of each node and the corresponding target service type identifier includes:
[0019] For each node, the target business type identifier of the node, the level and depth of the node, and the data type of the key corresponding to the node are arranged according to a preset arrangement to obtain the business node identifier of the node.
[0020] Optionally, the step of determining the memory occupancy information corresponding to the business memory data of each business according to the node information corresponding to each node path includes:
[0021] According to the node paths and the preset segmentation rule used to segment the keys of the business memory data, restore the target key template corresponding to each node path;
[0022] Based on the node information corresponding to the target key template and the corresponding relationship between the preset key template and each business, the memory occupancy information corresponding to the business memory data of each business is determined.
[0023] Optionally, before the step of constructing a multi-branch tree based on the key of each business memory data, the method further includes:
[0024] Divide the acquired memory data into multiple data slices, and use each data slice as a file to be analyzed, wherein the memory data includes keys of business memory data of various businesses and attribute information of each key;
[0025] The step of determining the memory occupancy information corresponding to the business memory data of each business according to the node information corresponding to each node path includes:
[0026] Get each node path corresponding to each file to be analyzed, and get all the node paths;
[0027] Constructing a multi-branch tree based on the names of the nodes included in all the node paths, merging the node paths with the same path in the multi-branch tree of all the node paths, and obtaining a target multi-branch tree;
[0028] Based on the node information corresponding to the target multi-branch tree, memory occupancy information corresponding to the business memory data of each business is determined.
[0029] Optionally, the step of constructing a multi-branch tree based on the key of each business memory data includes:
[0030] Determine the total number of data rows included in the memory data;
[0031] If the total number of data rows included in the memory data is not greater than the preset number of rows, a multi-branch tree is constructed based on the key of each business memory data in each file to be analyzed in a single-process single-thread serial manner;
[0032] If the total number of data rows included in the memory data is greater than the preset number of rows, a multi-tree is constructed based on the key of each business memory data in each file to be analyzed in a multi-process and multi-threaded parallel manner.
[0033] Optionally, before the step of merging the target nodes having the same preceding nodes and the same service node identifiers in the multi-branch tree, the method further includes:
[0034] For each node, the node name of the node's predecessor, the node name of the node, the node's level, depth, and the corresponding key data type are combined to obtain the target name of the node;
[0035] The target name of the node is mapped to an integer according to a preset mapping method as the updated node name of the node, wherein the preset mapping method enables the target name of the node to have a unique corresponding integer.
[0036] Optionally, the step of determining the target service type identifier of each node based on the node name of each node in the multi-branch tree and the correspondence between the preset node name and the service type identifier includes:
[0037] For each node in the multi-branch tree, if the node meets the following conditions, the step of determining the target business type identifier of each node based on the node name of each node in the multi-branch tree and the preset correspondence between the node name and the business type identifier is performed: if the node name of the node is not in the preset exclusion list; if the number of nodes included in the level where the node is located is not less than the preset number of nodes; if the depth of the node is greater than 1;
[0038] or,
[0039] If there is a node name that meets the preset rules among the node names of the nodes in the multi-branch tree, the target business type identifier of the node is determined according to the category identifier determination method corresponding to the preset rules; for the node whose node name does not meet the preset rules, the target business type identifier of the node is determined based on the node name of the node and the corresponding relationship between the preset node name and the business type identifier.
[0040] In a second aspect, an embodiment of the present application provides a business memory data analysis device, the device comprising:
[0041] A key acquisition module, used to acquire the key of each business memory data and the attribute information of each key, wherein the key of the business memory data is generated based on the key template of the business memory data, and the attribute information includes the memory occupied by the business memory data corresponding to the key;
[0042] A multi-branch tree construction module, used to construct a multi-branch tree based on the key of each business memory data, wherein each node of the multi-branch tree represents a field included in the key, and the field includes at least a business identifier of the business memory data;
[0043] An identification determination module, used to determine the target business type identification of each node based on the node name of each node in the multi-branch tree and the correspondence between the preset node name and the business type identification, and determine the business node identification of each node according to the metadata of each node and the corresponding target business type identification, wherein the metadata of the node includes the node level, depth and corresponding key data type, and the depth is the number of fields after the key corresponding to the node is split according to the preset segmentation rule;
[0044] A merging module, used to merge target nodes with the same preceding node and the same business node identifier in the multi-branch tree, and record node information of the merged nodes, wherein the node information includes the number of target nodes corresponding to the merged nodes and the memory occupied by the business memory data corresponding to the corresponding target nodes;
[0045] The information determination module is used to determine each node path from the root node to each end node in the multi-branch tree, and determine the memory occupancy information corresponding to the business memory data of each business based on the node information corresponding to each node path.
[0046] Optionally, the device further comprises:
[0047] An interface display module is used to display a visual graphic interface based on the memory occupancy information corresponding to the business memory data of each business, wherein the visual graphic interface at least includes the memory occupied by the business memory data of the target business displayed in a graphic, and / or a preset number of businesses whose memory occupancy rates of the business memory data displayed in a graphic are ranked in the top; the target business is a business whose memory occupancy rate of the corresponding business memory data is higher than a preset value.
[0048] Optionally, the multi-branch tree construction module includes:
[0049] The key segmentation submodule is used to segment each key according to the key structure and the preset segmentation rule to obtain the field sequence of the key;
[0050] A relationship determination submodule, used to take each field in each field sequence as a node, and determine the parent-child relationship of the nodes corresponding to each field according to the order of each field in each field sequence;
[0051] The merging submodule is used to start from the root node of the node sequence corresponding to each field sequence, traverse the node sequences, merge the same root nodes into one root node, and merge the nodes with the same name, corresponding key data type, level and preceding node into one node to obtain a multi-branch tree.
[0052] Optionally, the identification determination module includes:
[0053] The identification determination submodule is used to arrange the target business type identification of each node, the level and depth of the node, and the data type of the key corresponding to the node according to a preset arrangement to obtain the business node identification of the node.
[0054] Optionally, the information determination module includes:
[0055] A template restoration submodule, used to restore the target key template corresponding to each node path according to the node paths and the preset segmentation rules used to segment the keys of the business memory data;
[0056] The first determination submodule is used to determine the memory occupancy information corresponding to the business memory data of each business based on the node information corresponding to the target key template and the corresponding relationship between the preset key template and each business.
[0057] Optionally, the device further comprises:
[0058] A data slice partitioning module, used for, before the step of constructing a multi-branch tree based on the keys of the business memory data, partitioning the acquired memory data into a plurality of data slices, and using each data slice as a file to be analyzed, wherein the memory data includes the keys of the business memory data of each business and the attribute information of each key;
[0059] The information determination module comprises:
[0060] The path acquisition submodule is used to obtain the node paths corresponding to each file to be analyzed and obtain all the node paths;
[0061] A path merging submodule, used to construct a multi-branch tree based on the names of the nodes included in all the node paths, and merge the node paths with the same path in the multi-branch tree of all the node paths to obtain a target multi-branch tree;
[0062] The second determination submodule is used to determine the memory occupancy information corresponding to the business memory data of each business based on the node information corresponding to the target multi-branch tree.
[0063] Optionally, the multi-branch tree construction module includes:
[0064] A row number determination submodule, used to determine the total number of data rows included in the memory data;
[0065] The first construction submodule is used to construct a multi-branch tree based on the key of each business memory data in each file to be analyzed in a single-process single-thread serial manner if the total number of data rows included in the memory data is not greater than a preset number of rows;
[0066] The second construction submodule is used to construct a multi-branch tree based on the key of each business memory data in each file to be analyzed in a multi-process and multi-threaded parallel manner if the total number of data rows included in the memory data is greater than the preset number of rows.
[0067] Optionally, the device further comprises:
[0068] A combining module, for combining, for each node, the node name of the node's predecessor, the node name of the node, the node's level, the node's depth, and the corresponding key data type to obtain a target name for the node before merging the target nodes with the same predecessor nodes and the same business node identifier in the multi-branch tree;
[0069] The mapping module is used to map the target name of the node to an integer according to a preset mapping method as the updated node name of the node, wherein the preset mapping method enables the target name of the node to have a unique corresponding integer.
[0070] Optionally, the identification determination module includes:
[0071] An execution submodule is used for, for each node in the multi-branch tree, executing the step of determining the target business type identifier of each node based on the node name of each node in the multi-branch tree and the preset correspondence between the node name and the business type identifier for each node if the node meets the following conditions: if the node name of the node is not in the preset exclusion list; if the number of nodes included in the level where the node is located is not less than the preset number of nodes; if the depth of the node is greater than 1;
[0072] or,
[0073] If there is a node name that meets the preset rules among the node names of the nodes in the multi-branch tree, the target business type identifier of the node is determined according to the category identifier determination method corresponding to the preset rules; for the node whose node name does not meet the preset rules, the target business type identifier of the node is determined based on the node name of the node and the corresponding relationship between the preset node name and the business type identifier.
[0074] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0075] Memory, used to store computer programs;
[0076] The processor is used to implement the method described in the first aspect when executing the program stored in the memory.
[0077] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented.
[0078] In a fifth aspect, an embodiment of the present application further provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute any of the business memory data analysis methods described above.
[0079] Beneficial effects of the embodiments of the present application:
[0080] In the scheme provided by the embodiment of the present application, the electronic device can obtain the key of each business memory data and the attribute information of each key, wherein the key of the business memory data is generated based on the key template of the business memory data, and the attribute information includes the memory occupied by the business memory data corresponding to the key; a multi-branch tree is constructed based on the key of each business memory data, wherein each node of the multi-branch tree represents a field included in the key, and the field includes at least the business identifier of the business memory data; based on the node name of each node in the multi-branch tree, and the correspondence between the preset node name and the business type identifier, the target business type identifier of each node is determined, and according to the metadata of each node and the corresponding target business type identifier , determine the business node identifier of each node, wherein the metadata of the node includes the node's level, depth and the data type of the corresponding key, and the depth is the number of fields after the key corresponding to the node is split according to the preset segmentation rule; merge the target nodes in the multi-branch tree with the same preceding nodes and the same business node identifier, and record the node information of the merged nodes, wherein the node information includes the number of target nodes corresponding to the merged nodes and the memory occupied by the business memory data corresponding to the corresponding target nodes; determine each node path from the root node to each end node in the multi-branch tree, and determine the memory occupancy information corresponding to the business memory data of each business according to the node information corresponding to each node path.
[0081] The business memory data and the key of the business memory data are uniquely corresponding. According to the classification and merging results of the keys of the business memory data of each business and the memory occupied by the business memory data corresponding to the key of the business memory data, the memory proportion information of the business memory data of each business in the database can be determined. Since the field name of the key of the business memory data of each business is related to the business type identifier of the business to which the business memory data belongs, the name of each node in the multi-branch tree constructed using the key is also related to the business type identifier. According to the business category identifier corresponding to the node and the metadata of the node, the nodes can be classified according to the business, and the nodes corresponding to the same business in the multi-branch tree can be merged to obtain the node path corresponding to the business memory data of each business. Since the node information of each node path in the multi-branch tree is composed of the node information of each node merged into the node path, and the node information of each node is determined by the attribute information of the key corresponding to the node, the memory occupation information of the business memory data of each business can be obtained according to the node information of each node path in the multi-branch tree. According to the memory occupation information of the business memory data of each business, the staff can clearly and intuitively understand the memory distribution of the database, and then manage the business memory data in the database according to the memory distribution of the database to improve the data management efficiency. Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0082] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0083] Figure 1 A flowchart of a business memory data analysis method provided in an embodiment of the present application;
[0084] Figure 2 (a) is a schematic diagram of the metadata of a node;
[0085] FIG2( b ) is a schematic diagram of a multi-branch tree before node names are replaced based on the embodiment shown in S103 ;
[0086] FIG2( c ) is a schematic diagram of a multi-branch tree after node names are replaced according to the embodiment shown in S103 ;
[0087] FIG2( d ) is a schematic diagram of a node path based on the embodiment shown in S104 ;
[0088] FIG3 (a) is a schematic diagram of a multi-branch tree before node merging according to the embodiment shown in S104;
[0089] FIG3 (b) is a schematic diagram of a multi-branch tree after node merging according to the embodiment shown in S104;
[0090] FIG3 (c) is a schematic diagram of a node merging process based on the embodiment shown in S104;
[0091] FIG4 (a) is a schematic diagram of a visual graphic display interface;
[0092] FIG4( b ) is a schematic diagram of a visualized graphic display interface showing a memory usage information statistical graph of business memory data of each business;
[0093] FIG4( c ) is a schematic diagram of a visualization graphic display interface showing a business statistics chart of the top 20 business memory data memory usage rates;
[0094] FIG4( d ) is a schematic diagram of a visualization graphic display interface showing a business statistics chart of the top 20 business memory data volumes;
[0095] FIG4( e ) is a schematic diagram of a visualization graphic display interface showing a memory occupancy statistics chart of business memory data of each data type;
[0096] FIG4( f ) is a schematic diagram of a visualization graphic display interface showing a data volume statistics chart of business memory data with and without expiration time;
[0097] Figure 5 for Figure 1 A specific flow chart of step S102 in the illustrated embodiment;
[0098] Figure 6 (a) is based on Figure 5 A schematic diagram of a node sequence of the illustrated embodiment;
[0099] Figure 6(b) is based on Figure 5 A schematic diagram of three node sequence nodes of the illustrated embodiment;
[0100] Figure 6 (c) is based on Figure 5 A schematic diagram of a multi-branch tree obtained based on three node sequences in the illustrated embodiment;
[0101] Figure 7 A schematic diagram of a service node identifier based on the embodiment shown in S103;
[0102] Figure 8 for Figure 1 Another specific flow chart of step S102 in the illustrated embodiment;
[0103] Fig. 9 for Figure 1 A specific flow chart of step S104 in the illustrated embodiment;
[0104] Fig.10 Based on Fig. 9 A flow chart of a sub-node storage method of the illustrated embodiment;
[0105] Fig.11 This application provides a flow chart of a business memory data analysis example;
[0106] Fig.12 A schematic diagram of the structure of a business memory data analysis device provided in an embodiment of the present application;
[0107] Fig.13 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0108] The following will be combined with 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 of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.
[0109] In order to analyze the memory usage information corresponding to the business memory data of each business in the database, and thereby improve the database management efficiency, the embodiments of the present application provide a business memory data analysis method, device, electronic device, computer-readable storage medium and computer program product. The following first introduces a business memory data analysis method provided in an embodiment of the present application.
[0110] The business memory data analysis method provided in the embodiment of the present application can be applied to any electronic device with a data analysis function, for example, it can be a processor of an electronic device where a database storing business memory data key-value pairs is located, a server that provides memory data analysis services to an electronic device storing a database of business memory data key-value pairs, etc., without specific limitation here. For the sake of clarity of description, it is referred to as an electronic device in the following.
[0111] Furthermore, the electronic device storing the database of the business memory data key-value pairs and the electronic device executing the business memory data analysis method may be the same device or different devices, which is not specifically limited here.
[0112] like Figure 1 As shown, a method for analyzing business memory data includes:
[0113] S101: Obtain the key of each business memory data and the attribute information of each key.
[0114] The key of the business memory data is generated based on a key template of the business memory data, and the attribute information includes the memory occupied by the business memory data corresponding to the key.
[0115] S102: Construct a multi-branch tree based on the keys of the business memory data.
[0116] Each node of the multi-branch tree represents a field included in the key, and the field includes at least a business identifier of the business memory data.
[0117] S103: Determine the target business type identifier of each node based on the node name of each node in the multi-branch tree and the correspondence between the preset node name and the business type identifier, and determine the business node identifier of each node based on the metadata of each node and the corresponding target business type identifier.
[0118] The metadata of the node includes the node's level, depth, and data type of the corresponding key. The depth is the number of fields after the key corresponding to the node is split according to a preset splitting rule.
[0119] S104: Merge target nodes in the multi-branch tree that have the same preceding node and the same service node identifier, and record node information of the merged nodes.
[0120] The node information includes the number of target nodes corresponding to the merged node and the memory occupied by the business memory data corresponding to the corresponding target node.
[0121] S105: Determine each node path from the root node to each end node in the multi-branch tree, and determine the memory usage information corresponding to the business memory data of each business according to the node information corresponding to each node path.
[0122] In the scheme provided by the embodiment of the present application, the electronic device can obtain the key of each business memory data and the attribute information of each key, wherein the key of the business memory data is generated based on the key template of the business memory data, and the attribute information includes the memory occupied by the business memory data corresponding to the key; construct a multi-branch tree based on the key of each business memory data, wherein each node of the multi-branch tree represents a field included in the key, and the field at least includes the business identifier of the business memory data; based on the node name of each node in the multi-branch tree, and the correspondence between the preset node name and the business type identifier, determine the target business type identifier of each node, and determine the business node identifier of each node according to the metadata of each node and the corresponding target business type identifier; merge the target nodes with the same preceding nodes and the same business node identifier in the multi-branch tree, and record the node information of the merged nodes, wherein the node information includes the number of target nodes corresponding to the merged nodes and the memory occupied by the business memory data corresponding to the corresponding target nodes; determine each node path from the root node to each end node in the multi-branch tree, and determine the memory occupancy information corresponding to the business memory data of each business according to the node information corresponding to each node path.
[0123] The business memory data and the key of the business memory data are uniquely corresponding. According to the classification and merging results of the keys of the business memory data of each business and the memory occupied by the business memory data corresponding to the key of the business memory data, the memory proportion information of the business memory data of each business in the database can be determined. Since the field name of the key of the business memory data of each business is related to the business type identifier of the business to which the business memory data belongs, the name of each node in the multi-branch tree constructed using the key is also related to the business type identifier. According to the business category identifier corresponding to the node and the metadata of the node, the nodes can be classified according to the business, and the nodes corresponding to the same business in the multi-branch tree can be merged to obtain the node path corresponding to the business memory data of each business. Since the node information of each node path in the multi-branch tree is composed of the node information of each node merged into the node path, and the node information of each node is determined by the attribute information of the key corresponding to the node, the memory occupation information of the business memory data of each business can be obtained according to the node information of each node path in the multi-branch tree. According to the memory occupation information of the business memory data of each business, the staff can clearly and intuitively understand the memory distribution of the database, and then manage the business memory data in the database according to the memory distribution of the database to improve the data management efficiency.
[0124] For each business memory data stored in the database, the database also stores the key of the business memory data generated based on the key template of the business memory data and the attribute information of each key, wherein the attribute information of the key is determined according to the attribute information of the business memory data corresponding to the key, and may include the memory occupied by the business memory data corresponding to the key. Since the attribute information of the key is determined according to the attribute information of the business memory data corresponding to the key, the key of the business memory data of each business and the attribute information of each key are analyzed to determine the memory occupancy information of the business memory data of each business in the database.
[0125] Furthermore, in the above step S101, the electronic device can obtain the key of each business memory data and the attribute information of each key, wherein the key of the business memory data is generated based on the key template of the business memory data, and the attribute information includes the memory occupied by the business memory data corresponding to the key.
[0126] In order to standardize the key format of the key of each memory business data stored in the database, the key format of the key of each business memory data to be generated can be predetermined, and then the key template used to generate the key of each business memory data can be predetermined according to the key format. For example, when the key format of the key of the business memory data is desired to be component name: business identifier 1: variable 1: business identifier 2: variable 2, the key template of the business memory data can be set to: component name: business identifier 1: {variable 1}: business identifier 2: {variable 2}.
[0127] For the business memory data of each business, when the business memory data of the business exists in the database, the key of the business memory data can be generated according to the preset business memory data key template and the business identifier of the business to which the business memory data belongs. For different businesses, the key template of the business memory data is different, and the business identifier of the business is also different, and then the business identifiers included in each field in the key of the business memory data of different businesses are also different. For example, when the component name is ccfmss, business 1 is messagecache (message cache) and business 2 is deviceserial (device serial number), the key template of the business memory data of the business is: ccfmss:messagecache: {id}:deviceserial: {id}. Among them, id is a variable filled according to the specific data of each business memory data of the business. When the user id of the business memory data is 008d86db564b45b2b003af4eb5752e62, and the device serial number is AW3864924, the key of the business memory data is:
[0128] ccfmss:messagecache: 008d86db564b45b2b003af4eb5752e62:deviceserial:AW3864924.
[0129] As can be seen above, for different businesses, the key templates used to generate the business memory data of the business are different. For example, the key template of the business memory data of business 1 can be ccfmss:messagecache: {id}:deviceserial:{id}, the key template of the business memory data of business 2 can be ccfmss:messagecache: {id}:deviceserial:{id}:realtime, and the key template of the business memory data of business 3 can be ccfmss:messagecache:{id}.
[0130] For each business memory data stored in the database, the business memory data is uniquely corresponding to the key of the business memory data, and the attribute information of the key is determined based on the attribute information of the business memory data corresponding to the key. Therefore, the attribute information of the business memory data corresponding to the key can be determined based on the attribute information of the key of the business memory data. For example, the attribute information of the business memory data may include the memory occupied by the business memory data, and accordingly, the attribute information of the key may include the memory occupied by the business memory data corresponding to the key, and the memory occupied by the business memory data corresponding to the key can be determined based on the attribute information of the key.
[0131] In addition, the attribute information of the business memory data may also include the data type of the business memory data, whether the business memory data has an expiration time, idle time, expiration time, etc. Correspondingly, the attribute information of the key may include the data type of the business memory data corresponding to the key, whether the business memory data corresponding to the key has an expiration time, the idle time of the business memory data corresponding to the key, the expiration time of the business memory data corresponding to the key, etc., and the attribute information of the key may also include the memory occupied by the key, the data type of the key, whether the key has an expiration time, the idle time of the key, the expiration time of the key, etc.
[0132] When the electronic device wishes to analyze the memory occupancy of the business memory data of each business in the database by using the key of each business memory data, the electronic device may first obtain the key of each business memory data and the attribute information of each key.
[0133] As an implementation mode, when the electronic device is expected to analyze the memory usage of the business memory data of each business in the database, the user can send a data analysis instruction carrying the storage address of the memory data of the database to the electronic device, wherein the memory data of the database includes the key of the business memory data of each business stored in the database and the attribute information of each key. In this way, when the electronic device receives the above data analysis instruction, it can obtain the key of the business memory data of each business and the attribute information of each key from the above storage address.
[0134] After obtaining the keys of the business memory data of each business stored in the database and the attribute information of each key, the electronic device can classify and merge the keys of the business memory data belonging to each business according to the business identification of the business included in each field in the key, and determine the memory occupancy information of the business memory data of the business according to the attribute information of the keys of each memory business data of each business.
[0135] Furthermore, in the above step S102, the electronic device may construct a multi-branch tree based on the key of each service memory data, wherein each node of the multi-branch tree represents a field included in the key, and the field at least includes the service identifier of the service memory data.
[0136] The key of each business memory data includes multiple fields, and each field in the key includes at least the business identifier of the business memory data. For example, the key of the business memory data is:
[0137] ccfmss:messagecache: 008d86db564b45b2b003af4eb5752e62:deviceserial:AW3864924.
[0138] The key includes 5 fields, each of which includes a business component name of the business memory data, a business identifier of the business memory data, a user ID of the business memory data, device information of the business memory data, and a device serial number of the business memory data.
[0139] Based on this, although the keys of each business memory data are generated using a key template, the business memory data belonging to different businesses have different business identifiers for the business memory data included in some fields of their keys; correspondingly, the business identifiers of the business memory data included in each field of their keys for two business memory data belonging to the same business are similar. Furthermore, the keys of each business memory data can be classified according to the business to which the business memory data belongs, so as to analyze the memory usage information of the business memory data of each business in the database.
[0140] After obtaining the key of each business memory data and the attribute information of each key, the electronic device can use the key of each business memory data and the attribute information of each key to analyze the memory business data. Since each key includes multiple fields, in order to improve the efficiency of data processing and quickly and accurately analyze the memory occupancy of the business memory data of each business, the electronic device can construct a multi-branch tree of the key of each business memory data, wherein each node in the multi-branch tree represents a field included in the key, and a node path from a root node to an end node represents a field sequence of the key of a business memory data, and all nodes in the node path correspond to all fields included in the key of the business memory data. Accordingly, the node information of each node of the node path is also determined based on the attribute information of the key of the business memory data.
[0141] Furthermore, in the above step S103, the electronic device can determine the target business type identifier of each node based on the node name of each node in the multi-branch tree and the correspondence between the preset node name and the business type identifier, and determine the business node identifier of each node according to the metadata of each node and the corresponding target business type identifier. The metadata of the node includes the node level, depth and data type of the corresponding key, and the depth is the number of fields after the key corresponding to the node is split according to the preset segmentation rule.
[0142] For each business memory data belonging to the same business, each field of the business memory data key includes at least the business identifier of the business memory data, and then the field name of each field corresponds to the business type identifier. Among them, the business type identifier is an identifier related to the business, and the business type identifier is different according to the business type, for example, component name, user name, device serial number, etc., which are all reasonable and are not specifically limited here.
[0143] For example, the key template of the business memory data of a business is: component name: business identifier: {variable 1}: device information: {variable 2}; the field names of each field in the key of each business memory data belonging to the business correspond to the business type identifier. The variable 1 field in the key of each business memory data corresponds to the user name in the business type identifier, that is, the field name of this field in the key of each business memory data meets the naming rules of the user name of the business; the variable 2 field in the key of each business memory data corresponds to the device serial number in the business type identifier, that is, the field name of this field in the key of each business memory data meets the naming rules of the device serial number.
[0144] Since each node in the multi-branch tree corresponds to a field of the key, the node name of each node in the multi-branch tree is the field name of the field represented by the node. Since there is a corresponding relationship between the field names in the key and the business type identifier, there is also a corresponding relationship between the node names in the multi-branch tree and the business type identifier. The corresponding relationship between the node names in the multi-branch tree and the business type identifier can be set in advance and stored in the electronic device.
[0145] In order to analyze the memory usage information of the business memory data of each business, the nodes corresponding to the keys of the business memory data belonging to the same business in the multi-branch tree can be merged. However, since the node names of each node may be different, merging the nodes according to the node names of each node is difficult and the accuracy of the merged result is not high.
[0146] Based on this, in order to facilitate node merging, the electronic device can use the node name of each node in the multi-branch tree and the correspondence between the preset node name and the business type identifier to determine the target business type identifier of each node. Among them, the target business type identifiers of the same-level nodes corresponding to the keys of the business memory data belonging to the same business are the same.
[0147] For example, the correspondence between the node name and the business type identifier in the preset multi-branch tree includes: the correspondence between mailbox / UUID (Universally Unique Identifier) and ID. When the node name is mailbox or UUID, the target business type identifier of the node identifier can be determined as ID based on the node name and the correspondence between the node name and the business type identifier.
[0148] In order to avoid nodes with different attribute information from being mistakenly merged together due to having the same target business type identifier, after determining the target business type identifier of each node, the electronic device can also determine the business node identifier of each node based on the target business type identifier of each node and the metadata of each node.
[0149] Among them, the metadata of each node may include the node's level, depth and the data type of the corresponding key; the depth is the number of fields after the key corresponding to the node is split according to the preset splitting rules; the level is the position of the field corresponding to the node in the key; the key data type can be string, int, etc.
[0150] The metadata of a node can also include the name of the node, reference to the parent node, child nodes (children), memory occupied, number of child nodes, whether the node has been merged, and whether it has an expiration time. Figure 2 (a) is a schematic diagram of the metadata of a node, where the metadata of a node includes the name of the node (name), reference to the parent node (parent), child nodes (children), memory occupied (memory), number of child nodes (children_num), whether the node has been merged (is_merged), depth (depth), level (level), key data type (type), and whether it has an expiration time (has_ttl).
[0151] For example, if the node name of the node is 008d86db564b45b2b003af4eb5752e62, according to the node name of the node and the correspondence between the preset node name and the business type identifier, the target business type identifier of the node is determined to be ID. The metadata of the node includes the node level, and the node level is 3, then the target business type identifier of the node and the node metadata constitute ID3 as the business node identifier of the node.
[0152] For another example, the metadata of a node includes the depth, level, and key data type of the node. For the multi-branch tree shown in FIG2 (b), the business node identifier of each node is determined according to the correspondence between the node name, the preset node name and the business type identifier, and the metadata of each node, and the node name is replaced using the business node identifier of each node, that is, the node 008d86db564b45b2b003af4eb5752e62 and the node {ID3-5-str} are replaced using the business node identifier {ID3-5-str}. 008d86db564b45b2b003af4eb5752e63, use the business node identifier {ID5-5-str} to replace AW3864924 and AW3864925, use the business node identifier {ID3-6-str} to replace the node 008d86db564b45b2b003af4eb5752e64; and use the business node identifier {ID5-6-str} to replace AW3864926, and obtain the multi-branch tree shown in Figure 2 (c).
[0153] In this way, the business node identifier of each node is determined by utilizing the node name of each node, the correspondence between the preset node name and the business type identifier, and the metadata of each node. Each node name can be replaced with a business node identifier related to the business type identifier, and the node name of each node is replaced with the business node identifier. In this way, each node can be classified according to its business node identifier. Since the business node identifier of each node also includes the metadata of each node, it avoids the incorrect merging of nodes with the same business type identifier but different attribute information when subsequent nodes are merged, thereby improving the accuracy of the node merging results.
[0154] In the above step S104, the electronic device can merge the target nodes with the same preceding nodes and the same business node identifier in the multi-branch tree, and record the node information of the merged nodes, wherein the node information includes the number of target nodes corresponding to the merged nodes and the memory occupied by the business memory data corresponding to the corresponding target nodes.
[0155] Since the nodes at the same level corresponding to the keys of the business memory data belonging to the same business have the same business node identifier, in order to count the memory usage information of the business memory data of each business, the nodes belonging to the same business can be merged. Based on this, the electronic device can merge the target nodes with the same preceding nodes and the same business node identifier in the multi-branch tree, and record the node information of the merged nodes.
[0156] The node information includes the number of target nodes corresponding to the merged node and the memory occupied by the business memory data corresponding to the corresponding target node;
[0157] Moreover, the predecessor nodes are: all nodes located in front of the node in the node path from the root node to the node. For example, as shown in Figure 2 (d), in the node path, the predecessor nodes of node {ID3} are: the root node ccfmss and the parent node messagecache; the predecessor nodes of node {ID5} are: the root node ccfmss, the node messagecache, the node {ID3} and the parent node deviceserial.
[0158] The target nodes with the same preceding node and the same business node identifier in the multitree are merged. For example, as shown in FIG3 (a), node C is merged with node D, node E is merged with node F, and node G is merged with node H to obtain the merged nodes I, J, and K as shown in FIG3 (b).
[0159] Each level of the multitree is traversed in hierarchical order. When traversing each level, the target nodes with the same preceding node and the same business node identifier in the level of the multitree are merged, and when all levels are traversed, a multitree is obtained. For example, as shown in FIG3 (c), when traversing to the third level, the target node L and the target node M with the same preceding node and the same business node identifier are merged to obtain a merged node N, and the business node identifier of node N is {ID3-5-str}; when traversing to the fourth level, the target node R and the target node S with the same preceding node and the same business node identifier are merged to obtain a merged node T, and the business node identifier of node T is deviceserial; when traversing to the fifth level, the target node U and the target node V with the same preceding node and the same business node identifier are merged to obtain a merged node W, and the business node identifier of node W is {ID5-5-str}.
[0160] Since the merged node is formed by merging multiple target nodes, the node information of the merged node includes the number of corresponding target nodes corresponding to the merged node and the memory occupied by the business memory data corresponding to the corresponding target nodes. After the node merger is completed, the node information of the merged node can be recorded.
[0161] Furthermore, in the above step S105, the electronic device can determine each node path from the root node to each end node in the multi-branch tree, and determine the memory occupancy information corresponding to the business memory data of each business according to the node information corresponding to each node path.
[0162] After merging the target nodes with the same preceding nodes and the same service node identifier in the multi-branch tree, the electronic device can determine each node path from the root node to each terminal node in the multi-branch tree.
[0163] Since the node path is obtained by classifying and merging the nodes corresponding to the keys of the business memory data belonging to the same business, each node path obtained corresponds to each business memory data of a business, and the node information of each node path can represent the attribute information of each key of each business memory data of a business corresponding to the node path. Since the attribute information of the key is determined by the attribute information of the business memory data, the attribute information of the business memory data of each business can be determined according to the node information corresponding to each node path, that is, the memory occupied by the business memory data corresponding to the node merged by the node path is the memory occupancy information corresponding to the business memory data of each business.
[0164] The electronic device can determine the node name of the node in each node path, as well as the business type identifier of each business, to determine the business corresponding to each node path; and determine the memory usage information corresponding to the business memory data of each business based on the node information corresponding to each node path.
[0165] For example, as shown in FIG3(b), the multitree includes two node paths, namely, node path 1 and node path 2. Node path 1 corresponds to business X, and node path 2 corresponds to business Y. According to the node information corresponding to node path 1, the memory occupancy information corresponding to the business memory data of each business X can be determined, and according to the node information corresponding to node path 2, the memory occupancy information corresponding to the business memory data of each business Y can be determined. Among them, each determined node path actually corresponds to a key template of the business memory data of a business, that is, node path 1 corresponds to the key template of the business memory data of business X, that is, node path 2 corresponds to the key template of the business memory data of business Y.
[0166] Furthermore, as an implementation method, the electronic device can restore the target key template corresponding to each node path according to each node path and the preset segmentation rules used to segment the keys of the business memory data; based on the node information corresponding to the target key template, and the correspondence between the preset key template and each business, determine the memory usage information corresponding to the business memory data of each business.
[0167] Of course, the attribute information of the key can also include the data type of the business memory data, whether the business memory data has an expiration time, etc., so the above-mentioned business memory data analysis method can also determine the information of the business memory data of various data types in the database, determine the information of the business memory data with an expiration time in the database, and other information; and, since the node information corresponding to the node path includes the number of target nodes to be merged, the number of keys of the business memory data of each business can also be determined according to the node information corresponding to the node path.
[0168] In the scheme provided by the embodiment of the present application, the business memory data and the key of the business memory data are uniquely corresponding. According to the classification and merging results of the keys of the business memory data of each business and the memory occupied by the business memory data corresponding to the key of the business memory data, the memory share information of the business memory data of each business in the database can be determined. Since the field name of the key of the business memory data of each business is related to the business type identifier of the business to which the business memory data belongs, the name of each node in the multi-branch tree constructed using the key is also related to the business type identifier. The nodes can be classified according to the business according to the business category identifier corresponding to the node and the metadata of the node, and the nodes corresponding to the same business in the multi-branch tree can be merged to obtain the node path corresponding to the business memory data of each business. Since the node information of each node path in the multi-branch tree is composed of the node information of each node merged into the node path, and the node information of each node is determined by the attribute information of the key corresponding to the node, the memory occupancy information of the business memory data of each business can be obtained according to the node information of each node path in the multi-branch tree. Staff can clearly and intuitively understand the memory distribution of the database based on the memory usage information of the business memory data of each business, and then manage the business memory data in the database according to the memory distribution of the database to improve data management efficiency.
[0169] As an implementation of an embodiment of the present application, a business memory data analysis method provided in an embodiment of the present application may also include:
[0170] Based on the memory occupancy information corresponding to the business memory data of each business, a visual graphic interface is displayed. The visual graphic interface at least includes the memory occupied by the business memory data of the target business displayed in a graphic, and / or the business whose memory occupancy rate is ranked first by a preset number of business in the graphic display; the target business is the business whose memory occupancy rate of the corresponding business memory data is higher than the preset value.
[0171] In order to more intuitively display the memory occupied by the business memory data of each business, after determining the memory occupation information corresponding to the business memory data of each business, a visual graphical interface that graphically displays the business memory data occupation status of each business can be displayed according to the memory occupation information corresponding to the business memory data of each business.
[0172] After determining the memory occupancy information of the business memory data of each business, each business with a memory occupancy rate higher than the preset value can be used as a target business, and according to the memory occupancy information corresponding to the business memory data of each target business, a memory occupancy graph of the business memory data of the target business is drawn, and a visual graphic interface showing the above memory occupancy graph is displayed, so that the staff can clearly and intuitively understand the memory occupied by the business memory data of each target business through the visual graphic interface. Among them, the preset value can be set according to actual needs, which can be 0%, 5%, or 8%, etc., which are all reasonable and are not specifically limited here. When the above preset value is 0%, each business can be used as a target business, and according to the memory occupancy information corresponding to the business memory data of each business, a memory occupancy graph of the business memory data of each business is drawn, so that the visual graphic interface can display the memory occupancy graph of the business memory data of each business, and the staff can understand the memory occupancy of the business memory data of each business through the visual graphic interface.
[0173] After determining the memory occupancy information corresponding to the business memory data of each business, the memory occupancy rate of the business memory data can be ranked according to the memory occupancy information corresponding to the business memory data of each business, and the businesses whose memory occupancy rate of the business memory data ranks first in a preset number can be determined, wherein the preset number can be set according to actual needs, for example: 5, 20, etc., which are all reasonable and are not specifically limited here; and the ranking can be ranked from large to small according to the memory occupancy rate, or it can be ranked from small to large according to the memory occupancy rate, which is not specifically limited here. Then, according to the memory occupancy information of the businesses whose memory occupancy rate of the business memory data ranks first in a preset number of businesses, a statistical graph of the memory occupancy rate of the business memory data of the businesses whose memory occupancy rate of the business memory data ranks first in a preset number of businesses is drawn, and a visual graphical interface showing the above statistical graph is displayed. For example, each business is ranked in descending order according to the memory occupancy rate, and the top 20 businesses in terms of the memory occupancy rate of the business memory data are determined. Based on the memory occupancy rate of the business memory data of the top 20 businesses determined in terms of the memory occupancy rate, a sector graph is drawn to show the memory occupied by the business memory data of the 20 businesses with the highest memory occupancy rate, where the sector corresponding to each business is the memory occupancy rate of the business memory data of the business.
[0174] In this way, the visualization graphic interface may at least include the memory occupied by the business memory data of the target business displayed in a graphic, and / or the business memory data displayed in a graphic with the memory occupancy rate ranking of the preset number of businesses. As shown in FIG4 (a), the visualization graphic interface may display a statistical graph of the memory occupancy information of the business memory data of each business and a statistical graph of the top 20 businesses with the memory occupancy rate of the business memory data. As shown in FIG4 (b), the visualization graphic interface may only display a statistical graph of the memory occupancy information of the business memory data of each business, and as shown in FIG4 (c), the visualization graphic interface may only display a statistical graph of the top 20 businesses with the memory occupancy rate of the business memory data.
[0175] In addition, the electronic device can rank the business memory data volume of each business according to the number of keys of the business memory data of each business, determine the top 20 businesses in terms of business memory data volume, and draw a business statistics chart of the top 20 businesses in terms of business memory data volume according to the business memory data volume of each business in the determined business memory data volume ranking of the top 20 businesses; can draw a statistical chart showing the memory share of business memory data of each data type according to the data type corresponding to the business memory data of each business; can also make a statistical chart of the data volume of business memory data with expiration time and business memory data without expiration time according to whether the business memory data of each business has an expiration time; and display the above statistical charts on the same visual graphic interface, so that the staff can intuitively understand various statistical information of business memory data in the database through the visual graphic interface. As shown in FIG4 (a), the displayed visual graphic interface may include a statistical chart of memory occupancy information of business memory data of each business, a statistical chart of the top 20 businesses in terms of business memory data memory occupancy rate, a statistical chart of the top 20 businesses in terms of business memory data volume, a statistical chart of the memory occupancy rate of business memory data of each data type, and a statistical chart of the data volume of business memory data with expiration time and without expiration time.
[0176] As an implementation mode, the preset value is 0%, and the visualization graphical interface can only display the memory usage information statistics of the business memory data of each business; for example, as shown in FIG4 (b), the interface displays the memory usage information statistics of the business memory data of businesses 1-N (N is greater than 28).
[0177] As an implementation method, the visualization graphic interface can only display a statistical chart of the top 20 businesses whose memory occupancy rates of the business memory data are ranked. After determining the memory occupancy information corresponding to the business memory data of each business, the electronic device determines the top 20 businesses whose memory occupancy rates of the business memory data are ranked, namely, business 1 to business 20, and displays a visualization graphic interface showing a statistical chart of the top 20 businesses whose memory occupancy rates of the business memory data are ranked according to the proportion of each business, as shown in FIG4 (c). The sector corresponding to each business is the memory occupied by the business memory data of the business. The top 20 businesses whose memory occupancy rates of the business memory data are ranked according to the proportion of each business are ranked according to the proportion of each business.
[0178] As an implementation mode, the visualization graphic interface may only display a business statistical chart of the top 20 businesses in terms of business memory data volume. The electronic device may display a visualization graphic interface showing a business statistical chart of the top 20 businesses in terms of business memory data volume, as shown in FIG4 (d), based on the business memory data volume of each business. The data volume of the top 20 businesses in terms of business memory data volume accounts for 63% of the data in the database.
[0179] As an implementation mode, the visual graphic interface may only display the memory occupancy rate statistics graph of the business memory data of each data type, and the electronic device may display the visual graphic interface showing the memory occupancy rate statistics graph of the business memory data of data type 1 to data type 5 as shown in FIG4 (e) according to the data type corresponding to the business memory data of each business. The data type may be string, int, hash, etc., which is not specifically limited here.
[0180] As an implementation method, the visual graphic interface can only display a data volume statistics chart of business memory data with an expiration time. The electronic device can display a visual graphic interface showing a data volume statistics chart of business memory data with an expiration time and a data volume statistics chart of business memory data without an expiration time, as shown in FIG. 4 (f), based on whether the business memory data of each business has an expiration time.
[0181] Accordingly, since the key of the memory business data of a business is generated by the key template of the business memory data of the business, the key template of the business memory data of each business can be restored based on each node path in the multi-branch tree, and a visual graphic interface can be displayed according to the attribute information of each key template. The visual graphic interface at least includes the memory occupied by the business memory data corresponding to each key template displayed in a graphic, and / or the key templates of the business memory data displayed in a graphic with a memory occupancy rate ranked in the front by a preset number.
[0182] In this embodiment, by displaying a visual graphical interface of the memory usage information corresponding to the business memory data of each business, the memory occupied by the business memory data of each business in the database can be clearly and intuitively displayed, which is convenient for the staff to more intuitively understand the distribution of database memory and the proportion of memory occupied by the business memory data of each business. It is then convenient for the staff to formulate management strategies for the business memory data of each business based on the memory occupied by the business memory data of each business in the database, thereby improving the management efficiency of business data.
[0183] As an implementation method of the present application, Figure 5 As shown, the above step S102, i.e., the step of constructing a multi-branch tree based on the key of each business memory data, may include:
[0184] S501: For each key, split the key according to the key structure and the preset splitting rule to obtain the field sequence of the key.
[0185] Since the key of each business memory data includes multiple fields, each field corresponds to a different business identifier of the business memory data. In order to analyze the key of each business memory data, for each key, the key can be split according to the key structure and the preset splitting rule to obtain the field sequence of multiple fields of the key.
[0186] Among them, the preset segmentation rule is determined according to the key structure of the key. If the key structure of the key is that each field in the key is connected by a colon, then the preset segmentation rule is to use the colon as the delimiter for segmentation; if the key structure of the key is that each field in the key is connected by a comma, then the preset segmentation rule is to use the comma as the delimiter for segmentation.
[0187] For example, the key of business memory data is:
[0188] ccfmss:messagecache: 008d86db564b45b2b003af4eb5752e62:deviceserial:AW3864924.
[0189] The fields in the key structure of this key are connected by colons. Then, the key is split with colon as the separator, and after splitting, there are 5 nodes in total: ccfmss, messagecache, 008d86db564b45b2b003af4eb5752e62, deviceserial, AW3864924. Then the field sequence of this key is:
[0190] ccfmss,messagecache,008d86db564b45b2b003af4eb5752e62,deviceserial,AW3864924.
[0191] S502: taking each field in each field sequence as a node, and determining the parent-child relationship of the nodes corresponding to each field according to the order of each field in each field sequence.
[0192] When constructing a multi-branch tree for each key, each field in the field sequence of each key may be taken as a node, and according to the order of the fields in each field sequence, the root node, the terminal node and the parent-child relationship of the nodes corresponding to each field in each field sequence may be determined.
[0193] For example, the sequence of fields for a key is:
[0194] ccfmss, messagecache, 008d86db564b45b2b003af4eb5752e62, deviceserial, AW3864924. Each field is regarded as a node, ccfmss in the field sequence is the root node, and AW3864924 is the terminal node; and, according to the order of the fields in the field sequence, the node sequence corresponding to the field sequence is shown in Figure 6 (a), where ccfmss is the parent node of messagecache, messagecache is the parent node of 008d86db564b45b2b003af4eb5752e62, 008d86db564b45b2b003af4eb5752e62 is the parent node of deviceserial, and deviceserial is the parent node of AW3864924.
[0195] S503: Starting from the root node of the node sequence corresponding to each field sequence, traverse each node sequence, merge the same root nodes into one root node, and merge nodes with the same name, corresponding key data type, level, and preceding node into one node to obtain a multi-branch tree.
[0196] After determining the root node, terminal node, and parent-child relationship of the nodes corresponding to each field sequence, each node sequence can be traversed in sequence starting from the root node of the node sequence corresponding to each field sequence. When traversing the root node of each node sequence, the same root nodes are merged into one root node. Correspondingly, when traversing other levels of the node sequence, the nodes with the same name, corresponding key data type, level, and previous node in each node sequence are merged into one node. After traversing all node sequences, a multi-branch tree is obtained.
[0197] For example, the three node sequences are shown in Figure 6 (b). First, the root nodes of the three node sequences are traversed. The root nodes of the three node sequences are all ccfmss, and the root nodes of the three node sequences are merged into one root node.
[0198] Then, the second-layer nodes of the three node sequences are traversed. The names of the second-layer nodes of the three node sequences are all messagecache, and the preceding nodes of the second-layer nodes of the three node sequences are all ccfmss. The second-layer nodes of the three node sequences are merged into one second-layer node.
[0199] Then, the third-level nodes of the three node sequences are traversed. The preorder nodes of the third-level nodes of the three node sequences are ccfmss and messagecache, but the names of the third-level nodes of the three node sequences are different. The third-level nodes of the three node sequences are not merged. Moreover, since the names of the third-level nodes of the three node sequences are different, the preorder sequences of the fourth-level nodes and the fifth-level nodes of the three node sequences are different, and there is no need to merge them. Therefore, after traversing the three node sequences, the obtained multi-branch tree is shown in Figure 6 (c). The three node sequences have the same root node and the second-level node, and the node information of the second-level node and some attribute information of the node are recorded, that is, the name of the node (name) messagecache, the memory occupied by the business memory data corresponding to the node (memory) 1024, the number of children of the node (children_num) 3, the depth (depth) 5, the child nodes and the level (level) 2 and other information are recorded.
[0200] In this embodiment, when constructing a multi-branch tree, the electronic device can segment each key according to a preset segmentation rule to obtain a field sequence of the key, and then use each field in each field sequence as a node, and traverse each node sequence according to the hierarchy, merge nodes with the same name, hierarchy, and previous node, and then obtain a multi-branch tree of the key of each business memory data. By merging the same nodes during the construction of the multi-branch tree, the constructed multi-branch tree is more streamlined, so that the efficiency of subsequent business memory data analysis using the multi-branch tree is higher.
[0201] As an implementation method of an embodiment of the present application, the metadata of the node includes the level and depth of the node and the data type of the corresponding business memory data, and the depth is the number of all nodes corresponding to the key in the multi-branch tree;
[0202] The above step S103, i.e., the step of determining the service node identifier of each node according to the metadata of each node and the corresponding target service type identifier, may include:
[0203] For each node, the target business type identifier of the node, the level and depth of the node, and the data type of the key corresponding to the node are arranged according to a preset arrangement to obtain the business node identifier of the node.
[0204] The metadata of a node includes the node's level, depth, and the data type of the corresponding key, where the depth is the number of fields after the key corresponding to the node is split according to the preset splitting rules, that is, the number of all nodes included in the node sequence corresponding to the key.
[0205] After determining the target business type identifier of each node, in order to avoid nodes with the same target business type identifier but different node attributes from being erroneously merged, for each node, the target business type identifier of the node, the level and depth of the node, and the data type of the key corresponding to the node can be arranged in a preset order to obtain the business node identifier of the node.
[0206] Among them, the above-mentioned preset arrangement order can be the order of the node's target business type identifier, the node's level, depth, and the data type of the node's corresponding key, or it can be the order of the node's corresponding key data type, the node's level, depth, and the node's target business type identifier. This is all reasonable and no specific limitation is made here.
[0207] For example, Figure 7 As shown, the target business type identifiers of node O and node P are both IDs, and the preset arrangement order is the order of the target business type identifier of the node, the level and depth of the node, and the data type of the key corresponding to the node. After the target business type identifier of the node, the level and depth of the node, and the data type of the key corresponding to the node are arranged in the preset order, the business node identifier of node O {ID3-5-str} and the business node identifier of node P {ID5-5-str} are obtained.
[0208] In this embodiment, for each node, the electronic device concatenates the target business type identifier of the node, the level and depth of the node, and the data type of the key corresponding to the node to obtain the business node identifier of the node, so that the business node identifier of each node includes both the business type identifier of the node and the attribute information of the node itself. Furthermore, when the nodes are subsequently merged, the incorrect merging of nodes with different node attributes can be avoided, ensuring that the merged nodes belong to the same business and have the same node attributes, thereby improving the accuracy of the business memory data analysis results.
[0209] As an implementation of an embodiment of the present application, the above step S105, i.e., the step of determining the memory occupancy information corresponding to the business memory data of each business according to the node information corresponding to each node path, may include:
[0210] According to the node paths and the preset segmentation rules used to segment the keys of the business memory data, the target key template corresponding to each node path is restored; based on the node information corresponding to the target key template and the correspondence between the preset key template and each business, the memory usage information corresponding to the business memory data of each business is determined.
[0211] Since the node sequence is obtained according to the key field sequence, and the key field sequence is obtained by splitting the key according to the preset splitting rule, then, for the node sequence, if it is restored according to the preset splitting rule, the key corresponding to the node sequence can be obtained.
[0212] Since each node path is a node sequence obtained by classifying and merging the nodes corresponding to each key template, each node path is restored according to the preset segmentation rule of the key to obtain the target key template corresponding to each node path.
[0213] For example, the preset segmentation rule of the key is to segment according to the colon. Then, according to the preset segmentation rule, the two node paths shown in FIG3 (b) are restored to obtain the target key template 1 and the target key template 2, where:
[0214] Target key template 1: ccfmss:messagecache:{ID3-5-str}:deviceserial:{ID5-5-str};
[0215] Target key template 2: ccfmss:messagecache:{ID3-6-str}:deviceserial:{ID5-6-str}:realtime.
[0216] After determining the target key template corresponding to each node path, the business corresponding to each target key template can be determined according to the correspondence between the preset key template and each business, and the memory occupancy information corresponding to the business memory data of each business can be determined according to the node information corresponding to the target key template. Among them, the node information corresponding to the node path is used as the node information corresponding to the target key template corresponding to the node path.
[0217] The above process of restoring each node path to a key template according to the node path and the preset segmentation rules is the key template restoration process. By restoring the key template to which the keys of all business memory data in the database belong, the memory usage information of the business memory data of the business corresponding to each key template can be determined, and the memory distribution of the Redis database can be determined.
[0218] In this embodiment, the electronic device can restore each node path to a target key template based on each node path and the preset segmentation rules used to segment the keys of the business memory data. Then, based on the correspondence between the preset key template and each business, and the node information corresponding to the target key template, the memory usage information corresponding to the business memory data of each business can be determined.
[0219] As an implementation of an embodiment of the present application, before the above step S102, that is, the step of constructing a multi-branch tree based on the key of each business memory data, a business memory data analysis method provided by the embodiment of the present application may also include:
[0220] The acquired memory data is divided into a plurality of data slices, and each data slice is used as a file to be analyzed, wherein the memory data includes keys of business memory data of various businesses and attribute information of each key.
[0221] When the electronic device obtains the memory data including the key of the business memory data of each business and the attribute information of each key, the memory data may be divided into a plurality of data slices, and each data slice may be used as a file to be analyzed.
[0222] As an implementation manner, the electronic device may divide the memory data into a target number of data slices according to the target number of data slices that are desired to be divided.
[0223] As an implementation manner, the electronic device may divide the memory data into a target number of data slices according to the target number of data slices that are desired to be divided. For example, if the target number of data slices that are desired to be divided is 10, the memory data is divided into 10 data slices.
[0224] As an implementation method, the electronic device can calculate the ratio of the total number of data rows of memory data to the number of rows of each data slice to be divided, and obtain the number of divided data slices. For example, the total number of data rows of memory data is 800,000 rows, and the number of rows of each data slice to be divided is 100,000. The ratio of the number of data rows of memory data to the number of rows of each data slice is 8. The memory data can be divided into 8 data slices, and each data slice can be used as a file to be analyzed.
[0225] After dividing the memory data into multiple data slices to obtain multiple files to be analyzed, a multi-branch tree can be constructed based on the key of each business memory data in each data to be analyzed to obtain a multi-branch tree for each file to be analyzed. Then, based on the multi-branch tree of each file to be analyzed, the node paths corresponding to each file to be analyzed are determined.
[0226] Accordingly, the above step S105, i.e., the step of determining the memory occupancy information corresponding to the business memory data of each business according to the node information corresponding to each node path, may include:
[0227] Get each node path corresponding to each file to be analyzed, and get all the node paths;
[0228] Constructing a multi-branch tree based on the names of the nodes included in all the node paths, merging the node paths with the same path in the multi-branch tree of all the node paths, and obtaining a target multi-branch tree;
[0229] Based on the node information corresponding to the target multi-branch tree, memory occupancy information corresponding to the business memory data of each business is determined.
[0230] After the keys of each business memory data used for business memory data analysis and the attribute information of each key are divided into multiple files to be analyzed, and a multi-branch tree is constructed based on the keys of each business memory data included in each file to be analyzed, and the node paths corresponding to each file to be analyzed are determined, the electronic device can obtain the node paths corresponding to each file to be analyzed, thereby obtaining all the node paths corresponding to all the files to be analyzed.
[0231] Since different files to be analyzed may include keys of business memory data belonging to the same business, the node paths corresponding to the different files to be analyzed may include the same node paths, and thus all the node paths acquired by the electronic device may have the same node paths.
[0232] Since the same node path corresponds to the business memory data of the same business, and when analyzing the business memory data of each business, it is hoped to count the memory usage information of all business memory data belonging to the same business. If the business memory data of the same business is dispersed into multiple node paths, the statistical result of the memory usage information of all business memory data of the same business may be inaccurate.
[0233] Based on this, the electronic device can merge all the acquired node paths by constructing a multi-branch tree, that is, the electronic device can reconstruct the multi-branch tree based on the node names included in all the acquired node paths.
[0234] When constructing a multi-branch tree, you can first traverse the root nodes of all node paths and merge the same root nodes into one root node. Then, according to the hierarchical order of each node in the node path, traverse each level in turn, and when traversing to each level, merge the nodes with the same name, level and previous node in each node path into one node. In this way, after traversing all levels, you can get a target multi-branch tree that merges the node paths with the same path in all node paths.
[0235] Furthermore, the electronic device can determine each node path from the root node to each end node in the target multi-branch tree, and determine the memory occupancy information corresponding to the business memory data of each business based on the node information corresponding to each node path.
[0236] The above process of reconstructing a multitree based on all node paths and obtaining a target multitree by merging node paths with the same path in the multitree of all node paths is a process of secondary construction of a multitree based on all node paths of each multitree. Correspondingly, if the number of target multitrees obtained in the secondary construction process is large, the multitree can also be reconstructed based on all node paths of multiple target multitrees, which is reasonable, and the number of reconstructions of the multitree is not limited here.
[0237] That is, if after reconstructing the multi-branch tree, the determined node path is still greater than the first preset threshold, it can be reconstructed as a multi-branch tree, and it is confirmed whether the node path obtained this time is reduced compared with the node path obtained last time. If it is reduced, the multi-branch tree can be reconstructed based on the node path obtained this time, until the difference between the node path obtained by constructing and the node path obtained last time is less than the second preset threshold, and the final node path is obtained. In this way, by constructing the multi-branch tree multiple times, a more accurate node path result can be obtained. Among them, the first preset threshold and the second preset threshold can be set according to actual needs. For example, the first preset threshold can be 20,000, the second preset threshold can be 100, etc., which are not specifically limited here.
[0238] In this embodiment, the electronic device can divide the memory data into multiple data slices, use each data slice as a file to be analyzed, and construct a multi-branch tree based on the key of the business memory data of each file to be analyzed to obtain each node path corresponding to each file to be analyzed. Then, by re-constructing the target multi-branch tree, the same paths in all the node paths corresponding to the memory data are merged, and the memory occupancy information corresponding to the business memory data of each business is determined according to each node path in the target multi-branch tree, which can avoid the inaccurate statistical results of the business memory data of each business caused by erroneously dispersing the business memory data of the same business into multiple node paths, and improve the accuracy of the statistical results of the memory occupancy information corresponding to the business memory data of each business.
[0239] As an implementation method of the present application, Figure 8 As shown, the above step S102, i.e., the step of constructing a multi-branch tree based on the key of each business memory data, may include:
[0240] S801: Determine the total number of data rows included in the memory data;
[0241] S802: If the total number of data rows included in the memory data is not greater than a preset number of rows, a multi-branch tree is constructed based on the key of each business memory data in each file to be analyzed in a single-process single-thread serial manner.
[0242] S803: If the total number of data rows included in the memory data is greater than the preset number of rows, a multi-tree is constructed based on the key of each business memory data in each file to be analyzed in a multi-process multi-threaded parallel manner.
[0243] The electronic device determines the total number of data rows included in the memory data, and then determines the number of process threads used for business memory data analysis and the operation mode of the process threads according to the numerical relationship between the total number of data rows included in the memory and the preset number of rows. The preset number of rows can be set according to actual needs, for example, 100,000 rows, 200,000 rows, etc., which are all reasonable and are not specifically limited here.
[0244] If the total number of data rows included in the memory data is not greater than the preset number of rows, the electronic device may process multiple files to be analyzed in serial using a single-process single-thread serial method, that is, in a single process, each file to be analyzed is processed in serial using a single thread, and a multi-branch tree is constructed based on the key of each business memory data of each file to be analyzed;
[0245] If the total number of data rows included in the memory data is greater than the preset number of rows, the electronic device can process multiple files to be analyzed in parallel in a multi-process and multi-threaded manner according to the number of files to be analyzed, and use multiple threads in multiple processes to parallelly build a multi-branch tree based on the keys of each business memory data of the file to be analyzed in the process.
[0246] For example, the preset number of rows is 300,000 rows, the CPU (Central Processing Unit) of the electronic device is a 16-core CPU, and the maximum number of processes that can be used is 16. When the total number of rows of memory data is not more than 300,000 rows, a single process and a single thread can be used to serially process each file to be analyzed; when the total number of rows of memory data is more than 300,000 rows, if the memory data is divided into 15 files to be analyzed, 15 processes are created to process the 15 files to be analyzed in parallel, wherein each process includes a thread.
[0247] As an implementation method, when the total number of data rows included in the memory data is greater than the preset number of rows, if the number of files to be analyzed is not greater than the number of processes that can be used, then the number of processes for the number of files to be analyzed is used, and multiple processes and multiple threads are used to process the multiple files to be analyzed in parallel; if the number of files to be analyzed is greater than the number of processes that can be used, then all processes and multiple threads are used to process the multiple files to be analyzed in parallel. The number of processes that can be used is determined by the number and characteristics of the CPU cores, and the number of processes that can be used is usually equal to the number of CPU cores or twice the number of CPU cores. In addition, each process can include multiple threads or one thread, which is reasonable and is not specifically limited here.
[0248] For example, the preset number of rows is 20,000, and the number of processes that can be used is 8. When the total number of rows of memory data is 10,000 rows, a single process and a single thread can be used to serially process each file to be analyzed. When the total number of rows of memory data is 100,000 rows, if the number of files to be analyzed is 4, 4 processes and 4 threads are used to process each file to be analyzed in parallel, each process includes a thread, and the 4 processes construct a multi-tree of the keys of the business memory data of a file to be analyzed in the process in parallel; if the number of files to be analyzed is 10, 8 processes and 8 threads can be used to process each file to be analyzed in parallel, each process includes a thread, among which 6 processes respectively construct a multi-tree of the keys of the business memory data of a file to be analyzed in the process, and the remaining 2 processes respectively construct a multi-tree of the keys of the business memory data of two files to be analyzed in the process.
[0249] In this embodiment, the electronic device can adaptively determine the number of process threads to be used and the process thread operation mode according to the quantitative relationship between the total number of data rows included in the memory data and the preset number of rows. When the total number of data rows of the memory data is not greater than the preset number of rows, a single process and a single thread are used to serially process each file to be analyzed, and a multi-fork tree is constructed to process each file to be analyzed, which can avoid the waste of computing resources; and when the total number of data rows of the memory data is greater than the preset number of rows, a single process and a single thread are used to construct a multi-fork tree, resulting in a longer cycle of business memory data analysis. Therefore, multiple processes and multiple threads can be used to process each file to be analyzed in parallel, thereby improving the processing speed and shortening the cycle of business memory data analysis. On a 16-core 32G electronic device, it takes 12 hours to process 2G of memory data using a single process and a single thread, while it only takes 3 minutes to process each file to be analyzed using multiple processes and multiple threads in parallel, significantly improving data processing efficiency.
[0250] As an implementation method of the present application, Fig. 9As shown, before the above step S104, i.e., the step of merging the target nodes with the same preceding nodes and the same business node identifier in the multi-branch tree, a business memory data analysis method provided by an embodiment of the present application may further include:
[0251] S901: For each node, the node name of the preceding node of the node, the node name of the node, the level and depth of the node, and the data type of the corresponding key are combined to obtain the target name of the node.
[0252] After constructing the multi-branch tree, the electronic device can store each node in the multi-branch tree. When storing nodes, if the nodes are stored only according to their node names, there may be a situation where a previously stored node is overwritten by a later stored node with different node metadata but the same node name as the node, resulting in the loss of the node.
[0253] Based on this, in order to avoid node loss, for each node, the node name of the node's predecessor, the node name of the node, the node's level, depth and the corresponding key data type can be combined as the target name of the node.
[0254] In this way, since the target name of each node includes the node name of the predecessor node of the node, the node name of the node itself, and the metadata of the node, it is possible to avoid the situation where the node is overwritten by the node stored later simply because the node name is the same.
[0255] For example, for a node whose node name is 008d86db564b45b2b003af4eb5752e62, when storing the node, the target name of the node is stored as ccfmss:messagecache:008d86db564b45b2b003af4eb5752e62:35srt to prevent the node from being overwritten by a node with the same node name.
[0256] Furthermore, when storing the child nodes of each parent node according to the byte structure, the target name of the child node of the parent node can be stored to achieve the uniqueness of the target names of different child nodes and the consistency of the same child node name. For example, for the parent node messagecache, when storing the child node 008d86db564b45b2b003af4eb5752e62 of the parent node, the target name of the child node is stored ccfmss:messagecache:008d86db564b45b2b003af4eb5752e62:35str, so as to avoid the previously stored child node being overwritten by a different child node with different node metadata but the same node name.
[0257] S902: Map the target name of the node to an integer according to a preset mapping method as the updated node name of the node, wherein the preset mapping method enables the target name of the node to have a unique corresponding integer.
[0258] For each node, since the target name of the node is a combination of the node name of the node's predecessor, the node name of the node, the node's level, depth, and the corresponding key data type, the memory occupied by storing the target name of the node is relatively large. In addition, for each parent node, when storing the target name of the child node of the parent node, the length of each child node is relatively long and not uniform.
[0259] Based on this, in order to reduce the memory occupied by storing the target name of each node, the target name of the node is mapped to an integer using a preset mapping method, and the integer is used as the updated node name of the node.
[0260] The preset mapping method may be a hash operation or other mapping methods, which are all reasonable and are not specifically limited here. In addition, according to the preset mapping method, for each node, the target node of the node has a unique corresponding integer.
[0261] For example, Fig.10As shown in the figure, the parent node messagecache includes three child nodes (children) 008d86db564b45b2b003af4eb5752e62, 008d86db564b45b2b003af4eb5752e63 and 008d86db564b45b2b003af4eb5752e64. If the names of the three child nodes are recorded in the memory, and the child nodes corresponding to the recorded child node names are recorded, there may be nodes that are previously stored and are stored in memory. In order to avoid the situation where the node is overwritten by a node with different metadata but the same node name as the node stored later, the node name of the previous node of each child node, the node name, level, depth and the data type of the corresponding key can be combined as the target name of each child node; and in order to reduce the memory occupied by the child nodes, each child node can be mapped to an integer through a hash crc32 hash operation, and the integer of each child node can be stored, that is, according to the node name of the previous node + The node hash value obtained by name+level+depth+type is used as the target name childkey of the child node. As shown in the figure, the recorded childkey is 2177133336, and its corresponding child node is 008d86db564b45b2b003af4eb5752e62; the recorded childkey is 2177133337, and its corresponding child node is 008d86db564b45b2b003af4eb5752e63; the recorded childkey is 2177133338, and its corresponding child node is 008d86db564b45b2b003af4eb5752e64.
[0262] In this embodiment, by combining the node name of the preceding node of each node, the node name of the node, the level of the node, the depth and the corresponding key data type as the target name of each child node, it is possible to avoid the previously stored node being overwritten by the node with different node attributes but the same node name stored later; and when using a dictionary structure to store the child nodes of each parent node, the target name of each child node is stored, and the prefix information and level information of the child node are retained, which can avoid the loss of the child node and thus avoid affecting the subsequent merging results. In addition, mapping the target name of each node to an integer for storage can reduce the memory occupied by storing the name of the node, reduce the memory occupied when constructing a multi-branch tree, and improve storage efficiency.
[0263] Since the naming rules of the same field in the key of the business memory data of the same business are the same, and the field corresponds to the business type identifier, and then, the correspondence between the node name and the business type identifier is used to determine the target business type identifier of each node, it is possible to replace the node name with the business type identifier. In this way, the business type identifiers of the nodes corresponding to the business memory data belonging to the same business are the same, and then, according to the business type identifiers of each node, the nodes corresponding to the business memory data belonging to the same business can be merged.
[0264] However, when determining to use the business type identifier to replace the node name, there may be the following special cases where the node name does not need to be replaced: the node is a special node that does not require node name replacement; the node data included in the level where the node is located is less than the preset number of nodes, where the preset number of nodes can be set according to actual needs, for example, 2, 3, etc., which are all reasonable and are not specifically limited here; if the number of all nodes corresponding to the key of the node in the multi-branch tree is 1, that is, the node depth is 1. Nodes that meet the above conditions are some possible special cases, and when replacing the node name that meets the above conditions, there may be replacement anomalies.
[0265] Based on this, as an implementation method of an embodiment of the present application, the above step S103, that is, the step of determining the target business type identifier of each node based on the node name of each node in the multi-branch tree and the correspondence between the preset node name and the business type identifier, includes:
[0266] For each node in the multi-branch tree, if the node meets the following conditions, execute the step of determining the target business type identifier of each node based on the node name of each node in the multi-branch tree and the correspondence between the preset node name and the business type identifier: if the node name of the node is not in the preset exclusion list; if the number of nodes included in the level where the node is located is not less than the preset number of nodes; if the depth of the node is greater than 1.
[0267] In order to eliminate the influence of special cases on the memory analysis results and avoid abnormal replacement, the node names of special nodes that do not need to be replaced can be recorded in a preset exclusion list in advance, and the preset exclusion list can be stored in the electronic device.
[0268] Thus, for each node in the multi-branch tree, before replacing the node name of the node, the electronic device may first determine whether the node meets the following conditions:
[0269] The node name of the node is not in the preset exclusion list, the number of nodes included in the level where the node is located is not less than the preset number of nodes, and the depth of the node is greater than 1.
[0270] For each node, if the node meets all the above conditions, that is, the node name of the node is not in the preset exclusion list, the number of nodes included in the level where the node is located is not less than the preset number of nodes, and the depth of the node is greater than 1, then the electronic device can determine the target business type identifier of the node based on the node names of each node in the multi-branch tree and the correspondence between the preset node name and the business type identifier. Correspondingly, if the node does not meet at least one of the above conditions, then the step of determining the target business type identifier of the node based on the node names of each node in the multi-branch tree and the correspondence between the preset node name and the business type identifier is not performed on the node, so as to avoid replacement anomalies and affect the subsequent node merging results.
[0271] In this embodiment, in order to avoid node name replacement anomalies and eliminate the influence of special cases on memory analysis results, the conditions that nodes that need to be met for node name replacement can be set in advance. In this way, before the electronic device replaces the node name, it can first determine whether the node meets all the set conditions, and replace the node name for the node that meets all the conditions, thereby improving the accuracy of the name replacement results and subsequent node merging results.
[0272] Since each node corresponds to each field in the key, the node name corresponds to the field name of the field in the key, and each field in the node is obtained by segmenting the key, if the field segmentation is abnormal, the node name may be abnormal. In this case, according to various types of possible abnormal node names, the preset rules satisfied by the abnormal node names can be determined, and the category identification determination method for the nodes that meet the preset rules can be set, and the preset rules and the category identification determination method corresponding to the preset rules are used as a patch set, and the patch set is used to replace the node names of the nodes that meet the preset rules.
[0273] Based on this, as an implementation method of an embodiment of the present application, the above step S103, that is, the step of determining the target business type identifier of each node based on the node name of each node in the multi-branch tree and the correspondence between the preset node name and the business type identifier, includes:
[0274] If there is a node name that meets the preset rules among the node names of the nodes in the multi-branch tree, the target business type identifier of the node is determined according to the category identifier determination method corresponding to the preset rules; for the node whose node name does not meet the preset rules, the target business type identifier of the node is determined based on the node name of the node and the corresponding relationship between the preset node name and the business type identifier.
[0275] For each node in the multi-branch tree, before determining the target service type identifier of the node according to the node name of the node, the electronic device may first determine whether the node name is a node name that complies with a preset rule.
[0276] If the node name is a node name that complies with a preset rule, the target service type identifier of the node is determined according to the category identifier determination method corresponding to the preset rule.
[0277] Correspondingly, for a node whose node name does not conform to a preset rule, the electronic device may determine the target business type identifier of the node based on the node name of the node and the correspondence between the preset node name and the business type identifier.
[0278] For example, the keys of business memory data are:
[0279] hpcdar-isapi-device01, hpcdar-isapi-device02, and hpcdar-isapi-device03; when the key is split according to the colon in the key, since there is no colon in each key, the split results are still hpcdar-isapi-device01, hpcdar-isapi-device02, and hpcdar-isapi-device03. The node name of the node corresponding to the field is a non-standard name. You can set a patch set to replace the node sequence of the node in the hpcdar-isapi-format with hpcdar-isapi-{ID}.
[0280] In this embodiment, by setting a patch set including preset rules and a method for determining a category identifier corresponding to the preset rules, node names in non-standard situations can be replaced. Thus, by performing exception handling through the replacement process in the patch set, node names with abnormalities can be replaced, thereby ensuring the normal progress of the subsequent node merging process.
[0281] Of course, in actual application, there may be other special cases according to the key format and preset segmentation rules. For various special cases, in order to avoid affecting the data analysis results, the corresponding patch set can be set according to the actual situation to ensure the normal progress of the data analysis process.
[0282] In order to facilitate understanding of the business memory data analysis method provided by this application, Fig.11 The business memory data analysis flow chart shown illustrates the execution process of the business memory data analysis method.
[0283] The electronic device obtains memory data including the key of the business memory data of each business and the attribute information of each key, and then reads the memory data and determines the number of rows. The memory data is sliced to obtain multiple data slices, wherein each data slice includes 20,000 rows of data.
[0284] The electronic device determines whether the total number of rows of memory data is greater than 300,000 rows. If not, a single process and a single thread are used to serially process each data slice; if yes, multiple processes and multiple threads are used to parallelly process each data slice to improve the processing efficiency of the data slice.
[0285] When constructing a multitree for the first time, a multitree for each data slice is constructed based on the key of the business memory data of each data slice. Afterwards, for each data slice's multitree, similar node replacements are performed on each node belonging to the same business based on the name of each node in the multitree and the correspondence between the preset node name and the business type identifier, that is, the target business type identifiers belonging to the same business are the same, and the target business type identifier of each node, the node's level, depth, and the data type of the key corresponding to the node are used as the business node identifier of each node, and the name of each node is replaced with the business node identifier of each node. Afterwards, the electronic device can merge the multitree, that is, traverse the multitree, merge the target nodes with the same preceding nodes and the same business node identifier in the multitree, and then the electronic device can traverse the multitree to obtain the merged result.
[0286] After processing each data slice, the electronic device finally obtains the merging result of the N multi-branch trees, wherein the merging result includes each node path in each multi-branch tree.
[0287] After obtaining the merged result of N multi-branch trees, the merged result of the N multi-branch trees can be used for secondary construction, that is, based on the merged result of the N multi-branch trees, the multi-branch tree is rebuilt, and the same node paths in the multi-branch tree are merged. The multi-branch tree is merged to form a final multi-branch tree, and the final multi-branch tree is traversed to obtain various node paths. Each node path corresponds to the business memory data of a business. Furthermore, based on the node information in the multiple node paths, the memory usage information of the business memory data of each business can be determined. Combined with the front end, the business memory data of each business is graphically displayed so that the staff can intuitively understand the memory proportion of the business memory data of each business.
[0288] Corresponding to the above-mentioned business memory data analysis method, an embodiment of the present application also provides a business memory data analysis device. The following introduces a business memory data analysis device provided by an embodiment of the present application.
[0289] like Fig.12 As shown, a business memory data analysis device includes:
[0290] The key acquisition module 1210 is used to acquire the key of each business memory data and the attribute information of each key, wherein the key of the business memory data is generated based on the key template of the business memory data, and the attribute information includes the memory occupied by the business memory data corresponding to the key;
[0291] A multi-branch tree construction module 1220, configured to construct a multi-branch tree based on the key of each business memory data, wherein each node of the multi-branch tree represents a field included in the key, and the field includes at least a business identifier of the business memory data;
[0292] The identification determination module 1230 is used to determine the target business type identification of each node based on the node name of each node in the multi-branch tree and the correspondence between the preset node name and the business type identification, and determine the business node identification of each node according to the metadata of each node and the corresponding target business type identification, wherein the metadata of the node includes the level, depth and data type of the corresponding key of the node, and the depth is the number of fields after the key corresponding to the node is split according to the preset segmentation rule;
[0293] The merging module 1240 is used to merge the target nodes with the same preceding nodes and the same business node identifier in the multi-branch tree, and record the node information of the merged nodes, wherein the node information includes the number of target nodes corresponding to the merged nodes and the memory occupied by the business memory data corresponding to the corresponding target nodes;
[0294] The information determination module 1250 is used to determine each node path from the root node to each end node in the multi-branch tree, and determine the memory occupancy information corresponding to the business memory data of each business based on the node information corresponding to each node path.
[0295] In the scheme provided by the embodiment of the present application, the electronic device can obtain the key of each business memory data and the attribute information of each key, wherein the key of the business memory data is generated based on the key template of the business memory data, and the attribute information includes the memory occupied by the business memory data corresponding to the key; construct a multi-branch tree based on the key of each business memory data, wherein each node of the multi-branch tree represents a field included in the key, and the field at least includes the business identifier of the business memory data; based on the node name of each node in the multi-branch tree, and the correspondence between the preset node name and the business type identifier, determine the target business type identifier of each node, and determine the business node identifier of each node according to the metadata of each node and the corresponding target business type identifier; merge the target nodes with the same preceding nodes and the same business node identifier in the multi-branch tree, and record the node information of the merged nodes, wherein the node information includes the number of target nodes corresponding to the merged nodes and the memory occupied by the business memory data corresponding to the corresponding target nodes; determine each node path from the root node to each end node in the multi-branch tree, and determine the memory occupancy information corresponding to the business memory data of each business according to the node information corresponding to each node path.
[0296] The business memory data and the key of the business memory data are uniquely corresponding. According to the classification and merging results of the keys of the business memory data of each business and the memory occupied by the business memory data corresponding to the key of the business memory data, the memory proportion information of the business memory data of each business in the database can be determined. Since the field name of the key of the business memory data of each business is related to the business type identifier of the business to which the business memory data belongs, the name of each node in the multi-branch tree constructed using the key is also related to the business type identifier. According to the business category identifier corresponding to the node and the metadata of the node, the nodes can be classified according to the business, and the nodes corresponding to the same business in the multi-branch tree can be merged to obtain the node path corresponding to the business memory data of each business. Since the node information of each node path in the multi-branch tree is composed of the node information of each node merged into the node path, and the node information of each node is determined by the attribute information of the key corresponding to the node, the memory occupation information of the business memory data of each business can be obtained according to the node information of each node path in the multi-branch tree. According to the memory occupation information of the business memory data of each business, the staff can clearly and intuitively understand the memory distribution of the database, and then manage the business memory data in the database according to the memory distribution of the database to improve the data management efficiency.
[0297] As an implementation of the embodiment of the present application, the device further includes:
[0298] An interface display module is used to display a visual graphic interface based on the memory occupancy information corresponding to the business memory data of each business, wherein the visual graphic interface at least includes the memory occupied by the business memory data of the target business displayed in a graphic, and / or a preset number of businesses whose memory occupancy rates of the business memory data displayed in a graphic are ranked in the top; the target business is a business whose memory occupancy rate of the corresponding business memory data is higher than a preset value.
[0299] As an implementation of the embodiment of the present application, the multi-branch tree construction module 1220 includes:
[0300] The key segmentation submodule is used to segment each key according to the key structure and the preset segmentation rule to obtain the field sequence of the key;
[0301] A relationship determination submodule, used to take each field in each field sequence as a node, and determine the parent-child relationship of the nodes corresponding to each field according to the order of each field in each field sequence;
[0302] The merging submodule is used to start from the root node of the node sequence corresponding to each field sequence, traverse the node sequences, merge the same root nodes into one root node, and merge the nodes with the same name, corresponding key data type, level and preceding node into one node to obtain a multi-branch tree.
[0303] As an implementation of the embodiment of the present application, the identification determination module 1230 includes:
[0304] The identification determination submodule is used to arrange the target business type identification of each node, the level and depth of the node, and the data type of the key corresponding to the node according to a preset arrangement to obtain the business node identification of the node.
[0305] As an implementation of the embodiment of the present application, the information determination module 1250 includes:
[0306] A template restoration submodule, used to restore the target key template corresponding to each node path according to the node paths and the preset segmentation rules used to segment the keys of the business memory data;
[0307] The first determination submodule is used to determine the memory occupancy information corresponding to the business memory data of each business based on the node information corresponding to the target key template and the corresponding relationship between the preset key template and each business.
[0308] As an implementation of the embodiment of the present application, the device further includes:
[0309] A data slice partitioning module, used for, before the step of constructing a multi-branch tree based on the keys of the business memory data, partitioning the acquired memory data into a plurality of data slices, and using each data slice as a file to be analyzed, wherein the memory data includes the keys of the business memory data of each business and the attribute information of each key;
[0310] The information determination module 1250 includes:
[0311] The path acquisition submodule is used to obtain the node paths corresponding to each file to be analyzed and obtain all the node paths;
[0312] A path merging submodule, used to construct a multi-branch tree based on the names of the nodes included in all the node paths, and merge the node paths with the same path in the multi-branch tree of all the node paths to obtain a target multi-branch tree;
[0313] The second determination submodule is used to determine the memory occupancy information corresponding to the business memory data of each business based on the node information corresponding to the target multi-branch tree.
[0314] As an implementation of the embodiment of the present application, the multi-branch tree construction module 1220 includes:
[0315] A row number determination submodule, used to determine the total number of data rows included in the memory data;
[0316] The first construction submodule is used to construct a multi-branch tree based on the key of each business memory data in each file to be analyzed in a single-process single-thread serial manner if the total number of data rows included in the memory data is not greater than a preset number of rows;
[0317] The second construction submodule is used to construct a multi-branch tree based on the key of each business memory data in each file to be analyzed in a multi-process and multi-threaded parallel manner if the total number of data rows included in the memory data is greater than the preset number of rows.
[0318] As an implementation of the embodiment of the present application, the device further includes:
[0319] A combining module, for combining, for each node, the node name of the node's predecessor, the node name of the node, the node's level, the node's depth, and the corresponding key data type to obtain a target name for the node before merging the target nodes with the same predecessor nodes and the same business node identifier in the multi-branch tree;
[0320] The mapping module is used to map the target name of the node to an integer according to a preset mapping method as the updated node name of the node, wherein the preset mapping method enables the target name of the node to have a unique corresponding integer.
[0321] As an implementation of the embodiment of the present application, the identification determination module 1230 includes:
[0322] An execution submodule is used for, for each node in the multi-branch tree, executing the step of determining the target business type identifier of each node based on the node name of each node in the multi-branch tree and the preset correspondence between the node name and the business type identifier for each node if the node meets the following conditions: if the node name of the node is not in the preset exclusion list; if the number of nodes included in the level where the node is located is not less than the preset number of nodes; if the depth of the node is greater than 1;
[0323] or,
[0324] If there is a node name that meets the preset rules among the node names of the nodes in the multi-branch tree, the target business type identifier of the node is determined according to the category identifier determination method corresponding to the preset rules; for the node whose node name does not meet the preset rules, the target business type identifier of the node is determined based on the node name of the node and the corresponding relationship between the preset node name and the business type identifier.
[0325] The present application also provides an electronic device, such as Fig.13 As shown, including:
[0326] Memory 1301, used for storing computer programs;
[0327] The processor 1302 is used to implement the method steps described in any of the above embodiments when executing the program stored in the memory 1301.
[0328] Furthermore, the electronic device may further include a communication bus and / or a communication interface, and the processor 1302, the communication interface, and the memory 1301 communicate with each other via the communication bus.
[0329] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0330] The communication interface is used for communication between the above electronic device and other devices.
[0331] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0332] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0333] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned business memory data analysis methods are implemented.
[0334] In another embodiment provided in the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any of the business memory data analysis methods in the above embodiments.
[0335] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a solid-state hard disk (SSD), etc.
[0336] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0337] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, electronic device, computer-readable storage medium, and computer program product embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0338] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A business memory data analysis method, It is characterized in that The method comprises: Obtaining a key of each business memory data and attribute information of each key, wherein the key of the business memory data is generated based on a key template of the business memory data, and the attribute information includes the memory occupied by the business memory data corresponding to the key; Constructing a multi-branch tree based on the key of each business memory data, wherein each node of the multi-branch tree represents a field included in the key, and the field includes at least a business identifier of the business memory data; Based on the node name of each node in the multi-branch tree and the correspondence between the preset node name and the business type identifier, determine the target business type identifier of each node, and determine the business node identifier of each node according to the metadata of each node and the corresponding target business type identifier, wherein the metadata of the node includes the node level, depth and corresponding key data type, and the depth is the number of fields after the key corresponding to the node is split according to the preset segmentation rule; Merge the target nodes with the same preceding nodes and the same business node identifier in the multi-branch tree, and record the node information of the merged nodes, wherein the node information includes the number of target nodes corresponding to the merged nodes and the memory occupied by the business memory data corresponding to the corresponding target nodes; Determine each node path from the root node to each end node in the multi-branch tree, and determine the memory occupancy information corresponding to the business memory data of each business according to the node information corresponding to each node path; The step of constructing a multi-branch tree based on the key of each business memory data includes: For each key, split the key according to the key structure and the preset splitting rule to obtain the field sequence of the key; Taking each field in each field sequence as a node, and determining the parent-child relationship of the nodes corresponding to each field according to the order of each field in each field sequence; Starting from the root node of the node sequence corresponding to each field sequence, traverse the node sequences, merge the same root nodes into one root node, and merge the nodes with the same name, corresponding key data type, level and preceding node into one node to obtain a multi-branch tree.
2. The method according to claim 1, It is characterized in that The method further comprises: Displaying a visual graphical interface based on the memory usage information corresponding to the business memory data of each business; Among them, the visual graphic interface includes the memory occupied by the business memory data of the target business displayed in a graphic, and / or, the memory occupancy rate of the business memory data displayed in a graphic ranked top a preset number of businesses; the target business is the business whose memory occupancy rate of the corresponding business memory data is higher than the preset value.
3. The method according to claim 1, It is characterized in that The step of determining the service node identifier of each node according to the metadata of each node and the corresponding target service type identifier includes: For each node, the target business type identifier of the node, the level and depth of the node, and the data type of the key corresponding to the node are arranged according to a preset arrangement to obtain the business node identifier of the node.
4. The method according to claim 1, It is characterized in that The step of determining the memory occupancy information corresponding to the business memory data of each business according to the node information corresponding to each node path includes: According to the node paths and the preset segmentation rule used to segment the keys of the business memory data, restore the target key template corresponding to each node path; Based on the node information corresponding to the target key template and the corresponding relationship between the preset key template and each business, the memory occupancy information corresponding to the business memory data of each business is determined.
5. The method according to claim 1, It is characterized in that Before the step of constructing a multi-branch tree based on the key of each business memory data, the method further includes: Divide the acquired memory data into multiple data slices, and use each data slice as a file to be analyzed, wherein the memory data includes keys of business memory data of various businesses and attribute information of each key; The step of determining the memory occupancy information corresponding to the business memory data of each business according to the node information corresponding to each node path includes: Get each node path corresponding to each file to be analyzed, and get all the node paths; Constructing a multi-branch tree based on the names of the nodes included in all the node paths, merging the node paths with the same path in the multi-branch tree of all the node paths, and obtaining a target multi-branch tree; Based on the node information corresponding to the target multi-branch tree, memory occupancy information corresponding to the business memory data of each business is determined.
6. The method according to claim 5, It is characterized in that The step of constructing a multi-branch tree based on the key of each business memory data includes: Determine the total number of data rows included in the memory data; If the total number of data rows included in the memory data is not greater than the preset number of rows, a multi-branch tree is constructed based on the key of each business memory data in each file to be analyzed in a single-process single-thread serial manner; If the total number of data rows included in the memory data is greater than the preset number of rows, a multi-tree is constructed based on the key of each business memory data in each file to be analyzed in a multi-process and multi-threaded parallel manner.
7. The method according to any one of claims 3 to 6, It is characterized in that Before the step of merging the target nodes having the same preceding nodes and the same service node identifiers in the multi-branch tree, the method further includes: For each node, the node name of the node's predecessor, the node name of the node, the node's level, depth, and the corresponding key data type are combined to obtain the target name of the node; The target name of the node is mapped to an integer according to a preset mapping method as the updated node name of the node, wherein the preset mapping method enables the target name of the node to have a unique corresponding integer.
8. The method according to any one of claims 1 to 6, It is characterized in that The step of determining the target service type identifier of each node based on the node name of each node in the multi-branch tree and the correspondence between the preset node name and the service type identifier includes: For each node in the multi-branch tree, if the node meets the following conditions, the step of determining the target business type identifier of each node based on the node name of each node in the multi-branch tree and the preset correspondence between the node name and the business type identifier is performed: if the node name of the node is not in the preset exclusion list; if the number of nodes included in the level where the node is located is not less than the preset number of nodes; if the depth of the node is greater than 1; or, If there is a node name that meets the preset rules among the node names of the nodes in the multi-branch tree, the target business type identifier of the node is determined according to the category identifier determination method corresponding to the preset rules; for the node whose node name does not meet the preset rules, the target business type identifier of the node is determined based on the node name of the node and the corresponding relationship between the preset node name and the business type identifier.
9. A business memory data analysis device, It is characterized in that The device comprises: A key acquisition module, used to acquire the key of each business memory data and the attribute information of each key, wherein the key of the business memory data is generated based on the key template of the business memory data, and the attribute information includes the memory occupied by the business memory data corresponding to the key; A multi-branch tree construction module, used to construct a multi-branch tree based on the key of each business memory data, wherein each node of the multi-branch tree represents a field included in the key, and the field includes at least a business identifier of the business memory data; An identification determination module, used to determine the target business type identification of each node based on the node name of each node in the multi-branch tree and the correspondence between the preset node name and the business type identification, and determine the business node identification of each node according to the metadata of each node and the corresponding target business type identification, wherein the metadata of the node includes the node level, depth and corresponding key data type, and the depth is the number of fields after the key corresponding to the node is split according to the preset segmentation rule; A merging module, used to merge target nodes with the same preceding node and the same business node identifier in the multi-branch tree, and record node information of the merged nodes, wherein the node information includes the number of target nodes corresponding to the merged nodes and the memory occupied by the business memory data corresponding to the corresponding target nodes; An information determination module, used to determine each node path from the root node to each terminal node in the multi-branch tree, and determine the memory occupancy information corresponding to the business memory data of each business according to the node information corresponding to each node path; Wherein, the multi-branch tree construction module includes: The key segmentation submodule is used to segment each key according to the key structure and the preset segmentation rule to obtain the field sequence of the key; A relationship determination submodule, used to take each field in each field sequence as a node, and determine the parent-child relationship of the nodes corresponding to each field according to the order of each field in each field sequence; The merging submodule is used to start from the root node of the node sequence corresponding to each field sequence, traverse the node sequences, merge the same root nodes into one root node, and merge the nodes with the same name, corresponding key data type, level and preceding node into one node to obtain a multi-branch tree.
10. The device according to claim 9, It is characterized in that The device also includes: An interface display module, configured to display a visual graphical interface based on the memory occupancy information corresponding to the business memory data of each business, wherein the visual graphical interface at least includes the memory occupied by the business memory data of the target business displayed in a graphic, and / or the businesses whose memory occupancy rates of the business memory data displayed in a graphic are ranked first by a preset number; the target business is a business whose memory occupancy rate of the corresponding business memory data is higher than a preset value; The identification determination module includes: The identification determination submodule is used to arrange the target business type identification of each node, the level and depth of the node, and the data type of the key corresponding to the node according to a preset arrangement method to obtain the business node identification of the node; The information determination module comprises: A template restoration submodule, used to restore the target key template corresponding to each node path according to the node paths and the preset segmentation rules used to segment the keys of the business memory data; A first determination submodule, configured to determine memory usage information corresponding to business memory data of each business based on node information corresponding to the target key template and a correspondence between a preset key template and each business; The device also includes: A data slice partitioning module, used for, before the step of constructing a multi-branch tree based on the keys of the business memory data, partitioning the acquired memory data into a plurality of data slices, and using each data slice as a file to be analyzed, wherein the memory data includes the keys of the business memory data of each business and the attribute information of each key; The information determination module comprises: The path acquisition submodule is used to obtain the node paths corresponding to each file to be analyzed and obtain all the node paths; A path merging submodule, used to construct a multi-branch tree based on the names of the nodes included in all the node paths, and merge the node paths with the same path in the multi-branch tree of all the node paths to obtain a target multi-branch tree; A second determination submodule is used to determine the memory occupancy information corresponding to the business memory data of each business based on the node information corresponding to the target multi-branch tree; The multi-branch tree construction module includes: A row number determination submodule, used to determine the total number of data rows included in the memory data; The first construction submodule is used to construct a multi-branch tree based on the key of each business memory data in each file to be analyzed in a single-process single-thread serial manner if the total number of data rows included in the memory data is not greater than a preset number of rows; The second construction submodule is used to construct a multi-tree based on the key of each business memory data in each file to be analyzed by adopting a multi-process multi-thread parallel method if the total number of data rows included in the memory data is greater than the preset number of rows; The device also includes: A combining module, for combining, for each node, the node name of the node's predecessor, the node name of the node, the node's level, the node's depth, and the corresponding key data type to obtain a target name for the node before merging the target nodes with the same predecessor nodes and the same business node identifier in the multi-branch tree; A mapping module, used to map the target name of the node to an integer according to a preset mapping method as the updated node name of the node, wherein the preset mapping method enables the target name of the node to have a unique corresponding integer; The identification determination module includes: An execution submodule is used for, for each node in the multi-branch tree, executing the step of determining the target business type identifier of each node based on the node name of each node in the multi-branch tree and the preset correspondence between the node name and the business type identifier for each node if the node meets the following conditions: if the node name of the node is not in the preset exclusion list; if the number of nodes included in the level where the node is located is not less than the preset number of nodes; if the depth of the node is greater than 1; or, If there is a node name that meets the preset rules among the node names of the nodes in the multi-branch tree, the target business type identifier of the node is determined according to the category identifier determination method corresponding to the preset rules; for the node whose node name does not meet the preset rules, the target business type identifier of the node is determined based on the node name of the node and the corresponding relationship between the preset node name and the business type identifier.
11. An electronic device, It is characterized in that include: Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-8 when executing a program stored in a memory.
12. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Hierarchical data search method and device based on binary tree, equipment and storage medium
CN115048382A
Data storage method and device, electronic equipment and storage medium
CN115168365A
Method and device for processing key value pair storage system
CN118227337A
System to organize data for visualizing performance characteristics in dynamic perspectives using relational database
US20080288529A1
Adaptive prefix tree based order partitioned data storage system
US20170212680A1
