Persistent skip list design for write optimization

By expanding the underlying nodes and setting up master and slave nodes, the problems of high write operation latency and low throughput in the persistent jump table are solved, achieving low data persistence overhead and low write latency, and improving write performance.

CN118820221APending Publication Date: 2024-10-22HOHAI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310410284.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-04-17
Publication Date
2024-10-22

AI Technical Summary

Technical Problem

Existing persistent jump tables have high latency and low throughput problems during write operations. This is mainly due to frequent persistence operations caused by high node height and poor spatial locality, which affects write performance.

Method used

By expanding the underlying nodes to store multiple key values, reducing the height of the jump table, and setting up master and slave nodes in the underlying nodes to avoid copy operations during splits, grouping design and partner node algorithms are used to reduce competition and split overhead.

Benefits of technology

It significantly reduces the number of persistence operations and write latency, improves write throughput and write operation performance in multi-thread scenarios, and achieves low data persistence overhead and low write latency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118820221A_ABST
    Figure CN118820221A_ABST
Patent Text Reader

Abstract

The invention discloses a write-optimized persistent skip list design, and a skip list is an efficient ordered data structure and can be used for quick query, insertion and deletion operations. In a persistent memory environment, due to the problems of high write delay, write amplification and the like of persistent memory equipment, a traditional skip list has a large write operation performance bottleneck. In order to solve the problem, the invention provides a persistent skip list design for write optimization. According to the write-optimized persistent skip list, the extension method of the bottom layer nodes is used, the locality of the traditional skip list is optimized by expanding the bottom layer nodes of the traditional skip list, the height of the skip list is reduced, the number of persistent operation times is greatly reduced, and the write operation efficiency is improved. Secondly, providing a partner node design; the master node and the slave node are arranged in the bottom layer node, and the overhead of splitting of the bottom layer node during write operation is reduced by avoiding additional key value copying operation during node splitting.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] The present invention relates to the field of key-value storage, and in particular to a write-optimized persistent jump table design. Background Art

[0002] A skip list is a randomized data structure that can be used to implement an ordered set or dictionary. Compared with a red-black tree, it has a simpler implementation and better average search performance. With the increase in data volume and the growing storage demand in the big data era, people need a skip list storage solution that can quickly read and write large amounts of data. In this context, using persistent memory to build a skip list has become a popular technology.

[0003] Persistent Memory (PM) is a new type of computer memory technology that is different from traditional dynamic random access memory (DRAM) and mechanical disks. Persistent memory has a data access speed close to DRAM and can achieve persistent data storage like a mechanical disk.

[0004] Implementing skip table storage on persistent memory requires solving the following two problems: 1) How to use the hardware characteristics of persistent memory to improve the read and write speed of the skip table; 2) How to handle the data update and consistency issues of the skip table in persistent memory.

[0005] The current persistent skip table has the problems of high write latency and low write throughput. The high write latency problem mainly comes from a large number of persistent operations. To ensure the persistence of the skip table, the content written to the processor cache needs to be written back to the persistent memory after each write operation. Since the height of the node in the skip table may be very high, the amount of data that needs to be written may be much larger than the key value itself, which will cause high latency.

[0006] The low write throughput problem mainly comes from the poor spatial locality of the skip table and the large number of persistence operations on the upper nodes. Compared with the tree index structure, the skip table is very high and the key values ​​are stored in a discontinuous address space, which leads to poor spatial locality of the skip table and the need for a large number of persistence operations on the upper nodes, resulting in low throughput.

[0007] Compared to DRAM, persistent memory has a higher write latency. However, compared to traditional persistent data storage media, such as disks, persistent memory is still faster to write. Therefore, persistent memory is a better choice in scenarios where data persistence and fast write are required at the same time. This allows us to improve the jump table for DRAM and improve its write performance. Summary of the invention

[0008] In view of the defects of the prior art, an object of the present invention is to provide a write-optimized persistent jump table design.

[0009] The write-optimized persistent skip table design provided by the present invention includes:

[0010] Extension method of underlying nodes: Expand the underlying nodes of traditional skip tables so that they can store multiple key values, provide good locality and reduce the height of the skip table, reduce the number of persistence operations, and thus improve the performance of write operations;

[0011] Partner node design: Set up master and slave nodes in the underlying nodes to reduce the overhead of underlying node splitting during write operations by avoiding additional replication operations during splitting.

[0012] Preferably, the bottom node expansion method includes:

[0013] Component A1: Expanding the capacity of the traditional skip table to 1 key value bottom node, the bottom node of the write-optimized persistent skip table can accommodate up to 63 key values. Compared with the traditional skip table, this has good locality and greatly reduces the height of the upper node, thereby reducing the number of persistence operations. The performance of write operations is improved by utilizing the locality brought by key values ​​stored in continuous address space and the significant reduction in the number of upper node persistence operations due to the greatly reduced height of the upper node.

[0014] Component A2: Organization of the underlying nodes after expansion. The main components of the underlying nodes after expansion are: a 64-bit bitmap, a slot array with a length of 63, a key value array with a length of 63, and a read-write lock. The bitmap is used for persistent control and recording the use status of the key value array, the slot array is used to provide the size order of the key value pairs stored in the underlying node, the key value array is used to store the key value, and the read-write lock is used for contention control.

[0015] Component A3: Read and write operations on the bottom nodes. To read the bottom nodes, you need to first obtain the node read lock, then perform a binary search based on the slot array to determine the target key value position, then read the key value, and finally release the read lock. To write to the bottom nodes, you need to first obtain the node write lock, then perform a binary search based on the slot array to determine the target key value position, then insert the key value at that position. If the node is full, you need to split it, and finally release the write lock.

[0016] Component A4: Grouping design of bottom-level nodes. The bottom-level nodes use grouping design to reduce contention during multi-threaded write operations. The bottom-level nodes divide the key values ​​into 4 groups, i.e. 4 buckets. The remainders of the key values ​​in each bucket when divided by 4 are equal, namely 0, 1, 2, and 3. When a new key value is inserted, its remainder when divided by 4 can be used to quickly determine which bucket it belongs to, thus reducing the contention of multi-threaded write operations to one bucket rather than the entire node.

[0017] Preferably, the partner node design includes:

[0018] Step B1: The bottom layer nodes are divided into master nodes and slave nodes. For each master node, its successor node is its slave node. The master node and the slave node logically constitute a complete bottom layer node.

[0019] Step B2: Each upper layer node corresponds to a complete lower layer node, namely a master node and a slave node. During the indexing process, the master and slave nodes are quickly accessed through pre-fetching operations.

[0020] Step B3: When a write operation requires node splitting, the master-slave relationship of the node is changed through the sibling node splitting algorithm to achieve node splitting without key value replication.

[0021] Preferably, step B2 comprises:

[0022] Step B2.1: The upper node pre-fetches all the master and slave nodes into the processor cache before accessing them. This reduces the number of processor cache misses compared to the general method of accessing the slave node through the successor pointer of the master node, thereby achieving fast access to the master and slave nodes.

[0023] Step B2.2: Compare the version information of the master and slave nodes. If the version information is inconsistent, it means that the master and slave nodes have split during the pre-fetching process, and repeat step B2.1.

[0024] Step B2.3: Search in the master and slave nodes.

[0025] Preferably, step B3 comprises:

[0026] Step B3.1: When a write operation inserts a key value into a bottom-level node and the bottom-level node is full (both the master and slave nodes are full), a split is required.

[0027] Step B3.2: The master and slave nodes acquire write locks.

[0028] Step B3.3: Create a new node, insert it between the master and slave nodes, and set the slave node of the master node to this new node.

[0029] Step B3.4: Create a new node and insert it after the slave node. Set the slave node as the master node and the new node as its slave node.

[0030] Step B3.5: Since the slave node is the successor node of the master node, the key values ​​contained in it are all greater than the key values ​​contained in the master node, so there is no need to move or copy the key values ​​in the master and slave nodes.

[0031] Step B3.6: Release the read locks of the master and slave nodes, and the split is complete.

[0032] A write-optimized persistent jump table design provided by the present invention includes:

[0033] The expansion method of the bottom nodes: expand the bottom nodes of the traditional skip table, optimize its locality and reduce the height of the skip table, greatly reduce the number of persistence operations, and improve the efficiency of write operations;

[0034] Partner node design: Set up master and slave nodes in the underlying nodes to reduce the overhead of underlying node splitting during write operations by avoiding additional replication operations during splitting.

[0035] Compared with the prior art, the present invention has the following beneficial effects:

[0036] 1. Low data persistence overhead. By expanding the underlying nodes, the height of the jump table is reduced, thereby reducing the number of upper-level nodes that need to perform persistence operations and reducing data persistence overhead.

[0037] 2. High write throughput: By adopting the grouping design of the underlying nodes, the competition during multi-threaded write operations is reduced, thereby improving the write throughput in multi-threaded scenarios.

[0038] 3. Low write latency. The partner node algorithm greatly reduces the underlying node splitting overhead during the insertion process, thereby reducing write latency. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 It is the overall framework diagram of the present invention.

[0040] Figure 2 The figure is a schematic diagram of a bottom-level node expansion method according to a specific embodiment of the present invention.

[0041] Figure 3 The figure is a schematic diagram of the organization of the bottom-level nodes after expansion according to a specific embodiment of the present invention.

[0042] Figure 4 The figure is a schematic diagram of the grouping design of the bottom layer nodes according to a specific embodiment of the present invention.

[0043] Figure 5 The figure is a schematic diagram of the bottom-level node persistence operation according to a specific embodiment of the present invention.

[0044] Figure 6 The following is a schematic diagram of a bottom-level node insertion operation according to a specific embodiment of the present invention.

[0045] Figure 7 A schematic diagram of a partner node splitting operation according to a specific embodiment of the present invention. DETAILED DESCRIPTION

[0046] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments. It should be understood that these embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention. After reading the present invention, various equivalent forms of modifications to the present invention by those skilled in the art all fall within the scope defined by the claims attached to this application.

[0047] According to a write-optimized persistent skip table design provided by the present invention, Figure 1 As shown, including:

[0048] Extension method of underlying nodes: Expand the underlying nodes of traditional skip tables so that they can store multiple key values, provide good locality and reduce the height of the skip table, reduce the number of persistence operations, and thus improve the performance of write operations;

[0049] Partner node design: Set up master and slave nodes in the underlying nodes to reduce the overhead of underlying node splitting during write operations by avoiding additional replication operations during splitting.

[0050] Specifically, the expansion method of the bottom node of the write-optimized persistent skip table is as follows: Figure 2 As shown, it includes the following components:

[0051] Component A1: Expanding the capacity of the traditional skip table to 1 key value bottom node, the bottom node of the write-optimized persistent skip table can accommodate up to 63 key values. Compared with the traditional skip table, this has good locality and greatly reduces the height of the upper node, thereby reducing the number of persistence operations. The performance of write operations is improved by utilizing the locality brought by key values ​​stored in continuous address space and the significant reduction in the number of upper node persistence operations due to the greatly reduced height of the upper node.

[0052] Component A2: The organization of the underlying nodes after expansion. Figure 3 As shown in the figure, the main components of the expanded underlying node are: a 64-bit bitmap, a slot array with a length of 63, a key value array with a length of 63, and a read-write lock. The bitmap is used for persistent control and recording the use status of the key value array, the slot array is used to provide the size order of the key value pairs stored in the underlying node, the key value array is used to store the key value, and the read-write lock is used for contention control.

[0053] Component A3: Read and write operations on the bottom nodes. To read the bottom nodes, you need to first obtain the node read lock, then perform a binary search based on the slot array to determine the target key value position, then read the key value, and finally release the read lock. To write to the bottom nodes, you need to first obtain the node write lock, then perform a binary search based on the slot array to determine the target key value position, then insert the key value at that position. If the node is full, you need to split it, and finally release the write lock.

[0054] Component A4: Grouping design of underlying nodes. The underlying nodes use grouping design to reduce contention during multi-threaded write operations. Figure 4 As shown in the figure, the bottom node divides the key values ​​into 4 groups, namely 4 buckets. The remainders of the key values ​​in each bucket divided by 4 are equal, namely 0, 1, 2, and 3. When a new key value is inserted, its remainder divided by 4 can be used to quickly determine which bucket it belongs to, thus reducing the competition for write operations to one bucket rather than the entire node.

[0055] Specifically, for component A3, the maximum number of key values ​​that can be accommodated by the bottom node is 63. However, in actual implementation, it can be determined according to the actual situation, and the bitmap can also be adjusted to be greater than 63.

[0056] To better illustrate how the underlying nodes achieve persistence and ensure consistency, refer to Figure 5 For explanation. For the convenience of explanation, assume that the number of key values ​​that the node can accommodate is 3, then the bitmap is 4 bits. The last bit of the bitmap represents whether the current node state is consistent (0 is consistent, 1 is inconsistent), and this bit is used to ensure the consistency of the underlying nodes. The other bits of the bitmap represent whether the corresponding key value array position is occupied. Each element of the slot array is used to indicate the size order of the key value to which it corresponds. 2, 0, and 1 in the slot array correspond to key values ​​94, 12, and 55, respectively. This indicates that the key values ​​are sorted from small to large as 12, 55, and 94.

[0057] To better illustrate how the insertion operation is completed at the bottom level, refer to Figure 6 For explanation. For the convenience of explanation, assume that the number of key values ​​that the node can accommodate is 3, then the graph is 4 bits. The key values ​​20 and 99 are stored. Now insert 75. The slot array indicates the size order of the corresponding positions in the key value array. Before insertion: the key values ​​in the node are arranged from small to large as 20, 99. It is about to be inserted, and the last bit of the bitmap is changed to 1, indicating that the insertion operation is currently being performed, and the node status is inconsistent. The key value is inserted, but the persistence operation is not performed. The slot array changes, the key value array changes, and the corresponding position of the bitmap is 1. The key values ​​in the current node are 20, 75, 99 from small to large, and the status is still inconsistent. The persistence operation is completed, and the last bit of the bitmap is changed to 0. The node status is consistent and the insertion is completed.

[0058] Specifically, the partner node design includes the following components:

[0059] Step B1: The bottom layer nodes are divided into master nodes and slave nodes. For each master node, its successor node is its slave node. The master node and the slave node logically constitute a complete bottom layer node.

[0060] Step B2: Each upper layer node corresponds to a complete lower layer node, namely a master node and a slave node. During the indexing process, the master and slave nodes are quickly accessed through pre-fetching operations.

[0061] Step B3: When a write operation requires node splitting, the master-slave relationship of the node is changed through the sibling node splitting algorithm to achieve node splitting without key value replication.

[0062] Specifically, the step B2 includes the following components:

[0063] Step B2.1: The upper node pre-fetches all the master and slave nodes into the processor cache before accessing them. This reduces the number of processor cache misses compared to the general method of accessing the slave node through the successor pointer of the master node, thereby achieving fast access to the master and slave nodes.

[0064] Step B2.2: Compare the version information of the master and slave nodes. If the version information is inconsistent, it means that the master and slave nodes have split during the pre-fetching process, and repeat step B2.1.

[0065] Step B2.3: Search in the master and slave nodes.

[0066] Specifically, the step B3 includes the following components:

[0067] Step B3.1: When a write operation inserts a key value into a bottom-level node and the bottom-level node is full (both the master and slave nodes are full), a split is required.

[0068] Step B3.2: The master and slave nodes acquire write locks.

[0069] Step B3.3: Create a new node, insert it between the master and slave nodes, and set the slave node of the master node to this new node.

[0070] Step B3.4: Create a new node and insert it after the slave node. Set the slave node as the master node and the new node as its slave node.

[0071] Step B3.5: Since the slave node is the successor node of the master node, the key values ​​contained in it are all greater than the key values ​​contained in the master node, so there is no need to move or copy the key values ​​in the master and slave nodes.

[0072] Step B3.6: Release the read locks of the master and slave nodes, and the split is complete.

[0073] To better illustrate the implementation principle of partner node design and its connection with the index layer, refer to Figure 7For explanation. Each node in the index layer will have two pointers pointing to the master node and slave node of the corresponding logical underlying node. When executing the index, the two addresses can be taken out at once through the prefetch instruction, so this does not affect the indexing efficiency. When the split occurs, the partner node design follows the above operation to generate new nodes C and D respectively, and B is changed from a slave node to a master node, and the split is completed. It can be seen that there is no operation of copying data from A to B in the traditional split, so the performance is improved.

[0074] Specifically, for step B3.3, attention should be paid to the order of acquiring write locks of the middle and slave nodes. The write locks should be acquired in the order of master first and slave later, otherwise a deadlock will occur.

[0075] Specifically, for step B3.6, attention should be paid to the order of releasing the write locks of the master and slave nodes. The write locks should be released in the order of master first and slave later, otherwise deadlock will occur.

[0076] A write-optimized persistent jump table design provided by the present invention includes:

[0077] The expansion method of the bottom nodes: expand the bottom nodes of the traditional skip table, optimize its locality and reduce the height of the skip table, reduce the number of persistence operations, and improve the efficiency of write operations;

[0078] Partner node design: Set up master and slave nodes in the underlying nodes to reduce the overhead of underlying node splitting during write operations by avoiding additional replication operations during splitting.

[0079] In the description of the present application, it should be understood that the terms "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present application.

[0080] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. In the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.

Claims

1. A write-optimized persistent jump table design, characterized in that: include: Extension method of underlying nodes: Expand the underlying nodes of traditional skip tables so that they can store multiple key values, provide good locality and reduce the height of the skip table, reduce the number of persistence operations, and thus improve the performance of write operations; Partner node design: For the underlying nodes, set up master nodes and slave nodes. The master-slave node design reduces the overhead of underlying node splitting during write operations by avoiding additional data replication operations during splitting.

2. A write-optimized persistent jump table design according to claim 1, characterized in that: Extension method of the underlying node: Component A1: Expanding the capacity of the traditional skip table to 1 key value bottom node, the bottom node of the write-optimized persistent skip table can accommodate up to 63 key values. Compared with the traditional skip table, this design has good locality and can significantly reduce the height of the upper node, thereby reducing the number of persistence operations. The performance of write operations is improved by utilizing the locality brought by key values ​​stored in continuous address space and the significant reduction in the number of upper node persistence operations due to the significant reduction in the height of the upper node. Component A2: Organization of the underlying nodes after expansion. The main components of the underlying nodes after expansion are: a 64-bit bitmap, a slot array with a length of 63, a key value array with a length of 63, and a read-write lock. The bitmap is used for persistent control and recording the use status of the key value array, the slot array is used to provide the size order of the key value pairs stored in the underlying node, the key value array is used to store the key value, and the read-write lock is used for contention control. Component A3: Read and write operations on the bottom nodes. To read the bottom nodes, you need to first obtain the node read lock, then perform a binary search based on the slot array to determine the target key value position, then read the key value, and finally release the read lock. To write to the bottom nodes, you need to first obtain the node write lock, then perform a binary search based on the slot array to determine the target key value position, then insert the key value at that position. If the node is full, you need to split it, and finally release the write lock. Component A4: Grouping design of bottom-level nodes. The bottom-level nodes use grouping design to reduce contention interference during multi-threaded write operations. The bottom-level nodes divide the key values ​​into 4 groups, i.e. 4 buckets. The remainders of the key values ​​in each bucket when divided by 4 are equal, namely 0, 1, 2, and 3. When a new key value is inserted, the remainder when divided by 4 is used to determine which bucket it belongs to, thus reducing the contention of the write operation to one bucket rather than the entire node.

3. A write-optimized persistent skip table design according to claim 1, characterized in that: Partner Node Design: Step B1: The bottom layer nodes are divided into master nodes and slave nodes. For each master node, its successor node is its slave node. The master node and the slave node logically constitute a complete bottom layer node. Step B2: Each upper layer node corresponds to a complete lower layer node, namely a master node and a slave node. During the indexing process, fast master and slave node access is accomplished with the help of pre-fetch instructions. Step B3: When a write operation requires node splitting, the master-slave relationship of the node is changed through the sibling node splitting algorithm to achieve node splitting without key value replication.

4. The partner node design according to claim 3, characterized in that: Step B2: Step B2.1: The upper node pre-fetches all the master and slave nodes into the processor cache before accessing them. Through data pre-fetching, the method of accessing the slave node by the successor pointer of the master node reduces the number of processor cache misses, thereby achieving fast access to the master and slave nodes. Step B2.2: Compare the version information of the master node and the slave node. If the version information is inconsistent, it means that the master node and the slave node have split during the pre-fetching process, and repeat step B2.

1. Step B2.3: Search for data in the master node and the slave node.

5. The partner node design according to claim 3, characterized in that: Step B3: Step B3.1: When a write operation inserts a key value into a bottom-level node and the bottom-level node is full (both the master and slave nodes are full), a split is required. Step B3.2: The master node and the slave node acquire the write lock. Step B3.3: Create a new node, insert it between the master and slave nodes, and set the slave node of the master node to this new node. Step B3.4: Create a new node and insert it after the slave node. Set the slave node as the master node and the new node as its slave node. Step B3.5: Since the slave node is the successor node of the master node, the key values ​​contained in it are greater than the key values ​​contained in the master node, so there is no need to move and copy the key values ​​in the master and slave nodes. Step B3.6: Release the read locks of the master and slave nodes, and the split is complete.

6. A write-optimized persistent jump table design, characterized in that: include: The expansion method of the bottom nodes: expand the bottom nodes of the traditional skip table, optimize its locality and reduce the height of the skip table, reduce the number of persistence operations, and improve the efficiency of write operations; Partner node design: Set up master and slave nodes in the underlying nodes to reduce the overhead of underlying node splitting during write operations by avoiding additional replication operations during splitting.

Citation Information

Patent Citations

  • Data writing optimization method

    CN106569739A

  • Read-write performance optimization method based on persistent memory B + tree index

    CN115422182A