A KV separation LSM tree storage index acceleration method and device based on an intelligent SSD
By building a GC manager and scheduler on the smart SSD, the garbage collection operation is offloaded, and its independent computing power is utilized to solve the problems of decreased system throughput and uneven resource utilization caused by the garbage collection mechanism on the smart SSD, thus achieving more efficient resource utilization and performance improvement.
Patent Information
- Application Number
- CN202411905598.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2044-12-23
AI Technical Summary
In existing technologies, the garbage collection mechanism on smart SSDs leads to a sharp drop in system throughput and makes it difficult to achieve a balance between computing and storage optimization, affecting system performance and lifespan.
A GC manager and GC scheduler are built on the smart SSD. By offloading garbage collection operations to the smart SSD and utilizing its independent computing capabilities, GC computing units are used for decoding, processing, and encoding. Combined with an effective mapping table and scheduling strategy, garbage collection and read/write operations are separated, thus optimizing resource utilization.
It improves the efficiency of garbage collection operations, reduces the I/O and CPU burden on the host side, reduces system resource consumption, and improves system performance and the utilization efficiency of the smart SSD.
Smart Images

Figure CN119828969B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method and apparatus for accelerating KV separation LSM tree storage index based on intelligent SSD. Background Technology
[0002] In the era of big data, storage technology is facing unprecedented challenges. With the surge in data volume, traditional storage systems are struggling to meet the ever-increasing performance demands. Key-value stores based on Log-Structured Merge-trees (LSMs) have become a research hotspot due to their superior write performance. Especially when processing large-value data, key-value separated LSMs significantly reduce the space occupied by storing keys and values separately and replacing the actual value data with value address indexes, effectively mitigating the read / write amplification problem during data compression. However, this architecture also faces the problem of expired data accumulation. Current garbage collection (GC) mechanisms determine data validity by scanning value files and querying the LSM, filtering out invalid values and writing back valid values. This process significantly impacts system performance. When expired data accumulates to a certain extent, frequent garbage collection triggers can lead to a sharp drop in system throughput. Furthermore, while conservative garbage collection strategies reduce I / O contention, they increase the computational burden on the CPU, as data encoding / decoding, verification, and merging are all CPU-intensive operations.
[0003] To address these issues, Near Data Processing (NDP) architecture offers a novel solution. By offloading computational tasks to memory, NDP architecture reduces CPU utilization, frees up bus bandwidth, and minimizes data movement overhead. Solid State Drives (SSDs), as commercially available hardware examples of NDP architecture, allow their internal computing units to directly access data in the storage medium without navigating the complex operating system storage stack and interconnect buses. However, current garbage collection optimization efforts often face the challenge of simultaneously optimizing data and computation, requiring trade-offs between computational and read / write overhead. Currently, no research has utilized NDP architecture to overcome the bottlenecks of garbage collection mechanisms. Intelligent task offloading has the potential to overcome limitations in host resources, request latency, and energy consumption, and is considered a promising solution. However, in SSDs, due to differences in computing environments, simple task offloading cannot directly meet the requirements; specific processing is needed in areas such as task context, resource management, and data movement.
[0004] In summary, the shortcomings of existing technologies lie in the fact that garbage collection mechanisms lead to a sharp drop in system throughput, and the difficulty in achieving a balance between computation and storage optimization.
[0005] CN118550474A discloses a separate key-value pair storage system, including a host and a storage end. The host remotely accesses the storage end via an RDMA network. The host receives user read requests and searches for the target key-value pair. If no match is found, the NVMe read command is modified by filling the high 32 and low 32 bits of the key-value pair offset into the NVMe read command and sending it to the storage end. The storage end parses the TFilter metadata used to locate the target key-value pair in the NVMe read command, searches for the target key-value pair in the SGE (Short Terminate Entity), and modifies the start address and length of the SGE according to the TFilter metadata to filter out key-value pairs other than the target key-value pair, sending them as the SGE to be sent to the host. In this system, because the target key-value pair is filtered out before transmission, the network traffic overhead of data transmission is greatly reduced, and the transmission rate is improved. However, this technical solution cannot solve the bottleneck problem of garbage collection mechanism, that is, it cannot balance the problem between computation and storage optimization.
[0006] This invention aims to provide a method and apparatus for accelerating KV-separated LSM tree storage index based on intelligent SSD, which hopes to further reduce the impact of garbage collection mechanisms on system performance and achieve a balance between computation and storage optimization.
[0007] Furthermore, on the one hand, there are differences in understanding among those skilled in the art; on the other hand, the applicant studied a large number of documents and patents when making this invention, but due to space limitations, not all details and contents were listed in detail. However, this does not mean that the present invention does not possess the features of these prior art. On the contrary, the present invention already possesses all the features of the prior art, and the applicant reserves the right to add relevant prior art to the background art. Summary of the Invention
[0008] Existing technologies cannot reduce the computational burden of garbage collection mechanisms on smart SSDs. Due to the characteristics of NAND flash memory, erasure is required before writing, and erasure is done in blocks. This results in invalid data being generated by data deletion and overwriting. The garbage collection process involves copying all valid data to blank pages in different data areas, erasing all data cells in the current data area, and then writing new data to the just-erased data area. This process has a significant impact on the read / write performance and lifespan of smart SSDs. When implementing garbage collection, smart SSDs need to strike a trade-off between computational and read / write overhead. The high overhead of garbage collection significantly reduces the performance of smart SSDs and directly affects their lifespan. The computational units of smart SSDs are indeed different from traditional computing environments. What smart SSDs need is not simple task porting, but a deep understanding of their specific environment and constraints, and customized solutions.
[0009] To address the shortcomings of existing technologies, this invention provides a method for accelerating KV-separated LSM tree storage indexing based on intelligent SSDs, comprising: constructing a KV-separated LSM tree storage module on the host side, the KV-separated LSM tree storage module including a GC manager and a GC scheduler, wherein the GC manager constructs and manages a valid mapping table to record the validity of KV data used at each location in the value file, and the GC scheduler is used for starting, scheduling, and writing back results of GC computing units; constructing GC computing units on the intelligent SSD side to offload the garbage collection module from the host side to the intelligent SSD side, the GC computing units performing garbage collection processing on the intelligent SSD side in a decoding, processing, and encoding manner without data dependencies between them; and determining parameter configurations for the number of GC computing units deployed to meet throughput requirements.
[0010] The intelligent SSD possesses independent computing power, enabling it to handle garbage collection tasks without interfering with host resources. Therefore, offloading garbage collection operations to the intelligent SSD effectively frees up I / O and CPU resources. By offloading garbage collection operations to the intelligent SSD architecture, this invention fully utilizes the parallel processing capabilities of the intelligent SSD, reducing the I / O and CPU burden on the host. This approach significantly improves the efficiency of garbage collection operations while reducing system resource consumption.
[0011] According to a preferred embodiment, the method includes: a GC computing unit decoding the value file to be garbage collected and the valid mapping table corresponding to the value file; combining the key-value data of the value file with the validity status of the valid mapping table; and generating a character stream of key-value data containing the validity status. Based on unloading, a GC management and scheduling strategy is designed to avoid conflicts between garbage collection operations and read / write operations, efficiently utilize the hardware resources of the intelligent SSD, and achieve coordinated management of hardware and software status, thus fully leveraging the advantages of hardware unloading.
[0012] According to a preferred embodiment, the processing steps of the GC computing unit include: traversing the decoded character stream in the form of a data stream, determining the write / read type based on the validity status of the valid mapping table, and filtering out invalid KV data.
[0013] By running garbage collection on the smart SSD and combining it with scheduling strategies, the garbage collection process can be separated from read and write operations, reducing resource contention between tasks and thus achieving efficient resource utilization. This design strategy ensures that read and write operations are not interrupted during garbage collection, thereby improving overall system performance. Resources on the smart SSD can be utilized more effectively, and the scheduling strategy optimizes the collaboration between hardware and software.
[0014] According to a preferred embodiment, the encoding steps of the GC computing unit include: generating a new value file from the unfiltered KV data and writing it back to the solid-state drive, and rewriting the metadata into the KV-separated LSM tree storage module.
[0015] The ability of intelligent SSDs to handle data write-back allows the garbage collection process to be independent of host-side I / O operations, thus avoiding excessive use of network and CPU resources. This approach reduces the host-side I / O burden because GC calculations and writes are completed on the intelligent SSD itself, eliminating the need for frequent data transfers.
[0016] According to a preferred implementation, the GC manager collects expiration information of key-value pairs during data compression to build or update a valid mapping table. The GC scheduler collects garbage collection data, selects the timing to wake up the hardware, and wakes up the GC computing unit on the smart SSD to complete the GC result write-back.
[0017] The collaborative work of the GC manager and scheduler accurately determines and coordinates resource usage, reduces operational conflicts, and improves the efficiency of smart SSDs. Through the coordination of the GC manager and scheduler, a balance between garbage collection and data access is ensured, and the timing of GC activation is optimized for better utilization of hardware resources.
[0018] According to a preferred embodiment, the execution steps of the GC scheduler include: calculating the number of idle GC computing units and the quota allocation data of idle FPGA memory; reading the value file from the internal path between the solid-state drive and the field-programmable gate array (FPGA) to the GC computing unit; reading the valid mapping table from the PCIe bus between the host and the smart SSD to the GC computing unit; starting the GC computing unit and waiting for the garbage collection process to complete; and writing the result of the garbage collection process back to the KV-separated LSM tree storage module.
[0019] The rational partitioning of FPGA memory and the optimization of PCIe bus data transmission maximize the throughput of the GC computing unit and fully leverage its performance within the hardware limitations of the smart SSD. This approach optimizes data transmission paths and resource allocation through effective field-programmable gate array (FPGA) and memory management, thereby further improving system efficiency and throughput.
[0020] This invention provides, from a second aspect, a KV-separated LSM tree storage index acceleration device based on a smart SSD, comprising a smart SSD end and a host end, the smart SSD end and the host end being communicatively connected, the host end having a KV-separated LSM tree storage module, the KV-separated LSM tree storage module including a GC manager and a GC scheduler, wherein the GC manager constructs and manages a valid mapping table to record the validity of KV data used at each location in the value file, and the GC scheduler is used for starting, scheduling, and writing back results of GC computing units; GC computing units are constructed on the smart SSD end to offload the garbage collection module from the host end to the smart SSD end, the GC computing units perform garbage collection processing on the smart SSD end in a decoding, processing, and encoding manner without data dependencies between them; and parameter configuration is used to determine the number of GC computing units deployed to meet throughput requirements.
[0021] By building a GC computing unit on the intelligent SSD, the garbage collection module is effectively offloaded from the host to the intelligent SSD. This offloading allows the GC computing unit to perform decoding, processing, and encoding on the intelligent SSD without causing data dependency issues. The architecture on the intelligent SSD resolves the I / O and CPU bottlenecks in the garbage collection process. By executing garbage collection operations independently on the intelligent SSD, the system effectively reduces the burden on the host, improves the efficiency of garbage collection operations, and optimizes resource utilization.
[0022] The device of the present invention processes garbage collection tasks through the intelligent SSD, reducing the data transmission between the host and the SSD, reducing the burden on bus transmission, and improving the concurrency and efficiency of data processing.
[0023] According to a preferred embodiment, the GC calculation unit is configured to: decode the value file to be garbage collected and the valid mapping table corresponding to the value file, combine the KV data of the value file with the validity status of the valid mapping table, and generate a character stream of KV data containing the validity status.
[0024] This step ensures that garbage collection operations can identify valid and invalid data, thereby optimizing the garbage collection process, improving system performance, and effectively reducing the storage and computational overhead caused by invalid data. By performing decoding and state combination directly on the smart SSD, the number of times data needs to be transferred between the host and the smart SSD is reduced, lowering data transfer latency and bandwidth requirements.
[0025] According to a preferred embodiment, the GC computing unit is further configured to: traverse the decoded character stream in the form of a data stream, determine the write / read type based on the validity status of the valid mapping table, and filter out invalid KV data.
[0026] By filtering invalid data, the garbage collection process reduces unnecessary data processing and storage, further improving system efficiency and performance while ensuring data validity. Performing invalid data filtering on the intelligent SSD side reduces the amount of data that needs to be transferred to the host, thereby optimizing the data transfer path and improving data processing speed.
[0027] According to a preferred embodiment, the GC computing unit is also configured to: generate new value files from unfiltered KV data and write them back to the solid-state drive (SSD), and rewrite the metadata into the KV-separated LSM tree storage module. This method ensures the integrity and consistency of data after the garbage collection process, while maintaining the correct operating state of the system by updating the metadata. By directly performing data write-back and metadata updates internally within the smart SSD, the number of external data transfers and the time required for data processing are reduced, further improving the system's response speed. Attached Figure Description
[0028] Figure 1 This is a schematic diagram of the module connection of the KV separation LSM tree storage index acceleration device based on intelligent SSD provided by the present invention;
[0029] Figure 2 This is a logical schematic diagram of the KV separation LSM tree storage index acceleration method based on intelligent SSD provided by the present invention;
[0030] Figure 3 This is a schematic diagram of the structure of the GC computing unit provided by the present invention;
[0031] Figure 4 This is a flowchart of the calculation process for unloading garbage collection tasks provided by the present invention;
[0032] Figure 5 This is a schematic diagram of the operating logic of the GC scheduler provided by the present invention;
[0033] Figure 6 This is a schematic diagram of the operating logic of the GC manager provided by the present invention;
[0034] Figure 7 This is a flowchart of the read / write request processing procedure provided by the present invention. Detailed Implementation
[0035] The following is a detailed explanation with reference to the accompanying drawings.
[0036] This invention provides explanations for some terms and nouns.
[0037] Key-Value Separation (KV) is a storage optimization technique commonly used in key-value databases. By separating the storage of keys and values, it improves performance and resource utilization. Keys are typically smaller and accessed frequently, so they are stored in fast-access media such as memory, while values are larger and updated frequently, and can be stored on slower disks. KV separation not only reduces memory usage but also mitigates write amplification, thereby improving overall system performance and responsiveness.
[0038] Garbage collection (GC) in a key-value (KV) separated LSM tree storage is a file management module used to clean up invalid data and improve storage efficiency. Its main function is to release storage space occupied by a large number of invalid values generated by data insertion, updates, and deletions, reducing I / O operations and improving storage system performance. By identifying expired and invalid key-value data in the value file, the garbage collection module can safely release the SSD storage space occupied by this data, thereby simplifying the developer's file management tasks and improving the robustness and stability of the program. However, the garbage collection process may have a temporary impact on system performance because, in some cases, it needs to pause the normal execution of the program to ensure consistency between memory and secondary storage operations.
[0039] Solid State Drive (SSD): A type of solid-state storage device that integrates processing power, enabling data processing tasks to be performed directly within the storage medium, without relying on the host CPU. SSDs are equipped with dedicated hardware accelerators (Field-Programmable Gate Arrays, or FPGAs), allowing computation to be performed while data remains internally stored, thus reducing data transfer latency and bandwidth consumption. Through a Near Data Processing (NDP) architecture, SSDs effectively alleviate the computational burden on the host and optimize overall system performance, making them suitable for scenarios such as big data processing, real-time analytics, and high-performance computing. The term "SSD end" refers to the electronic device equipped with an SSD.
[0040] FPGA (Field-Programmable Gate Array): A field-programmable gate array is an integrated circuit that can be configured by a user in the field using a hardware description language (such as VHDL or Verilog). An FPGA consists of an array of programmable logic cells that can be used to implement complex digital computation logic. Through flexible configuration, FPGAs can adapt to a variety of applications, from digital signal processing and real-time data processing to custom computing accelerators. Compared to application-specific integrated circuits (ASICs), FPGAs offer significant advantages in design cycle time and flexibility because their functionality can be reprogrammed at the hardware level.
[0041] FPGA memory refers to the storage resources integrated within the FPGA memory chip, used to support temporary data storage and fast access for logic circuits. FPGA memory chips typically include on-chip random access memory (RAM), read-only memory (ROM), block RAM (BRAM), and distributed RAM. FPGA memory chips provide the necessary storage space for implementing complex calculations and data processing, supporting implementations ranging from simple data buffering and lookup tables to more complex state machines and caches. This flexible memory configuration capability enhances the performance and adaptability of FPGAs when handling various tasks and algorithms.
[0042] SSD Controller: The core component of a smart SSD, responsible for managing and coordinating read and write operations within the SSD. The SSD controller acts as a bridge between the host and NAND flash memory chips, performing tasks such as error correction, garbage collection, wear leveling, and data encryption through sophisticated firmware algorithms. The performance and efficiency of the SSD controller directly impact the SSD's speed, reliability, and lifespan. It ensures efficient data layout and transfer across different storage blocks to optimize overall performance.
[0043] NAND chips: Non-volatile memory components used to store data in smart SSDs. NAND flash memory stores data in blocks, featuring high density and low cost, making it ideal for large-capacity data storage applications. It stores bits of data through arrays of electronic cells, with common types including SLC (single-layer cell), MLC (multi-layer cell), TLC (triple-layer cell), and QLC (quadruple-layer cell), each differing in performance, durability, and cost. The characteristics of NAND chips directly determine the storage capacity, durability, and data processing speed of a smart SSD.
[0044] Garbage Collection Manager (GC Manager): A component or module responsible for managing and executing the garbage collection process. GC managers are typically found in storage systems, especially in key-value (KV) LSM tree storage systems. The primary task of the GC manager is to identify, reclaim, and release storage space that is no longer referenced by programs, allowing the system to reuse these resources. By automating the garbage collection process, the GC manager reduces redundant space usage and the complexity of manual file management, improving software stability and efficiency.
[0045] Garbage Collection Scheduler (GC Scheduler): A component or module responsible for scheduling and optimizing the garbage collection process. In file management, the GC scheduler determines the specific timing and frequency of garbage collection to minimize the impact on application performance. The GC scheduler intelligently coordinates garbage collection execution time by analyzing the system's redundant space usage ratio, program execution status, and resource availability. An effective GC scheduler can ensure efficient utilization and timely reclamation of storage resources while maintaining system performance.
[0046] The Garbage Collection Compute Unit (GC Compute Unit) typically refers to the part of the garbage collection process responsible for performing computationally intensive operations. These operations may include identifying expired or invalid data, compacting and shrinking storage space, and updating references in memory. The purpose of the GC Compute Unit is to perform garbage collection operations efficiently, minimizing its impact on application performance. By optimizing these computationally intensive tasks, the GC Compute Unit can help improve the efficiency of the garbage collection process, thereby enhancing the overall system performance and responsiveness.
[0047] The host side includes a central processing unit (CPU) and DRAM. The program running the KV-separated LSM tree storage module runs on the host-side CPU and DRAM. The CPU handles all system computational operations, such as key-value pair reading and writing, data compaction, file reading and writing, and garbage collection (GC). System data structures, such as in-memory tables, are cached in memory. Preferably, the host side can be a server or a server cluster. Preferably, the host side can also be a dedicated integrated chip with the same computing and operational capabilities.
[0048] A ValidMap is a data structure used to identify which data items or memory regions are valid. It can be applied in various scenarios; for example, in memory management, ValidMap marks which memory addresses have been allocated and are available; in garbage collection mechanisms, it identifies which objects are still referenced and therefore need to be retained rather than reclaimed; in data caching systems, ValidMap helps determine which cached data is up-to-date or valid to avoid using expired information. Different systems may have specific implementations and uses for ValidMap, but its core function is to represent the validity status of data through a mapping structure.
[0049] Example 1
[0050] This invention provides a KV-separated LSM tree storage index acceleration device based on intelligent SSD, comprising a host side and an intelligent SSD side. For example... Figure 1 As shown, the intelligent SSD and the host are connected via a PCIe (Peripheral Component Interconnect Express) bus. The PCIe bus features high bandwidth and low latency, meeting the demands of fast data transfer between the intelligent SSD and the host. Specifically, the intelligent SSD connects to the host motherboard via a PCIe slot. The PCIe slot provides electrical connection and physical fixation, ensuring stable communication between the intelligent SSD and the host. Data transfer between the intelligent SSD and the host uses the PCIe communication protocol. The PCIe protocol defines the data packet format, transmission method, and error handling mechanism, ensuring accurate data transmission.
[0051] Preferably, such as Figure 1 and Figure 2 As shown, intelligent SSDs include solid-state drives (SSDs) and field-programmable gate arrays (FPGAs). Solid-state drives (SSDs) provide large-capacity data storage capabilities. For example... Figure 1As shown, a solid-state drive (SSD) includes an SSD controller and NAND chips as the storage medium. The SSD controller and NAND chips are connected to each other, enabling the SSD controller to manage data read and write operations. A field-programmable gate array (FPGA) is connected to and communicates with the SSD via internal circuitry, working together to improve data processing efficiency. In a smart SSD, the FPGA can implement various functions such as data processing, encryption, and compression. Specifically, the SSD is responsible for reading and writing data, while the FPGA is used for real-time data processing and computation. The SSD also contains drivers for both the SSD driver and the FPGA driver.
[0052] The smart SSD has a PCIe interface. The solid-state drive (SSD) and field-programmable gate array (FPGA) are connected to the PCIe interface on the smart SSD side, respectively. This connection allows for high-speed data transfer to meet the computational demands of both the SSD and the FPGA. The SSD and FPGA are mapped to different PCIe address spaces (e.g., ...). Figure 1 As shown in the figure, this means that in the PCIe architecture of the system, they each occupy an independent address range and can handle read and write requests from solid-state drives (SSDs) and computation requests from field-programmable gate arrays (FPGAs) respectively.
[0053] Preferably, when the host sends a read / write request to the smart SSD, the host sends request data containing information such as the target address and data length to the smart SSD via the corresponding PCIe address. The SSD controller on the smart SSD receives the request data via a PCIe Switch, parses and determines the content of the request data, and performs corresponding operations based on the request type. If it is a read request, the SSD controller reads data from the solid-state drive (SSD) and sends the data to the host via the PCIe bus. If it is a write request, the SSD controller writes the data sent by the host into the NAND chip and sends a response signal to the host after the write is complete.
[0054] like Figure 1As shown, when the host sends a read / write request to the smart SSD, the host passes the computation request to the SSD device driver (SSD driver for short). The SSD device driver encapsulates the computation request with control information, making it conform to the format and protocol for communication with the smart SSD. When the SSD controller on the smart SSD receives the computation / read / write request, it allocates and schedules tasks according to the type and priority of the computation request, and then performs computation using the programmable logic circuits of its corresponding Field-Programmable Gate Array (FPGA) based on the instructions and data in the computation request. The FPGA is equipped with FPGA memory chips.
[0055] like Figure 2 As shown, the overall device of the present invention is divided into a host end and a smart SSD end.
[0056] The host device is configured with a memory table and an immutable memory table for a KV-separated LSM tree storage module, as well as the GC manager and GC scheduler proposed in this invention. The memory table is responsible for caching the KV data from write requests received by the entire device. Once full, it is converted into an immutable memory table and refreshed before being written to the solid-state drive (SSD) storage on the smart SSD side. The memory table is also used for reading KV data. The GC manager is responsible for collecting and maintaining the valid map structure from the data compaction results of the SS tables. Data compaction refers to the process of merging multiple small SS tables into a larger SS table to optimize query performance and storage efficiency. The immutable memory table is continuously refreshed. The GC scheduler is responsible for executing garbage collection operations. It reads the corresponding valid map from the GC manager and transmits it to the GC computing unit of the FPGA. The value file is synchronously transmitted to the GC computing unit through the I / O control unit, and then the GC computing unit's processing process is initiated through the computing control unit. Finally, the metadata of the processing results is rewritten to the memory table. Preferably, the FPGA has FPGA computing power. FPGA computing power refers to the computing capability of the Field-Programmable Gate Array (FPGA).
[0057] The intelligent SSD internally comprises a solid-state drive (SSD) and a field-programmable gate array (FPGA). The SSD stores key files (SS tables) and value files. The host-side garbage collector (GC) manager continuously performs data compaction on the key files and garbage collection on the value files to maintain storage stability. The FPGA contains several GC computation units. These units offload garbage collection operations originally performed on the host side from the KV-separated LSM tree storage. Under the control of the host-side GC scheduler's I / O control unit, data in the FPGA's memory and file storage on the SSD can be directly transferred via the intelligent SSD's internal bus channel.
[0058] This configuration enables the intelligent SSD to perform garbage collection calculations. The garbage collection process is then offloaded from the KV-separated LSM tree storage module, extracting the garbage collection task from the host context. File transfer preparation is completed through the intelligent SSD's internal pathways, and the intelligent SSD performs the garbage collection calculations and writes back the corresponding results (metadata). This process is completed with the assistance and control of the host's GC manager and GC scheduler.
[0059] The steps of the KV separation LSM tree storage module on the intelligent SSD in handling read and write requests are as follows: Figure 7 As shown.
[0060] S000: Start.
[0061] S101: When the device consisting of the host and the smart SSD is started, the KV-separated LSM tree storage module configures parameters to create relevant resources. Specifically, the KV-separated LSM tree storage module invokes the required field-programmable gate array (FPGA) and GC computing unit instances on the smart SSD based on the number of currently idle GC computing units.
[0062] S102: Initiate a request.
[0063] After startup, the KV-separated LSM tree storage module can receive requests initiated by external systems or users. These requests can be read or write operations.
[0064] S103: Determine the type.
[0065] The KV-separated LSM tree storage module determines the type of the request, specifically whether it's a write or read request. If the request is for a read request, execute step S104; if the request is for a write request, execute step S109.
[0066] S104: When the request is of the read type, the KV separation LSM tree storage module performs a memory table search (MemTable), that is, searches for the required data in the memory table.
[0067] S105: Determine if the required data was found. If the required data was found, return the data and the process ends.
[0068] S106: If the required data is not found, the KV separation LSM tree storage module performs an SS table traversal search.
[0069] S107: If the required data is found in the SS Table, return the data and the process ends.
[0070] S108: If the required data is not found in the SS table, return the result of "not found" and end the query.
[0071] S109: When the request is of the write type, the KV-separated LSM tree storage module writes the data to the memory table (MemTable).
[0072] S110: Returns a message indicating successful write.
[0073] S111: Check if the memory table (MemTable) is full. That is, check if the memory table's capacity has reached its limit. If yes, execute S112; otherwise, execute S113 (i.e., the write operation is complete).
[0074] S112: If yes, trigger the Flush operation, write the data from the memory table to the disk in SS Table file format (Level_0 in LSM), create a valid mapping table (ValidMap) corresponding to the new SS Table, and execute S114.
[0075] S113: Write complete.
[0076] S114: Check if Level_0 is full.
[0077] After the flush operation is completed, check whether the capacity of Level_0 has reached the threshold. If yes, execute S115; otherwise, execute S113.
[0078] S115: If so, trigger data compression.
[0079] S116: Update the valid mapping table (ValidMap).
[0080] After data compaction is complete, the GC manager updates the ValidMap to mark the current validity status of the data.
[0081] S117: The GC manager checks whether the value file garbage rate has reached the threshold (garbage rate threshold). If yes, proceed to S118; otherwise, proceed to S113.
[0082] S118: If so, create a garbage collection task (GC task) and publish it to the GC scheduler.
[0083] S119: Transfer the value file and the corresponding valid mapping table (ValidMap).
[0084] When the GC scheduler receives a new garbage collection task, the compute control unit creates a hardware GC offload task context, and the I / O control unit transfers all value files and the corresponding valid maps to the GC compute unit.
[0085] S120: Trigger GC (GC Computation Unit).
[0086] In other words, the GC computing unit starts the GC computing process and waits for the result to be completed.
[0087] S121: Write back metadata.
[0088] After the GC computation unit completes its task, the metadata write-back unit in the GC manager will receive the returned GC metadata. At this time, all metadata will be written back to the KV-separated LSM tree storage module through batch write requests.
[0089] Preferably, the unloading process of the garbage collection task by the GC computing unit includes three stages: input decoding, data calculation, and output encoding.
[0090] Input decoding phase: The GC computation unit processes the value files to be garbage collected and the valid mapping table (ValidMap) corresponding to each value file. For example... Figure 3 As shown, an FPGA DRAM in the FPGA memory chip reads the value file to be processed in this garbage collection task. The value file includes value file 0, value file 1, value file 2, ... and a valid map (ValidMap) input from the host. Key-value pairs within the value file are adjacent to each other. The GC computing unit determines the offset boundary based on the data size, and the valid map (ValidMap) is encoded with standardized character data to efficiently obtain the flag information at the corresponding position. Based on this, the GC computing unit performs a highly parallel pipelined decoding process on the target file.
[0091] Data computation phase: The GC computation unit traverses the character stream in the form of a data stream based on the ValidMap to perform filtering and generate filtering or retention signals. During the loop iteration, the GC computation unit captures the decoded KV data at the current offset position and the filtering signal. If the signal is to be retained, the KV data is buffered, and the metadata of the KV data (the size and offset position of the current KV data) is collected. If the signal is to be filtered, since expired data does not need to be copied and migrated again, the KV data is captured and skipped, and the loop proceeds to the processing of the next data.
[0092] Output Encoding: The GC calculation unit re-encodes all buffered key-value (KV) data in its original order to generate value file 3. This means filling all KV data according to the value file format and setting the file header, then directly writing value file 3 back to the solid-state drive (SSD) via the internal bus of the intelligent SSD. During the data calculation phase, metadata collection is performed. This involves collecting metadata for each KV data point, calculating and appending other metadata, including the number of KVs, file size, and the old and new addresses and sizes of the KV data, generating all the metadata for this garbage collection task. This metadata is then transmitted to the host-side GC scheduler's metadata write-back unit via the PCIe bus.
[0093] like Figure 4 As shown, the unloading steps of the garbage collection task by the GC computing unit are as follows.
[0094] S000: Start.
[0095] S210: During the initialization phase, initialize the computation unit (GC computation unit), input value file and corresponding valid mapping table (ValidMap), and parse the file header.
[0096] Specifically, the memory space is initialized, the internal communication library and modules of the smart SSD are loaded, and the GC computing unit is ensured to be in a ready state.
[0097] The GC computation unit receives the value file and corresponding valid mapping table (ValidMap) as input from the garbage collection task. The GC computation unit parses the file header of the value file, extracting key information such as file format version, compression format, and file size to ensure correct data processing in the subsequent steps.
[0098] S220: During the processing phase, each key-value pair is processed cyclically, parsing the key-value pair format and reading the corresponding bit status from the ValidMap. Specifically, the GC computation unit processes each key-value pair cyclically.
[0099] For each key-value pair, first, the key-value pair format is parsed to determine the length of the key and value in order to read and process the data correctly.
[0100] Then, based on the position of the current key-value pair, the corresponding bit state is read from the ValidMap to determine whether the current key-value pair data is valid.
[0101] If not, meaning the key-value pair is invalid, it is ignored and skipped, and the loop proceeds to the next key-value pair. If yes, meaning the key-value pair is valid, the key-value pair is buffered, the loop ends, and the loop awaits subsequent encoding processing.
[0102] Throughout the process, when processing key-value pairs, a pipelined, cyclical, and optimized technique can be used for parallel processing to improve data processing efficiency. For example, in steps such as parsing the key-value pair format, reading the corresponding bit status from the valid map, and determining validity, multiple key-value pairs can be processed simultaneously, increasing throughput.
[0103] S230: In the final stage, a new value file is built in the KV data buffer and written to the solid-state drive (SSD), and the metadata is written back to the host; the computation unit ends.
[0104] Specifically, the GC computing unit reads all key-value pair data from the KV data buffer, reconstructs a new value file according to the value file format, and writes the new value file to the solid-state drive (SSD) through an internal channel.
[0105] After processing all key-value pairs, the GC computation unit writes metadata (such as the new address of the migrated KV data, basic information of the new value file, etc.) back to the host-side GC scheduler's metadata write-back unit. After completing all data processing and write-back operations, the GC computation unit is shut down and cleaned up, releasing occupied resources such as memory and file handles.
[0106] S240: End.
[0107] like Figure 5 As shown, the execution process of the GC scheduler includes the following steps.
[0108] like Figure 5As shown, the GC scheduler includes an I / O control unit, a compute control unit, and a metadata write-back unit. The I / O control unit controls the Field Programmable Gate Array (FPGA) to prepare and write back GC data using the internal path between the Solid State Drive (SSD) and the FPGA. The compute control unit establishes data connections and process control with the GC compute units within the FPGA. The metadata generated by the GC compute units is input to the metadata write-back unit, then written to the host-side memory table, and finally persisted to the SSD storage via a host-side flush operation.
[0109] (1) The I / O control unit is responsible for data preparation and result write-back under the premise of idle GC computing unit and idle DRAM. Specifically, the GC computing unit needs to input a value file and a valid map table (ValidMap) to perform a garbage collection task, and output a new value file and metadata. Under the control of the I / O control unit, the reading and writing back of the value file is completed by the field programmable gate array (FPGA) through the internal data path of the smart SSD. The valid map table (ValidMap) and write-back metadata are completed through the system bus path between the host and the smart SSD. In addition, in implementation, the I / O control unit uses asynchronous instruction allocation and transmission in hardware, which enhances the parallelism of read and write between paths and tasks while avoiding concurrent errors.
[0110] (2) The computation control unit is responsible for scheduling the GC computation units. The number of computation units in the hardware is determined by the GC parameters specified during system runtime. The usage of FPGA memory chips can be allocated and managed based on the number of computation units in use and the FPGA DRAM quota of each computation unit. The theoretical minimum memory size required by each computation unit includes: input file, reserved output file, and temporary area for intermediate computation values. In addition, the computation control unit is also responsible for starting and ending the GC computation units, which is implemented in an asynchronous waiting manner. When the GC computation unit finishes execution, a callback function is started to pass the result data to the metadata write-back unit;
[0111] (3) The metadata write-back unit is responsible for writing the results of the GC calculation unit back to the KV-separated LSM tree storage module, including: basic information of the new value file (file name, key range, size, data volume) and the new address of the migrated KV data. This information is collected during the execution of the GC calculation unit and finally transmitted to the metadata write-back unit.
[0112] The GC manager includes a valid map (ValidMap) maintenance submodule and a GC information collection submodule.
[0113] like Figure 6As shown, the ValidMap uses a bitmap as its basic structure, with a single bit indicating the validity of data at each offset. One ValidMap corresponds to one value file. The memory space of all ValidMaps is uniformly registered or destroyed by the host-side dynamic memory management interface. The ValidMap maintenance submodule is responsible for maintaining and reading the ValidMap in memory. By monitoring the validity ratio in the ValidMap corresponding to each value file, when the garbage rate threshold is exceeded, the GC manager publishes a garbage collection task in the metadata queue of the garbage collection task and assigns the task to the GC scheduler for subsequent processing. Furthermore, during the process of passing the garbage collection task to the GC scheduler, the ValidMap corresponding to the value file to be garbage collected is also read and transmitted to the GC scheduler via transposition or metadata assistance. Metadata assistance refers to the auxiliary information provided by metadata throughout the garbage collection and validity management process, enabling the system to more effectively identify which data is invalid and needs to be reclaimed, and which data is still valid. Transposition refers to the rearrangement or relocation of data or metadata in memory during memory management. This is done to optimize memory usage, improve access efficiency, or reorganize data.
[0114] Data Compression: Update. The GC information collection submodule collects the location information of all filtered data passed in the callback at the end of each data compression. When the set of data related to the locations of invalid data is obtained, the GC manager starts the update process and traverses the invalid data. Preferably, the GC manager reconstructs each temporary valid mapping table (ValidMap) according to the file number and offset order in the invalid data, and finally performs a bitwise OR operation between the temporary valid mapping table (ValidMap) and the corresponding valid mapping table (ValidMap) in the global space to complete the data structure update.
[0115] Metadata write-back. After the garbage collection operation is complete, the files deleted during the garbage collection process are sent to the GC manager. Upon receiving the metadata of the filenames, the GC manager deletes the valid maps (ValidMaps) corresponding to these files.
[0116] This method maximizes the efficiency of the Field-Programmable Gate Array (FPGA) hardware resources on the smart SSD through systematic parameter configuration. Since the resources of the smart SSD have an upper limit and cannot support an excessive number of computing units, and the DRAM resources on the smart SSD need to support the various data demands of each GC computing unit, resource constraints must be considered when increasing the number of computing units to improve overall throughput. Because the computational performance of the GC computing unit can be determined at compile time, and by monitoring the overall device's throughput status in handling external requests in real time, theoretical modeling and solving for the throughput performance of the GC computing unit can provide guidance for setting GC parameters under various read-write mixed scenarios.
[0117] S310: In order to solve the GC-related parameters, we first organize the current workflow characteristics and hardware resource quotas to provide the necessary data for the following calculation steps.
[0118] Specifically, workflow characteristics refer to the total throughput and request type ratio of the overall device for processing external read and write requests, while hardware resource quota refers to the resource quota of FPGA computing power (including CLB, FF, LUT) in the smart SSD and the number of resources required for the deployment of each GC computing unit.
[0119] S320: The garbage collection task is triggered when the file garbage rate is greater than a threshold. Therefore, when the overall device reaches a stable stage (i.e., while the overall device continuously receives read and write requests, the proportion of redundant space in the value file remains stable), in order to ensure stable storage space utilization, the following formula needs to be satisfied:
[0120]
[0121] Among them, Th update This indicates a key-value pair update or delete request for the entire device. i N represents the throughput of each GC computing unit. CU This indicates the number of GC computing units deployed, and Gr represents the garbage rate threshold for GC triggering. The system throughput before garbage collection occurs is the theoretical upper limit of the current configuration. The GC computing units offloaded by hardware will not put too much burden on the system. When the total throughput of garbage collection by all hardware units reaches the system garbage generation rate, the redundancy space of the entire storage can be kept stable without compromising system performance.
[0122] For example, taking the default value of Gr as 0.5 (meaning that garbage collection is required when the proportion of invalid data in a file is greater than 50%), assuming that the overall device update request throughput is 30,000 requests / second and the GC computing unit processing throughput is 15,000 requests / second, the minimum number of GC computing units required to be deployed can be calculated according to the above formula as 4.
[0123] S330: The part to be solved in the above formula is the theoretical throughput calculation for each computing unit. The calculation method is as follows: the total time of one garbage collection task includes the completion time of reading data, computing execution, writing data, and writing back metadata.
[0124] The throughput of a GC computing unit is the quotient of the total number of data processed in a single task and the total time consumed, which satisfies the following formula:
[0125]
[0126] Among them, Th i N represents the theoretical throughput of each GC computing unit. sum T represents the total number of data processed in a single garbage collection (GC) task. read T compute T write and T meta These represent the completion times for reading data, performing calculations, writing data, and writing back metadata in a single garbage collection task.
[0127] S340: The hardware resources required by each GC computing unit, such as CLB (Configurable Logic Blocks), FF (FlipFlop), and LUT (Lookup Table), are determined at compile time. When using the Vitis module for hardware compilation and deployment of the GC computing unit, the resource usage report automatically generated by the Vitis module records the usage of all hardware resources. Based on the number of hardware resources required by the GC computing unit, the upper limit of the number of GC computing units that can be deployed on a single smart SSD within the smart SSD can be determined, satisfying the following formula:
[0128]
[0129] Among them, R CLB R FF R LUT N represents the CLB, FF, and LUT hardware resource quotas of the FPGA computing power in a single smart SSD. CLB N FF N LUT This represents the number of CLB, FF, and LUT resources required by a single GC computing unit, and the actual number of GC computing units deployed, N. CU Hardware resource limits must be met, meaning that the amount of resources provided by the smart SSD cannot be exceeded.
[0130] S350: Based on the stable storage space utilization condition in step S320, combined with the theoretical throughput calculation method of the GC computing unit in step S330 and the resource constraint condition in S340, the storage space redundancy Gr and the number of GC computing units N that meet the overall device read / write throughput requirements can be finally solved. CU Configure the parameters to run the KV-separated LSM tree storage module with the corresponding parameters when it starts up.
[0131] For example, if a garbage collection task has 300,000 input key-value pairs, and the completion times for reading data, performing computation, writing data, and writing back metadata are 2 seconds, 12 seconds, 2 seconds, and 4 seconds respectively, then the total garbage collection task time is 20 seconds. The processing throughput of the GC computing unit can be calculated as 15,000 pieces / second. For example, in a smart SSD, the number of CLBs, FFs, and LUTs in a Field-Programmable Gate Array (FPGA) are 70,000, 500,000, and 1,000,000 respectively. The number of resources required for a single computing unit deployment are 8,000, 20,000, and 30,000 respectively. The solution N can be obtained. cu The maximum is 8; the overall device has a throughput of 30,000 update requests per second, and the minimum number of GC computing units required to be deployed can be calculated to be 4 (less than the maximum of 8).
[0132] Example 2
[0133] This embodiment is a further improvement on embodiment 1, and repeated content will not be described again.
[0134] For example, large e-commerce platforms experience very frequent data updates and writes, and their data storage structures are constantly changing (such as updating and writing product information, recording user behavior logs, and managing transaction order data). In such an environment, the performance of the storage engine determines whether the platform can provide high-quality and stable services.
[0135] The method and apparatus of the present invention can be applied to e-commerce platforms to optimize their data processing efficiency. The specific steps are as follows:
[0136] (1) KV separation LSM tree storage
[0137] In e-commerce platforms, large volumes of data are stored in key-value pairs within a KV-separated LSM tree storage module. Taking user behavior logs as an example, these logs play a crucial role in analyzing user behavior, optimizing user experience, and conducting targeted marketing. When users perform various actions on the e-commerce platform, such as browsing products, searching for products, adding items to their cart, and placing orders, the system generates user behavior logs in real time. These logs contain the user's unique identifier (e.g., user ID), the type of behavior (e.g., browsing, searching, adding items to cart), the time the behavior occurred, and information about related products. Using a KV-separated LSM tree storage module, the key of a log entry can be a unique identifier of the user's behavior, such as a string consisting of the user ID, behavior type, and timestamp. The value contains detailed behavior information, such as the product ID and search keywords. In this KV-separated storage method, the key is stored in the index file of the KV-separated LSM tree storage module, while the value is stored in a separate data file area. This approach allows for quick location of the value during queries based on the key index, improving query and access efficiency.
[0138] (2) Acceleration methods based on smart SSDs
[0139] In e-commerce platforms, a large amount of key-value pair data, such as product information, user data, and order records, needs to be written and updated in real time. For example, when user A browses, searches, or makes a transaction, or when product B is listed, delisted, or has its configuration modified, the original key-value pair data will expire, requiring continuous garbage collection to handle expired data in a timely manner. By using a KV-separated LSM tree storage module built on a smart SSD, the GC computing unit on the smart SSD non-intrusively solves the problem of expired data accumulation in the value area, avoiding the impact on the system's read and write performance due to the need for efficient processing of expired data.
[0140] When the method and apparatus of the present invention are applied to an e-commerce platform, the e-commerce platform has the following advantages:
[0141] First, address I / O and CPU bottlenecks: Offload garbage collection operations from the host to the smart SSD, leveraging its high-speed in-memory computing power and high-bandwidth internal bus characteristics to reduce system I / O operations, avoid CPU bottlenecks caused by garbage collection, and ensure that the e-commerce platform can maintain stable performance in high-concurrency data read and write scenarios (such as a large number of users placing orders and querying product information during promotional activities).
[0142] Second, improve computing performance: The hardware GC computing unit in the smart SSD divides the GC process into three stages: decoding, computing, and encoding, and performs highly parallel pipeline optimization. Compared with the traditional CPU processing method, it greatly reduces the computing time of data encoding and decoding, verification, and merging operations, and improves the overall system performance.
[0143] Third, efficient management of hardware resources: Through systematic parameter configuration, the system provides optimal GC parameter recommendations based on the workflow characteristics, hardware resource availability, and target performance requirements of the e-commerce platform. For example, it rationally determines parameters such as the garbage collection trigger threshold and the number of computing units to ensure that the redundant storage space is maintained stably without affecting system performance, while efficiently utilizing the hardware resources of the smart SSD.
[0144] Fourth, optimize resource utilization efficiency: The I / O control unit in the GC scheduler utilizes the internal data path of the smart SSD to achieve parallel read and write operations and avoid concurrent errors; the GC computing unit rationally allocates the number of computing units and FPGA DRAM quota to improve resource utilization; the metadata write-back unit coordinates the write-back of GC results through a buffer queue and batch flushing mechanism to reduce the impact on performance, thereby making full use of the hardware resources of the smart SSD in e-commerce platform data storage.
[0145] It should be noted that the specific embodiments described above are exemplary. Those skilled in the art can devise various solutions inspired by the disclosure of this invention, and these solutions all fall within the scope of this invention and its protection. Those skilled in the art should understand that this specification and its accompanying drawings are illustrative and not intended to limit the scope of the claims. The scope of protection of this invention is defined by the claims and their equivalents. This specification contains multiple inventive concepts; phrases such as "preferredly" or "according to a preferred embodiment" indicate that the corresponding paragraph discloses an independent concept. The applicant reserves the right to file divisional applications based on each inventive concept.
Claims
1. A smart-SSD-based KV separation LSM tree storage index acceleration method, characterized in that, The method comprises the following steps: a KV separation LSM tree storage module is constructed on the host side, and the KV separation LSM tree storage module comprises a GC manager and a GC scheduler, wherein the GC manager constructs and manages a valid mapping table to record the validity of KV data at each position in a value file, the GC scheduler is used for starting, scheduling and result writing back of a GC calculation unit; a GC calculation unit is constructed on the intelligent SSD side to offload the garbage collection module from the host side to the intelligent SSD side, and the GC calculation unit performs garbage collection processing on the intelligent SSD side in a manner of decoding, processing and encoding without data dependency between each other; a parameter configuration of a GC calculation unit deployment quantity satisfying a throughput requirement is determined; wherein the GC calculation unit decodes a value file to be garbage collected and a valid mapping table corresponding to the value file, combines the KV data of the value file with the validity state of the valid mapping table, and generates a character stream containing the KV data with the validity state; the processing step of the GC calculation unit comprises: traversing the decoded character stream in the form of a data stream, judging the write / read type according to the validity state of the valid mapping table, and filtering invalid KV data; the encoding step of the GC calculation unit comprises: generating a new value file from the unfiltered KV data and writing it back to the solid state disk, and re-writing metadata into the KV separation LSM tree storage module.
2. The method according to claim 1, wherein the GC manager collects expiration information of KV key-value pairs in a data compression process to construct or update a valid mapping table, the GC scheduler collects garbage collection data, selects a hardware occasion to wake up, and wakes up a GC calculation unit on the intelligent SSD side to complete GC result writing back.
3. The method according to claim 1 or 2, characterized in that, The execution step of the GC scheduler comprises: calculating the number of idle GC calculation units and the quota allocation data of idle FPGA memories; reading a value file from an internal passage between a solid state disk and a field programmable gate array (FPGA) to the GC calculation unit, and reading a valid mapping table to the GC calculation unit through a PCIe bus between the host side and the intelligent SSD side, starting the GC calculation unit and waiting for the garbage collection process to complete, writing back the result of the garbage collection process to the KV separation LSM tree storage module.
4. An intelligent-SSD-based KV-separated LSM tree storage index acceleration device, characterized in that, The method comprises an intelligent SSD side and a host side, and the intelligent SSD side is in communication connection with the host side, the host side is constructed with a KV separation LSM tree storage module, and the KV separation LSM tree storage module comprises a GC manager and a GC scheduler, wherein the GC manager constructs and manages a valid mapping table to record the validity of KV data at each position in a value file, the GC scheduler is used for starting, scheduling and result writing back of a GC calculation unit; a GC calculation unit is constructed on the intelligent SSD side to offload the garbage collection module from the host side to the intelligent SSD side, and the GC calculation unit performs garbage collection processing on the intelligent SSD side in a manner of decoding, processing and encoding without data dependency between each other; a parameter configuration of a GC calculation unit deployment quantity satisfying a throughput requirement is determined; The GC computing unit is configured to: decode a value file to be garbage collected and a valid mapping table corresponding to the value file, combine the KV data of the value file and the validity state of the valid mapping table to generate a character stream containing the KV data of the validity state; traverse the decoded character stream in the form of a data stream, judge the write / read type according to the validity state of the valid mapping table, and filter out invalid KV data; generate new value files from the unfiltered KV data and write them back to the solid state disk, and re-write the metadata into the KV separated LSM tree storage module.