High-performance tail delay controllable memory learning type index structure

Through the group hashing and group migration technology of the memory learning index structure, the performance bottleneck of the learning index under global and local complexity is solved, and efficient data access with controllable tail latency is achieved, which is suitable for delay-sensitive applications.

CN120631899APending Publication Date: 2025-09-12INST OF COMPUTING TECH CHINESE ACAD OF SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510949050.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-10
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

Existing learning-based indexes have performance bottlenecks in global complexity, local complexity, and tail latency, especially when the dataset is unevenly distributed. This leads to an increase in the number of nodes, a decrease in model fitting accuracy, and excessive tail latency, making it unable to meet the needs of latency-sensitive applications.

Method used

It adopts an in-memory learning index structure, designs an internal index tree and leaf node hierarchy, and utilizes group hashing and group migration technologies to control the size of the internal index tree, optimize leaf node structure change operations, and reduce tail latency.

Benefits of technology

It effectively addresses the global and local complexity of data sets, improves access efficiency, significantly reduces worst-case tail latency, and supports efficient add, delete, modify, and query operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120631899A_ABST
    Figure CN120631899A_ABST
Patent Text Reader

Abstract

The invention provides a high-performance tail-delay-controllable memory learning type index structure. The high-performance tail-delay-controllable memory learning type index structure comprises an internal index tree and a leaf node layer, an index entry of the internal index tree comprises a minimum key of a leaf node and a pointer pointing to the leaf node, and the space size of the internal index tree is adaptive to a CPU cache; the leaf node layer is composed of a plurality of leaf nodes, and each leaf node comprises a linear model, a Nano array and a Nano overflow array; each of the Nano array and the Nano overflow array comprises a plurality of Nano storage units, and the Nano array and the Nano overflow array form a plurality of groups; data keys are mapped to the Nano storage unit in the group in a Hash mode; the structure change operation of the leaf nodes is migrated in units of groups.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer data storage, and in particular to a high-performance memory learning index structure with controllable tail delay. Background Art

[0002] With the advancement of data storage technology, learned indexes have emerged as a new index structure replacing traditional indexes such as B-trees. Learned indexes utilize the data distribution information of a dataset to optimize data access speed. The basic idea is to build a model by simulating the cumulative distribution function (CDF) of the dataset. For a given data key, the model predicts the corresponding location of the key based on the model. Then, local search and other methods are used near the predicted location to determine the key's exact storage location. This significantly reduces the large number of key comparisons required by traditional indexes and significantly reduces the height of the index tree, efficiently supporting operations such as add, delete, modify, and query.

[0003] Compared with traditional index structures, learning indexes have the following two main problems. First, the performance of learning indexes is closely related to the data distribution of the dataset. However, real-world datasets are often not evenly distributed, and their complexity is reflected in two dimensions: global complexity and local complexity. Datasets with higher global complexity will result in a larger number of internal nodes in the learning index and a complex internal hierarchy. Datasets with higher local complexity will result in a decrease in the model fitting accuracy of leaf nodes and increase the cost of local search. Second, the nodes of learning indexes are generally larger, so structural change operations take longer to complete. In addition, existing learning indexes often improve performance by rebuilding subtrees and retraining models, which incurs a large time overhead. These operations result in a long tail delay in the learning index, which generally reaches milliseconds or even seconds in existing learning indexes, which is unacceptable for delay-sensitive applications.

[0004] The following describes the problems of existing learning indexes in terms of global complexity, local complexity, and tail latency.

[0005] Global Complexity: Existing learning-based indexes address global complexity by using piecewise linear fitting to build nodes at each layer from the bottom up, using a cost model to select the number of subnodes within each node from the top down, or a combination of these approaches, modifying the internal structure built from the top down based on the results of linear segmentation. However, when global complexity is high, the index height, number of nodes, and internal node space occupied by existing learning-based indexes are significantly increased compared to simpler datasets, making it impossible to fit them into the CPU cache, resulting in poor performance of existing work.

[0006] Local complexity: Existing learned indexes address local complexity by using gapped arrays to reduce the likelihood of keys mapping to the same location, recursively building subtrees for conflicting keys, and establishing overflow buffers. However, as local complexity increases, the structures used by existing learned indexes to resolve conflicts at leaf nodes become more complex, making it more difficult to locate the target key and degrading the performance of existing work.

[0007] Tail Latency: Existing learning-based indexes primarily cause worst-case tail latency when changing node structures. This latency primarily involves model retraining and subtree reconstruction. When insertions are frequent, existing learning-based indexes cannot guarantee an upper limit on the worst-case insertion latency.

[0008] To this end, the present invention considers proposing a high-performance learning index structure with controllable tail delay, which achieves the goal of controllable tail delay while ensuring efficient access to the learning index. Summary of the Invention

[0009] In response to the shortcomings of the existing technology, the present invention proposes a high-performance memory learning index structure with controllable tail latency, which can effectively cope with the global complexity and local complexity of the data set, support efficient addition, deletion, modification and query operations, and strictly limit the access latency in the worst case.

[0010] The present invention provides an in-memory learning index structure, comprising an internal index tree and a leaf node hierarchy;

[0011] The index items of the internal index tree include the minimum key of the leaf node and the pointer to the leaf node, and the space size of the internal index tree is adapted to the CPU cache;

[0012] The leaf node hierarchy is composed of a plurality of leaf nodes, each leaf node includes a linear model, a Nano array and a Nano overflow array; the Nano array and the Nano overflow array each include a plurality of Nano storage units, and the Nano array and the Nano overflow array form a plurality of groups;

[0013] The data keys are mapped to the Nano storage units by hashing within the group;

[0014] The structural change operation of the leaf nodes is performed in groups.

[0015] In one embodiment of the present invention, the process of establishing the internal index tree includes:

[0016] Sort the data keys of the data set and calculate the piecewise linear function to fit the data distribution;

[0017] Create a leaf node for each linear segment and insert the minimum key and node pointer of the leaf node as an index item into the internal index tree;

[0018] By adjusting the prediction error parameter of the piecewise linear function, the size of the internal index tree is controlled to fit the CPU cache.

[0019] In one embodiment of the present invention, the Nano storage unit is a fixed-length data structure that stores multiple key-value pairs;

[0020] The Nano storage unit includes slots and meta information, wherein the meta information includes a bitmap marking the idle state of the slots, an overflow bit, and a hash value fingerprint of some slots;

[0021] The addition and deletion operations of the key-value pairs are implemented by modifying the bitmap; the search operation is performed by comparing the SIMD accelerator keys, and judging whether the Nano overflow array needs to be searched based on the overflow bit.

[0022] In one embodiment of the present invention, the hash mapping method of the grouping is:

[0023] The data key is calculated using a first hash function to determine the position of a first Nano storage unit in the Nano array; if the packet size exceeds a set threshold, the data key is further calculated using a second hash function to determine the position of a second Nano storage unit in the Nano array;

[0024] If the slots of the first Nano storage unit and the second Nano storage unit are not idle, the key-value pair is stored in the Nano storage unit of the Nano overflow array; if the slots of the Nano overflow array are not idle, a leaf node structure change operation is triggered.

[0025] In one embodiment of the present invention, the linear model is in the form of y=kx+b, where x is the data key, k and b are the slope and intercept parameters obtained by fitting, and y is the subscript of the predicted Nano array;

[0026] The number of the group is obtained by dividing the subscript of the Nano array by the number of Nano storage units in the Nano array contained in each group.

[0027] In one embodiment of the present invention, the leaf node structure change operation includes a migration preparation phase, a group migration phase, and a migration completion phase;

[0028] During the migration preparation phase, the operation type is determined based on the data key distribution, a new node is allocated and initialized, a leaf node migration flag, a pointer to the new node, and initialization group migration metadata are recorded; the group migration metadata records the migration status of each group, where the status includes not migrated, migrating, and migrated, and the operation type includes expansion operation and split operation;

[0029] During the group migration phase, for index operations, the group of the original leaf node or the new leaf node is accessed based on the group migration metadata. For write operations, if a leaf node is being migrated, a group migration is performed to migrate a group that has not yet been migrated to the new node.

[0030] In the migration completion phase, during the expansion operation, the pointer of the internal index tree is updated to the pointer of the new leaf node; during the split operation, two new leaf nodes are inserted into the internal index tree and the original leaf node is deleted.

[0031] In one embodiment of the present invention, the structural parameters of the leaf node include the number of Nano storage units of the Nano array and the number of Nano storage units of the Nano overflow array in the group;

[0032] The structural parameters are determined by calculating a cost model. The cost model calculates the key mapping situation within the data key distribution statistical group based on the search cost, migration time and space utilization, and selects parameters that meet the tail delay and space requirements and minimize the search cost.

[0033] In one embodiment of the present invention, the type of the internal index tree is a traditional index or a learned index;

[0034] The traditional index includes a B-tree, and the learned index includes an ALEX index.

[0035] In one embodiment of the present invention, the access process of the index structure includes:

[0036] Search the key of the data to be queried through the internal index tree and select the rightmost leaf node whose minimum key is less than or equal to the key of the data to be queried;

[0037] In the rightmost leaf node, the group corresponding to the data key to be queried is calculated using a linear model;

[0038] The target Nano storage unit of the Nano array is searched for in the corresponding group by hash positioning. If not found, the overflow bit is checked and the Nano storage unit of the Nano overflow array is searched.

[0039] In one embodiment of the present invention, the index structure supports concurrent read and write operations;

[0040] The internal index tree supports concurrent access; the grouping of leaf nodes maintains read-write consistency through a locking mechanism, and the locking granularity is grouping.

[0041] From the above scheme, it can be seen that the advantages of the present invention are:

[0042] The high-performance tail-delay controllable memory learning index structure provided by the present invention is composed of an internal index tree and a leaf node hierarchy, and applies the technology of group hashing in the leaf nodes, and adopts group migration in the leaf node structure change operation to optimize the performance of the learning index. First, for the global complexity of the data set, by controlling the size of the internal index tree, the internal index tree can be placed in the CPU cache, reducing the access cost of the internal structure. Second, for the local complexity of the data set, hashing is used in each group of the leaf node to even out its local data distribution, and unordered key-value pair storage is used in Nano, thereby improving the access efficiency and space utilization in the leaf node. Third, the leaf node structure change operation is divided by group migration, so that each group migration in the migration preparation stage, the group migration stage, and the migration completion stage meet the set tail delay requirements, thereby significantly reducing the worst-case tail delay of the learning index. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 The figure shows the overall structure of the memory learning index structure provided by one embodiment of the present invention;

[0044] Figure 2 A schematic diagram of a memory learning index structure provided by a specific example is shown;

[0045] Figure 3 Shown Figure 2 The structural change operation process of the leaf nodes of the memory learning index structure;

[0046] Figure 4 The experimental results of the method of the present invention and related existing technologies on different data sets are shown;

[0047] Figure 5 The experimental results of the method of the present invention and the related prior art on tail delay are shown.

[0048] Wherein, the accompanying drawings are marked as follows:

[0049] 1: Memory learning index structure;

[0050] 10: internal index tree;

[0051] 20: leaf node level;

[0052] 21: leaf node;

[0053] 211: Linear Models;

[0054] 212: Nano array;

[0055] 213: Nano overflow array;

[0056] 214: Nano storage unit. DETAILED DESCRIPTION

[0057] It should be noted that, in this application, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus.

[0058] Without further constraints, an element defined by the phrase "comprises a..." does not preclude the existence of additional identical elements in the process, method, article or apparatus that includes the element.

[0059] refer to Figure 1 , Figure 1 A structural diagram of a high-performance tail-latency controllable memory learning index structure provided by an embodiment of the present invention is shown.

[0060] An in-memory learning index structure 1 includes an internal index tree 10 and a leaf node hierarchy 20. Index entries in the internal index tree 10 include the minimum key of a leaf node and a pointer to the leaf node. The internal index tree is sized to fit within a CPU cache. The internal index tree occupies a small space and can fit within the CPU cache, accelerating access to the internal structure and effectively addressing the global complexity of datasets.

[0061] The leaf node hierarchy 20 is composed of a plurality of leaf nodes 21, each of which includes a linear model 211, a Nano array 212, and a Nano overflow array 213. The Nano array 213 and the Nano overflow array 214 each include a plurality of Nano storage units 214, and the Nano array and the Nano overflow array form a plurality of groups. In this embodiment, the leaf nodes are composed of Nano storage units, the internal keys of each Nano storage unit are unordered, and the plurality of Nano storage units form a group. The model in the leaf node predicts the group position.

[0062] In a specific embodiment, the Nano storage unit is a fixed-length data structure that stores multiple key-value pairs. The Nano storage unit includes multiple slots and meta-information, and the meta-information includes a bitmap that marks the idle state of each slot, an overflow bit, and hash value fingerprints of some slots. The overflow bit is used to record whether there is a key overflow belonging to the Nano storage unit. The key-value pairs are unordered in the Nano storage unit. The addition and deletion operations of the key-value pairs are implemented by modifying the bitmap. The newly inserted key-value pairs only need to find any slot with an idle bit of 0 to be inserted. Deleting a key-value pair can set the idle position of the corresponding slot to 0. The search operation uses SIMD to compare the 1-byte hash value with the hash value of the data key to be searched to quickly eliminate unmatched slots, then eliminate the idle slots through the idle bitmap, and finally compare the slots that are not eliminated in turn.

[0063] In one embodiment, the process of establishing the internal index tree includes: sorting the data keys of a data set, calculating a piecewise linear function to fit the data distribution; establishing a leaf node for each linear segment, and inserting the leaf node's minimum key and node pointer as an index item into the internal index tree. When calculating the piecewise linear function, an appropriate number of segments is obtained by selecting an appropriate prediction error parameter. By adjusting the prediction error parameter of the piecewise linear function, the size of the internal index tree is controlled to adapt to the CPU cache, ensuring that the internal index tree structure is small enough to fit in the CPU cache while also ensuring that the leaf nodes are not too large, maintaining leaf node access performance.

[0064] In one embodiment, an internal index tree is constructed based on leaf nodes. The internal index tree uses the leaf node's minimum key and a pointer to the leaf node as a key-value pair for insertion into the internal index tree. The internal index tree can be selected from a traditional index and a learned index based on the specific data set and workload. The traditional index includes a B-tree, and the learned index includes an ALEX index.

[0065] In one embodiment, data keys are mapped to the Nano storage units in a hashing manner within the group, and hash access is adopted within the group, thereby effectively coping with the local complexity of the data set.

[0066] The grouping uses a hashing method to map data keys to Nano storage units. Specifically, the data key is calculated using a first hash function to locate the corresponding Nano storage unit in the Nano array. If the group size exceeds a set threshold, the data key is further calculated using a second hash function to locate the corresponding Nano storage unit in the Nano array. If the first Nano storage unit cannot accommodate the key-value pair, the key-value pair will be stored in the second Nano storage unit.

[0067] If there are no free slots in either the first or second Nano storage units, meaning the Nano array cannot accommodate the key-value pair, the key-value pair is stored in the Nano storage units of the Nano overflow array. If there are no free slots in the Nano overflow array, meaning the overflow Nano array cannot accommodate the key-value pair, a leaf node structure change operation is triggered, performing a leaf node expansion or leaf node splitting operation.

[0068] In one embodiment, the Nano array and Nano overflow array form multiple groups. Each group contains m Nano storage units in the Nano array and k Nano storage units in the Nano overflow array. m and k are structural parameters determined by each leaf node based on the distribution of the data keys it stores.

[0069] In one embodiment, the linear model is of the form y = kx + b, where x is the data key, k and b are the slope and intercept parameters obtained by fitting, and y is the predicted subscript of the Nano array. The group number is obtained by dividing the subscript y of the Nano array by the number m of Nano storage units in the Nano array contained in each group.

[0070] In one embodiment, the leaf node structure change operation is performed on a group-by-group basis. Leaf node structure change operations include leaf node expansion and leaf node splitting. Both operations require migrating the key values ​​in the original leaf node to the new leaf node. The migration operation is performed on a group-by-group basis, effectively dividing the overall data migration time and reducing the tail latency of the structure change operation. The structure change operation is divided into three phases: migration preparation, group migration, and migration completion.

[0071] Among them, in the migration preparation stage, the operation type is determined according to the data key distribution, that is, the data key distribution stored in the original leaf node determines whether to adopt leaf node expansion or leaf node splitting operation, allocate and initialize new nodes, record the leaf node migration flag, the pointer to the new node, and initialize the group migration metadata; the group migration metadata records the migration status of each group, wherein the status includes not migrated, migrating, and migrated.

[0072] During the group migration phase, the original leaf node and the new leaf node exist in the index at the same time; the index operation accesses the group of the original leaf node or the new leaf node based on the group migration metadata; for write operations, if a leaf node that is being migrated is encountered, a group migration is performed in conjunction with it, and a group that has not yet been migrated is migrated to the new node. Specifically, the index operation determines whether the current leaf node is being migrated based on the leaf node migration flag; if the current leaf node is being migrated, the status of the group corresponding to the data key that needs to be accessed is determined based on the group migration metadata; if the corresponding group has not been migrated, the group in the original leaf node is accessed; if the corresponding group has been migrated, the group in the new leaf node is accessed; if the corresponding group is being migrated, the current index operation is retried. For write operations such as additions, deletions, and modifications, if a leaf node that is being migrated is encountered, the operation is accompanied by a group migration, and a group that has not yet been migrated is migrated to the new node.

[0073] The migration completion phase is performed after all groups of the leaf node have been migrated. For the leaf node expansion operation, a modification operation is performed on the internal index tree to modify the pointer of the original leaf node to the pointer of the new leaf node, and the pointer of the internal index tree is updated to the pointer of the new leaf node. For the leaf node splitting operation, two new leaf nodes are inserted into the internal index tree and the original leaf node is deleted. While the migration completion operation of the leaf node split is in progress, the internal index tree may contain index items pointing to the original leaf node and the new leaf node at the same time. At this time, if the original leaf node is found for the data key access, the corresponding group has been migrated, and the new leaf node is accessed, so the correctness of the access can be guaranteed.

[0074] In one embodiment, the structural parameters of the leaf node include the number m of Nano storage units in the Nano array within the group and the number k of Nano storage units in the Nano overflow array. The leaf node structural parameters are calculated for different group sizes based on a cost model during leaf node creation. The cost model uses data key distribution statistics to calculate the key mapping within the group, calculate the search cost, migration time, and space utilization, and selects parameters that meet tail latency and space requirements while minimizing the search cost. Leaf node creation occurs during initial index generation or when a new leaf node is generated due to a leaf node structural change. When creating a leaf node, given all data keys assigned to the leaf node, the number of data keys mapped to each data unit for each group size is counted, and the number of overflowed data keys is calculated. This allows the search cost, group migration time, migration preparation time, and space utilization of the leaf node to be estimated for that group. By ensuring that both group migration time and migration preparation time are less than the desired tail latency and that space utilization is within the expected range, the leaf node search cost is minimized, thereby achieving the optimal structural parameters.

[0075] In a specific embodiment, the access process of the index structure includes: first searching for the data key to be checked in the internal index tree, finding the leaf node corresponding to the data key to be checked, and searching the rightmost leaf node that satisfies the minimum key of the leaf node is less than or equal to the data key to be checked through the internal index tree. In the rightmost leaf node, the group corresponding to the data key to be checked is calculated by a linear model based on the data key to be checked and the linear model in the leaf node. Then, in the corresponding group, the position of the specific one or two target Nano storage units of the data key to be checked is located by hashing, and the data key is searched in the Nano storage unit of the corresponding Nano array. Finally, if the data key is not found in the Nano storage unit of the corresponding Nano array, and its overflow bit is 1, then continue to search for the data key in the Nano storage unit of the overflow Nano array of the group.

[0076] In one embodiment, the index structure supports concurrent read and write operations; the internal index tree supports concurrent access; concurrent access to leaf nodes is protected by locks, and the granularity of locking is grouped. Each group is locked to maintain read and write consistency for key values ​​within the same group.

[0077] Figure 2 This paper demonstrates a specific example of an in-memory learned index structure. The internal index tree (InnerTree) is a modified implementation of the existing ALEX learned index. ALEX is an updateable learned index that utilizes techniques such as gapped leaf arrays and model-based insertion to support comparisons. In this example, the initial density of ALEX's leaf array is adjusted to 50% full. Furthermore, a function is added to ALEX to find the maximum key less than or equal to the data key, thus supporting inexact searches from a key to a leaf node. This involves finding the rightmost leaf node where the minimum key of the leaf node is less than or equal to the key of the data being searched. In this specific example, the internal index tree can be replaced with other learned indexes or traditional indexes such as B-trees. Experiments show that when the prediction error parameter of the piecewise linear fit is set to 256, the size of the internal index does not exceed 10MB on multiple datasets with an initial size of 100M key-value pairs, making it suitable for server CPU cache.

[0078] like Figure 2As shown in the example, the Nano storage unit is a 256-byte data structure. It contains 15 slots for key-value pairs (8B key, 8B value) and 16 bytes of metadata. This metadata includes a bitmap indicating whether each key-value slot is free, an overflow bit, and a 1-byte hash value fingerprint for the first 14 key-value slots. Key-value pairs are unordered in Nano. Newly inserted key-value pairs can be inserted into any slot with a free bit set to 0. Deleting a key-value pair can set the free bit of the corresponding slot to 0. The search operation uses SIMD to compare the 1-byte hash value with the hash value of the searched key to quickly eliminate unmatched slots. The free bitmap is then used to eliminate free slots, and finally the remaining slots are compared sequentially. If the free bit of the 15th slot is 1, the search operation must compare that slot because the 1-byte hash value fingerprint for the 15th slot is not recorded.

[0079] like Figure 2 The leaf node Leaf shown includes 3 groups, each group includes m=4 Nano storage units of the Nano array and k=1 Nano storage unit of the overflow Nano array.

[0080] Figure 3 The diagram vividly illustrates the process of leaf node structure change. A write request attempts to insert the key value 4 into leaf node A but fails because the overflow Nano array of the target group is full. This triggers a leaf node structure change operation. In the migration preparation phase, the instance decides to expand the leaf node based on the data distribution of the current leaf node, and allocates a new leaf node A'. The migration flag, the pointer to the new node, and the initialization group migration metadata are recorded in the original leaf node A, and the leaf node structure is converted to Figure 3 (b) The system then tries to insert the key value 4 again. The instance detects that the target group has not been migrated yet, so it migrates the group, copies all the key values ​​in the group to the new leaf node, and marks the migration of the group as complete, as shown in Figure 3 (c) shows that another write request to insert key value 12 performs a similar group migration. Once this migration is completed, as shown in Figure 3 As shown in (d), the structural change operation is completed. The instance then updates the internal index and replaces the original pointer to A with the pointer to A'.

[0081] We further evaluated this application using different read-write load ratios on real datasets. The experiment covered six datasets of different complexity, each of which contained five workloads: 100% read, 80% read, 50% read, 20% read, and 0% read. Figure 4As shown in the figure, the comparison objects include the present invention (i.e., LINE shown in the figure), the traditional index B-tree, and four other advanced learning indexes, including PGM, ALEX, LIPP, and DILI. At 100% read load, the throughput of the present invention is at most 4.2 times that of the B-tree and 1.9-3.3 times that of other learning indexes; at 0% read load, the throughput of the present invention is at most 1.9-2.7 times that of other indexes except PGM. The tail latency effect is shown in the figure. Figure 5 As shown in the figure, the horizontal axis is the average latency, and the vertical axis is the maximum latency. The worst-case tail latency of each index at 0% read load is less than 1 millisecond for each dataset, which is up to 12.9-12086 times shorter than other learning indexes.

[0082] Therefore, in summary, the memory learning index structure provided by the present invention is composed of an internal index tree and a leaf node hierarchy, and applies the technology of group hashing in the leaf nodes, and adopts group migration in the leaf node structure change operation, which optimizes the performance of the learning index, mainly including three aspects. The first is for the global complexity of the data set. The present invention controls the size of the internal index tree so that the internal index tree can be placed in the CPU cache, thereby reducing the access cost of the internal structure. The second is for the local complexity of the data set. The present invention uses hashing in each group of the leaf node to even out its local data distribution, and adopts unordered key-value pair storage in Nano, thereby improving the access efficiency and space utilization in the leaf node. The third is to divide the leaf node structure change operation by group migration, so that each group migration in the migration preparation stage, the group migration stage, and the migration completion stage meet the set tail delay requirements, thereby significantly reducing the worst-case tail delay of the learning index.

[0083] Although the embodiments of the present invention have been disclosed above, they are not limited to the applications listed in the description and implementation methods. They can be fully applied to various fields suitable for the present invention. For those familiar with the art, additional modifications can be easily implemented. Therefore, without departing from the general concept defined by the claims and the scope of equivalents, the present invention is not limited to the specific details and illustrations shown and described herein.

Claims

1. A high-performance memory-learning index structure with controllable tail latency, characterized by: Includes internal index tree and leaf node hierarchy; The index items of the internal index tree include the minimum key of the leaf node and the pointer to the leaf node, and the space size of the internal index tree is adapted to the CPU cache; The leaf node hierarchy is composed of a plurality of leaf nodes, each leaf node includes a linear model, a Nano array and a Nano overflow array; the Nano array and the Nano overflow array each include a plurality of Nano storage units, and the Nano array and the Nano overflow array form a plurality of groups; The data keys are mapped to the Nano storage units by hashing within the group; The structural change operation of the leaf nodes is performed in groups.

2. The memory learning index structure according to claim 1, characterized in that The process of establishing the internal index tree includes: Sort the data keys of the data set and calculate the piecewise linear function to fit the data distribution; Create a leaf node for each linear segment and insert the minimum key and node pointer of the leaf node as an index item into the internal index tree; By adjusting the prediction error parameter of the piecewise linear function, the size of the internal index tree is controlled to fit the CPU cache.

3. The memory learning index structure according to claim 1, characterized in that The Nano storage unit is a fixed-length data structure that stores multiple key-value pairs; The Nano storage unit includes slots and meta information, wherein the meta information includes a bitmap marking the idle state of the slots, an overflow bit, and a hash value fingerprint of some slots; The addition and deletion operations of the key-value pairs are implemented by modifying the bitmap; the search operation is performed by comparing the SIMD accelerator keys, and judging whether the Nano overflow array needs to be searched based on the overflow bit.

4. The memory learning index structure according to claim 3, characterized in that: The hash mapping method of the group is: The data key is calculated using a first hash function to determine the position of a first Nano storage unit in the Nano array; if the packet size exceeds a set threshold, the data key is further calculated using a second hash function to determine the position of a second Nano storage unit in the Nano array; If the slots of the first Nano storage unit and the second Nano storage unit are not idle, the key-value pair is stored in the Nano storage unit of the Nano overflow array; if the slots of the Nano overflow array are not idle, a leaf node structure change operation is triggered.

5. The memory learning index structure according to claim 1, characterized in that: The linear model is of the form y=kx+b, where x is the data key, k and b are the slope and intercept parameters obtained by fitting, and y is the subscript of the predicted Nano array; The number of the group is obtained by dividing the subscript of the Nano array by the number of Nano storage units in the Nano array contained in each group.

6. The memory learning index structure according to claim 1, characterized in that: The leaf node structure change operation includes a migration preparation phase, a group migration phase, and a migration completion phase; During the migration preparation phase, the operation type is determined based on the data key distribution, a new node is allocated and initialized, a leaf node migration flag, a pointer to the new node, and initialization group migration metadata are recorded; the group migration metadata records the migration status of each group, where the status includes not migrated, migrating, and migrated, and the operation type includes expansion operation and split operation; During the group migration phase, for index operations, the group of the original leaf node or the new leaf node is accessed based on the group migration metadata. For write operations, if a leaf node is being migrated, a group migration is performed to migrate a group that has not yet been migrated to the new node. In the migration completion phase, during the expansion operation, the pointer of the internal index tree is updated to the pointer of the new leaf node; during the split operation, two new leaf nodes are inserted into the internal index tree and the original leaf node is deleted.

7. The memory learning index structure according to claim 1, characterized in that: The structural parameters of the leaf node include the number of Nano storage units of the Nano array and the number of Nano storage units of the Nano overflow array in the group; The structural parameters are determined by calculating a cost model. The cost model calculates the key mapping situation within the data key distribution statistical group based on the search cost, migration time and space utilization, and selects parameters that meet the tail delay and space requirements and minimize the search cost.

8. The memory learning index structure according to claim 1, characterized in that: The type of the internal index tree is a traditional index or a learning index; The traditional index includes a B-tree, and the learned index includes an ALEX index.

9. The memory learning index structure according to claim 3, characterized in that: The access process of the index structure includes: Search the key of the data to be queried through the internal index tree and select the rightmost leaf node whose minimum key is less than or equal to the key of the data to be queried; In the rightmost leaf node, the group corresponding to the data key to be queried is calculated using a linear model; The target Nano storage unit of the Nano array is searched for in the corresponding group by hash positioning. If not found, the overflow bit is checked and the Nano storage unit of the Nano overflow array is searched.

10. The memory learning index structure according to claim 1, characterized in that: The index structure supports concurrent read and write operations; the internal index tree supports concurrent access; the grouping of leaf nodes maintains read and write consistency through a locking mechanism, and the locking granularity is grouping.