Storage position determination method and device, equipment, storage medium and program product
By adjusting the number of data layers and partitioning data according to business scenarios in the cardinal tree, the problems of large memory footprint and low data access performance caused by the depth of the cardinal tree structure are solved, and more efficient storage performance is achieved.
Patent Information
- Application Number
- CN202411135299.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-19
- Publication Date
- 2025-01-03
AI Technical Summary
In traditional data storage technology, the increase in the depth of the cardinal tree structure leads to a large memory footprint, affects storage performance, and low data access performance.
By determining the number of layers of data layers in the cardinal tree according to the business scenario, and dividing the integer data, quickly and accurately determine the storage location, avoiding the cardinal tree structure with excessive depth, and improving storage performance.
It effectively improves the storage performance of the storage system, reduces memory usage, and improves data access efficiency.
Smart Images

Figure CN119248176A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data storage, and in particular to a storage location determination method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] As people's demand for data continues to grow, the development of storage technology and hardware technology has also changed with each passing day. Traditional data storage technology has become increasingly unable to meet people's needs. Therefore, how to continuously break the bottleneck of storage performance and have better storage performance is an urgent problem to be solved in today's rapidly developing big data environment. Cache is an indispensable part of the flash storage system. Combined with the corresponding business processes, the design of a better cache storage structure can further shorten the overall I / O process, reduce the system load, and thus improve the overall performance of the storage system.
[0003] In traditional technology, a tree structure is used to manage stored data. However, the more data is stored, the deeper the tree structure is, which occupies a large amount of memory, thereby affecting the storage performance of the storage system. Summary of the invention
[0004] Based on this, it is necessary to provide a storage location determination method, apparatus, computer device, computer-readable storage medium and computer program product that can improve the storage performance of a storage system in response to the above technical problems.
[0005] In a first aspect, the present application provides a method for determining a storage location. The method comprises:
[0006] In the process of determining the storage location of the target Value corresponding to the target Key in the radix tree, obtaining the integer data corresponding to the target Key;
[0007] According to the current business scenario, determine the number of layers of the multiple data layers included in the radix tree;
[0008] The integer data is divided according to the number of layers to obtain division results corresponding to each data layer, and the storage location is determined according to each division result.
[0009] In one embodiment, the multiple data layers include a leaf node layer and multiple other node layers, and determining the storage location according to each of the division results includes:
[0010] For the leaf node layer, according to the division result corresponding to the leaf node layer, determine the slot identifier corresponding to the target Key in the leaf node layer;
[0011] For each of the other node layers, determine the pointer information corresponding to the target Key in the other node layer according to the division result corresponding to the other node layer;
[0012] The storage location is determined according to each of the pointer information and the slot identifier.
[0013] In one embodiment, determining the storage location according to each of the pointer information and the slot identifier includes:
[0014] Determine the target node corresponding to the target Key in each of the other node layers according to each of the pointer information;
[0015] The storage location is determined according to each of the target nodes and the slot identifiers.
[0016] In one embodiment, the multiple other node layers include a root node layer and a non-leaf node layer, the root node layer includes a root node, and determining the target node corresponding to the target Key in each of the other node layers according to each of the pointer information includes:
[0017] According to the pointer information corresponding to the target Key in the root node layer, determine the target non-leaf node corresponding to the target Key in the non-leaf node layer under the root node;
[0018] The root node and the target non-leaf node are determined as a plurality of target nodes.
[0019] In one embodiment, determining the storage location according to each of the target nodes and the slot identifiers includes:
[0020] According to the pointer information corresponding to the target Key at the non-leaf node layer, determine the target leaf node corresponding to the target Key from the multiple leaf nodes under the target non-leaf node;
[0021] According to the slot identifier, the target slot corresponding to the target Key is determined in the target leaf node, and the target slot is determined as the storage location.
[0022] In one embodiment, the method further comprises:
[0023] Obtaining page frame information corresponding to each leaf node in the leaf node layer of the radix tree, wherein the page frame information includes a leaf node pointer, a number of visits to the leaf node, linked list structure information, and leaf node elimination control information;
[0024] According to the number of accesses and a preset number threshold, the leaf node pointer is added to the active linked list or the inactive linked list corresponding to the linked list structure information, and the leaf node elimination control information is updated. The leaf node elimination control information is used to represent the position of the leaf node pointer in the active linked list or the position in the inactive linked list.
[0025] In one embodiment, adding the leaf node pointer to an active linked list or an inactive linked list corresponding to the linked list structure information according to the access count and a preset count threshold includes:
[0026] If the number of visits to the leaf node is greater than the number threshold, adding the leaf node pointer corresponding to the leaf node to the active linked list;
[0027] If the number of visits to the leaf node is less than the number threshold, the leaf node pointer corresponding to the leaf node is added to the inactive linked list.
[0028] In one embodiment, the page frame information also includes the length of the inactive linked list, and the method further includes:
[0029] When the length of the linked list is greater than a preset length threshold, the tail leaf node pointer in the inactive linked list is deleted, and the Value in the leaf node corresponding to the tail leaf node pointer is deleted.
[0030] In a second aspect, the present application further provides a storage location determination device. The device comprises:
[0031] A first acquisition module, used to acquire the integer data corresponding to the target Key in the process of determining the storage location of the target Value corresponding to the target Key in the radix tree;
[0032] A first determination module, used to determine the number of layers of the multiple data layers included in the radix tree according to the current business scenario;
[0033] The second determination module is used to divide the integer data according to the number of layers, obtain the division results corresponding to each data layer, and determine the storage location according to each division result.
[0034] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the method described in the first aspect are implemented.
[0035] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.
[0036] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.
[0037] In the above-mentioned storage location determination method, device, computer equipment, computer-readable storage medium and computer program product, in the process of determining the storage location of the target Value corresponding to the target Key in the radix tree, first, the server obtains the integer data corresponding to the target Key, then, according to the current business scenario, determines the number of layers of the multiple data layers included in the radix tree, and then divides the integer data according to the number of layers to obtain the division results corresponding to each data layer, and determines the storage location according to each division result. Since the number of layers of the data layer of the radix tree is determined by the business scenario, the depth of the radix tree can be specified according to the business scenario, thereby avoiding the problem of the radix tree being too deep, occupying too much memory, and resulting in low data access performance. Moreover, after the integer data is divided according to the number of layers, the division results can be determined as the storage location corresponding to each data layer, so that the storage location can be determined quickly and accurately, thereby improving the efficiency of determining the storage location in the radix tree and improving the storage performance of the storage system. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0039] FIG1-a is a schematic diagram of a classic radix tree in one embodiment;
[0040] FIG1-b is a schematic diagram of a linear hash structure in one embodiment;
[0041] Figure 1-c is a schematic diagram of a chain hash structure in one embodiment;
[0042] FIG2 is a schematic diagram of a flow chart of a method for determining a storage location in one embodiment;
[0043] FIG3 is a schematic diagram of a flow chart of step 203 in one embodiment;
[0044] FIG4 is a schematic diagram of a flow chart of step 303 in one embodiment;
[0045] FIG5 is a schematic diagram of a flow chart of step 401 in one embodiment;
[0046] FIG6 is a schematic diagram of a flow chart of step 402 in one embodiment;
[0047] FIG7 is a schematic diagram of determining a storage location in a radix tree in one embodiment;
[0048] FIG8 is a schematic flow chart of a storage location determination method in another embodiment;
[0049] FIG9 is a schematic diagram of an active linked list and an inactive linked list in one embodiment;
[0050] FIG10 is a schematic diagram of a flow chart of a method for determining a storage location in one embodiment;
[0051] FIG11 is a structural block diagram of a storage location determination device in one embodiment;
[0052] FIG. 12 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction 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 are not used to limit the present application.
[0054] In data storage, the classic radix tree is one of the main forms of traditional cache data storage structure, as shown in Figure 1-a. Its main components include root nodes, non-leaf nodes and leaf nodes. In the page cache, the memory page is managed as a leaf node, where the number of slots for each non-leaf node and leaf node is a fixed value. When storing data, it is necessary to divide the key to be stored into several parts according to the number of slots, and then determine the storage location in the radix tree according to the values of each divided part, so as to store the value corresponding to the key in the radix tree. Under the same data level, the hit rate of data query of the classic radix tree is higher, and when the memory is large enough, the full amount of data can be cached. Therefore, the classic radix tree is mainly used in scenarios with high hit rate requirements and full data cache. However, the management structure of the classic radix tree needs to occupy a large memory space. The more data is cached and the deeper the tree is, the more memory space the management structure occupies. Secondly, as the depth of the tree increases, the data access performance will become lower and lower. Thirdly, since there are memory address jumps when accessing data in the classic radix tree, it is difficult to use the data prefetching function of the CPU cache. Therefore, when using the classic radix tree for data storage, it will affect the overall performance of the storage system.
[0055] Linear hashing is also a widely used data storage structure, as shown in Figure 1-b. This data storage structure uses a hash algorithm to hash data in the memory space and insert conflicting data backwards into free slots. This method can not only quickly locate the location of the data, but also because the data is stored continuously, it can take advantage of the data pre-fetching function of the CPU cache. However, in the scenario of deleting data, additional data write operations will be caused due to the need for data migration, and some memory fragments will be difficult to use.
[0056] Based on the above hash structure, there is also a chain structure, as shown in Figure 1-c. When there is a conflict between data, a linked list node is requested and the data is stored in the linked list. However, this data storage structure requires the introduction of a linked list management structure, and in the scenarios of data insertion and data deletion, the linked list pointer needs to be modified, resulting in additional write operations.
[0057] Therefore, there is a problem in the conventional technology that the data storage structure occupies a large amount of memory, which affects the storage performance of the storage system. Based on this, the present application provides a storage location determination method to improve the storage performance of the storage system. It should be noted that the storage location determination method provided by the present application can be applied to application scenarios such as data writing, data reading, data deletion, and data modification.
[0058] In one embodiment, as shown in FIG. 2 , a storage location determination method is provided. This embodiment is illustrated by applying the method to a server. In this embodiment, the method includes the following steps:
[0059] Step 201, in the process of determining the storage location of the target Value corresponding to the target Key in the radix tree, obtain the integer data corresponding to the target Key.
[0060] Among them, the radix tree is a tree with a binary bit string as a keyword. It is a multi-branch tree structure and is similar to a multi-layer index table. Each non-leaf node contains an array of pointers to multiple leaf nodes, and the leaf node contains a pointer to the actual object. It should be noted that the embodiment of the present application is based on the multi-level structure of the classic radix tree and proposes a data storage structure to solve the problem of large memory usage and low data access performance of the classic radix tree.
[0061] The target Key refers to the Key in the Key-Value to be stored, and the storage location of the corresponding target Value in the radix tree can be determined according to the target Key. It should be noted that the Key is usually a set of strings, but the storage location is integer data. Therefore, when determining the storage location in the radix tree according to the Key, the Key needs to be converted into integer data, and then the storage location is determined according to the integer data. Among them, the integer data is a set of binary data.
[0062] It should be noted that in the application scenarios of data writing, data reading, data modification and data deletion, the process of determining the storage location of the target Value corresponding to the target Key is involved. In the embodiment of the present application, the process of the storage location determination method provided in the present application can be described in detail by taking the application scenario of data storage as an example.
[0063] Optionally, in this embodiment, the server may receive a data storage request sent by other computer devices, obtain the Key-Value to be stored from the data storage request, and then serialize the Key to obtain the integer data corresponding to the Key; or the server may also receive data storage information triggered by the user, and then obtain the Key-Value to be stored from the external memory, and serialize the Key to obtain the integer data corresponding to the Key. During the serialization process, a serialization algorithm may be used to convert the Key in string form into data in integer form.
[0064] Step 202: Determine the number of layers of the multiple data layers included in the radix tree according to the current business scenario.
[0065] It is understandable that in different business scenarios, the memory size allocated by the radix tree is different. Therefore, the number of data layers included in the radix tree is also different. The radix tree can include multiple data layers, for example, a root node layer, a non-leaf node layer, and a leaf node layer.
[0066] In this embodiment, the server can determine the memory size occupied by the radix tree according to the memory size corresponding to the current business scenario, and thus determine the number of data layers included in the radix tree according to the memory size. For example, if the memory size is 256M, it can be determined that the number of data layers included in the radix tree is 3 layers, and if the memory size is 1024M, it can be determined that the number of data layers included in the radix tree is 5 layers.
[0067] Step 203, divide the integer data according to the number of layers, obtain the division results corresponding to each data layer, and determine the storage location according to each division result.
[0068] Among them, the partition result refers to the division of the integer data into several sub-data, each sub-data can be used as the partition result corresponding to each data layer, and the storage position refers to the storage position of the target Value corresponding to the target Key in the bottom layer of the radix tree. It can be understood that the storage position of the target Value needs to be determined according to the integer data corresponding to the target Key, and the corresponding position of each data layer of the radix tree except the bottom layer is determined in sequence. It should be noted that in the partition results obtained by data partitioning, each partition result corresponds to each data layer from top to bottom in the radix tree in sequence. For example, the first partition result corresponds to the topmost data layer, and the last partition result corresponds to the bottommost data layer.
[0069] For example, if the integer data includes 10 binary numbers and the number of layers is 4, the integer data can be divided into 4 division results, each of which can be 2 binary numbers, 2 binary numbers, 2 binary numbers, and 4 binary numbers respectively; or, each division result can also be 1 binary number, 1 binary number, 3 binary numbers, and 5 binary numbers.
[0070] In this embodiment, the server can divide the integer data into several sub-data according to the number of layers, determine each sub-data as the division result corresponding to each data layer, and then determine the corresponding numerical value according to each division result, and use the numerical value to determine the position of the target Key in the data to be stored in the data layers other than the bottom layer of the radix tree, thereby determining the storage position of the target Value in the last data layer of the radix tree according to the position of other data layers.
[0071] In the above storage location determination method, in the process of determining the storage location of the target Value corresponding to the target Key in the radix tree, first, the server obtains the integer data corresponding to the target Key, then, according to the current business scenario, determines the number of layers of the multiple data layers included in the radix tree, and then divides the integer data according to the number of layers to obtain the division results corresponding to each data layer, and determines the storage location according to each division result. Since the number of layers of the data layer of the radix tree is determined by the business scenario, the depth of the radix tree can be specified according to the business scenario, thereby avoiding the problem of the radix tree being too deep, occupying too much memory, and resulting in low data access performance. Moreover, after the integer data is divided according to the number of layers, the division results can be determined as the storage location corresponding to each data layer, so that the storage location can be determined quickly and accurately, thereby improving the efficiency of determining the storage location in the radix tree and improving the storage performance of the storage system.
[0072] Based on the embodiment shown in FIG2 , referring to FIG3 , the multiple data layers may include a leaf node layer and multiple other node layers. This embodiment relates to the process of how the server determines the storage location according to each division result. As shown in FIG3 , step 203 may include steps 301 to 303 shown in FIG3 .
[0073] Step 301, for the leaf node layer, according to the division result corresponding to the leaf node layer, determine the slot identifier corresponding to the target Key in the leaf node layer.
[0074] Among them, the leaf node layer refers to the bottom data layer in the radix tree. The leaf node layer may include one or more leaf nodes, each leaf node corresponds to an upper node, and there is no lower node. In each leaf node, there are multiple slots, each slot is used to store Value, and each slot corresponds to a slot identifier that represents the position of the slot. Usually, the leaf nodes in the leaf node layer can be in the form of a data page, and multiple storage units can be divided in the data page. Each storage unit is a slot, and the slot identifier of each slot can be the storage address of the storage unit. For example, if the storage address is represented by a 3-bit binary number, the range of the slot identifier in a leaf node is array [0]-[7].
[0075] In this embodiment, for the leaf node layer, the server can determine the last division result as the division result corresponding to the leaf node layer, and then perform numerical conversion on the division result to obtain the corresponding decimal number, and determine the slot identifier for storing the Value in the leaf node layer based on the decimal number.
[0076] For example, if each leaf node includes 10 slots, and the slot corresponding to the target Key determined by the server in the leaf node layer is identified as array [8], then it can be determined that the Value is stored in the storage position of array [8] of a leaf node in the leaf node layer.
[0077] Step 302: for each other node layer, according to the division results corresponding to the other node layers, determine the pointer information corresponding to the target Key in the other node layers.
[0078] Among them, the other node layer refers to the data layer in the radix tree except the leaf node layer. In each other node layer, there may be one or more other nodes, and each other node corresponds to one or more nodes in the next layer. In each other node, there are multiple slots, each slot is used to store pointer information pointing to the node of the next layer, and the pointer information is used to point to the node storing the pointer information in the next layer of other node layer, wherein the pointer information may include the pointer stored in the other node, and may also include the number of all slots in the other node.
[0079] In this embodiment, for each other node layer, the server can determine the other division results except the last division result as the division results corresponding to the other node layers, and then perform numerical conversion on each other division result to obtain the corresponding decimal number, and determine the pointer information stored in each other node layer according to each decimal number.
[0080] Step 303: Determine the storage location according to each pointer information and slot identifier.
[0081] In this embodiment, the server can determine the corresponding storage position of the data to be stored in each other node layer in the radix tree based on each pointer information, and then determine the position of storing the target Value in the leaf node, that is, the storage position, based on the corresponding storage position in each other node layer and the corresponding slot identifier of the data to be stored in the leaf node layer in the radix tree.
[0082] In this embodiment, first, for the leaf node layer, the server can determine the slot identifier corresponding to the target Key in the leaf node layer according to the division results corresponding to the leaf node layer. Then, for each other node layer, the server can determine the pointer information corresponding to the target Key in other node layers according to the division results corresponding to the other node layers. Since the process of determining the slot identifier and pointer information according to the division results is relatively simple, the server can then quickly determine the storage location according to each pointer information and slot identifier, thereby improving the efficiency of determining the storage location during data storage and improving the storage performance of the storage system.
[0083] Based on the embodiment shown in Figure 3, referring to Figure 4, this embodiment relates to the process of how the server determines the storage location according to each pointer information and slot identifier. Step 303 may include steps 401 and 402 shown in Figure 4.
[0084] Step 401, according to each pointer information, determine the target node corresponding to the target Key in each other node layer.
[0085] The target node refers to the storage location of the decimal number used to store the integer data corresponding to the target key in each other node layer. It should be noted that each pointer information can be used to represent the target storage location of the next node layer, and the target storage location in each other node layer is the target node. For example, if the pointer information stored in a slot in a certain node layer is an array [5], it means that the storage node of the next layer is the 5th node among the multiple nodes under the node.
[0086] In this embodiment, for each pointer information, the server can determine other nodes related to the target Key in other node layers of the next layer pointed to by the pointer information, and then determine the other nodes as the target nodes in the next layer, thereby determining the next layer nodes pointed to by each pointer information as the target nodes corresponding to the target Key in the radix tree.
[0087] Step 402, determining the storage location according to each target node and slot identifier.
[0088] In this embodiment, the server can determine the storage location corresponding to the target Key in each other node layer based on each target node, and then determine the multiple leaf nodes under the target node of the second-to-last layer based on the storage location, and then determine the leaf node where the slot identifier is located based on the multiple leaf nodes and slot identifiers, and then determine the storage location of the target Value.
[0089] In this embodiment, the server can quickly determine the target node corresponding to the target Key in each other node layer based on the pointer information, and then quickly determine the storage location of the target Value based on each target node and slot identifier, thereby improving the efficiency of determining the storage location of the target Value in the radix tree.
[0090] Based on the embodiment shown in FIG4 , referring to FIG5 , multiple other node layers include a root node layer and a non-leaf node layer, and the root node layer includes a root node. This embodiment involves how the server determines the target node corresponding to the target Key in each other node layer according to each pointer information. Step 401 may include steps 501 and 502 shown in FIG5 .
[0091] Step 501, according to the pointer information corresponding to the target Key in the root node layer, determine the target non-leaf node corresponding to the target Key in the non-leaf node layer under the root node.
[0092] It should be noted that, in a radix tree, there is usually a root node and one or more non-leaf nodes. In this embodiment, multiple other node layers may include a root node layer and a non-leaf node layer, and the root node layer includes a root node. Therefore, the root node is the target node corresponding to the root node layer, and the root node stores a pointer to the target non-leaf node in the next non-leaf node layer. Among them, the target non-leaf node refers to the corresponding target node in each non-leaf node layer.
[0093] In this embodiment, the server can determine the target node in the next non-leaf node layer according to the pointer information stored in the root node layer, and then determine the target node in the next non-leaf node layer according to the pointer information stored in the target node, thereby determining the target nodes in multiple non-leaf node layers as target non-leaf nodes. Exemplarily, if the radix tree has four layers, the server can determine the first target node in the first non-leaf node layer according to the pointer information stored in the root node layer, and then determine the second target node in the second non-leaf node layer according to the pointer information stored in the first target node, thereby determining the first target node and the second target node as target non-leaf nodes.
[0094] Step 502: determine the root node and the target non-leaf node as multiple target nodes.
[0095] In this embodiment, the server can jointly determine the root node and the target non-leaf node as multiple target nodes. For example, if there are multiple target non-leaf nodes, the target node includes a root node and multiple target non-leaf nodes; if there is one target non-leaf node, the target node includes a root node and a target non-leaf node.
[0096] In this embodiment, the server determines the target non-leaf node corresponding to the target Key in the non-leaf node layer under the root node based on the pointer information corresponding to the target Key in the root node layer. Since the target non-leaf node can be quickly and accurately determined based on the pointer information, the root node and the target non-leaf node can be quickly determined as multiple target nodes, thereby improving the efficiency and accuracy of determining the target node.
[0097] Based on the embodiment shown in Figure 5, referring to Figure 6, this embodiment relates to a process of how the server determines a storage location according to each target node and slot identifier. Step 402 may include steps 601 and 602 shown in Figure 6.
[0098] Step 601, based on the pointer information corresponding to the target Key at the non-leaf node layer, determine the target leaf node corresponding to the target Key from multiple leaf nodes under the target non-leaf node.
[0099] The target leaf node refers to the target node in the leaf node layer, that is, the node used to store the target Value. It is understandable that the last non-leaf node layer may include multiple leaf nodes, wherein the pointer information stored in the target non-leaf node may include a pointer to the target leaf node and the number of leaf nodes under the target non-leaf node.
[0100] In this embodiment, the server can determine the leaf node pointed to by the pointer information among the multiple leaf nodes under the target non-leaf node based on the pointer information corresponding to the non-leaf node layer, thereby determining the leaf node pointed to by the pointer information as the target leaf node.
[0101] Exemplarily, if the non-leaf node layer includes two layers, the server can obtain first pointer information from the first target non-leaf node of the first non-leaf node layer, and determine the second target non-leaf node of the second non-leaf node layer based on the first pointer information, and then obtain second pointer information from the second target non-leaf node, and determine the target leaf node from the multiple leaf nodes under the second non-leaf node layer based on the second pointer information.
[0102] Step 602, according to the slot identifier, determine the target slot corresponding to the target Key in the target leaf node, and determine the target slot as the storage location.
[0103] Among them, the target slot refers to the storage unit in the target leaf node for storing the Value. Optionally, the storage capacity of the storage unit corresponding to the target slot can be 1 byte, or it can be 3 bytes, which is not limited in this embodiment.
[0104] As a possible implementation, the capacity of the storage space corresponding to the leaf node can be determined in advance according to the business scenario, and then the number of corresponding storage units in the leaf node can be determined according to the business scenario, thereby determining the storage capacity of each storage unit.
[0105] In this embodiment, the server can determine the storage location in the target leaf node based on the slot identifier, and then determine the storage unit corresponding to the storage location as the target slot corresponding to the target Key, and then determine the target slot as the storage location for storing the target Value.
[0106] Exemplarily, a schematic diagram for determining the storage location is shown in FIG7. The following is a description of the storage location determination process provided by the present application in conjunction with FIG7. Taking the storage of a Key-Value pair as an example, first, the Key is serialized into integer data according to the serialization algorithm. Then, assuming that the business scenario specifies that the radix tree is a four-layer structure, the integer data is divided into four parts: a, b, c, and d. The decimal number corresponding to a is used to represent the pointer value stored in the root node, the decimal number corresponding to b and the decimal number corresponding to c are used to represent the pointer value stored in the target non-leaf node in the first non-leaf node layer and the second non-leaf node layer, respectively, and the decimal number corresponding to d is used to represent the target slot in the leaf node for storing the Value. The second non-leaf node layer and each leaf node include a page frame information for storing relevant information of each leaf node.
[0107] In this embodiment, the server can determine the target leaf node corresponding to the target Key from multiple leaf nodes under the target non-leaf node based on the pointer information corresponding to the target Key at the non-leaf node layer, and then, according to the slot identifier, can determine the target slot corresponding to the target Key in the target leaf node, and then, can determine the target slot as the storage location. Since the target leaf node corresponding to the target Key can be quickly and accurately determined from multiple leaf nodes under the target non-leaf node according to the pointer information, the target slot can be quickly and accurately determined according to the slot identifier and the target slot can be determined as the storage location, thereby improving the efficiency of determining the storage location.
[0108] In one embodiment, based on the above embodiment, referring to FIG8 , this embodiment involves a process of how a server performs elimination control on leaf nodes in a radix tree. As shown in FIG8 , the server can execute steps 701 and 702 to implement this process.
[0109] Step 701, obtain the page frame information corresponding to each leaf node in the leaf node layer of the radix tree, the page frame information includes the leaf node pointer, the number of visits to the leaf node, the linked list structure information and the leaf node elimination control information.
[0110] The page frame information refers to a control structure used to store leaf node related information. For example, the page frame information may include a leaf node pointer, which is used to point to the leaf node corresponding to the page frame information; the number of leaf node accesses, which is used to represent the number of times the data in the leaf node is obtained, modified, or deleted; the linked list structure information is used to indicate the linked list to which the leaf node belongs; the leaf node elimination control information is used to indicate whether the leaf node belongs to an active linked list or an inactive linked list, and its position in the active linked list or the inactive linked list;
[0111] As a possible implementation, the page frame information may also include the storage location of the upper layer non-leaf node corresponding to each leaf node, and the number of slots in each leaf node.
[0112] In this embodiment, the server can obtain the management structure of the radix tree from the memory in real time, and then obtain the page frame information corresponding to each leaf node of the radix tree from the management structure of the radix tree.
[0113] Step 702, according to the number of accesses and a preset number threshold, adds the leaf node pointer to the active linked list or the inactive linked list corresponding to the linked list structure information, and updates the leaf node elimination control information, where the leaf node elimination control information is used to represent the position of the leaf node pointer in the active linked list or in the inactive linked list.
[0114] Among them, the preset number threshold is used to determine whether a leaf node is an active node, and then determine whether the leaf node pointer corresponding to each leaf node is added to the active linked list or the inactive linked list based on the result of the judgment.
[0115] Among them, the active linked list and the inactive linked list are used to store the leaf node pointers corresponding to all leaf nodes in the radix tree. Optionally, if the leaf node is visited many times, the leaf node pointer corresponding to the leaf node is stored in the active linked list; if the leaf node is visited few times, the leaf node pointer corresponding to the leaf node is stored in the inactive linked list.
[0116] In this embodiment, the server can obtain the number of visits to each leaf node in real time, and then determine whether the number of visits is greater than the number threshold. Then, based on the judgment result, the leaf node pointer corresponding to the leaf node is added to the active linked list or the inactive linked list. Further, the linked list type and position in the linked list of each leaf node at the current time are obtained, and the node elimination control information corresponding to each leaf node is updated using the obtained linked list type and position in the linked list.
[0117] As a possible implementation, the active linked list and the inactive linked list may include a leaf node pointer, a forward linked list pointer, and a backward linked list pointer corresponding to each leaf node. When the number of visits to a leaf node changes, the forward linked list pointer and the backward linked list pointer corresponding to each leaf node can be called to update the position of the leaf node pointer in the active linked list or the inactive linked list.
[0118] Exemplarily, a schematic diagram of an active linked list and an inactive linked list may be shown in Figure 9. Each linked list stores a leaf node pointer, a forward linked list pointer, a backward linked list pointer and linked list structure information corresponding to each leaf node.
[0119] In a possible implementation of step 702, if the number of visits to the leaf node is greater than the number threshold, the leaf node pointer corresponding to the leaf node is added to the active linked list.
[0120] The number threshold refers to the number of times a leaf node is accessed. Optionally, if a plurality of data are stored in the leaf node, the sum of the number of times the plurality of data are accessed may be determined as the number of times the leaf node is accessed.
[0121] In this embodiment, the server can monitor and obtain the number of visits to the leaf node in real time, and then compare the number of visits to the leaf node with the number threshold. If the comparison result indicates that the number of visits to the leaf node is greater than the number threshold, the leaf node pointer corresponding to the leaf node is added to the active linked list.
[0122] In another possible implementation of step 702, if the number of visits to the leaf node is less than the number threshold, the leaf node pointer corresponding to the leaf node is added to the inactive linked list.
[0123] In this embodiment, the server may add a leaf node pointer corresponding to the leaf node to the inactive linked list when the comparison result indicates that the number of visits to the leaf node is less than the number threshold.
[0124] In the above implementation, by comparing the number of visits to a leaf node and the number threshold, it is possible to quickly determine whether a leaf node is a leaf node with a large number of visits, thereby quickly adding the leaf node to the corresponding active linked list or inactive linked list.
[0125] In this embodiment, the server obtains the page frame information corresponding to each leaf node in the leaf node layer of the radix tree, and the page frame information includes a leaf node pointer, the number of times the leaf node is accessed, the linked list structure information, and the leaf node elimination control information. Then, according to the number of accesses and a preset number threshold, the leaf node pointer can be added to the active linked list or the inactive linked list, and the position of the leaf node pointer in the active linked list or the position in the inactive linked list can be updated, so that the access popularity of the leaf node can be counted through the active linked list and the inactive linked list, and then it can be determined whether to continue to store the data in the leaf node according to the active linked list and the inactive linked list, thereby improving the flexibility of the data structure of the radix tree and adapting to different business needs.
[0126] In one embodiment, the page frame information also includes the length of the inactive linked list. This embodiment relates to the process of how the server deletes leaf nodes. The above method may include: when the length of the linked list is greater than a preset length threshold, deleting the tail leaf node pointer in the inactive linked list, and deleting the Value in the leaf node corresponding to the tail leaf node pointer.
[0127] The preset length threshold refers to the maximum number of leaf node pointers that can be stored in the inactive linked list. It is understandable that in order to improve the success rate of obtaining the value to be queried in the radix tree, the value with a large number of accesses can be stored in the radix tree. However, due to the limited storage space in the radix tree, the value in the leaf node with a large number of accesses can be retained according to the number of accesses of the value in the leaf node, and the value in the leaf node with a small number of accesses can be deleted.
[0128] In this embodiment, the server can monitor and obtain the number of leaf node pointers in the inactive linked list in real time, and then compare the obtained number of leaf node pointers with a preset length threshold. Then, when the linked list length is greater than the preset length threshold, the tail leaf node pointer in the inactive linked list is deleted, and the stored Value is deleted from the leaf node corresponding to the tail leaf node pointer.
[0129] In this embodiment, when the length of the linked list is greater than a preset length threshold, the server can delete the tail leaf node pointer in the inactive linked list and the Value in the leaf node corresponding to the tail leaf node pointer. In this way, the server can delete the tail leaf node pointer at the tail of the inactive linked list in a timely manner according to the number of times the leaf node is accessed, so that more frequently accessed data can be stored in the radix tree, thereby improving the data hit rate.
[0130] In one embodiment, referring to FIG. 10 , a storage location determination method is provided, the method comprising:
[0131] Step 1001, in the process of determining the storage location of the target Value corresponding to the target Key in the radix tree, obtain the integer data corresponding to the target Key.
[0132] Step 1002: Determine the number of layers of the multiple data layers included in the radix tree according to the current business scenario.
[0133] Step 1003, dividing the integer data according to the number of layers, and obtaining the division results corresponding to each data layer.
[0134] Step 1004, for the leaf node layer, according to the division result corresponding to the leaf node layer, determine the slot identifier corresponding to the target Key in the leaf node layer.
[0135] Step 1005: for each other node layer, according to the division results corresponding to the other node layers, determine the pointer information corresponding to the target Key in the other node layers.
[0136] Step 1006, according to the pointer information corresponding to the target Key in the root node layer, determine the target non-leaf node corresponding to the target Key in the non-leaf node layer under the root node.
[0137] Step 1107, based on the pointer information corresponding to the target Key at the non-leaf node layer, determine the target leaf node corresponding to the target Key from the multiple leaf nodes under the target non-leaf node.
[0138] Step 1008, according to the slot identifier, determine the target slot corresponding to the target Key in the target leaf node, and determine the target slot as the storage location.
[0139] Step 1009, obtaining the page frame information corresponding to each leaf node in the leaf node layer in the radix tree, wherein the page frame information includes a leaf node pointer, the number of visits to the leaf node, linked list structure information, and leaf node elimination control information.
[0140] Step 1010, determine whether the number of visits to the leaf node is greater than a threshold number.
[0141] Step 1011, if the number of visits to the leaf node is greater than the number threshold, the leaf node pointer corresponding to the leaf node is added to the active linked list.
[0142] Step 1012: If the number of visits to the leaf node is less than the number threshold, the leaf node pointer corresponding to the leaf node is added to the inactive linked list.
[0143] Step 1013, update leaf node elimination control information.
[0144] Step 1014, when the length of the linked list is greater than the preset length threshold, delete the tail leaf node pointer in the inactive linked list, and delete the Value in the leaf node corresponding to the tail leaf node pointer.
[0145] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0146] Based on the same inventive concept, the embodiment of the present application also provides a storage location determination device for implementing the storage location determination method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more storage location determination device embodiments provided below can refer to the limitations of the storage location determination method above, and will not be repeated here.
[0147] In an exemplary embodiment, as shown in FIG11 , a storage location determination device is provided, including:
[0148] The first acquisition module 1101 is used to acquire the integer data corresponding to the target Key in the process of determining the storage location of the target Value corresponding to the target Key in the radix tree;
[0149] A first determining module 1102 is used to determine the number of layers of the multiple data layers included in the radix tree according to the current business scenario;
[0150] The second determination module 1103 is used to divide the integer data according to the number of layers, obtain the division results corresponding to each data layer, and determine the storage location according to each division result.
[0151] In one embodiment, the multiple data layers include a leaf node layer and multiple other node layers, and the second determination module 1103 includes:
[0152] A first determining unit is used to determine, for the leaf node layer, a slot identifier corresponding to the target Key in the leaf node layer according to a division result corresponding to the leaf node layer;
[0153] A second determining unit is used to determine, for each of the other node layers, pointer information corresponding to the target Key in the other node layer according to the division result corresponding to the other node layer;
[0154] The third determining unit is used to determine the storage location according to each of the pointer information and the slot identifier.
[0155] In one of the embodiments, the third determining unit is specifically configured to determine the target node corresponding to the target Key in each of the other node layers according to each of the pointer information;
[0156] The storage location is determined according to each of the target nodes and the slot identifiers.
[0157] In one of the embodiments, the multiple other node layers include a root node layer and a non-leaf node layer, the root node layer includes a root node, and the third determination unit is specifically used to determine the target non-leaf node corresponding to the target Key in the non-leaf node layer under the root node according to the pointer information corresponding to the target Key in the root node layer;
[0158] The root node and the target non-leaf node are determined as a plurality of target nodes.
[0159] In one of the embodiments, the third determination unit is specifically used to determine the target leaf node corresponding to the target Key from multiple leaf nodes under the target non-leaf node according to the pointer information corresponding to the target Key at the non-leaf node layer;
[0160] According to the slot identifier, the target slot corresponding to the target Key is determined in the target leaf node, and the target slot is determined as the storage location.
[0161] In one embodiment, the device further comprises:
[0162] A second acquisition module is used to obtain page frame information corresponding to each leaf node in the leaf node layer of the radix tree, wherein the page frame information includes a leaf node pointer, a number of visits to the leaf node, linked list structure information, and leaf node elimination control information;
[0163] An adding module is used to add the leaf node pointer to the active linked list or the inactive linked list corresponding to the linked list structure information according to the number of accesses and a preset number threshold, and to update the leaf node elimination control information, wherein the leaf node elimination control information is used to represent the position of the leaf node pointer in the active linked list or the position of the inactive linked list.
[0164] In one embodiment, adding a module includes:
[0165] A first adding unit, configured to add a leaf node pointer corresponding to the leaf node to the active linked list if the number of visits to the leaf node is greater than the number threshold;
[0166] The second adding unit is used to add the leaf node pointer corresponding to the leaf node to the inactive linked list if the number of visits to the leaf node is less than the number threshold.
[0167] In one embodiment, the page frame information also includes the length of the inactive linked list, and the device further includes:
[0168] The deletion module is used to delete the tail leaf node pointer in the inactive linked list and delete the Value in the leaf node corresponding to the tail leaf node pointer when the length of the linked list is greater than a preset length threshold.
[0169] Each module in the above storage location determination device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a server in the form of hardware, or can be stored in a memory in a server in the form of software, so that the processor can call and execute operations corresponding to each module.
[0170] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG12. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store disease risk analysis data and / or health status assessment data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a disease risk analysis method and / or a health status assessment method is implemented.
[0171] Those skilled in the art will understand that the structure shown in FIG. 12 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0172] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0173] In the process of determining the storage location of the target Value corresponding to the target Key in the radix tree, obtaining the integer data corresponding to the target Key;
[0174] According to the current business scenario, determine the number of layers of the multiple data layers included in the radix tree;
[0175] The integer data is divided according to the number of layers to obtain division results corresponding to each data layer, and the storage location is determined according to each division result.
[0176] In one embodiment, the processor implements the following steps when executing the computer program:
[0177] For the leaf node layer, according to the division result corresponding to the leaf node layer, determine the slot identifier corresponding to the target Key in the leaf node layer;
[0178] For each of the other node layers, determine the pointer information corresponding to the target Key in the other node layer according to the division result corresponding to the other node layer;
[0179] The storage location is determined according to each of the pointer information and the slot identifier.
[0180] In one embodiment, the processor implements the following steps when executing the computer program:
[0181] Determine the target node corresponding to the target Key in each of the other node layers according to each of the pointer information;
[0182] The storage location is determined according to each of the target nodes and the slot identifiers.
[0183] In one embodiment, the processor implements the following steps when executing the computer program:
[0184] According to the pointer information corresponding to the target Key in the root node layer, determine the target non-leaf node corresponding to the target Key in the non-leaf node layer under the root node;
[0185] The root node and the target non-leaf node are determined as a plurality of target nodes.
[0186] In one of the embodiments, the processor specifically implements the following steps when executing the computer program: determining the target leaf node corresponding to the target Key from multiple leaf nodes under the target non-leaf node according to the pointer information corresponding to the target Key at the non-leaf node layer;
[0187] According to the slot identifier, the target slot corresponding to the target Key is determined in the target leaf node, and the target slot is determined as the storage location.
[0188] In one embodiment, the processor implements the following steps when executing the computer program:
[0189] Obtaining page frame information corresponding to each leaf node in the leaf node layer of the radix tree, wherein the page frame information includes a leaf node pointer, a number of visits to the leaf node, linked list structure information, and leaf node elimination control information;
[0190] According to the number of accesses and a preset number threshold, the leaf node pointer is added to the active linked list or the inactive linked list corresponding to the linked list structure information, and the leaf node elimination control information is updated. The leaf node elimination control information is used to represent the position of the leaf node pointer in the active linked list or the position in the inactive linked list.
[0191] In one embodiment, the processor implements the following steps when executing the computer program:
[0192] If the number of visits to the leaf node is greater than the number threshold, adding the leaf node pointer corresponding to the leaf node to the active linked list;
[0193] If the number of visits to the leaf node is less than the number threshold, the leaf node pointer corresponding to the leaf node is added to the inactive linked list.
[0194] In one embodiment, the processor implements the following steps when executing the computer program:
[0195] When the length of the linked list is greater than a preset length threshold, the tail leaf node pointer in the inactive linked list is deleted, and the Value in the leaf node corresponding to the tail leaf node pointer is deleted.
[0196] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0197] In the process of determining the storage location of the target Value corresponding to the target Key in the radix tree, obtaining the integer data corresponding to the target Key;
[0198] According to the current business scenario, determine the number of layers of the multiple data layers included in the radix tree;
[0199] The integer data is divided according to the number of layers to obtain division results corresponding to each data layer, and the storage location is determined according to each division result.
[0200] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:
[0201] For the leaf node layer, according to the division result corresponding to the leaf node layer, determine the slot identifier corresponding to the target Key in the leaf node layer;
[0202] For each of the other node layers, determine the pointer information corresponding to the target Key in the other node layer according to the division result corresponding to the other node layer;
[0203] The storage location is determined according to each of the pointer information and the slot identifier.
[0204] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:
[0205] Determine the target node corresponding to the target Key in each of the other node layers according to each of the pointer information;
[0206] The storage location is determined according to each of the target nodes and the slot identifiers.
[0207] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:
[0208] According to the pointer information corresponding to the target Key in the root node layer, determine the target non-leaf node corresponding to the target Key in the non-leaf node layer under the root node;
[0209] The root node and the target non-leaf node are determined as a plurality of target nodes.
[0210] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:
[0211] According to the pointer information corresponding to the target Key at the non-leaf node layer, determine the target leaf node corresponding to the target Key from the multiple leaf nodes under the target non-leaf node;
[0212] According to the slot identifier, the target slot corresponding to the target Key is determined in the target leaf node, and the target slot is determined as the storage location.
[0213] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:
[0214] Obtaining page frame information corresponding to each leaf node in the leaf node layer of the radix tree, wherein the page frame information includes a leaf node pointer, a number of visits to the leaf node, linked list structure information, and leaf node elimination control information;
[0215] According to the number of accesses and a preset number threshold, the leaf node pointer is added to the active linked list or the inactive linked list corresponding to the linked list structure information, and the leaf node elimination control information is updated. The leaf node elimination control information is used to represent the position of the leaf node pointer in the active linked list or the position in the inactive linked list.
[0216] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:
[0217] If the number of visits to the leaf node is greater than the number threshold, adding the leaf node pointer corresponding to the leaf node to the active linked list;
[0218] If the number of visits to the leaf node is less than the number threshold, the leaf node pointer corresponding to the leaf node is added to the inactive linked list.
[0219] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0220] When the length of the linked list is greater than a preset length threshold, the tail leaf node pointer in the inactive linked list is deleted, and the Value in the leaf node corresponding to the tail leaf node pointer is deleted.
[0221] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0222] In the process of determining the storage location of the target Value corresponding to the target Key in the radix tree, obtaining the integer data corresponding to the target Key;
[0223] According to the current business scenario, determine the number of layers of the multiple data layers included in the radix tree;
[0224] The integer data is divided according to the number of layers to obtain division results corresponding to each data layer, and the storage location is determined according to each division result.
[0225] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:
[0226] For the leaf node layer, according to the division result corresponding to the leaf node layer, determine the slot identifier corresponding to the target Key in the leaf node layer;
[0227] For each of the other node layers, determine the pointer information corresponding to the target Key in the other node layer according to the division result corresponding to the other node layer;
[0228] The storage location is determined according to each of the pointer information and the slot identifier.
[0229] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:
[0230] Determine the target node corresponding to the target Key in each of the other node layers according to each of the pointer information;
[0231] The storage location is determined according to each of the target nodes and the slot identifiers.
[0232] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:
[0233] According to the pointer information corresponding to the target Key in the root node layer, determine the target non-leaf node corresponding to the target Key in the non-leaf node layer under the root node;
[0234] The root node and the target non-leaf node are determined as a plurality of target nodes.
[0235] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:
[0236] According to the pointer information corresponding to the target Key at the non-leaf node layer, determine the target leaf node corresponding to the target Key from the multiple leaf nodes under the target non-leaf node;
[0237] According to the slot identifier, the target slot corresponding to the target Key is determined in the target leaf node, and the target slot is determined as the storage location.
[0238] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:
[0239] Obtaining page frame information corresponding to each leaf node in the leaf node layer of the radix tree, wherein the page frame information includes a leaf node pointer, a number of visits to the leaf node, linked list structure information, and leaf node elimination control information;
[0240] According to the number of accesses and a preset number threshold, the leaf node pointer is added to the active linked list or the inactive linked list corresponding to the linked list structure information, and the leaf node elimination control information is updated. The leaf node elimination control information is used to represent the position of the leaf node pointer in the active linked list or the position in the inactive linked list.
[0241] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:
[0242] If the number of visits to the leaf node is greater than the number threshold, adding the leaf node pointer corresponding to the leaf node to the active linked list;
[0243] If the number of visits to the leaf node is less than the number threshold, the leaf node pointer corresponding to the leaf node is added to the inactive linked list.
[0244] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:
[0245] When the length of the linked list is greater than a preset length threshold, the tail leaf node pointer in the inactive linked list is deleted, and the Value in the leaf node corresponding to the tail leaf node pointer is deleted.
[0246] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0247] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0248] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for determining a storage location, characterized in that: The method comprises: In the process of determining the storage location of the target Value corresponding to the target Key in the radix tree, obtaining the integer data corresponding to the target Key; According to the current business scenario, determine the number of layers of the multiple data layers included in the radix tree; The integer data is divided according to the number of layers to obtain division results corresponding to each data layer, and the storage location is determined according to each division result.
2. The method according to claim 1, characterized in that The multiple data layers include a leaf node layer and multiple other node layers, and the determining the storage location according to each of the division results includes: For the leaf node layer, according to the division result corresponding to the leaf node layer, determine the slot identifier corresponding to the target Key in the leaf node layer; For each of the other node layers, determine the pointer information corresponding to the target Key in the other node layer according to the division result corresponding to the other node layer; The storage location is determined according to each of the pointer information and the slot identifier.
3. The method according to claim 2, characterized in that The step of determining the storage location according to each of the pointer information and the slot identifier includes: Determine the target node corresponding to the target Key in each of the other node layers according to each of the pointer information; The storage location is determined according to each of the target nodes and the slot identifiers.
4. The method according to claim 3, characterized in that The multiple other node layers include a root node layer and a non-leaf node layer, the root node layer includes a root node, and determining the target node corresponding to the target Key in each of the other node layers according to each of the pointer information includes: According to the pointer information corresponding to the target Key in the root node layer, determine the target non-leaf node corresponding to the target Key in the non-leaf node layer under the root node; The root node and the target non-leaf node are determined as a plurality of target nodes.
5. The method according to claim 4, characterized in that The determining the storage location according to each of the target nodes and the slot identifiers includes: According to the pointer information corresponding to the target Key at the non-leaf node layer, determine the target leaf node corresponding to the target Key from the multiple leaf nodes under the target non-leaf node; According to the slot identifier, the target slot corresponding to the target Key is determined in the target leaf node, and the target slot is determined as the storage location.
6. The method according to claim 1, characterized in that The method further comprises: Obtaining page frame information corresponding to each leaf node in the leaf node layer of the radix tree, wherein the page frame information includes a leaf node pointer, a number of visits to the leaf node, linked list structure information, and leaf node elimination control information; According to the number of accesses and a preset number threshold, the leaf node pointer is added to the active linked list or the inactive linked list corresponding to the linked list structure information, and the leaf node elimination control information is updated. The leaf node elimination control information is used to represent the position of the leaf node pointer in the active linked list or the position in the inactive linked list.
7. The method according to claim 6, characterized in that The adding the leaf node pointer to an active linked list or an inactive linked list corresponding to the linked list structure information according to the access count and a preset count threshold includes: If the number of visits to the leaf node is greater than the number threshold, adding the leaf node pointer corresponding to the leaf node to the active linked list; If the number of visits to the leaf node is less than the number threshold, the leaf node pointer corresponding to the leaf node is added to the inactive linked list.
8. The method according to claim 6, characterized in that The page frame information also includes the length of the inactive linked list, and the method further includes: When the length of the linked list is greater than a preset length threshold, the tail leaf node pointer in the inactive linked list is deleted, and the Value in the leaf node corresponding to the tail leaf node pointer is deleted.
9. A storage location determination device, characterized in that: The device comprises: A first acquisition module, used to acquire the integer data corresponding to the target Key in the process of determining the storage location of the target Value corresponding to the target Key in the radix tree; A first determination module, used to determine the number of layers of the multiple data layers included in the radix tree according to the current business scenario; The second determination module is used to divide the integer data according to the number of layers, obtain the division results corresponding to each data layer, and determine the storage location according to each division result.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
