Search

CN-122019533-A - Multi-dimensional resource dynamic management and efficient access method, terminal equipment and storage medium

CN122019533ACN 122019533 ACN122019533 ACN 122019533ACN-122019533-A

Abstract

The invention provides a multidimensional resource dynamic management and efficient access method, terminal equipment and a storage medium, wherein the method comprises the steps of defining a node data structure of a hierarchical tree; constructing a static hierarchical skeleton structure of a hierarchical tree, dynamically adding resource index nodes, establishing a multidimensional index mapping table, establishing a node ID index mapping table, realizing a hierarchical caching strategy, realizing batch caching writing, realizing efficient subsequent node traversal, realizing batch traversal operation and realizing caching consistency assurance. The method can realize dynamic construction of hierarchical data, efficient indexing of multidimensional resources, differentiated cache management and rapid traversal of batch data.

Inventors

  • HUANG JIALI
  • LIU JINGLEI
  • LI ZHEN

Assignees

  • 厦门星纵数字科技有限公司

Dates

Publication Date
20260512
Application Date
20251229

Claims (10)

  1. 1. A method for dynamic management and efficient access of multidimensional resources, the method comprising: step S1, defining a node data structure of a hierarchical tree; s2, constructing a static hierarchical skeleton structure of a hierarchical tree; s3, dynamically adding resource index nodes; S4, establishing a multidimensional index mapping table; s5, establishing a node ID index mapping table; s6, realizing a hierarchical caching strategy; s7, realizing batch cache writing; step S8, efficient subsequent node traversal is achieved; S9, realizing batch traversal operation; and S10, realizing cache consistency assurance.
  2. 2. The method according to claim 1, wherein in the step S1, the node data structure of the defining hierarchical tree, the node class of the designing hierarchical tree is performed, and each node includes the following attributes: The node identifier is represented by ID, the ID is used as a unique identifier of the node, and an integer sequence with separated points is adopted; a child node set is stored by using TreeSet ordered sets based on red black trees and is automatically arranged according to an identifier dictionary sequence; Parent node reference, which refers to a parent node and is used for backtracking operation; node metadata, storing additional information of the node; wherein the set of child nodes is stored using a TreeSet ordered set based on red-black trees, the set of child nodes comprising: the time complexity of the insert and find operations are both 0 log k, where k is the number of child nodes; the child nodes are automatically ordered according to identifiers, and efficient traversal operation is supported; And supporting range query and rapidly acquiring child nodes in a designated range.
  3. 3. The method according to claim 2, wherein in the step S2, constructing a static hierarchical skeleton structure of the hierarchical tree, according to a data model of a predefined hierarchical tree, constructing the static skeleton structure of the hierarchical tree includes: creating a root node and setting a root node identifier; Traversing the data model definition, and creating a tree node for each data object; For scalar single value objects, additionally creating a leaf node of the ".0" suffix; analyzing the identifier of each node, determining the father node of each node, and adding the node into the child node set of the father node; In the step S3, dynamically adding resource index nodes, after the static skeleton of the hierarchical tree is constructed, inquiring an actual resource list in the current system, dynamically adding index nodes for each resource entity under a corresponding table entry node, including: inquiring a relational database to obtain resource configuration information; inquiring a time sequence database to obtain a dynamic resource list; Allocating a unique integer index to each resource, wherein the index is increased from 1; An index node is added at a corresponding position of the hierarchical tree, and the node identifier format is "parent node ID. index value".
  4. 4. The method for dynamically managing and efficiently accessing multi-dimensional resources according to claim 3, wherein in the step S4 of creating the multi-dimensional index mapping table, for the resources having multi-dimensional attributes, creating the mapping relationship from the tag combinations to the indexes comprises: Extracting dimension labels from the time sequence database query results; Ordering according to the dictionary sequence of the dimension label values, and guaranteeing the stability of index allocation; assigning a unique integer index to each dimension tag combination; storing the mapping relation into a distributed cache, wherein the key format is: { prefix }: { resource type }: { dimension 1 value }: { dimension 2 value }; And establishing an association index between the dimensions.
  5. 5. The method for dynamically managing and efficiently accessing multidimensional resources according to claim 4, wherein in the step S5, a hash table is constructed in the node ID index mapping table, and the method comprises: when locating a node corresponding to a certain ID, the node can be completed within 0 or 1 time; the node ID index mapping table is generated after the construction of the hierarchical tree is completed, and is synchronously updated when the structure of the hierarchical tree is changed; In the step S6, implementing the hierarchical caching policy includes: Dividing data into a plurality of cache levels according to the data change frequency, and setting differentiated cache expiration time and acquisition period for each level; the coordination formula of the buffer expiration time and the acquisition period is that the buffer expiration time=the acquisition period×the buffer coefficient, wherein the buffer coefficient is 1.2-1.5.
  6. 6. The method for dynamically managing and efficiently accessing multidimensional resources according to claim 5, wherein in the step S7 of implementing batch cache writing, a Pipeline mechanism of a distributed cache is adopted to implement batch writing, comprising: Creating batch operation objects; traversing data items to be cached, and adding asynchronous SET operation for each data item; Setting corresponding buffer expiration time according to the buffer level of the data; Executing batch operation, and submitting all write commands at one time; In the step S8, in implementing efficient subsequent node traversal, when a hierarchical structure needs to be traversed, an optimized depth-first search algorithm is adopted, including: the current node is positioned quickly, namely the node corresponding to the request ID is positioned directly within 0 or 1 time complexity through the node ID index mapping table; Searching a subsequent node, namely returning to the first child node if the current node has the child node, searching the next brother node in the child node set of the father node if the current node has no child node, backtracking to the ancestor node if the father node has no next brother node, and repeating the process; and returning the ID of the subsequent node and the corresponding data value.
  7. 7. The method for dynamically managing and efficiently accessing multidimensional resources according to claim 6, wherein in the step S9 of implementing batch traversal operation, for a batch query request, supporting acquisition of a plurality of successor nodes at a time, comprises: Analyzing batch request parameters, including a starting position and a maximum return number; starting from the initial position, continuously executing a plurality of subsequent node searches; directly acquiring a subsequent node along an advanced traversal path by utilizing an ordered structure of the hierarchical tree; realizing response size limitation, and stopping traversing when the number of results reaches the limitation; And packaging all the results and returning.
  8. 8. The method for dynamically managing and efficiently accessing multidimensional resources according to claim 7, wherein in the step S10 of implementing cache consistency assurance, ensuring consistency and availability of cache data comprises: The buffer expiration time fault tolerance design is that the buffer expiration time is set to be 1.2-1.5 times of the acquisition period, and buffering is provided for acquisition delay; the acquisition retry mechanism is used for retrying in a short time when the data source inquiry fails; A cache degradation strategy, namely when a back-end data source is not available, prolonging the expiration time of the existing cache, continuously providing service by using the data which is old but available, and marking the data state; Health checking, namely periodically checking the freshness of the cache data, and triggering supplementary acquisition when abnormality is found.
  9. 9. A multi-dimensional resource dynamic management and efficient access terminal device, characterized by comprising a processor, a memory and a computer program stored in the memory and running on the processor, the processor implementing the steps of the method according to any of claims 1-8 when executing the computer program.
  10. 10. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the steps of the method according to any one of claims 1-8.

Description

Multi-dimensional resource dynamic management and efficient access method, terminal equipment and storage medium Technical Field The application belongs to the technical field of distributed data management, and particularly relates to a multidimensional resource dynamic management and efficient access method, terminal equipment and a storage medium. Background In modern distributed systems, management information is typically organized in a hierarchical tree structure. The structure is widely applied to network equipment management for organizing and managing objects through object identifiers (Object Identifier, OID for short), file systems for organizing files and directories through path levels, organization structures for representing relationships between departments and personnel through tree structures, and other levels of data management for organizing resource directories of various resources through classification levels. In the current cloud computing and distributed system, the managed resource generally has attributes with multiple dimensions, and there is a management challenge of the multidimensional resource. For example, server monitoring is taken as an example, in a server dimension, there is an attribute of which server a resource belongs to, in a device dimension, there is an attribute of a specific device identifier, and in a time dimension, there is an attribute of data acquisition time and validity period. Therefore, the prior art has the following problems that the hierarchical structure is static and can not adapt to dynamic resource change. Conventional hierarchical data structures are determined at design time and are difficult to dynamically adjust at runtime. When the managed resource changes (e.g., a new server, a deleted device), the entire data structure needs to be reconstructed, and even the system restarted. This is particularly inconvenient in cloud environments where resources are elastically scaled. The index mapping of multidimensional resources is difficult. Conventional hierarchies typically use a single integer index. For resources with multiple dimensions, a single index cannot express the multidimensional attribution of the resources. For example, a disk device belongs to a certain server and a certain device path at the same time, and a single index cannot express both dimensions at the same time. The unified caching strategy can not meet the problem of differentiated requirements. Different types of monitoring data have different frequencies of variation and real-time requirements. For example, high frequency data (e.g., CPU usage) is changed on a second level, requiring high real-time, intermediate frequency data (e.g., number of on-line users) is changed on a minute level, requiring moderate real-time, and low frequency data (e.g., configuration information) is changed on an hour level or lower, requiring relatively low real-time. The unified buffer expiration Time (TTL) cannot meet these differentiated requirements at the same Time. And the batch data traversal is inefficient. Conventional linear searching approaches are inefficient when a large amount of data in the hierarchy needs to be traversed. Especially when batch queries are performed, the piece-by-piece approach can result in a large number of repeated computations and network round trips. Disclosure of Invention In order to overcome the defects in the prior art, the application provides a multidimensional resource dynamic management and efficient access method, terminal equipment and a storage medium, which can solve the problems. The invention provides a multidimensional resource dynamic management and efficient access method, which comprises the following steps: step S1, defining a node data structure of a hierarchical tree; s2, constructing a static hierarchical skeleton structure of a hierarchical tree; s3, dynamically adding resource index nodes; S4, establishing a multidimensional index mapping table; s5, establishing a node ID index mapping table; s6, realizing a hierarchical caching strategy; s7, realizing batch cache writing; step S8, efficient subsequent node traversal is achieved; S9, realizing batch traversal operation; and S10, realizing cache consistency assurance. Further, according to the method for dynamically managing and efficiently accessing multidimensional resources provided by the present application, in the step S1, in the node data structure of the defined hierarchical tree, the node class of the designed hierarchical tree is performed, and each node includes the following attributes: The node identifier is represented by ID, the ID is used as a unique identifier of the node, and an integer sequence with separated points is adopted; a child node set is stored by using TreeSet ordered sets based on red black trees and is automatically arranged according to an identifier dictionary sequence; Parent node reference, which refers to a parent node and is used for backtracking ope