Separated key-value pair storage system

By modifying the NVMe read instructions and using the filter TFilter in the detached key-value storage system, combined with the two-level cache and buffer queue design, the problem of network traffic overhead when transmitting data in the detached key-value storage system was solved, and improved Transfer rate and cache space utilization.

CN118550474APending Publication Date: 2024-08-27HUAZHONG UNIV OF SCI & TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410861077.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-08-27

AI Technical Summary

Technical Problem

The detached key-value storage system has a large network traffic overhead when transmitting data, which limits the transmission rate of the system.

Method used

By modifying the NVMe read command on the host side, the key-value offset value is stored in the free field of the read command, and the filter TFilter is used on the storage side to filter out the target key-value pair, and only the target key-value pair is sent, combined with the two-level cache Structure and buffer queue design reduce network transmission data volume and I/O times.

Benefits of technology

It effectively reduces the network traffic overhead of transmitting data, increases the transmission rate, and optimizes cache space utilization and network traffic in the write process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550474A
    Figure CN118550474A
Patent Text Reader

Abstract

The invention belongs to the technical field related to information storage, and discloses a separated key-value pair storage system, which comprises a host end and a storage end, and is characterized in that the host end remotely accesses the storage end through an RDMA (Remote Direct Memory Access) network; the host end is used for receiving a read request of a user and searching for a target key value pair from the host end, if the target key value pair is not hit, an NVMe read instruction is modified, high 32 bits and low 32 bits of a key value pair offset value are filled into the NVMe read instruction respectively, and the NVMe read instruction is sent to the storage end; the storage end analyzes TFilter metadata used for positioning a target key-value pair in the NVMe read instruction, searches the target key-value pair from the SGE, modifies the initial address and length of the SGE according to the TFilter metadata so as to filter the key-value pairs except the target key-value pair, and sends the key-value pairs to the host end as to-be-sent SGE. In the system, the target key value pair is sent after being filtered out, so that the network flow overhead of data transmission is greatly reduced, and the transmission rate is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field related to information storage, and more specifically, relates to a separated key-value pair storage system. Background Art

[0002] In the new data center architecture, storage resources and computing resources are decoupled and interconnected through high-speed networks. This can address the problems of insufficient storage resource expansion capabilities, low utilization, and weak performance in storage servers in traditional architectures.

[0003] However, scenarios involving resource interaction and data transmission over the network place higher demands on the infrastructure of data centers. Network bandwidth is a key factor limiting system performance and scalability. Since all I / O requests and their responses pass through the network, such a large amount of round-trip data transmission puts tremendous pressure on the network bandwidth, thereby limiting the transmission rate.

[0004] Therefore, how to reduce the network traffic overhead of transmitting data in a separated key-value storage system is a technical problem that needs to be solved urgently. Summary of the invention

[0005] In view of the above defects or improvement needs of the prior art, the present invention provides a separate key-value pair storage system, which aims to reduce the network traffic overhead of transmitting data in the separate key-value pair storage system and increase the transmission rate.

[0006] To achieve the above object, the present invention provides a separated key-value pair storage system, including a host end and a storage end, wherein the host end remotely accesses the storage end through an RDMA network; the host end has a driver NVMe-oF Initiator for initiating remote access, and the storage end has a driver NVMe-oF Target for receiving remote access and a solid-state hard disk for storing data, and the NVMe-oF Target is provided with a filter TFilter;

[0007] The host end is used to receive a user's read request and search for a target key-value pair from the host end. If a hit is found, feedback is returned to the user. If a hit is not found, the NVMe read instruction is modified, and the high 32 and low 32 bits of the key-value pair offset value are respectively filled into the second double word and the third double word of the NVMe read instruction, and the operation code of the NVMe read instruction is modified, and the modified NVMe read instruction is sent to the storage end;

[0008] The storage end is used to receive the NVMe read instruction sent by the host end and parse the TFilter metadata used to locate the target key-value pair, find the target key-value pair from the scatter-gather unit SGE of the NVMe-oF Target, and use TFilter to modify the starting address and length of the SGE with the target key-value pair according to the TFilter metadata as the SGE to be sent, filter the key-value pairs other than the target key-value pair, so that the SGE to be sent contains only the target key-value pair and is sent to the host end;

[0009] The host end is also used to receive the SGE sent by the storage end, obtain the target key-value pair and return it to the user.

[0010] Further, a target key-value pair is found from the scatter-gather unit SGE of the NVMe-oF Target, and a starting address and a length of the SGE having the target key-value pair are modified by TFilter according to TFilter metadata as the SGE to be sent, including:

[0011] When the target key-value pairs all exist in the same SGE, only the starting address and length of the corresponding SGE are modified as the SGE to be sent;

[0012] When the key-value pair spans multiple SGEs, the starting address and length of each SGE spanned are modified as the SGE to be sent.

[0013] Furthermore, the system also has a two-level cache structure TCache, which is a cache KV Cache located at the host end and a cache Block Cache located at the storage end;

[0014] The host end is used for:

[0015] During the writing of the key-value pair, the key-value pair to be stored in the storage end is synchronously written into the KV Cache;

[0016] During the reading of the key-value pair, the target key-value pair is first searched in the KV Cache. If a hit is found, feedback is returned to the user. If a hit is not found, a modified NVMe read instruction is sent to the storage end.

[0017] The storage end is used to: first search for a target data block with a target key-value pair in the Block Cache according to an NVMe read instruction; if a hit is found, the target data block is stored in the SGE and then the target key-value pair in the SGE is sent to the host end; if a hit is found, the target data block is extracted from the hard disk to the Block Cache, and the target data block is stored in the SGE and then the target key-value pair in the SGE is sent to the host end.

[0018] Further, the KV Cache includes a first hash table index, a plurality of first LRU linked lists, and a plurality of large page memory buffers corresponding to the first LRU linked lists one by one, wherein the first hash table index is used to locate a key-value pair in the first LRU linked list according to the size of the key-value pair, and different first LRU linked lists are used to store key-value pairs of different sizes;

[0019] The Block Cache includes a second hash table index, a second LRU linked list and a DMA buffer, wherein the second LRU linked list is used to store a data block pointer pointing to the DMA buffer, and the second hash table index is used to locate the data block pointer of the second LRU linked list according to the Slab number and block number of the data block;

[0020] Writing the new key-value pair into the KV Cache includes: storing the key-value pair into a first LRU linked list for storing key-value pairs of the same size;

[0021] The searching for a target key-value pair in the KV Cache comprises: judging whether the target key-value pair exists in the KV Cache according to the first hash table index, and if so, reading the target key-value pair from the corresponding first LRU linked list; if not, sending a modified NVMe read instruction to the storage end;

[0022] The searching for a target data block having a target key-value pair in the Block Cache includes: determining whether the target data block exists in the Block Cache according to a second hash table index; if so, locating a data block pointer according to the second hash table index and extracting the target data block pointed to by the data block pointer; if not, extracting the target data block from the solid-state drive to the DMA buffer, and extracting a target key-value pair from the target data block and sending it to the host end.

[0023] Furthermore, the host end further includes a buffer queue, the buffer queue has a plurality of buffer spaces TBuffer, and the host end is also used to write key-value pairs, and the process of writing key-value pairs includes:

[0024] Write the key-value pair into the TBuffer at the head of the queue. When the TBuffer is full, an asynchronous write I / O request is triggered.

[0025] Submit the full TBuffer for flushing and then dequeue it, and the queue head pointer points to the next TBuffer for subsequent writing;

[0026] Write the key-value pair into the TBuffer pointed to by the new queue head pointer;

[0027] After waiting for the write I / O of TBuffer to be asynchronously flushed to complete, the TBuffer that has completed data flushing is added back to the tail of the queue to serve subsequent writes.

[0028] Furthermore, the host end is used to batch-flush the TBuffers submitted for flushing, and when a maximum flushing time interval is reached, flush the data of the TBuffers submitted for flushing to the storage end.

[0029] Furthermore, the host side includes multiple buffer queues, and the TBuffer in each buffer queue is used to store key-value pairs of different sizes. The host side is used to select a TBuffer for storing the same size to write the key-value pair according to the size of the key-value pair.

[0030] Furthermore, the host side is also allocated with multiple queue pairs QP, each queue pair includes a request sending queue SQ and a request completion queue CQ. When the host side sends an I / O request to the storage side, the I / O request is written into the SQ in one of the QPs, and the foreground thread polls the CQ to obtain the processing result.

[0031] Furthermore, the multiple queue pairs QP are divided into QPs corresponding to read requests and QPs corresponding to write requests. When executing a read request, the host side applies to use the QP of the read request, and when executing a write request, the host side applies to use the QP of the write request.

[0032] Furthermore, the storage end is also used to perform space allocation, and the space allocation process includes:

[0033] Create a new Slab logical file, allocate an initial data segment with a length of 1 data block, and append it to the end of the ordered array that stores the data segment position and length information maintained by the metadata;

[0034] When applying to expand the file size, a new data segment with a length equal to the sum of the lengths of the existing data segments is allocated to the target Slab, and its metadata is updated;

[0035] When the mth data block is obtained, the position of the corresponding data segment in the meta information is its binary digit k, and the offset in the data segment is calculated by the following formula: offset = m-2k-1.

[0036] In general, compared with the prior art, the above technical solutions conceived by the present invention mainly have the following beneficial effects:

[0037] 1. The separated key-value pair storage system proposed in the present invention is divided into a host end and a storage end. When the host end needs to read a key-value pair from the storage end, the traditional NVMe read instruction is modified, and the key-value pair offset value is stored in the free field in the NVMe read instruction and sent to the storage end. The storage end can parse the NVMe read instruction, obtain the TFilter metadata that can filter out the target key-value pair, and use the filter TFilter in combination with the TFilter metadata to filter the data of the scattered aggregation unit SGE, filter out the key-value pairs other than the target key-value pair, and only retain the target key-value pair as the SGE to be sent and send it to the host end through the network. In the above system, since the NVMe read instruction is modified on the host end and the filter TFilter is added on the storage end, the target key-value pair in the original SGE can be filtered out and then sent. Compared with transmitting the entire SGE to the host end for parsing, the network traffic overhead of transmitting data is greatly reduced, and the transmission rate is provided.

[0038] 2. Furthermore, by designing a two-level cache structure TCache, the problem of low utilization of coarse-grained cache space can be solved. A fine-grained two-layer cache across the host and storage ends is designed to reduce network transmission and I / O times.

[0039] 3. Furthermore, by designing the TBuffer queue, the problem of frequent flushing of dirty pages in the write process can be solved. When writing key-value pairs, the write request is received through the TBuffer queue to avoid the redundant network traffic overhead caused by flushing every time a key-value pair is updated. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 is a structural block diagram of a separate key-value pair storage system in an embodiment of the present invention;

[0041] Figure 2 is a schematic diagram of a storage end filtering a data block in an embodiment of the present invention;

[0042] Figure 3 is a schematic diagram of an NVMe read instruction in one embodiment of the present invention;

[0043] Figure 4 1 is a schematic diagram of filtering SGE in an embodiment of the present invention, wherein (a) is a schematic diagram of filtering when a target key-value pair exists in a single SGE, and (b) is a schematic diagram of filtering when a target key-value pair spans multiple SGEs;

[0044] Figure 5 is a schematic diagram of the structure of TCache in one embodiment of the present invention;

[0045] Figure 6 is a schematic diagram of the structure of a KV Cache in an embodiment of the present invention;

[0046] Figure 7 is a schematic diagram of the structure of a Block Cache in an embodiment of the present invention;

[0047] Figure 8 is a schematic diagram of the structure of a TBuffer queue in an embodiment of the present invention;

[0048] Fig. 9 is a workflow diagram of a TBuffer queue in one embodiment of the present invention;

[0049] Fig.10 is a schematic diagram of the structure of a garbage collection mechanism on the near data side in one embodiment of the present invention;

[0050] Fig.11 is a schematic diagram of the allocation of queues to QPs in one embodiment of the present invention;

[0051] Fig.12 It is a structural diagram of a simplified Slab space allocation strategy in one embodiment of the present invention;

[0052] Fig.13 It is a simplified schematic diagram of the Slab data block positioning process in one embodiment of the present invention. DETAILED DESCRIPTION

[0053] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention 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 invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0054] like Figure 1 The structure diagram of the separated key-value storage system in one embodiment of the present invention is shown, and the system is referred to as TrickleKV below, which includes a host end and a storage end. The host end remotely accesses the storage end through the RDMA network; the host end has a driver NVMe-oF Initiator for initiating remote access, and the storage end has a driver NVMe-oFTarget for receiving remote access and a solid-state hard disk for storing data, and the NVMe-oF Target is provided with a filter TFilter. The host end is used to receive the user's read instructions and write instructions, extract key-value pairs according to the read instructions, and write key-value pairs according to the write instructions. The storage end is used to store key-value pairs and provide the key-value pairs to be extracted to the host end.

[0055] Based on the above separated key-value pair storage system, the operation mode of the system is described in detail below.

[0056] Example 1

[0057] like Figure 2 The figure shows a schematic diagram of a storage end filtering a data block in an embodiment of the present invention. When a user sends a read request to the system, the system responds as follows:

[0058] The host receives the user's read request and searches for the target key-value pair from the host. If it hits, feedback is returned to the user. If it does not hit, the NVMe read instruction is modified, and the high 32 and low 32 bits of the key-value pair offset value are filled into the second double word and the third double word of the NVMe read instruction respectively, and the operation code of the NVMe read instruction is modified, and the modified NVMe read instruction is sent to the storage end;

[0059] The storage end receives the NVMe read command sent by the host end and parses the TFilter metadata used to locate the target key-value pair, searches for the target key-value pair from the scatter-gather unit SGE of the NVMe-oF Target, and uses TFilter to modify the starting address and length of the SGE with the target key-value pair according to the TFilter metadata as the SGE to be sent, filters the key-value pairs other than the target key-value pair, and sends the SGE to the host end after only containing the target key-value pair;

[0060] The host side then receives the SGE sent by the storage side, obtains the target key-value pair and returns it to the user.

[0061] In this process, by pushing down the step of filtering key-value pairs from data blocks to the storage layer for execution, the impact of cross-network read requests on network bandwidth can be greatly alleviated. At the same time, in order to reduce the additional metadata transmission overhead, a metadata transmission scheme based on NVMe read instructions is designed. The host side reads the key-value pairs by directly calling the modified NVMe read instructions, and uses the free fields in the NVMe command to store the filtering metadata. In addition, by taking advantage of the self-developable characteristics of the SPDK user-mode driver, filtering operations are performed directly on the Scatter Gather Element (SGE) data of the RDMA transport layer to achieve zero copy of data.

[0062] like Figure 3The figure shows a schematic diagram of an NVMe read instruction in one embodiment of the present invention. In the process of filtering out key-value pairs from a data block, TFilter needs the participation of filtering conditions, i.e., metadata. In TrickleKV, the filtering condition is expressed as the location information of the key-value pair in the data block. In order to reduce the additional metadata transmission overhead, the metadata required by TFilter is filled into the free space in the NVMe command by reusing the path for transmitting NVMe commands in the NVMe-oF protocol, reducing an additional remote procedure call (RPC) and hiding the network bandwidth overhead caused by metadata transmission. Specifically, the metadata of TFilter is first filled into the free field of the NVMe read command through the encoding process of bitwise splitting on the host side, and then transmitted to the storage side together with the NVMe command through the RDMA network, and then decoded and recombined into the metadata of TFilter, and finally cooperated with TFilter to filter out the key-value pairs required for the read request from the data block. According to the NVM command set specification, an NVMe command has a fixed length of 16 double words (DWORD), i.e., 64 bytes. Since the length of NVMe commands is fixed, redundant space must exist to be compatible with all types of commands. Since TrickleKV has no requirements on whether the NVMe device is in end-to-end protection mode, and the metadata is only a 64-bit key-value pair offset value, the second and third double words are directly filled in, and the operation code is modified to distinguish it from the original NVMe read command.

[0063] NVMe-oF Target is divided into RDMA transport layer and fast device layer. Preferably, TFilter is deployed in the RDMA transport layer.

[0064] like Figure 4 The figure shows a schematic diagram of filtering SGE in an embodiment of the present invention. The data blocks read from the hard disk by the storage end are organized in a dispersed and aggregated manner. The SGE array is used to describe multiple physically discontinuous memory spaces. Each SGE represents a small continuous memory space, and records its starting address and length as well as the Lkey used to establish the RDMA connection. The starting address and length of the key-value pair are located through the metadata of TFilter, and the discussion is classified according to whether the key-value pair spans multiple SGEs:

[0065] (1) If the key-value pair is in a single SGE, such as Figure 4 As shown in (a), the starting address and length of SGE are modified directly according to the TFilter metadata, and the SGE is used as the only element of the SGE array, so that the data to be sent by the RDMA transport layer is only the target key-value pair;

[0066] (2) If the key-value pair spans multiple SGEs, such as Figure 4As shown in (b), the starting address and length of each SGE in the SGE array are modified in sequence according to the TFilter metadata, and only the SGE involved in the target key-value pair is retained in the array.

[0067] This solution avoids copying data blocks by modifying the starting address and length of SGE in situ at the RDMA transport layer, thus completing the zero-copy key-value pair filtering process.

[0068] Example 2

[0069] Furthermore, the separated key-value pair storage system also has a two-level cache structure TCache, such as Figure 5 FIG. 1 is a schematic diagram of the structure of TCache in an embodiment of the present invention, wherein TCache includes a cache KV Cache located at the host end and a cache Block Cache located at the storage end. TCache is involved in both data writing and reading processes.

[0070] When a user sends a write request to the system, the host is responsible for storing the new key-value pair in the storage end and also updating the new key-value pair to the KV Cache.

[0071] When a read request is sent to the system, the response process is as follows:

[0072] The host first searches for the target key-value pair in the KV Cache. If a hit is found, feedback is returned to the user. If a hit is not found, the modified NVMe read instruction is sent to the storage end according to the method of Example 1.

[0073] The storage end first searches for a target data block with a target key-value pair in the Block Cache according to the NVMe read instruction. If a hit is found, the target data block is stored in the SGE and then the target key-value pair in the SGE is sent to the host end in the manner of Example 1. If a hit is not found, the target data block is extracted from the hard disk to the Block Cache, and the target data block is stored in the SGE and then the target key-value pair in the SGE is sent to the host end in the manner of Example 1.

[0074] The host stores the target key-value pair in KV Cache and feeds it back to the user.

[0075] like Figure 6 The figure shows a structural diagram of the KV Cache in an embodiment of the present invention. The KV Cache includes a first hash table index, multiple first LRU linked lists, and multiple large page memory buffers corresponding one-to-one to the first LRU linked lists. The first hash table index is used to locate the key-value pairs in the first LRU linked list according to the size of the key-value pairs. Different first LRU linked lists are used to store key-value pairs of different sizes.

[0076] like Figure 7The figure shows a schematic diagram of the structure of the Block Cache in one embodiment of the present invention. The Block Cache includes a second hash table index, a second LRU linked list and a DMA buffer. The second LRU linked list is used to store data block pointers pointing to the DMA buffer. The second hash table index is used to locate the data block pointer of the second LRU linked list according to the Slab number and block number of the data block.

[0077] Writing a new key-value pair into the KV Cache includes: storing the key-value pair into a first LRU linked list for storing key-value pairs of the same size;

[0078] Searching for a target key-value pair in the KV Cache, including: determining whether the target key-value pair exists in the KV Cache according to the first hash table index, and if so, reading the target key-value pair from the corresponding first LRU linked list; if not, sending a modified NVMe read instruction to the storage end;

[0079] Searching for a target data block with a target key-value pair in the Block Cache includes: determining whether the target data block exists in the Block Cache according to a second hash table index; if so, locating a data block pointer according to the second hash table index and extracting the target data block pointed to by the data block pointer; if not, extracting the target data block from the solid-state drive to a DMA buffer, and extracting a target key-value pair from the target data block and sending it to a host.

[0080] Specifically, TCache consists of two levels of cache across the host and storage, including the KV Cache on the host and the Block Cache on the storage. For a read request, it first enters the first level of TCache and searches the KV Cache on the host according to the requested Key value. If it hits, it can return directly. Otherwise, the asynchronous read I / O request initiated by the host to the storage will enter the second level of TCache and search the Block Cache on the storage. If it hits, further read I / O to the hard disk can be avoided.

[0081] KV Cache consists of a hash table index, LRU linked lists of different key-value pair sizes, and a large page memory buffer. The key of the hash table index is the key of the key-value pair, and the hash table can quickly index the cache page in the LRU linked list. The preset LRU linked list is matched according to the key-value pair size. The LRU algorithm is used in the linked list to evict and replace cache pages. The key-value pair sizes that cannot be matched are maintained by a separate extra LRU linked list. An independent cache pool is set for the cache pages in the LRU linked list of the preset cache page size, and multiple fixed-length cache pages are allocated in advance for use, which can reduce the overhead of common operations such as applying for allocation and releasing cache pages. The cache pages in the extra LRU linked list can only be applied individually because the size cannot be predicted, but most operations can be within the preset key-value pair size range.

[0082] The hash table index and LRU linked list of Block Cache are embedded in the block device layer of the NVMe-oF Target driver on the storage side. The key of the hash table is composed of the Slab number and block number of the data block to ensure the uniqueness of the key. The content cached in the LRU linked list is not the data block itself, but a pointer to the data block memory. When the Target driver processes a read request, it reads the data block into the DMA buffer. The Block Cache reuses the buffer memory and delays the release of the data block buffer. After the data block is read from the hard disk to the buffer, the operation of returning the buffer memory to the memory pool is skipped, and the pointer of the new cache page is pointed to the buffer. When the Block Cache capacity is full and eviction replacement occurs, the buffer memory pointed to by the evicted page is returned to the memory pool. This design can avoid the copy overhead of the data block between the buffer and the BlockCache cache page with a single pointer operation.

[0083] In this embodiment, by designing a two-level cache structure TCache, the problem of low utilization of coarse-grained cache space can be solved. A fine-grained two-layer cache across the host side and the storage side is designed to reduce network transmission and I / O times.

[0084] Example 3

[0085] Furthermore, the host side of the separated key-value pair storage system also includes a buffer queue, and the buffer queue has a plurality of buffer spaces TBuffer, and the buffer queue is a TBuffer queue, such as Figure 8 FIG. 1 is a schematic diagram of the structure of a TBuffer queue in an embodiment of the present invention. Fig. 9 The flowchart of the TBuffer queue in one embodiment of the present invention is shown. The TBuffer queue participates in the process of writing key-value pairs into the system.

[0086] When the user sends a write request to the system, the host responds as follows:

[0087] Write the key-value pair into the TBuffer at the head of the queue. When the TBuffer is full, an asynchronous write I / O request is triggered.

[0088] Submit the full TBuffer for flushing and then dequeue it, and the queue head pointer points to the next TBuffer for subsequent writing;

[0089] Write the key-value pair into the TBuffer pointed to by the new queue head pointer;

[0090] After waiting for the write I / O of TBuffer to be asynchronously flushed to complete, the TBuffer that has completed data flushing is added back to the tail of the queue to serve subsequent writes.

[0091] Specifically, TBuffe is used as a buffer for writing key-value pairs to replace the dirty pages of Page Cache in KVell. The new data written is stored in the TBuffer of the local memory on the host side, and the TBuffer after asynchronous flushing is persisted as a data block in the Slab file of the hard disk on the storage side. In some embodiments, different independent TBuffer buffer queues are distinguished according to the different lengths of the buffered key-value pairs, and the TBuffer in each buffer queue is used to store key-value pairs of different sizes. The host side is used to select a TBuffer for storing key-value pairs of the same size according to the size of the key-value pairs. The TBuffer stores the key-value pairs of the buffered write request in the form of a key-value pair array, and also has a buffer counter, which provides external interfaces for appending writes, random reads, and in-situ updates. Due to the characteristics of the NVMe solid-state drive, it can ensure that the performance of random reads and writes is basically consistent with that of sequential reads and writes, so the impact of the off-site update mode on the read performance is not significant.

[0092] In order to avoid waiting for TBuffer to flush under heavy writing pressure and becoming a bottleneck in the writing process, an asynchronous flushing mechanism for TBuffer is designed, including initiating an asynchronous flushing request, allocating a new TBuffer, writing key-value pairs, and returning TBuffer after flushing.

[0093] (1) Initiate an asynchronous flush request: The key-value pair is written to the full TBuffer, triggering an asynchronous write I / O request to write the full TBuffer to the storage end. Since this operation is asynchronous, the full TBuffer will not block the processing flow of subsequent write requests after it is submitted;

[0094] (2) Allocate a new TBuffer: The previously full TBuffer is dequeued after being submitted for flushing, and the queue head pointer is redirected to an idle TBuffer for subsequent writing. It should be noted that once the queue is empty, it means that write blocking occurs at this time, and the process can only continue after the write I / O of at least one TBuffer is flushed;

[0095] (3) Write key-value pairs: append the key-value pairs to the TBuffer pointed to by the new queue head pointer;

[0096] (4) Return TBuffer after flushing: After waiting for the write I / O of TBuffer to be completed, refresh the metadata of TBuffer in the callback function and add it back to the end of the queue to serve subsequent writes.

[0097] Among them, the key-value pairs flushed are written to the end of the data block buffer array on the storage side in an appended manner according to the size, stored in chronological order, and the record of the number of key-value pairs (and the time when the first key-value pair was written) in the metadata is updated, and the write request is returned.

[0098] Specifically, an asynchronous refresh request is initiated when the following refresh conditions are met:

[0099] Nitems ≥ Nmax

[0100] Where Nitems represents the number of valid key-value pairs in the current TBuffer, and Nmax is the maximum number of key-value pairs that TBuffer can accommodate. The above variables can be obtained from the TBuffer metadata. This formula describes the spatial conditions for controlling the flushing of TBuffer. When the number of valid key-value pairs cached in TBuffer reaches the maximum capacity of TBuffer, the flushing is triggered.

[0101] Furthermore, when the following write conditions are met, the flush operation is performed:

[0102] T-Tfirst≥Tmax

[0103] Where T represents the current time, Tfirst represents the writing time of the first key-value pair after the previous flush, and Tmax represents the maximum tolerable flush time interval. This formula describes the time condition for controlling the flush of TBuffer, that is, when the existence time of TBuffer reaches the maximum flush time interval, the flush of TBuffer is triggered.

[0104] Furthermore, in view of the introduction of off-site updates, a storage-side garbage collection (GC) mechanism for near data is designed to eliminate cross-network data transmission in the garbage collection process.

[0105] Considering the impact of the GC process on network bandwidth, we choose to implement GC operations on the storage side to avoid affecting the foreground request processing. At the same time, we transmit GC metadata instead of data blocks to avoid extra network bandwidth consumption caused by transmitting GC data blocks across the network during the GC process. Fig.10 As shown in the figure, it consists of two parts: the GC controller on the host side and the GC worker on the storage side. The following is a detailed description:

[0106] (1) GC controller: Located on the host side, it is responsible for polling the metadata of each data block in the Slab. Each time, it selects two data blocks with valid data accounting for less than 50% as GC objects, and uses their data block numbers and the target data block numbers written after GC as GC metadata to initiate a GC request to the storage side. The response to the GC request contains the valid key information after the storage side completes the merge. The GC controller updates the index based on this information in the callback function of the request, and finally puts the merged and recovered data block numbers into the free block list. The free block list is used to manage the released free data block numbers to facilitate the reuse of the GC data block space.

[0107] (2) GC worker: Located on the storage side, it is responsible for receiving GC requests initiated by the GC controller. After reading the GC object data block, it merges different key-value pairs with the same key, retains the key-value pair with the latest timestamp, and does not retain the latest key-value pair if it is a deletion mark. When merging, it records the data of the retained valid keys (including location and value) to form a valid key list. After the merge is completed, it writes the new target data block location specified in the GC metadata locally through the NVMe command on the storage side, and returns the response containing the valid key list to the host-side GC controller.

[0108] In this embodiment, by designing the TBuffer queue, the problem of frequent flushing of dirty pages in the write process can be solved. When writing key-value pairs, the write request is received through the TBuffer queue to avoid the redundant network traffic overhead caused by flushing every time a key-value pair is updated.

[0109] Example 4

[0110] Furthermore, the host side is also allocated with multiple queue pairs QP, each queue pair includes a request sending queue SQ and a request completion queue CQ. When the host side sends an I / O request to the storage side, it writes the I / O request into the SQ in one of the QPs and polls the CQ through the foreground thread to obtain the processing result.

[0111] like Fig.11The figure shows a schematic diagram of the allocation of queue pairs QP in an embodiment of the present invention. TrickleKV designs a queue pair consisting of a request sending queue and a completion queue for each foreground thread. The foreground thread puts the I / O request into the sending queue and returns. It only needs to read the I / O processing results from the completion queue regularly. The foreground thread can respond to other requests in the interval between two regular readings to avoid CPU overhead caused by frequent polling or delay caused by thread switching overhead.

[0112] Furthermore, the multiple queue pairs QP are divided into QPs corresponding to read requests and QPs corresponding to write requests. When executing a read request, the host side applies to use the QP of the read request, and when executing a write request, the host side applies to use the QP of the write request.

[0113] Specifically, TrickleKV designs independent I / O threads and paths for read requests and write requests, and each read and write process has its own queue pair. I / O requests are submitted to the corresponding type of request sending queue according to the read and write types. After the storage end processes the request, the result will be stored in the completion queue. By isolating and exclusively using read and write I / O resources, additional queuing delays caused by differences in I / O scale and processing speed can be avoided, thereby improving I / O efficiency.

[0114] Slab in TrickleKV represents a logical concept, which means a collection of multiple data blocks of key-value pairs of the same length. Since the I / O method based on SPDK NVMe-oF protocol is used, the hard disk can be directly accessed in the form of block devices. In order to reduce the latency of the I / O stack, the form of using the file system to manage Slab files in KVell is abandoned, and the logical Slab files are directly organized in the form of segment multiplication.

[0115] like Fig.12 As shown in the figure, the metadata information such as the starting position and length of each data segment of each Slab file is stored in the data segment array SegList and persisted in the first data block of fixed length on the hard disk. Each Slab file initially contains one data segment with a length of one data block. When the Slab is expanded, the total number of data blocks already contained in the current Slab file is allocated from the free space on the hard disk as new data segments to be added to SegList, thus doubling the capacity.

[0116] Since its size satisfies the power of 2, bit operations can be used to speed up and simplify the acquisition of data segment offsets. Fig.13In the example shown, to locate the 18th (binary representation is 10010) data block in the Slab file, firstly, the bit operation is performed to obtain that the highest bit 1 appears in the 5th bit, indicating that the data block is in the 5th data segment, and the offset is the block number after removing the highest bit, which is 2 (binary representation is 00010). Finally, the starting block address of the 5th data segment is obtained by querying the metadata, and then offset 2 data blocks backward.

[0117] The technical features of the above embodiments can 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. It should be noted that "in one embodiment", "for example", "for example", etc. of the present invention are intended to illustrate the present invention, rather than to limit the present invention.

[0118] The above embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the patent application. It should be pointed out that, for those of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention.

Claims

1. A separate key-value storage system, It is characterized in that It includes a host end and a storage end, wherein the host end remotely accesses the storage end through an RDMA network; the host end has a driver NVMe-oF Initiator for initiating remote access, and the storage end has a driver NVMe-oF Target for receiving remote access and a solid-state hard disk for storing data, and the NVMe-oF Target is provided with a filter TFilter; The host end is used to receive a user's read request and search for a target key-value pair from the host end. If a hit is found, feedback is returned to the user. If a hit is not found, the NVMe read instruction is modified, and the high 32 and low 32 bits of the key-value pair offset value are respectively filled into the second double word and the third double word of the NVMe read instruction, and the operation code of the NVMe read instruction is modified, and the modified NVMe read instruction is sent to the storage end; The storage end is used to receive the NVMe read instruction sent by the host end and parse the TFilter metadata used to locate the target key-value pair, find the target key-value pair from the scatter-gather unit SGE of the NVMe-oF Target, and use TFilter to modify the starting address and length of the SGE with the target key-value pair according to the TFilter metadata as the SGE to be sent, filter the key-value pairs other than the target key-value pair, so that the SGE to be sent contains only the target key-value pair and then sends it to the host end; The host end is also used to receive the SGE sent by the storage end, obtain the target key-value pair and return it to the user.

2. The separated key-value pair storage system according to claim 1, It is characterized in that Find the target key-value pair from the scatter-gather unit SGE of the NVMe-oF Target, and use TFilter to modify the starting address and length of the SGE with the target key-value pair according to the TFilter metadata as the SGE to be sent, including: When the target key-value pairs all exist in the same SGE, only the starting address and length of the corresponding SGE are modified as the SGE to be sent; When the key-value pair spans multiple SGEs, the starting address and length of each SGE spanned are modified as the SGE to be sent.

3. The separated key-value pair storage system according to claim 1, It is characterized in that The system also has a two-level cache structure TCache, which is a cache KV Cache located at the host end and a cache BlockCache located at the storage end; The host end is used for: During the writing of the key-value pair, the key-value pair to be stored in the storage end is synchronously written into the KV Cache; During the reading of the key-value pair, the target key-value pair is first searched in the KV Cache. If a hit is found, feedback is returned to the user. If a hit is not found, a modified NVMe read instruction is sent to the storage end. The storage end is used to: first search for a target data block with a target key-value pair in the Block Cache according to an NVMe read instruction; if a hit is found, the target data block is stored in the SGE and then the target key-value pair in the SGE is sent to the host end; if a hit is found, the target data block is extracted from the hard disk to the Block Cache, and the target data block is stored in the SGE and then the target key-value pair in the SGE is sent to the host end.

4. The separated key-value pair storage system according to claim 3, It is characterized in that The KV Cache includes a first hash table index, a plurality of first LRU linked lists, and a plurality of large page memory buffers corresponding to the first LRU linked lists one by one, wherein the first hash table index is used to locate a key-value pair in the first LRU linked list according to the size of the key-value pair, and different first LRU linked lists are used to store key-value pairs of different sizes; The Block Cache includes a second hash table index, a second LRU linked list and a DMA buffer, wherein the second LRU linked list is used to store a data block pointer pointing to the DMA buffer, and the second hash table index is used to locate the data block pointer of the second LRU linked list according to the Slab number and block number of the data block; Writing the new key-value pair into the KV Cache includes: storing the key-value pair into a first LRU linked list for storing key-value pairs of the same size; The searching for a target key-value pair in the KV Cache includes: determining whether the target key-value pair exists in the KV Cache according to the first hash table index, and if so, reading the target key-value pair from the corresponding first LRU linked list; if not, sending a modified NVMe read instruction to the storage end; The searching for a target data block having a target key-value pair in the Block Cache includes: determining whether the target data block exists in the Block Cache according to a second hash table index; if so, locating a data block pointer according to the second hash table index and extracting the target data block pointed to by the data block pointer; if not, extracting the target data block from the solid-state drive to the DMA buffer, and extracting a target key-value pair from the target data block and sending it to the host end.

5. The separated key-value pair storage system according to claim 1, It is characterized in that The host end also includes a buffer queue, the buffer queue has a plurality of buffer spaces TBuffer, and the host end is also used to write key-value pairs. The process of writing key-value pairs includes: Write the key-value pair into the TBuffer at the head of the queue. When the TBuffer is full, an asynchronous write I / O request is triggered. Submit the full TBuffer for flushing and then dequeue it, and the queue head pointer points to the next TBuffer for subsequent writing; Write the key-value pair into the TBuffer pointed to by the new queue head pointer; After waiting for the write I / O of TBuffer to be asynchronously flushed to complete, the TBuffer that has completed data flushing is added back to the tail of the queue to serve subsequent writes.

6. The separated key-value pair storage system according to claim 5, It is characterized in that The host end is used to batch-flush the TBuffers submitted for flushing, and when the maximum flushing time interval is reached, flush the data of the TBuffers submitted for flushing to the storage end.

7. The separated key-value pair storage system according to claim 5, It is characterized in that The host end includes multiple buffer queues, and the TBuffer in each buffer queue is used to store key-value pairs of different sizes. The host end is used to select a TBuffer for storing the same size to write the key-value pair according to the size of the key-value pair.

8. The separated key-value pair storage system according to claim 1, It is characterized in that The host side is also allocated with multiple queue pairs QP, each queue pair includes a request sending queue SQ and a request completion queue CQ. When the host side sends an I / O request to the storage side, the I / O request is written into the SQ in one of the QPs, and the foreground thread polls the CQ to obtain the processing result.

9. The separated key-value pair storage system according to claim 8, It is characterized in that The multiple queue pairs QP are divided into QP corresponding to read requests and QP corresponding to write requests. When executing a read request, the host side applies to use the QP of the read request, and when executing a write request, the host side applies to use the QP of the write request.

10. The separated key-value pair storage system according to claim 1, It is characterized in that The storage end is also used to perform space allocation, and the space allocation process includes: Create a new Slab logical file, allocate an initial data segment with a length of 1 data block, and append it to the end of the ordered array that stores the data segment position and length information maintained by the metadata; When applying to expand the file size, a new data segment with a length equal to the sum of the lengths of the existing data segments is allocated to the target Slab, and its metadata is updated; When the mth data block is obtained, the position of the corresponding data segment in the meta information is its binary digit k, and the offset in the data segment is calculated by the following formula: offset = m-2k-1.

Citation Information

Cited By

  • Data-driven hash indexing method based on persistent CPU cache

    CN120255799A