Data preheating method and device, electronic equipment and computer program product
By querying the organizational tree level by level in multi-level storage, determining the total preheating depth based on the target node depth, and selectively loading data to upstream storage, the database pressure problem caused by explosive concurrent queries is solved, and query efficiency and caching rationality are improved.
Patent Information
- Application Number
- CN202511348717.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-19
- Publication Date
- 2026-01-23
AI Technical Summary
In the management systems of large enterprises and schools, explosive concurrent data queries can lead to excessive pressure on database access, which can easily cause system response delays or crashes. Existing full data preheating methods can also increase caching pressure.
By querying the organizational tree level by level in multi-level storage, the total preheating depth is determined based on the depth of the target node, and the data of the node to be preheated is selectively loaded to the upstream storage, thus avoiding full data preheating.
It improves data query efficiency, reduces cache pressure, meets the data query needs of actual business, and reduces hardware costs.
Smart Images

Figure CN121387953A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of computer, and particularly relates to a data preheating method and device, electronic equipment and computer program product. BACKGROUND
[0002] In the management system of large enterprises, schools and other organizations, there are often scenes of explosive concurrent data query. Such scenes cause great access pressure on the database and easily lead to system response delay or even crash. Some related technologies use full data preheating to improve data query efficiency and reduce database access pressure, but the amount of cache data is large when full data preheating, causing the rise of cache pressure. SUMMARY
[0003] The embodiments of the present application provide a data preheating method, device, electronic equipment and computer program product, which can improve the rationality of data preheating and help to balance the amount of cache data and query efficiency.
[0004] The first aspect of the embodiments of the present application provides a data preheating method, comprising: in response to a data query request, querying data of a target node pointed by the data query request in an organization tree in a multi-level storage step by step; if the data of the target node is queried in a downstream storage in the multi-level storage, determining a preheating total depth according to a target depth of the target node in the organization tree, the preheating total depth being negatively correlated with the target depth; determining a node to be preheated in the organization tree according to the preheating total depth; and loading data of the node to be preheated into an upstream storage of the downstream storage.
[0005] In some embodiments of the present application, the determining the node to be preheated in the organization tree according to the preheating total depth comprises: determining a preheating depth according to the depth of the target node and the preheating total depth; and taking the target node and nodes belonging to the preheating depth among all descendant nodes of the target node in the organization tree as the node to be preheated.
[0006] In some embodiments of the present application, the querying data of the target node in the organization tree in the multi-level storage step by step comprises: querying data of the target node in the multi-level storage step by step according to a query code carried by the data query request; and the querying the data of the target node comprises: comparing the query code with a node code of each node in the organization tree, each node code recording a path from a root node to a corresponding node.
[0007] In some embodiments of the present application, the data preheating method further comprises: in response to an add or delete operation on a node, updating the most downstream storage in the multi-level storage and re-determining the node codes of the nodes in the structure tree; and if the node codes of the nodes other than the added node and / or the deleted node change, clearing the cached data of the nodes whose node codes change in the storage other than the most downstream storage.
[0008] In some embodiments of the present application, when the add or delete operation is an add operation, the data preheating method further comprises: determining the to-be-preheated node corresponding to the added node; and loading the data of the to-be-preheated node corresponding to the added node into the upstream storage of the downstream storage.
[0009] In some embodiments of the present application, the data preheating method further comprises: in response to a data update operation on a node, if the cached data of the to-be-updated node pointed to by the data update operation is cleared in the storage other than the most downstream storage in the multi-level storage; and modifying the data of the to-be-updated node in the most downstream storage.
[0010] In some embodiments of the present application, after the data of the target node pointed to by the data query request in the structure tree is queried in the multi-level storage, the data preheating method further comprises: recording the query frequency of the target node; when the storage other than the most downstream storage in the multi-level storage is reset, determining the data of the node to be cached in the other storage according to the query frequency of each node in the structure tree; and loading the data of the node to be cached into the corresponding other storage.
[0011] The second aspect of the embodiment of the present application provides a data preheating device, which comprises: a data query unit, configured to query the data of a target node pointed to by a data query request in a structure tree in a multi-level storage in stages; a depth determination unit, configured to determine a total preheating depth according to a target depth of the target node in the structure tree if the data of the target node is queried in a downstream storage in the multi-level storage, the total preheating depth being negatively correlated with the target depth; a node determination unit, configured to determine a to-be-preheated node in the structure tree according to the total preheating depth; and a data preheating unit, configured to load the data of the to-be-preheated node into an upstream storage of the downstream storage.
[0012] The third aspect of the embodiment of the present application provides an electronic device, which comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the data preheating method when executing the computer program.
[0013] The fourth aspect of the embodiment of the present application provides a computer readable storage medium, the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps of the data preheating method.
[0014] The fifth aspect of the embodiment of the present application provides a computer program product, when the computer program is executed, the data preheating method is executed.
[0015] In the embodiment of the present application, in response to the data query request, the data of the target node in the organization tree is queried in the multi-level storage step by step, and when the data of the target node is queried from the downstream storage, the total preheating depth and the node to be preheated are determined according to the target depth of the target node in the organization tree, the data of the node to be preheated is loaded into the upstream storage of the downstream storage, on the one hand, by loading the data of the node to be preheated into the upstream storage (that is, data preheating), the subsequent data query efficiency can be improved, on the other hand, since the total preheating depth is negatively correlated with the target depth, full data preheating is no longer needed, but according to the target depth, a part of the data of the node is selectively loaded into the upstream storage, which can improve the rationality of data preheating, help to balance the cache data volume and the query efficiency, and meet the data query demand in the actual business. BRIEF DESCRIPTION OF DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0017] Figure 1 is an implementation flow diagram of a data preheating method provided by the embodiment of the present application;
[0018] Figure 2 is a schematic diagram of an organization tree provided by the embodiment of the present application;
[0019] Figure 3 is a specific implementation flow diagram of data query provided by the embodiment of the present application;
[0020] Figure 4 is a structure diagram of a data preheating device provided by the embodiment of the present application;
[0021] Figure 5 is a structure diagram of an electronic device provided by the embodiment of the present application. DETAILED DESCRIPTION
[0022] In order to make the purposes, technical solutions and advantages of the present application clearer, further detailed description will be made to the present application in combination with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and not used to limit the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work belong to the protection scope of the present application.
[0023] In the management system of large enterprises, schools and other organizations, the scene of explosive concurrent data query often occurs. Such a scene causes great access pressure to the database and easily causes system response delay or even crash. Some related technologies use full data preheating to improve data query efficiency and reduce database access pressure, but the cache data volume is large when full data preheating, causing cache pressure to rise.
[0024] In view of this, the present application provides a data preheating method, which can improve the rationality of data preheating, help to balance cache data volume and query efficiency, and meet the data query demand in actual business.
[0025] In order to explain the technical solutions of the present application, specific embodiments will be described below.
[0026] Figure 1 An implementation flowchart of a data preheating method provided by an embodiment of the present application is shown, and the method can be applied to an electronic device. The above-mentioned electronic device can be a computer (such as a server device), a smart phone or other smart device, and the present application does not limit this.
[0027] Specifically, the above-mentioned data preheating method can include the following steps S101 to S103.
[0028] Step S101, in response to a data query request, querying the data of a target node pointed by the data query request in an organization tree in a multi-level storage step by step.
[0029] The data query request can be used to query the data of the target node in the organization tree. The organization tree can be used to represent a tree-shaped data structure of organizational hierarchical relationship, and can be used to display the department or employee relationship of a company, a school or other organization. The nodes in the organization tree extend from the root node to the lower layers. The target node is the node in the organization tree indicated by the data query request and needs to be queried.
[0030] In the embodiment of the present application, a multi-level storage can be set. The most downstream storage is a database, which is used to store full data. One or more levels of storage can be set upstream of the database, which is used to store at least part of the data in the database.
[0031] In response to the data query request, data of the target node pointed to by the data query request in the organization tree can be queried in the multi-level storage step by step, more specifically, data of the target node can be queried step by step from the uppermost storage until the data of the target node is queried. For example, if the data of the target node is queried in the uppermost storage, the data can be returned and the query can be stopped, if the data of the target node is not queried in the uppermost storage, the data of the target node can be queried in the second level storage, and so on until the data of the target node is queried.
[0032] It should be noted that the data content of the data of each node is not limited in the present application, and can be an employee name, a department name, an employee rank, etc.
[0033] In step S102, if the data of the target node is queried in the downstream storage in the multi-level storage, the total preheating depth is determined according to the target depth of the target node in the organization tree.
[0034] It can be understood that the depth of the organization tree is the path length from the root node to a certain node, that is, the number of edges on the path. For example, the depth of the root node is 0, and the depth of the child node of the root node is 1. The target depth is the depth of the target node in the organization tree.
[0035] The downstream storage can refer to any one level storage other than the uppermost storage. If the data of the target node is queried in the downstream storage in the multi-level storage, it indicates that the data cannot be queried at least in the uppermost storage, and therefore data related to the data can be preheated.
[0036] According to the target depth of the target node in the organization tree, the total preheating depth can be determined. The total preheating depth is the total number of layers (the number of layers can be understood as the depth plus one) in the organization tree that need to be preheated. The total preheating depth is negatively correlated with the target depth. That is, the deeper the target depth of the target node in the organization tree, the fewer the total depth that needs to be preheated.
[0037] For example, when the depth of the target node is 3, the total preheating depth is 5, and five layers of nodes need to be preheated (the specific layer of the five layers of nodes can be adjusted according to the actual situation); when the depth of the target node is 5, the total preheating depth is 3, and three layers of nodes need to be preheated.
[0038] In step S103, the nodes to be preheated are determined in the organization tree according to the total preheating depth.
[0039] In the embodiments of the present application, the to-be-preheated node refers to a node that needs to be preheated. According to the total preheating depth, the to-be-preheated node can be determined in the organization tree, so that the total number of layers in which the to-be-preheated node is located matches the total preheating depth. For example, if the target depth and the total preheating depth are both 3, all nodes with depths of 4, 5 and 6 (i.e., nodes in the 5th to 7th layers) are to-be-preheated nodes.
[0040] In step S104, the data of the to-be-preheated node is loaded into the upstream storage of the downstream storage.
[0041] In the embodiments of the present application, the data of the to-be-preheated node can be loaded into the upstream storage of the downstream storage to store the data of the to-be-preheated node in the upstream storage. In this way, when the data of the to-be-preheated node is queried next time, the data of the to-be-preheated node can be queried in the upstream storage.
[0042] It should be noted that the upstream storage here is relative to the downstream storage in step S102. For example, when the data of the target node is queried in the most downstream storage (i.e., the database) in step 102, the upstream storage can be any one level of storage other than the most downstream storage. When the data of the target node is queried in the second level of storage in step 102, the upstream storage can be the most upstream storage.
[0043] In the embodiments of the present application, in response to the data query request, the data of the target node in the organization tree is queried in the multi-level storage step by step, and when the data of the target node is queried from the downstream storage, the total preheating depth and the to-be-preheated node are determined according to the target depth of the target node in the organization tree, the data of the to-be-preheated node is loaded into the upstream storage of the downstream storage. On the one hand, by loading the data of the to-be-preheated node into the upstream storage (i.e., data preheating), the subsequent data query efficiency can be improved. On the other hand, since the total preheating depth is negatively correlated with the target depth, full data preheating is no longer needed, but a part of the data of the node is selectively loaded into the upstream storage according to the target depth, which can improve the rationality of data preheating, help to balance the cache data volume and query efficiency, and meet the data query demand in actual business.
[0044] In this way, the efficient query of massive organization data can be run on a server cluster with medium configuration, reducing the hardware cost.
[0045] In some embodiments of the present application, the electronic device can be configured with multi-level storage, and the multi-level storage includes at least two types of storage.
[0046] Among them, the most downstream storage can be a persistent database (such as MySQL), used to store the authoritative copy of full data.
[0047] In some embodiments of the present application, the multi-level storage can be three-level storage, including application local memory L1 (such as Caffeine, Guava Cache, etc.), distributed cache L2 (such as Redis Cluster), and persistent database L3 from upstream to downstream.
[0048] When the step-by-step query is performed in step S101, the data of the target node can be queried from the application local memory L1. If the data of the target node exists in the application local memory L1, the result is returned and the query is stopped; if the data of the target node does not exist in the application local memory L1, the data of the target node is queried from the distributed cache L2, if the data of the target node exists in the distributed cache L2, the result is returned and the query is stopped, otherwise the data of the target node is queried from the persistent database L3.
[0049] In some embodiments of the present application, the step-by-step query mechanism in the multi-level storage for the data of the target node pointed by the data query request in the organization tree can include: according to the query code carried by the data query request, the data of the target node is queried step by step in the multi-level storage.
[0050] Wherein, the data of the target node can include: comparing the query code with the node code of each node in the organization tree, and each node code records the path from the root node to the corresponding node.
[0051] Specifically, the information of the nodes in the organization tree can include: node unique identifier (ID), node name, depth, parent node ID, direct child node ID set, and node code. By establishing a bidirectional association based on the parent node ID and the child node ID set, a complete tree topology model can be constructed in the memory, and the organization tree can be formed. At this time, the tree topology model can be converted into a flattened string code.
[0052] For example, the coding rule of the node code is as follows: the root node code is a fixed prefix (such as 0), and the non-root node is coded according to “parent node code-current node in the parent node” from the root node, where “-” represents the path.
[0053] For example, the root node is 0, the 1st child node of the root node is 0-0, the 2nd child node of the root node is 0-1, the 1st child node of the node 0-1 is 0-1-0, and the 3rd child node of the node 0-1 is 0-1-2. In this way, each node code records the path from the root node to the corresponding node.
[0054] At this time, the query code carried by the data query request can be compared with the node code of each node in the organization tree, and the node whose node code matches the query code is taken as the target node to obtain the data of the target node.
[0055] It should be noted that the above data query request can be encapsulated as a unified standardized interface for the business layer to call, so as to simplify the development of the business layer and improve the maintainability and scalability of the code.
[0056] In order to improve security, before querying the data of the target node pointed to by the data query request in the mechanism tree in the multi-level storage, the authority of the user issuing the data query request can be detected and verified, so that authorized users can access the corresponding data.
[0057] In order to avoid malicious attacks, before querying the data of the target node pointed to by the data query request in the mechanism tree in the multi-level storage, the data query request can be token allocated. Specifically, an independent bucket can be created for each tenant (i.e. user), and a certain number of tokens can be configured in the bucket. For each incoming data query request, the tenant to which it belongs is identified, and a "token taking" operation is performed in the token bucket corresponding to the tenant, and the result is used to decide whether to release or limit flow. When there is a token in the token bucket, the data of the target node pointed to by the data query request in the mechanism tree in the multi-level storage is queried, otherwise, it is rejected or waited, so as to avoid exhausting system resources due to a large number of requests from a certain tenant, affecting the normal use of other tenants.
[0058] In order to improve data reliability, during the process of querying the data of the target node pointed to by the data query request in the mechanism tree in the multi-level storage, a distributed lock can be distributed on the data of the target node to prevent cache breakdown and ensure the availability of the cache under high concurrency.
[0059] In some embodiments of the present application, after querying the data of the target node pointed to by the data query request in the mechanism tree in the multi-level storage, the data preheating method further comprises: recording the query frequency of the target node; when the other level storage except the most downstream storage in the multi-level storage is reset, determining the data of the node to be cached for the other level storage according to the query frequency of each node in the mechanism tree; loading the data of the node to be cached into the corresponding other level storage.
[0060] Specifically, when the other level storage except the most downstream storage in the multi-level storage is reset, the initial data needs to be reloaded for the other level storage except the most downstream storage. The initial data can be determined according to the query frequency of each node in the mechanism tree.
[0061] Specifically, the application local memory L1 can store data of leaf nodes or middle layer nodes with high frequency of access (query frequency greater than a first threshold). The distributed cache L2 can store metadata (including but not limited to unique identifier ID, name, parent ID, child ID set, node code, depth) and data of a large number of nodes of the full-amount organization tree, where the nodes can be nodes with query frequency less than the first threshold and greater than a second threshold. Thus, in the process of querying data, the corresponding result can be queried in the application local memory L1 or the distributed cache L2 in most cases.
[0062] In some embodiments of the present application, determining the nodes to be preheated in the organization tree according to the total preheating depth can include: determining a preheating depth according to the depth of the target node and the total preheating depth; and taking the target node and the nodes belonging to the preheating depth among all descendant nodes of the target node in the organization tree as the nodes to be preheated.
[0063] Specifically, the preheating depth refers to the depth of the nodes that need to be preheated. According to the depth of the target node and the total preheating depth, the preheating depth can be determined as each depth in the range from the depth of the target node to the sum of the depth of the target node and the total preheating depth. For example, please refer to Figure 2 When the depth of the target node is 2 and the total preheating depth is 4, the preheating depth is 2, 3, 4, 5, and 6. At this time, the target node and all descendant nodes of the target node with depth 3, 4, 5, and 6 can be taken as the nodes to be preheated.
[0064] It should be noted that the nodes to be preheated can also be searched based on the node code. For each node, ancestor determination can be performed, and the ancestor node of each node is the prefix of the node code of the node. For example, node 0-1 is the ancestor of 0-1-2. The depth of each node is the number of separators “-” in the code. For example, the depth of node 0-1-2 is 2. The node codes of the sibling nodes of each node have the same length and only differ in the last index (such as 0-1-0, 0-1-1, and 0-1-2). In this way, in the scenario where the maximum depth D of the organization tree is fixed (such as D≤15) and much smaller than the total number of nodes N: the ancestor and descendant relationship determination is completed through one-time string prefix matching, the time complexity is O(D), the actual efficiency tends to O(1), and the performance is significantly improved compared with the time complexity O(N) of recursive query and the time complexity O(N 2
[0065] Also, as mentioned above, the preheat total depth is negatively correlated with the target depth, which means the deeper the depth, the closer the preheated descendant node is to the target node. On one hand, in the business scenario, users usually need to perform continuous query operations. When the first data query operation comes, the target node and the adjacent descendant nodes are taken as the preheat nodes, and the subsequent query operations are usually query operations for the nodes related to the target nodes. Therefore, after data preheating, the query efficiency of the subsequent query operations is improved. On the other hand, deep nodes are usually accessed only by specific users, and the access is usually limited to the direct child nodes or a few layers. For example, a user may only care about the direct child nodes of a deep node, but not continue to explore downward. Therefore, preheating less layers of data for deep nodes is enough to cover most access scenarios, and can reduce the data storage pressure.
[0066] Please refer to Figure 3 After the gateway receives the data query request, it can detect whether the data of the target node exists in the application local memory L1. If a hit is made in the application local memory L1, the result is returned, otherwise, whether the data of the target node exists in the distributed cache L2 is detected. If a hit is made in the distributed cache L2, data preheating can be performed, the data of the preheat node is loaded into the application local memory L1, and the result is returned, otherwise, the result is queried in the database, the data of the preheat node is loaded into the application local memory L1 and / or the distributed cache L2, and the result is returned.
[0067] In some embodiments of the present application, the data preheating method can further include: in response to the addition and deletion operation of the node, updating the most downstream storage in the multi-level storage, and re-determining the node coding of each node in the structure tree; if the node coding of other nodes except the newly added node and / or the deleted node changes, clearing the cached data of the nodes whose node coding changes in the storage other than the most downstream storage.
[0068] Specifically, the electronic device can capture the institutional data change events (including but not limited to addition, deletion, and update) in the database transaction log in real time through the log listener. If it is an addition and deletion operation of the node, the most downstream storage (database) needs to be updated, and the change event is broadcasted through the message queue. The nodes are added or removed in the institutional tree model according to the addition and deletion operation, and the child node set of the parent node is updated accordingly. At this time, the node coding of each node in the structure tree needs to be re-determined. If the node coding of other nodes does not change, it means that the preheated data in the original upstream storage is available, and no processing is needed. If the node coding of other nodes changes, the cached data of the nodes whose node coding changes can be cleared in the storage other than the most downstream storage, so that the cache items of the changed nodes are invalidated.
[0069] In some embodiments of the present application, when the insert operation is an add operation, the data preheating method can further include: determining the to-be-preheated node corresponding to the added node, and loading the data of the to-be-preheated node corresponding to the added node into the upstream storage of the downstream storage.
[0070] Specifically, for the added node, the total preheating depth can be determined according to the depth thereof, and the to-be-preheated node corresponding to the added node can be determined in the organization tree according to the total preheating depth. The specific manner can refer to the manner of determining the to-be-preheated node corresponding to the target node. Subsequently, loading the data of the to-be-preheated node corresponding to the added node into the upstream storage of the downstream storage can complete the data preheating for the added node.
[0071] In some embodiments of the present application, the data preheating method can further include: in response to a data update operation on a node, if the cached data of the to-be-updated node pointed to by the data update operation is cleared in the other level storage except the most downstream storage in the multi-level storage; modifying the data of the to-be-updated node in the most downstream storage.
[0072] Specifically, when the data update operation on the node is received, the database can be updated, the change event can be broadcasted through the message queue, the old data cache of the node in the upstream storage can be cleared, the old data of the node in the upstream storage can be invalidated, and the next time the node is queried, the data preheating can be triggered to obtain the new data.
[0073] Thus, based on the database log monitoring and the accurate cache invalidation and incremental preheating mechanism, the consistency of the cache data at each level after the data change is ensured.
[0074] In some embodiments of the present application, if it is detected that any service fails, the connection with the service can be quickly cut off to prevent the failure from spreading, thereby improving the stability and reliability of the system.
[0075] It should be noted that, for the foregoing method embodiments, in order to simply describe, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited by the action order described, because according to the present application, certain steps can be performed in other orders.
[0076] As Figure 4 Fig. 4 shows a structural schematic diagram of a data preheating apparatus 400 provided by an embodiment of the present application, which is configured on an electronic device.
[0077] Specifically, the data preheating apparatus 400 can include:
[0078] The data query unit 401 is configured to, in response to a data query request, query the data of a target node pointed to by the data query request in the organization tree in the multi-level storage level by level.
[0079] a depth determination unit 402, configured to determine a total preheating depth according to a target depth of the target node in the organization tree, the total preheating depth being negatively correlated with the target depth, if the data of the target node is found in a downstream storage in the multi-level storage;
[0080] a node determination unit 403, configured to determine a to-be-preheated node in the organization tree according to the total preheating depth;
[0081] a data preheating unit 404, configured to load data of the to-be-preheated node into an upstream storage of the downstream storage.
[0082] In some embodiments of the present application, the node determination unit 403 can be specifically configured to: determine a preheating depth according to the depth of the target node and the total preheating depth; and determine the target node and nodes belonging to the preheating depth among all descendant nodes of the target node in the organization tree as the to-be-preheated node.
[0083] In some embodiments of the present application, the data query unit 401 can be specifically configured to: query the data of the target node in the multi-level storage level by level according to a query code carried by the data query request; and compare the query code with node codes of each node in the organization tree, each node code recording a path from a root node to a corresponding node.
[0084] In some embodiments of the present application, the data preheating apparatus 400 can comprise a node changing unit, configured to: in response to an adding or deleting operation on a node, update a most downstream storage in the multi-level storage and re-determine node codes of nodes in the organization tree; and if a node code of a node other than a newly-added node and / or a deleted node changes, clear cached data of the node whose node code changes in a storage other than the most downstream storage.
[0085] In some embodiments of the present application, the node changing unit can be further configured to: determine a to-be-preheated node corresponding to the newly-added node; and load data of the to-be-preheated node corresponding to the newly-added node into an upstream storage of the downstream storage.
[0086] In some embodiments of the present application, the node changing unit can be further configured to: in response to a data updating operation on a node, clear cached data of a to-be-updated node pointed by the data updating operation in a storage other than the most downstream storage in the multi-level storage; and modify data of the to-be-updated node in the most downstream storage.
[0087] In some embodiments of the present application, the data pre-warming apparatus 400 can comprise an initialization unit configured to: record the query frequency of the target node; when the other level storage except the most downstream storage in the multi-level storage is reset, determine the data of the node to be cached in the other level storage according to the query frequency of each node in the structure tree; and load the data of the node to be cached into the corresponding other level storage.
[0088] It should be noted that, for the convenience and brevity of description, the specific working process of the above data pre-warming apparatus 400 can be referred to Figures 1 to 3 the corresponding process of the method, which will not be repeated here.
[0089] As Figure 5 shown, an electronic device provided by an embodiment of the present application is shown. Specifically, the electronic device 5 can comprise a processor 50, a memory 51, and a computer program 52 stored in the memory 51 and executable on the processor 50, such as a data pre-warming program. The processor 50 implements the steps in each of the above data pre-warming method embodiments when executing the computer program 52, such as Figure 1 steps S101-S104. Alternatively, the processor 50 implements the functions of each module / unit in each of the above apparatus embodiments when executing the computer program 52, such as Figure 4 the functions of the data query unit 401, the depth determination unit 402, the node determination unit 403, and the data pre-warming unit 404.
[0090] The computer program can be divided into one or more modules / units, which are stored in the memory 51 and executed by the processor 50 to complete the present application. The one or more modules / units can be a series of computer program instruction segments capable of completing a specific function, which are used to describe the execution process of the computer program in the electronic device.
[0091] For example, the computer program can be divided into: a data query unit, a depth determination unit, a node determination unit, and a data pre-warming unit. The specific functions of each unit are as follows: the data query unit is configured to query the data of the target node pointed to by a data query request in the structure tree in the multi-level storage level by level in response to the data query request; the depth determination unit is configured to determine a pre-warming total depth according to the target depth of the target node in the structure tree if the data of the target node is queried in the downstream storage in the multi-level storage, the pre-warming total depth being negatively correlated with the target depth; the node determination unit is configured to determine a node to be pre-warmed in the structure tree according to the pre-warming total depth; and the data pre-warming unit is configured to load the data of the node to be pre-warmed into the upstream storage of the downstream storage.
[0092] The electronic device can include, but is not limited to, a processor 50, a memory 51. Those skilled in the art can understand that, Figure 5 The electronic device is only an example and does not constitute a limitation on the electronic device, and can include more or fewer components than the diagram, or combine certain components, or different components, for example, the electronic device can also include an input / output device, a network access device, a bus, etc.
[0093] The processor 50 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), ready programmable gate arrays or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.
[0094] The memory 51 can be an internal storage unit of the electronic device, such as a hard disk or a memory of the electronic device. The memory 51 can also be an external storage device of the electronic device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Further, the memory 51 can include both the internal storage unit and the external storage device of the electronic device. The memory 51 is used to store the computer program and other programs and data required by the electronic device. The memory 51 can also be used to temporarily store data that has been output or will be output.
[0095] It should be noted that for the convenience and brevity of description, the structure of the above electronic device can also refer to the specific description of the structure in the method embodiment, which will not be repeated here.
[0096] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of each functional unit and module is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be realized in the form of hardware or software. In addition, the specific names of each functional unit and module are only for easy distinction, and do not limit the protection scope of the present application. The specific working process of the units and modules in the above system can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.
[0097] In the above embodiments, the description of each embodiment has its own emphasis, and the parts not described or recorded in detail in a certain embodiment can be referred to the related description of other embodiments.
[0098] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0099] In the embodiments provided in the present application, it should be understood that the disclosed devices / equipment and methods can be implemented in other ways. For example, the device / equipment embodiments described above are only schematic, for example, the division of the modules or units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the shown or discussed mutual units can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0100] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
[0101] In addition, each of the function units in each of the embodiments of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software function unit.
[0102] The integrated module / unit, if realized in the form of a software function unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above-mentioned embodiment methods can also be completed by a computer program instructing related hardware, and the computer program can be stored in a computer-readable storage medium. When the processor executes the computer program, the steps of each method embodiment described above can be implemented. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or some intermediate forms, etc. The computer-readable medium can include any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content included in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.
[0103] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. A data pre-warming method, characterized by, The method comprises: in response to a data query request, querying data of a target node in an organization tree to which the data query request points in a multi-level storage step by step; if the data of the target node is queried in a downstream storage in the multi-level storage, determining a preheating total depth according to a target depth of the target node in the organization tree, the preheating total depth being negatively correlated with the target depth; determining a node to be preheated in the organization tree according to the preheating total depth; loading data of the node to be preheated into an upstream storage of the downstream storage.
2. The data warm-up method of claim 1, wherein, The determining a node to be preheated in the organization tree according to the preheating total depth comprises: determining a preheating depth according to the depth of the target node and the preheating total depth; taking the target node and a node belonging to the preheating depth among all descendant nodes of the target node in the organization tree as the node to be preheated.
3. The data warm-up method of claim 1, wherein, The querying data of the target node in the organization tree to which the data query request points in the multi-level storage step by step comprises: querying the data of the target node in the multi-level storage step by step according to a query code carried by the data query request; the querying the data of the target node comprises: comparing the query code with a node code of each node in the organization tree, each node code recording a path from a root node to a corresponding node.
4. The data warm-up method of claim 3, wherein, The method further comprises: in response to an adding or deleting operation on a node, updating a most downstream storage in the multi-level storage and re-determining a node code of each node in the organization tree; if a node code of a node other than a newly added node and / or a deleted node changes, clearing cached data of the node whose node code changes in a storage other than the most downstream storage.
5. The data warm-up method of claim 4, wherein, When the adding or deleting operation is an adding operation, the method further comprises: determining a node to be preheated corresponding to the newly added node; loading data of the node to be preheated corresponding to the newly added node into an upstream storage of the downstream storage.
6. The data warm-up method of any of claims 1-5, wherein, The method further comprises: in response to a data updating operation on a node, if cached data of a node to be updated pointed by the data updating operation is cleared in a storage other than the most downstream storage in the multi-level storage; modifying data of the node to be updated in the most downstream storage.
7. The data warm-up method of any of claims 1-5, wherein, After the querying data of the target node in the organization tree to which the data query request points in the multi-level storage step by step, the method further comprises: recording a query frequency of the target node; when a storage other than the most downstream storage in the multi-level storage is reset, determining data of a node to be cached in the storage according to the query frequency of each node in the organization tree; loading the data of the node to be cached into the corresponding storage.
8. A data warming device, characterized by, The method comprises: a data query unit, configured to query data of a target node in an organization tree to which a data query request points in a multi-level storage step by step in response to the data query request. a depth determining unit, configured to determine a total preheat depth according to a target depth of the target node in the organization tree, if data of the target node is found in a downstream storage in the multi-level storage, the total preheat depth being negatively related to the target depth; a node determining unit, configured to determine a node to be preheated in the organization tree according to the total preheat depth; a data preheating unit, configured to load data of the node to be preheated to an upstream storage of the downstream storage.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor implements the steps of the data preheating method according to any one of claims 1 to 7 when executing the computer program.
10. A computer program product, characterised in that, The computer program is run to cause the data preheating method according to any one of claims 1 to 7 to be executed.