Intelligent storage device with standard operating system
By adopting a dual-CPU group structure in the storage device to process NVMe commands and run user programs, the problem of KV key-value pair compression operations occupying host resources is solved, and the independent processing capabilities and host performance of the storage device are improved.
Patent Information
- Application Number
- CN202311287254.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-03-23
- Filing Date
- 2023-09-28
- Publication Date
- 2024-09-24
AI Technical Summary
When existing storage devices perform compression operations on KV key-value pairs, they occupy the computing and storage resources of the host, causing host performance to decrease and other task processing efficiency to be affected.
A storage device with a dual-CPU group structure. One CPU group processes NVMe commands, and the other CPU group runs a standard operating system, loads user-specified programs to implement specified operations, and interacts with the host through SSH communication, reducing the impact on host resources. rely.
It improves the independent processing capability of the storage device, reduces the occupation of host resources, and improves the instantaneous performance and service quality of the host.
Smart Images

Figure CN118689378A
Abstract
Description
Technical Field
[0001] The present application relates to storage technology, and in particular, to smart storage devices. Background Art
[0002] Figure 1A The block diagram of the solid-state storage device is shown. The solid-state storage device 102 is coupled to the host to provide storage capacity for the host. The host and the solid-state storage device 102 can be coupled in a variety of ways, including but not limited to connecting the host and the solid-state storage device 102 through, for example, SATA (Serial Advanced Technology Attachment), SCSI (Small Computer System Interface), SAS (Serial Attached SCSI), IDE (Integrated Drive Electronics), USB (Universal Serial Bus), PCIE (Peripheral Component Interconnect Express, PCIe), NVMe (NVM Express), Ethernet, Fiber Channel, wireless communication network, etc. The host can be an information processing device that can communicate with the storage device in the above manner, such as a personal computer, a tablet computer, a server, a portable computer, a network switch, a router, a cellular phone, a personal digital assistant, etc. The storage device 102 includes an interface 103 , a control component 104 , one or more NVM chips 105 , and a DRAM (Dynamic Random Access Memory) 110 .
[0003] NAND flash memory, phase change memory, FeRAM (Ferroelectric RAM), MRAM (Magnetic Random Access Memory), RRAM (Resistive Random Access Memory), XPoint memory, etc. are common NVMs.
[0004] The interface 103 may be adapted to exchange data with the host via, for example, SATA, IDE, USB, PCIE, NVMe, SAS, Ethernet, Fibre Channel, etc.
[0005] The control component 104 is used to control data transmission between the interface 103, the NVM chip 105 and the DRAM 110, and is also used for storage management, mapping of host logical addresses to flash physical addresses, erase leveling, bad block management, etc. The control component 104 can be implemented in a variety of ways, such as software, hardware, firmware, or a combination thereof. For example, the control component 104 can be in the form of an FPGA (Field-programmable gate array), an ASIC (Application Specific Integrated Circuit), or a combination thereof. The control component 104 can also include a processor or a controller, in which software is executed to manipulate the hardware of the control component 104 to process IO (Input / Output) commands. The control component 104 can also be coupled to the DRAM 110 and can access the data of the DRAM 110. The data of the FTL table and / or cached IO commands can be stored in the DRAM.
[0006] The control component 104 includes a flash memory interface controller (or medium interface controller, flash memory channel controller), which is coupled to the NVM chip 105 and issues commands to the NVM chip 105 in a manner that complies with the interface protocol of the NVM chip 105 to operate the NVM chip 105, and receives command execution results output from the NVM chip 105. Known NVM chip interface protocols include "Toggle", "ONFI" and the like.
[0007] In the storage device, the FTL (Flash Translation Layer) is used to maintain the mapping information from the logical address to the physical address. The logical address constitutes the storage space of the solid-state storage device perceived by the upper-layer software such as the operating system. The physical address is the address used to access the physical storage unit of the solid-state storage device. In the related art, the address mapping can also be implemented using the intermediate address form. For example, the logical address is mapped to the intermediate address, and then the intermediate address is further mapped to the physical address. In these cases, the read / write command received by the storage device indicates the logical address.
[0008] The table structure that stores the mapping information from logical addresses to physical addresses is called an FTL table. The FTL table is an important metadata in a solid-state storage device. Usually, the entries in the FTL table record the address mapping relationship in units of data pages in the storage device.
[0009] Some storage devices' FTLs are provided by the host to which the storage device is coupled, with the host's memory storing the FTL table and the host's CPU executing software to provide the FTL. Other storage management devices provided by some storage management devices between the host and the storage device provide the FTL. In these cases, the read / write commands received by the storage device indicate physical addresses.
[0010] The command provided by the host to the storage device may access the logical address space corresponding to one or more entries of the FTL table. And the control component may change the form of the command received from the interface 103 (for example, split the command according to the size of the logical address space corresponding to the FTL entry) and process the command of the changed form. For the purpose of clarity, in this article, the read / write command received by the storage device to access a single FTL entry is used as an example for description.
[0011] Figure 1B A detailed block diagram showing the control components of a storage device.
[0012] The host accesses the storage device with IO commands that follow the storage protocol. The control component generates one or more storage commands based on the IO commands from the host and provides them to the media interface controller. The media interface controller generates storage media access commands (e.g., programming commands, read commands, erase commands) that follow the interface protocol of the NVM chip based on the storage commands. The control component also tracks that all storage commands generated from an IO command have been executed and indicates the processing results of the IO commands to the host.
[0013] See also Figure 1B The control components include, for example, a host interface, a host command processing unit, a storage command processing unit, a media interface controller (or flash memory interface controller, flash memory channel controller) and a storage medium management unit. The host interface obtains the IO command provided by the host, and generates a storage command to provide it to the storage command processing unit. The storage command, for example, accesses storage space of the same size, such as 4KB. The data unit corresponding to the data accessed by a storage command recorded in the NVM chip is called a data frame. The physical page records one or more data frames. For example, the size of the physical page is 17664 bytes, and the size of the data frame is 4KB, then one physical page can store 4 data frames.
[0014] The storage medium management unit maintains the conversion of logical addresses to physical addresses for each storage command. For example, the storage medium management unit includes an FTL table. For a read command, the storage medium management unit outputs the physical address corresponding to the logical address accessed by the storage command. For a write command, the storage medium management unit allocates an available physical address and records the mapping relationship between the logical address accessed and the allocated physical address. The storage medium management unit also maintains functions required to manage the NVM chip, such as garbage collection and wear leveling.
[0015] The storage command processing unit operates the media interface controller to issue a storage medium access command to the NVM chip according to the physical address provided by the storage medium management unit. For the purpose of clarity, the command sent by the storage command processing unit to the media interface controller is called a media interface command, and the command sent by the media interface controller to the NVM chip is called a storage medium access command. The storage medium access command follows the interface protocol of the NVM chip.
[0016] Storage devices can store various types of data, and Key-Value data (KV for short) is a common type of data stored by storage devices; Key represents a keyword; Value represents the value corresponding to the keyword. Common KV storage systems use systems such as Rocks DB or Level DB to store KV key-value pairs; Rocks DB provides a storage engine library for the key-value storage interface; Level DB is a KV database.
[0017] Figure 1C A schematic diagram showing how existing storage devices use the Rocks DB system to store KV key-value pairs.
[0018] like Figure 1C As shown, the Rocks DB system is deployed on the host operating system. For example, the user sends a KV data access request to the host through an application. In response to receiving the KV data access request sent by the user, the host parses the KV data access request through the Rocks DB system. Based on the parsed information, the KV data access request is processed through a combination of three operations: read file, write file, and compaction. Among them, the two operations of read file and write file are standard interfaces or standard operations provided by mainstream file systems.
[0019] The Rocks DB system includes MemTable and ImmuTable recorded in DRAM and SST File stored in the storage device. KV data access requests include, for example, Get(Key) and Put(Key, Value), where Key represents the key in the KV data access request, and Value represents the value corresponding to the key in the KV data access request. For example, in response to Put(Key, Value), the Key and Value are associated and recorded in the MemTable. In response to Get(Key), the Key is used to query the MemTable, Immutable or SST File to obtain the Value corresponding to the Key.
[0020] SSF File has a hierarchy (indicated by Level). When performing compression (Compaction), for example, the SST File of Leveln is merged with the SST File of Level n+1, and a new SST File of Level n+1 is generated. In this process, the file system generates, for example, an NVMe command that complies with the NVMe protocol based on the LBA address through an NVMe driver (referred to as NVMe Driver), sends the NVMe command to the storage device, and reads the SSTFile of Level n and Level n+1 from the storage device. RocksDB sorts the KV key-value pairs in the read SST File by Key to generate a new SST File of Level n+1. And then generates an NVMe command through the NVMe driver to write the new SST File of Level n+1 to the storage device.
[0021] Rocks DB uses the logical address-based block device service provided by storage devices through NVMe to process KV data access requests. Summary of the invention
[0022] Control components are used to control e.g. Figure 1A The control component is an important device for data transmission between the interface 103, NVM chip 105 and DRAM 110 shown. The control component can support storage, computing and other functions. Since the storage device is user-oriented, different users may have different needs, such as data compression, image search, matching, KV key-value pair storage and application acceleration. The user group facing the storage device is large, and there may be thousands of user needs. It is impossible for the control component designer to be compatible with all user needs during the design of the control component. In order to meet the needs of different users, the firmware of the control component needs to be redeveloped or modified according to different user needs. Developing or modifying the firmware not only takes time, but also adds additional workload.
[0023] In addition, the host controls the storage device to store KV key-value pairs (such as Figure 1C As shown in the figure, the host will merge the SST File through the compaction operation. However, the timing of the host's compaction operation is uncertain, and the reading of the SST File from the storage device and the writing of the SST File to the storage device during the compaction operation occupy the host's computing and storage resources. The sorting and merging of the KV key-value pairs in the SST File also occupy the host's resources, resulting in a significant impact on the host's instantaneous performance when the compaction operation occurs, thereby affecting the host's service quality and the processing efficiency of other tasks on the host.
[0024] According to the first aspect of the present application, a first storage device according to the first aspect of the present application is provided, and the storage device includes: a control component and a memory; the control component includes: a first CPU group and a second CPU group, wherein; the first CPU group processes the received NVMe command; the second CPU group loads a user-specified program by running a standard operating system, and implements specified operations by running the program.
[0025] According to the first storage device of the first aspect of the present application, a second storage device according to the first aspect of the present application is provided, and the two CPU groups receive a first call request for the program sent by the host, process the first call request, control the execution of the program to implement the specified operation, and return the call result.
[0026] According to the first or second storage device of the first aspect of the present application, a third storage device according to the first aspect of the present application is provided, which also includes: the second CPU group receives a second call request for the program generated by the first CPU group based on the received custom command that satisfies the NVMe protocol, processes the second call request and controls the program to perform a specified operation, and feeds back the call result to the first CPU group.
[0027] According to the third storage device of the first aspect of the present application, a fourth storage device according to the first aspect of the present application is provided, wherein the first CPU group responds to receiving a custom command that satisfies the NVMe protocol and is sent by the host, wherein the custom command indicates information associated with a specified operation; the first CPU group parses the custom command to obtain the information associated with the specified operation, and generates the second call request based on the information associated with the specified operation, and sends the second call request to the second CPU group; the first CPU group receives the call result corresponding to the second call request fed back by the second CPU group, generates completion information of the custom command based on the call result, and sends the completion information to the host.
[0028] According to the third or fourth storage device of the first aspect of the present application, a fifth storage device according to the first aspect of the present application is provided, wherein the first CPU group receives the custom command, parses the custom command to obtain information associated with the specified operation, and generates the second call request based on the information associated with the specified operation; and receives the call result corresponding to the second call request fed back by the second CPU group, generates completion information of the custom command based on the call result, and sends the completion information to the host.
[0029] According to one of the first to fifth storage devices of the first aspect of the present application, a sixth storage device according to the first aspect of the present application is provided, and also includes: the standard operating system running on the second CPU group includes a file system and an NVMe driver, the NVMe driver is used to access the first storage device, and the file system manages the storage space provided by the first storage device.
[0030] According to the sixth storage device of the first aspect of the present application, a seventh storage device according to the first aspect of the present application is provided, wherein the first storage device is the same as or different from the second storage device presented by the first CPU group processing the NVMe command of the host.
[0031] According to the sixth or seventh storage device of the first aspect of the present application, an eighth storage device according to the first aspect of the present application is provided, and the program running in the standard operating system accesses the first storage device in a block device manner through an NVMe driver.
[0032] According to the sixth or seventh storage device of the first aspect of the present application, a ninth storage device according to the first aspect of the present application is provided. In response to a program running in the standard operating system wanting to access a file in the file system, a logical address and / or namespace information for the first storage device is determined based on the file through the file system; an access command is generated based on the logical address and / or namespace information, and the access command is sent to the first CPU group through the NVMe driver.
[0033] According to the ninth storage device of the first aspect of the present application, a tenth storage device according to the first aspect of the present application is provided, and the access command is an IO command that complies with the NVMe protocol or a custom command that complies with the NVMe protocol.
[0034] According to the ninth or tenth storage device of the first aspect of the present application, an eleventh storage device according to the first aspect of the present application is provided, wherein the first CPU group includes a first data path; wherein the first data path includes a host command processing unit, a storage command processing unit and a storage medium management unit; the host command processing unit receives the access command, parses the access command, generates a storage command according to the parsing result and sends the storage command to the storage command processing unit; the storage command processing unit parses the storage command in response to receiving the storage command to obtain a logical address and / or namespace information; the storage medium management unit determines the physical address of the NVM chip to be accessed according to the logical address and / or namespace information, generates a media interface command based on the physical address, and sends the media interface command to the media interface controller, so that the media interface controller generates a storage medium access command based on the media interface command, sends the storage medium access command to the NVM chip, and accesses the NVM chip based on the storage medium access command.
[0035] According to one of the ninth to eleventh storage devices of the first aspect of the present application, a twelfth storage device according to the first aspect of the present application is provided, and in response to completion of processing the access command, the first CPU group generates a response corresponding to the access command, and the response is an access result for accessing the file in the file system.
[0036] According to the ninth to twelfth storage devices of the first aspect of the present application, a thirteenth storage device according to the first aspect of the present application is provided, which also includes: a first command queue and a first message queue; the first command queue is coupled to the first CPU group and the second CPU group, and the second CPU group adds the access command to the first command queue in response to generating the access command; the first CPU group obtains the access command from the first command queue; the first message queue is coupled to the first CPU group and the second CPU group, and the first CPU group stores the response corresponding to the access command to the first message queue in response to processing the access command; the second CPU group obtains the response corresponding to the access command from the first message queue.
[0037] According to the thirteenth storage device of the first aspect of the present application, there is provided a fourteenth storage device according to the first aspect of the present application, which also includes: the second CPU group allocates cache in the memory by running the program, and stores the response corresponding to the obtained access command through the cache.
[0038] According to one of the third to fourteenth storage devices of the first aspect of the present application, a fifteenth storage device according to the first aspect of the present application is provided, which also includes: a second command queue and a second message queue; the second command queue is coupled to the first CPU group, and is used to store the custom command or the NVMe command; the second message queue is coupled to the first CPU group, and is used to store the custom command fed back by the first CPU group or the response to the NVMe command.
[0039] According to one of the first to fifteenth storage devices of the first aspect of the present application, a sixteenth storage device according to the first aspect of the present application is provided, further comprising: a hardware accelerator; wherein the hardware accelerator is coupled to the second CPU group, and the second CPU group uses the hardware accelerator by running the program.
[0040] According to the sixteenth storage device of the first aspect of the present application, a seventeenth storage device according to the first aspect of the present application is provided, wherein the second CPU group loads and installs a user-specified application and a driver for the accelerator by running a standard operating system; the second CPU group runs the application in the standard operating system to use the hardware accelerator through the driver.
[0041] According to the seventeenth storage device of the first aspect of the present application, there is provided the eighteenth storage device of the first aspect of the present application, wherein the host and the control component communicate via SSH.
[0042] According to the eighteenth storage device of the first aspect of the present application, a nineteenth storage device according to the first aspect of the present application is provided, wherein the control component also includes a serial port and / or a network port; the control component is coupled to the host via the serial port or the network port; the host and the second CPU group carry the SSH communication via the serial port or the network port.
[0043] According to the eighteenth storage device of the first aspect of the present application, there is provided a twentieth storage device according to the first aspect of the present application, wherein the control component does not include a serial port; the host converts the SSH communication into a custom command that satisfies the NVMe protocol and provides it to the first CPU group; the first CPU group forwards the custom command to the second CPU group; and the second CPU group processes the SSH communication carried by the custom hit.
[0044] According to one of the seventeenth to twentieth storage devices of the first aspect of the present application, a twenty-first storage device according to the first aspect of the present application is provided. If the application is used to provide services to the host, the host uses the services provided by the application through a serial port, a network card, or a custom command that satisfies the NVMe protocol; the host issues a command to call the service, which is directly given to the second CPU group through the serial port or the network port, or is given to the first CPU group through a custom command that satisfies the NVMe protocol, and then transferred from the first CPU group to the second CPU group; the second CPU group processes the command through the application and gives the result of calling the service.
[0045] According to the first to twenty-first storage devices of the first aspect of the present application, a twenty-second storage device according to the first aspect of the present application is provided, the memory includes a first storage space and a second storage space, the first storage space and the second storage space are isolated from each other; the first CPU group uses the first storage space, and the second CPU group uses the second storage space; the first CPU group performs DMA operations to move data between the first storage space and the second storage space, and to move data between the first storage space and the host.
[0046] According to the first to twenty-second storage devices of the first aspect of the present application, a twenty-third storage device according to the first aspect of the present application is provided, and the second CPU group receives an access KV key-value pair command sent by the host, processes the access KV key-value pair command to read the value corresponding to the keyword in the KV key-value pair stored in the storage device, or writes a KV key-value pair to the storage device.
[0047] According to the twenty-third storage device of the first aspect of the present application, a twenty-fourth storage device according to the first aspect of the present application is provided, in response to the Get(Key) command for accessing the KV key-value pair to read the value corresponding to the keyword, the second CPU group parses the Get(Key) command to obtain the keyword indicated by it, and determines whether the Value corresponding to the Key is stored in the memory based on the Key; and if the Value corresponding to the Key is stored in the memory, the Value is directly read from the memory as a response to the custom command.
[0048] According to the twenty-fourth storage device of the first aspect of the present application, there is provided a twenty-fifth storage device according to the first aspect of the present application, if the Value to be read is not stored in the memory, a first entry is determined by querying the first table stored in the memory according to the Key, wherein the Key belongs to the Key range recorded in the first entry; and an index of the second type of storage unit recorded in the first entry is obtained; and based on the second type of storage unit index and the Key, the multiple NVMe commands are generated and provided to the first CPU group, and the Value is obtained from the responses to the multiple NVMe commands as a response to the access KV key-value pair command.
[0049] According to the twenty-third or twenty-fourth storage device of the first aspect of the present application, a twenty-sixth storage device according to the first aspect of the present application is provided. In response to the access KV key-value pair command being a Put (Key, Value) command for writing a KV key-value pair, the second CPU group parses the Put (Key, Value) command to obtain the indicated keyword and the value corresponding to the keyword, and stores the keyword and the key value corresponding to the keyword in an associated manner in a memory.
[0050] According to the second aspect of the present application, a first method for accessing a storage device according to the second aspect of the present application is provided, the method comprising: receiving an NVMe command and processing the received NVMe command; loading and installing a user-specified program by running a standard operating system, and implementing a specified operation by running the program.
[0051] According to the first method for accessing a storage device according to the second aspect of the present application, a second method for accessing a storage device according to the second aspect of the present application is provided, receiving a first call request for the program sent by a host, processing the first call request and controlling the program to perform a specified operation, and returning a call result.
[0052] According to the first or second method for accessing a storage device according to the second aspect of the present application, a third method for accessing a storage device according to the second aspect of the present application is provided, which also includes: receiving a custom command that satisfies the NVMe protocol sent by a host, and generating a second call request for the program based on the custom command; processing the second call request to control the program to perform a specified operation, and feeding back the call result; generating completion information of the custom command based on the call result, and sending the completion information to the host.
[0053] According to the third method for accessing a storage device according to the second aspect of the present application, there is provided a fourth method for accessing a storage device according to the second aspect of the present application. In response to the custom command indicating information associated with a specified operation, the custom command is parsed to obtain information associated with the specified operation, and the second call request is generated based on the information associated with the specified operation, and a call result corresponding to the second call request is fed back, completion information of the custom command is generated based on the call result, and the completion information is sent to the host.
[0054] According to the third or fourth method for accessing a storage device according to the second aspect of the present application, there is provided a fifth method for accessing a storage device according to the second aspect of the present application,
[0055] In response to receiving the custom command, the custom command is parsed to obtain information associated with the specified operation, and the second call request is generated based on the information associated with the specified operation; and a call result corresponding to the second call request is obtained, completion information of the custom command is generated based on the call result, and the completion information is sent to the host.
[0056] According to one of the first to fifth methods of accessing a storage device according to the second aspect of the present application, a sixth method of accessing a storage device according to the second aspect of the present application is provided, further comprising: the running standard operating system includes a file system and an NVMe driver, the NVMe driver is used to access the first storage device, and the file system manages the storage space provided by the first storage device.
[0057] According to the sixth method for accessing a storage device according to the second aspect of the present application, a seventh method for accessing a storage device according to the second aspect of the present application is provided, wherein the first storage device is the same as or different from the second storage device presented by the NVMe command processing the host.
[0058] According to the sixth or seventh method for accessing a storage device according to the second aspect of the present application, an eighth method for accessing a storage device according to the second aspect of the present application is provided, and the program running in the standard operating system accesses the first storage device in a block device manner through an NVMe driver.
[0059] According to the sixth or seventh method for accessing a storage device according to the second aspect of the present application, there is provided a ninth method for accessing a storage device according to the second aspect of the present application, wherein, in response to a program running in the standard operating system wanting to access a file in the file system, a logical address and / or namespace information for the first storage device is determined based on the file through the file system; and an access command is generated based on the logical address and / or namespace information.
[0060] According to the ninth method for accessing a storage device according to the second aspect of the present application, a tenth method for accessing a storage device according to the second aspect of the present application is provided, wherein the access command is an IO command conforming to the NVMe protocol or a custom command conforming to the NVMe protocol.
[0061] According to one of the eighth to tenth methods for accessing a storage device according to the second aspect of the present application, an eleventh method for accessing a storage device according to the second aspect of the present application is provided, and in response to completion of processing the access command, a response corresponding to the access command is generated, and the response is an access result for accessing a file in the file system.
[0062] According to one of the first to eleventh methods for accessing a storage device according to the second aspect of the present application, a twelfth method for accessing a storage device according to the second aspect of the present application is provided, which loads and installs a user-specified application and a driver for an accelerator by running a standard operating system; the application in the standard operating system uses the accelerator in the storage device through the driver.
[0063] According to one of the first to twelfth methods for accessing a storage device according to the second aspect of the present application, a thirteenth method for accessing a storage device according to the second aspect of the present application is provided, which receives a user-specified program sent by a host through an SSH communication method.
[0064] According to one of the first to thirteenth methods for accessing a storage device according to the second aspect of the present application, a fourteenth method for accessing a storage device according to the second aspect of the present application is provided. If the program is used to provide services to a host, the service provided by the program is used through a serial port, a network card, or a custom command that satisfies the NVMe protocol; in response to receiving a command from the host to call a service, the command is processed by the program and a result of calling the service is given.
[0065] According to one of the first to fourteenth methods for accessing a storage device according to the second aspect of the present application, a fifteenth method for accessing a storage device according to the second aspect of the present application is provided, which responds to receiving an access KV key-value pair command sent by a host, processes the access KV key-value pair command to read the value corresponding to the keyword in the KV key-value pair stored in the storage device; or writes the KV key-value pair to the storage device.
[0066] According to the fifteenth method for accessing a storage device according to the second aspect of the present application, there is provided a sixteenth method for accessing a storage device according to the second aspect of the present application, in response to the Get(Key) command for accessing the KV key-value pair being a command for reading the value corresponding to the keyword, the Get(Key) command is parsed to obtain the keyword indicated by it, and based on the Key, it is determined whether the Value corresponding to the Key is stored in the memory; and if the Value corresponding to the Key is stored in the memory, the Value is directly read from the memory as a response to the custom command.
[0067] According to the sixteenth method for accessing a storage device according to the second aspect of the present application, there is provided a seventeenth method for accessing a storage device according to the second aspect of the present application, and if the Value to be read is not stored in the memory, a first entry is determined by querying a first table stored in the memory according to a Key, wherein the Key belongs to a Key range recorded in the first entry; and an index of a second type of storage unit recorded in the first entry is obtained; and the multiple NVMe commands are generated based on the second type of storage unit index and the Key and provided to the first CPU group, and Value is obtained from the responses to the multiple NVMe commands as a response to the access KV key-value pair command.
[0068] According to one of the fifteenth to seventeenth methods for accessing a storage device according to the second aspect of the present application, an eighteenth method for accessing a storage device according to the second aspect of the present application is provided, and in response to the command for accessing the KV key-value pair being a Put (Key, Value) command for writing a KV key-value pair, the Put (Key, Value) command is parsed to obtain the keyword indicated therein and the value corresponding to the keyword, and the keyword and the key value corresponding to the keyword are stored in a memory in an associated manner.
[0069] According to the third aspect of the present application, a first method for accessing KV data according to the third aspect of the present application is provided, including: in response to receiving an access command for accessing a KV key-value pair, generating a custom command that satisfies the NVMe protocol based on the access command, and sending the custom command to a storage device, wherein the KV key-value pair includes a keyword Key and a value Value corresponding to the keyword; receiving a first response to the custom command fed back by the storage device, and generating and outputting a second response to the KV command based on the first response.
[0070] According to the first method for accessing KV data according to the third aspect of the present application, a second method for accessing KV data according to the third aspect of the present application is provided, and the access command is a Get(Key) command for reading the value corresponding to the keyword in the KV key-value pair or a Put(Key, Value) command for writing the KV key-value pair.
[0071] According to the first or second method for accessing KV data according to the third aspect of the present application, a third method for accessing KV data according to the third aspect of the present application is provided, including: in response to receiving a custom command that complies with the NVMe protocol, the storage device parses the custom command to obtain information carried by the custom command; wherein the information includes keywords or KV key-value pairs in KV key-value pairs; and obtaining a first response to the custom command based on the information.
[0072] According to one of the first to third methods for accessing KV data according to the third aspect of the present application, a fourth method for accessing KV data according to the third aspect of the present application is provided, and the custom command includes a first command and a second command that satisfy the NVMe protocol; wherein the first command indicates reading the value corresponding to the keyword in the KV key-value pair, which carries the keyword in the KV key-value pair to be read; and the second command indicates writing the KV key-value pair, which carries the KV key-value pair to be written.
[0073] According to the fourth method for accessing KV data according to the third aspect of the present application, a fifth method for accessing KV data according to the third aspect of the present application is provided. In response to the custom command being the second command, the storage device records the keyword in the KV key-value pair indicated in the second command in association with the value corresponding to the keyword into the memory.
[0074] According to the fifth method for accessing KV data of the third aspect of the present application, there is provided a sixth method for accessing KV data according to the third aspect of the present application, wherein the memory comprises a first-category storage unit and at least one second-category storage unit; wherein the keywords in the KV key-value pairs stored in the first-category storage unit are unordered; the KV key-value pairs stored in the second-category storage unit are sorted by keywords; the storage device records the keyword indicated in the second command in association with the value corresponding to the keyword in the memory, including: recording the keyword in association with the value corresponding to the keyword in the form of a KV key-value pair in the first-category storage unit.
[0075] According to the sixth method for accessing KV data according to the third aspect of the present application, a seventh method for accessing KV data according to the third aspect of the present application is provided, and the storage device moves the KV key-value pairs stored in the first type of storage unit to the second type of storage unit based on the order of the keywords.
[0076] According to the sixth or seventh method for accessing KV data of the third aspect of the present application, there is provided an eighth method for accessing KV data according to the third aspect of the present application, further comprising: the storage device also generates a flush operation, and processes the flush operation to flush the second-type storage unit as a whole to the NVM chip of the storage device; wherein a data area is used to represent a second-type storage unit flushed to the NVM chip.
[0077] According to the eighth method for accessing KV data of the third aspect of the present application, a ninth method for accessing KV data according to the third aspect of the present application is provided, and in response to flashing the second type storage unit to the NVM chip, the storage device deletes the second type storage unit.
[0078] According to the eighth or ninth method for accessing KV data of the third aspect of the present application, there is provided a tenth method for accessing KV data according to the third aspect of the present application, in response to flashing the second type of storage unit to the NVM chip, the storage device updates a first table in the memory; wherein the first table includes multiple entries, each entry records a data area index, and a keyword range corresponding to all KV key-value pairs stored in the data area.
[0079] According to the tenth method for accessing KV data according to the third aspect of the present application, there is provided an eleventh method for accessing KV data according to the third aspect of the present application, wherein the updating of the first table in the memory comprises: the storage device adds an entry in the first table, wherein the entry records the data area index and the keyword range corresponding to the KV key-value pairs stored in the data area.
[0080] According to the tenth or eleventh method for accessing KV data according to the third aspect of the present application, a twelfth method for accessing KV data according to the third aspect of the present application is provided, wherein the data area index is a logical address or namespace for a storage device.
[0081] According to one of the ninth to twelfth methods for accessing KV data according to the third aspect of the present application, a thirteenth method for accessing KV data according to the third aspect of the present application is provided, wherein the first storage device generates a first flush operation, and processes the first flush operation to flush the second type of storage unit stored in the memory of the first storage device to the NVM chip of the first storage device or the second storage device; or the second storage device generates a second flush operation, and processes the second flush operation to flush the second type of storage unit stored in the memory of the first storage device to the NVM chip of the first storage device or the second storage device; wherein the first storage device and the second storage device are different storage devices.
[0082] According to one of the eighth to thirteenth methods for accessing KV data according to the third aspect of the present application, a fourteenth method for accessing KV data according to the third aspect of the present application is provided, which also includes: the storage device performs a data compression operation to compress N data areas stored in the NVM chip into M data areas stored in the NVM chip, where N>M.
[0083] According to the fourteenth method for accessing KV data of the third aspect of the present application, there is provided a fifteenth method for accessing KV data according to the third aspect of the present application, wherein the N data areas include a data area belonging to an upper layer of two adjacent layers and N-1 data areas of a lower layer of the two adjacent layers; and the M data areas are the M data areas of the lower layer of the two adjacent layers.
[0084] According to the fourteenth or fifteenth method for accessing KV data of the third aspect of the present application, there is provided a sixteenth method for accessing KV data according to the third aspect of the present application, wherein the N data areas are located in a third storage device and a fourth storage device; the third storage device and the fourth storage device are different storage devices; the third storage device performs a data compression operation, generates an NVMe read command, and sends the NVMe read command to the fourth storage device; the fourth storage device reads part of the N data areas stored in the fourth storage device according to the NVMe read command and sends it to the third storage device; the third storage device performs a data compression operation on the N data areas to obtain M data areas; and generates an NVMe write command, and sends one or more of the M data areas to the fourth storage device based on the write command.
[0085] According to one of the tenth to sixteenth methods for accessing KV data in the third aspect of the present application, a seventeenth method for accessing KV data in the third aspect of the present application is provided, wherein the storage device responds to the custom command and the first command, parses the first command to obtain the required information indicated by the first command,
[0086] The keyword corresponding to the read KV key-value pair; and determining whether the value corresponding to the keyword is stored in the memory; and
[0087] If the value corresponding to the keyword is stored in the memory, the value corresponding to the keyword is directly read from the memory as a response to the first command.
[0088] According to the seventeenth method for accessing KV data of the third aspect of the present application, there is provided an eighteenth method for accessing KV data of the third aspect of the present application. If the value corresponding to the keyword to be read is not stored in the memory, the storage device queries the first table stored in the memory according to the keyword to determine a first entry, wherein the keyword belongs to the keyword range recorded in the first entry; and obtains the first data area index of the first entry record; and determines the first data area in the NVM chip based on the first data area index, obtains the value corresponding to the keyword in the first data area according to the keyword, and uses the value corresponding to the keyword as a response to the custom command.
[0089] According to the eighteenth method for accessing KV data of the third aspect of the present application, there is provided a nineteenth method for accessing KV data according to the third aspect of the present application, which also includes: the entry of the first table also records the storage device identification information; the host sends the custom command to the fifth storage device, and in response to the custom command being the first command, the fifth storage device obtains the storage device identification information and the first data area index from the entry of the first table, and obtains the value corresponding to the keyword indicated by the first command from the first data area corresponding to the first data area index in the storage device indicated by the storage device identification information, and generates a first response.
[0090] According to the nineteenth method for accessing KV data of the third aspect of the present application, there is provided a twentieth method for accessing KV data according to the third aspect of the present application, wherein, in response to the first data area being located in a fifth storage device indicated by the storage device identification information, the fifth storage device obtains a value corresponding to the keyword from the first data area; or in response to the first data area being located in a sixth storage device, the sixth storage device obtains a value corresponding to the keyword from the first data area, and sends the read value corresponding to the keyword to the fifth storage device, wherein the sixth storage device and the fifth storage device are different storage devices.
[0091] According to the twentieth method for accessing KV data of the third aspect of the present application, there is provided a twenty-first method for accessing KV data according to the third aspect of the present application, wherein the fifth storage device generates a third command according to the first command, and sends the third command to the sixth storage device, wherein the third command indicates a keyword and a first data area index; the sixth storage device reads a value corresponding to the keyword from the corresponding first data area based on the keyword indicated by the third command and the first data area index, and sends the value to the fifth storage device; the fifth storage device generates a first response based on the value fed back by the sixth storage device.
[0092] According to the twentieth method for accessing KV data according to the third aspect of the present application, there is provided a twenty-second method for accessing KV data according to the third aspect of the present application, which also includes: the fifth storage device determines the logical address corresponding to the first data area to be accessed according to the first data area index; generates an NVMe read command according to the logical address; sends the NVMe read command to the sixth storage device; the sixth storage device responds to receiving the NVMe read command, reads the first data area corresponding to the logical address indicated by the NVMe read command, and sends it to the fifth storage device; the fifth storage device responds to receiving the first data area sent by the sixth storage device, determines the value corresponding to the keyword from the first data area, and generates a first response based on the value.
[0093] According to the fourth aspect of the present application, a method for accessing KV data according to the first response of the fourth aspect of the present application is provided, including: in response to receiving a custom command that complies with the NVMe protocol, parsing the custom command to obtain the information it carries; wherein the information includes a keyword in a KV key-value pair or a KV key-value pair, and the KV key-value pair includes a keyword and a value corresponding to the keyword; and based on the information, reading the value corresponding to the keyword in the KV key-value pair from a storage device or writing the KV key-value pair to a storage device, and generating a first response to the custom command.
[0094] According to the method for accessing KV data in the first response of the fourth aspect of the present application, a method for accessing KV data in the second response of the fourth aspect of the present application is provided, and the custom command includes a first command and a second command that satisfy the NVMe protocol; wherein, the first command indicates reading the value corresponding to the keyword in the KV key-value pair, which carries the keyword in the KV key-value pair to be read; the second command indicates writing the KV key-value pair, which carries the KV key value to be written.
[0095] According to the method for accessing KV data in the second response of the fourth aspect of the present application, a method for accessing KV data in the third response of the fourth aspect of the present application is provided. In response to the custom command being the second command, the keyword indicated by the second command is recorded in the memory in association with its corresponding value.
[0096] According to the method for accessing KV data in the third response of the fourth aspect of the present application, a method for accessing KV data in the fourth response of the fourth aspect of the present application is provided, and the keyword and its corresponding value are recorded in association with the first type of storage unit in the memory; wherein the keywords in the KV key-value pairs stored in the first type of storage unit are unordered.
[0097] According to the method for accessing KV data according to the fourth response of the fourth aspect of the present application, a method for accessing KV data according to the fifth response of the fourth aspect of the present application is provided, which also includes: storing the KV key-value pairs in the first-type storage unit into the second-type storage unit of the memory based on the keyword order; wherein the KV key-value pairs stored in the second-type storage unit are sorted by keyword.
[0098] According to the method for accessing KV data in the fifth response according to the fourth aspect of the present application, a method for accessing KV data in the sixth response according to the fourth aspect of the present application is provided, which also includes: generating a flush operation, and processing the flush operation to flush the second-type storage unit as a whole to the NVM chip of the storage device; wherein a data area is used to represent a second-type storage unit flushed to the NVM chip.
[0099] According to the sixth response method for accessing KV data according to the fourth aspect of the present application, a seventh response method for accessing KV data according to the fourth aspect of the present application is provided, and in response to flashing the second type of storage unit to the NVM chip, the second type of storage unit is deleted.
[0100] According to the sixth or seventh response method for accessing KV data according to the fourth aspect of the present application, there is provided a method for accessing KV data according to the eighth response method of the fourth aspect of the present application, in response to flashing the second type of storage unit to the NVM chip, updating the first table in the memory; wherein the first table includes multiple entries, each entry records a data area index, and a keyword range corresponding to the data area.
[0101] According to the eighth response method of the fourth aspect of the present application, there is provided a method for accessing KV data according to the ninth response method of the fourth aspect of the present application, and an entry is added to the first table, which records the data area index and the keyword range corresponding to the data area.
[0102] According to the eighth or ninth response to the method for accessing KV data according to the fourth aspect of the present application, there is provided a tenth response to accessing KV data according to the fourth aspect of the present application, in response to the custom command being the first command, parsing the first command to obtain the keyword corresponding to the KV key-value pair indicated by the first command to be read; and
[0103] Determine whether the value corresponding to the keyword is stored in the memory; and if the value corresponding to the keyword is stored in the memory, directly read the value corresponding to the keyword from the memory as a response to the first command.
[0104] According to the tenth response method for accessing KV data according to the fourth aspect of the present application, there is provided a method for accessing KV data according to the eleventh response method for accessing KV data according to the fourth aspect of the present application. If the value corresponding to the keyword to be read is not stored in the memory, the storage device queries the first table stored in the memory according to the keyword to determine the first entry, wherein the keyword belongs to the keyword range recorded in the first entry; and obtains the first data area index of the first entry record; and determines the first data area in the NVM chip based on the first data area index, obtains the value corresponding to the keyword in the first data area according to the keyword, and uses the value corresponding to the keyword as a response to the custom command.
[0105] According to one of the methods for accessing KV data in the first to eleventh responses of the fourth aspect of the present application, a method for accessing KV data in the twelfth response of the fourth aspect of the present application is provided, and one or more storage devices receive the custom command sent by the host and generate a first response to the custom command.
[0106] According to the twelfth response method for accessing KV data according to the fourth aspect of the present application, there is provided a thirteenth response method for accessing KV data according to the fourth aspect of the present application, wherein each of the one or more storage devices may generate a flush operation, and process the flush operation to flush one or more second-class storage units in the memory into the NVM chip.
[0107] According to the thirteenth response to the method for accessing KV data according to the fourth aspect of the present application, there is provided a method for accessing KV data according to the fourteenth response to the fourth aspect of the present application, wherein the first storage device generates a first flush operation, and processes the first flush operation to flush the second type of storage unit stored in the memory of the first storage device to the NVM chip of the first storage device or the second storage device; or the second storage device generates a second flush operation, and processes the second flush operation to flush the second type of storage unit stored in the memory of the first storage device to the NVM chip of the first storage device or the second storage device; wherein the first storage device and the second storage device are different storage devices.
[0108] According to one of the methods for accessing KV data in the twelfth to fourteenth responses of the fourth aspect of the present application, a method for accessing KV data in the fifteenth response of the fourth aspect of the present application is provided, which also includes: generating a data compression operation, and processing the data compression operation to compress N data areas stored in the NVM chip into M data areas stored in the NVM chip, where N>M.
[0109] According to the fifteenth response of the method for accessing KV data according to the fourth aspect of the present application, there is provided a method for accessing KV data according to the sixteenth response of the fourth aspect of the present application, wherein the N data areas include a data area belonging to an upper layer of two adjacent layers and N-1 data areas of a lower layer of the two adjacent layers; and the M data areas are the M data areas of the lower layer of the two adjacent layers.
[0110] According to the sixteenth or seventeenth response to the method for accessing KV data in the fourth aspect of the present application, there is provided a method for accessing KV data in the eighteenth response to the fourth aspect of the present application, wherein the N data areas are located in a third storage device and a fourth storage device; the third storage device and the fourth storage device are different storage devices; the third storage device performs a data compression operation, generates an NVMe read command, and sends the NVMe read command to the fourth storage device; the fourth storage device reads part of the N data areas stored in the fourth storage device according to the NVMe read command and sends it to the third storage device; the third storage device performs a data compression operation on the N data areas to obtain M data areas; and generates an NVMe write command, and sends one or more of the M data areas to the fourth storage device based on the write command.
[0111] According to one of the methods for accessing KV data in the fourteenth to eighteenth responses of the fourth aspect of the present application, a method for accessing KV data in the nineteenth response of the fourth aspect of the present application is provided, which also includes: the entry of the first table also records the storage device identification information; the fifth storage device receives the custom command sent by the host, and in response to the custom command being the first command, the fifth storage device obtains the storage device identification information and the first data area index from the entry of the first table, and obtains the value corresponding to the keyword indicated by the first command from the first data area corresponding to the first data area index in the storage device indicated by the storage device identification information, and generates a first response.
[0112] According to the nineteenth response to the method for accessing KV data of the fourth aspect of the present application, there is provided a twentieth response to the method for accessing KV data of the fourth aspect of the present application, in response to the first data area being located in the fifth storage device indicated by the storage device identification information, the fifth storage device obtains the value corresponding to the keyword from the first data area; or in response to the first data area being located in the sixth storage device, the sixth storage device obtains the value corresponding to the keyword from the first data area, and sends the read value corresponding to the keyword to the fifth storage device, wherein the sixth storage device and the fifth storage device are different storage devices.
[0113] According to the method for accessing KV data in the twentieth response of the fourth aspect of the present application, there is provided a method for accessing KV data in the twenty-first response of the fourth aspect of the present application, wherein the fifth storage device generates a third command according to the first command, and sends the third command to the sixth storage device, wherein the third command indicates a keyword and a first data area index; the sixth storage device reads a value corresponding to the keyword from the corresponding first data area based on the keyword indicated by the third command and the first data area index, and sends the value to the fifth storage device; the fifth storage device generates a first response based on the value fed back by the sixth storage device.
[0114] According to the method for accessing KV data in the twenty-first response of the fourth aspect of the present application, there is provided a method for accessing KV data in the twenty-second response of the fourth aspect of the present application, which also includes: the fifth storage device determines the logical address corresponding to the first data area to be accessed according to the first data area index; generates an NVMe read command according to the logical address; sends the NVMe read command to the sixth storage device; the sixth storage device responds to receiving the NVMe read command, reads the first data area corresponding to the logical address indicated by the NVMe read command, and sends it to the fifth storage device; the fifth storage device responds to receiving the first data area sent by the sixth storage device, determines the value corresponding to the keyword from the first data area, and generates a first response based on the value.
[0115] According to the fifth aspect of the present application, a first method for accessing KV data according to the fifth aspect of the present application is provided, comprising: in response to receiving an access command for accessing a KV key-value pair, the host obtains information of the KV key-value pair to be accessed as indicated by the access command, wherein the information includes a keyword in the KV key-value pair or a KV key-value pair, and the KV key-value pair includes a keyword Key and a value Value corresponding to the keyword; and controlling the storage of the KV key-value pair or the reading of the KV key-value pair according to the information.
[0116] According to the first method for accessing KV data according to the fifth aspect of the present application, a second method for accessing KV data according to the fifth aspect of the present application is provided. In response to the access command being a Put (Key, Value) command for writing a KV key-value pair, the host records the keyword in the KV key-value pair indicated by the Put (Key, Value) command in association with the value corresponding to the keyword in the host memory.
[0117] According to the second method for accessing KV data according to the fifth aspect of the present application, a third method for accessing KV data according to the fifth aspect of the present application is provided, wherein the host memory includes a first-class storage unit and at least one second-class storage unit; wherein the keywords in the KV key-value pairs stored in the first-class storage unit are unordered; the KV key-value pairs stored in the second-class storage unit are sorted by keywords; the host records the keywords in the KV key-value pairs indicated by the Put (Key, Value) command in association with the values corresponding to the keywords in the host memory, including: recording the keywords in association with the values corresponding to the keywords in the first-class storage unit of the host memory.
[0118] According to the third method for accessing KV data according to the fifth aspect of the present application, a fourth method for accessing KV data according to the fifth aspect of the present application is provided, and the host moves the KV key-value pairs stored in the first type of storage unit in the host memory to the second type of storage unit based on the keyword order.
[0119] According to the third or fourth method for accessing KV data according to the fifth aspect of the present application, a fifth method for accessing KV data according to the fifth aspect of the present application is provided, which also includes: the host determines a first logical address corresponding to the second-type storage unit, generates a write command based on the first logical address and the second-type storage unit, converts the write command into an NVMe write command and sends it to the storage device, the NVMe write command is used to move the second-type storage unit stored in the host memory to the NVM chip of the storage device; wherein a data area is used to represent a second-type storage unit flashed to the NVM chip.
[0120] According to the fifth method for accessing KV data of the fifth aspect of the present application, a sixth method for accessing KV data according to the fifth aspect of the present application is provided, which also includes: the host receives a response to the NVMe write command fed back by the storage device, and deletes the second type storage unit.
[0121] According to the fifth method for accessing KV data according to the fifth aspect of the present application, a seventh method for accessing KV data according to the fifth aspect of the present application is provided, which also includes: the host updates a first table in the host memory; wherein the first table includes multiple entries, each entry records a data area index, and a keyword range corresponding to the data area.
[0122] According to the seventh method for accessing KV data according to the fifth aspect of the present application, there is provided an eighth method for accessing KV data according to the fifth aspect of the present application, wherein the host adds an entry in the first table, the entry recording the data area index and the keyword range corresponding to the data area.
[0123] According to the eighth method for accessing KV data of the fifth aspect of the present application, there is provided a ninth method for accessing KV data according to the fifth aspect of the present application. In response to the access command being a Get(Key) command for reading KV data, the host parses the Get(Key) command to obtain the keyword in the KV key-value pair to be accessed; and determines whether the value corresponding to the keyword is stored in the host memory; if the value corresponding to the keyword is stored in the host memory, obtains the value corresponding to the keyword from the host memory.
[0124] According to the ninth method for accessing KV data of the fifth aspect of the present application, there is provided a tenth method for accessing KV data according to the fifth aspect of the present application, which also includes: if the value corresponding to the keyword is not stored in the host memory, the host queries the first table in the host memory according to the keyword to determine the first entry; wherein the keyword belongs to the keyword range recorded in the first entry; and obtains the data area index of the first entry record, determines the second logical address according to the data area index of the first entry record, generates an NVMe read command based on the second logical address, and sends the NVMe read command to the storage device; and receives the data area storing the value corresponding to the keyword fed back by the storage device based on the NVMe read command, and reads the value corresponding to the keyword from the data area.
[0125] According to the tenth method for accessing KV data of the fifth aspect of the present application, there is provided an eleventh method for accessing KV data according to the fifth aspect of the present application, further comprising: recording storage device identification information in the entry of the first table;
[0126] According to the eleventh method for accessing KV data according to the fifth aspect of the present application, there is provided a twelfth method for accessing KV data according to the fifth aspect of the present application, wherein the host is coupled to one or more storage devices; the host obtains storage device identification information from an entry in a first table; the NVMe read command is sent to a first storage device indicated by the storage device identification information according to the storage device identification information; and the first storage device feeds back to the host a data area storing a value corresponding to the keyword based on the NVMe read command.
[0127] According to the twelfth method for accessing KV data according to the fifth aspect of the present application, a thirteenth method for accessing KV data according to the fifth aspect of the present application is provided, in response to the NVMe read command, the data area to be read is located in the first storage device indicated by the storage device identification information, and the first storage device reads the corresponding data area from the corresponding NVM chip.
[0128] According to the twelfth or thirteenth method for accessing KV data according to the fifth aspect of the present application, a fourteenth method for accessing KV data according to the fifth aspect of the present application is provided, in response to the NVMe read command, the data area to be read is located in the second storage device, and the first storage device reads the corresponding data area from the second storage device, wherein the second storage device and the first storage device are different storage devices.
[0129] According to the fourteenth method for accessing KV data according to the fifth aspect of the present application, there is provided a fifteenth method for accessing KV data according to the fifth aspect of the present application, wherein the first storage device generates a read command according to the NVMe read command, and sends the read command to the second storage device; the second storage device reads the corresponding data area from the NVM chip corresponding to it based on the logical address indicated by the read command; the first storage device determines the value corresponding to the keyword in the KV key-value pair to be read based on the data area feedback from the second storage device.
[0130] According to one of the first to fifteenth methods for accessing KV data according to the fifth aspect of the present application, a sixteenth method for accessing KV data according to the fifth aspect of the present application is provided, which also includes: the host generates a data compression command; wherein the data compression command indicates information of the data area to be compressed; and a first custom command that complies with the NVMe protocol is generated based on the information, and the first custom command is sent to the storage device, so that the storage device performs a compression operation on the data area stored in the NVM chip based on the first custom command.
[0131] According to the sixteenth method for accessing KV data according to the fifth aspect of the present application, there is provided a seventeenth method for accessing KV data according to the fifth aspect of the present application, wherein the information of the data area to be compressed includes the data area index to be compressed; wherein the data area index includes a logical address or a namespace.
[0132] According to the sixteenth or seventeenth method for accessing KV data according to the fifth aspect of the present application, there is provided an eighteenth method for accessing KV data according to the fifth aspect of the present application, wherein the storage device compresses N data areas stored in the NVM chip into M data areas based on the first custom command, and stores them in the NVM chip; wherein N>M.
[0133] According to the eighteenth method for accessing KV data of the fifth aspect of the present application, there is provided a nineteenth method for accessing KV data according to the fifth aspect of the present application, wherein the N data areas include a data area belonging to an upper layer of two adjacent layers and N-1 data areas of a lower layer of the two adjacent layers; and the M data areas are the M data areas of the lower layer of the two adjacent layers.
[0134] According to the nineteenth method for accessing KV data according to the fifth aspect of the present application, there is provided a twentieth method for accessing KV data according to the fifth aspect of the present application, wherein the N data areas are stored in the same storage device or in different storage devices; and the M data areas are stored in the same storage device or in different storage devices.
[0135] According to the twentieth method for accessing KV data of the fifth aspect of the present application, there is provided a twenty-first method for accessing KV data of the fifth aspect of the present application, and before the host sends the first custom command to the storage device, it also includes: the host generates a second custom command that complies with the NVMe protocol in response to the data area to be compressed being located in different storage devices, and sends the second custom command to a third storage device; the second custom command indicates the index of the data area to be moved; the third storage device moves the N second-type storage units from one or more fourth storage devices to the third storage device based on the second custom command, wherein the third storage device and the fourth storage device are different storage devices.
[0136] According to the sixth aspect of the present application, a method for accessing KV data according to the first response of the sixth aspect of the present application is provided, including: responding to receiving a first custom command sent by the host, wherein the first custom command indicates information of the data area to be compressed; wherein the data area is a storage space with continuous logical addresses in the NVM chip and stores KV key-value pairs in keyword order; based on the first custom command, compressing N data areas stored in the NVM chip into M data areas, and storing them in the NVM chip; wherein N>M.
[0137] According to the first response method for accessing KV data according to the sixth aspect of the present application, there is provided a second response method for accessing KV data according to the sixth aspect of the present application, wherein the N data areas include a data area belonging to an upper layer of two adjacent layers and N-1 data areas of a lower layer of the two adjacent layers; and the M data areas are the M data areas of the lower layer of the two adjacent layers.
[0138] According to the method for accessing KV data in the first or second response of the sixth aspect of the present application, there is provided a method for accessing KV data in the third response of the sixth aspect of the present application, wherein the information of the data area to be compressed includes the data area index to be compressed; wherein the data area index includes a logical address or a namespace.
[0139] According to the third response method for accessing KV data according to the sixth aspect of the present application, a method for accessing KV data according to the fourth response method of the sixth aspect of the present application is provided, wherein the N data areas are located in the same storage device or different storage devices; the M data areas are located in the same storage device or stored in different storage devices.
[0140] According to the fourth response method for accessing KV data according to the sixth aspect of the present application, there is provided a method for accessing KV data according to the fifth response method of the sixth aspect of the present application, before the host sends the first custom command to the storage device, it also includes: in response to the data area to be compressed being located in different storage devices, the host generates a second custom command that complies with the NVMe protocol, and sends the second custom command to the first storage device, the second custom command indicating the index of the data area to be moved; the first storage device moves the N second-type storage units from one or more second storage devices to the first storage device based on the second custom command, wherein the first storage device and the second storage device are different storage devices.
[0141] One of the methods for accessing KV data according to the first to sixth responses of the sixth aspect of the present application provides a method for accessing KV data according to the seventh response of the sixth aspect of the present application, and also includes: receiving an NVMe write command sent by the host, storing the second type of storage unit stored in the host memory indicated by the NVMe write command in the NVM chip, and generating and feeding back a first response to the host.
[0142] According to one of the methods for accessing KV data in the first to seventh responses of the sixth aspect of the present application, a method for accessing KV data in the eighth response of the sixth aspect of the present application is provided, which also includes: receiving an NVMe read command sent by the host, and determining the corresponding NVM chip physical address according to the logical address indicated by the NVMe read command; reading the data area according to the NVM chip physical address, and feeding back the read data area to the host.
[0143] According to the method for accessing KV data in the eighth response of the sixth aspect of the present application, a method for accessing KV data in the ninth response of the sixth aspect of the present application is provided. If the third storage device receives an NVMe read command sent by the host, and the physical address corresponding to the logical address indicated by the NVMe read command is the physical address of the NVM chip in the third storage device, the third storage device reads the corresponding data area from its corresponding NVM chip according to the physical address.
[0144] According to the eighth or ninth response method for accessing KV data according to the sixth aspect of the present application, a tenth response method for accessing KV data according to the sixth aspect of the present application is provided. If the third storage device receives an NVMe read command sent by the host, the physical address corresponding to the logical address indicated by the NVMe read command is the physical address of the NVM chip in the fourth storage device, and the third storage device reads the data area from the fourth storage device; wherein the third storage device and the fourth storage device are different storage devices.
[0145] According to the tenth response method of the sixth aspect of the present application, there is provided a method for accessing KV data according to the eleventh response method of the sixth aspect of the present application, wherein the third storage device generates a read command according to the logical address indicated by the NVMe read command, and sends the read command to the fourth storage device; the fourth storage device reads a data area based on the physical address corresponding to the logical address indicated by the read command, and sends the read data area to the third storage device; the third storage device determines the value corresponding to the keyword in the KV key-value pair to be read by the NVMe read command based on the data area of the fourth storage device.
[0146] According to the seventh aspect of the present application, a method for accessing KV data according to the first response of the seventh aspect of the present application is provided, including: a first storage device responds to receiving a custom command sent by the host, wherein the custom command is a fourth command, and the fourth command indicates a keyword in the KV key-value pair to be read and a data area index storing the KV key-value pair in its NVM chip; the first storage device reads out the corresponding data area based on the data area index indicated by the fourth command, and determines from the data area the value corresponding to the keyword in the KV key-value pair corresponding to the keyword according to the keyword indicated by the fourth command, and feeds back the value corresponding to the read keyword to the host; wherein the data area is a storage space with continuous logical addresses in the NVM chip and stores KV key-value pairs in keyword order.
[0147] A method for accessing KV data according to a first response of the seventh aspect of the present application is provided. If the data area corresponding to the data area index indicated in the fourth command is located in the first storage device, the first storage device determines the corresponding data area from the corresponding NVM chip, and reads from the data area the value corresponding to the keyword in the KV key-value pair indicated by the fourth command to be read, and sends it to the host.
[0148] A method for accessing KV data according to the first or second response of the seventh aspect of the present application is provided, and a method for accessing KV data according to the third response of the seventh aspect of the present application is provided, wherein if the data area corresponding to the data area index indicated in the fourth command is located in the second storage device, the first storage device transfers the fourth command to the second storage device; wherein the second storage device and the first storage device are different storage devices; the second storage determines the data area corresponding to the data area index indicated in the fourth command, and reads out the value corresponding to the keyword in the KV key-value pair indicated by the fourth command to be read from the data area, and feeds back the read value corresponding to the keyword to the first storage device.
[0149] According to the third response method for accessing KV data in the seventh aspect of the present application, there is provided a fourth response method for accessing KV data in the seventh aspect of the present application, wherein the first storage device determines the logical address corresponding to the data area to be accessed according to the data area index; generates an NVMe read command according to the logical address; sends the NVMe read command to the second storage device; in response to receiving the NVMe read command, the second storage device reads the data area corresponding to the logical address indicated by the NVMe read command and sends it to the first storage device; the first storage reads the value corresponding to the keyword in the KV key-value pair to be read indicated by the fourth command from the data area, and feeds back the read value corresponding to the keyword to the host.
[0150] According to the method for accessing KV data in the third or fourth response of the seventh aspect of the present application, there is provided a method for accessing KV data in the fifth response of the seventh aspect of the present application, wherein the first storage device generates a fifth command based on the fourth command, and sends the fifth command to the second storage device; wherein the fourth command and the fifth command are commands in different forms carrying the same information; the second storage device responds to receiving the fifth command, and reads the corresponding data area based on the fifth command and sends it to the first storage device; the first storage reads out the value corresponding to the keyword in the KV key-value pair indicated by the fourth command to be read from the data area, and feeds back the read value corresponding to the keyword to the host.
[0151] According to one of the methods for accessing KV data in the first to fifth responses of the seventh aspect of the present application, there is provided a method for accessing KV data in the sixth response of the seventh aspect of the present application, wherein the data area index includes a command space identifier.
[0152] According to the eighth aspect of the present application, a storage system according to the eighth aspect of the present application is provided, the system comprising a host and at least one storage device coupled to the host; wherein the host and the storage device execute the method described in any one of the third to seventh aspects. BRIEF DESCRIPTION OF THE DRAWINGS
[0153] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0154] Figure 1A A block diagram of a storage device in the prior art;
[0155] Figure 1B A detailed block diagram showing the control components of a storage device;
[0156] Figure 1C A schematic diagram showing how existing storage devices use the RocksDB system to store KV data;
[0157] Figure 2 A schematic diagram of the structure of a storage device provided in an embodiment of the present application is shown;
[0158] Figure 3 A schematic diagram of the structure of the control component provided in the embodiment of the present application is shown;
[0159] Figure 4A A flowchart of a specified operation for processing user needs provided by an embodiment of the present application is shown;
[0160] Figure 4B A schematic diagram of the structure of another control component provided in an embodiment of the present application is shown;
[0161] Figure 5A A schematic diagram showing a method of loading the Star DB system provided by an embodiment of the present application into a host computer is shown;
[0162] Figure 5B A schematic diagram of a host controlling writing of a KV key-value pair to a storage device provided in an embodiment of the present application is shown;
[0163] Figure 5C A schematic diagram of a host controlling the reading of a KV key-value pair from a storage device provided in an embodiment of the present application is shown;
[0164] Figure 5D A schematic diagram showing a host provided in an embodiment of the present application controlling the compression processing of KV data through the Star DB system;
[0165] Fig. 6A A schematic diagram showing loading the Star DB system provided by an embodiment of the present application into a storage device is shown;
[0166] Figure 6B A schematic diagram showing coupling of another host and a storage device according to an embodiment of the present application is shown;
[0167] Fig. 7A A schematic diagram of writing a KV key-value pair to a storage device is shown when the Star DB system provided by an embodiment of the present application is loaded in both the host and the storage device;
[0168] Figure 7B A schematic diagram of reading KV key-value pairs from a storage device is shown when the Star DB system provided by an embodiment of the present application is loaded in both the host and the storage device;
[0169] Figure 8A schematic diagram showing a storage device provided in an embodiment of the present application controlling the compression processing of KV data through the Star DB system;
[0170] Fig.9A A schematic diagram showing the coupling between a host and a storage device provided by an embodiment of the present application is shown;
[0171] Fig. 9B A schematic diagram showing another coupling between a host and a storage device provided in an embodiment of the present application is shown;
[0172] Fig.10 A schematic diagram of coupling another host and a storage device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0173] The following is a clear and complete description of the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0174] Figure 2 A schematic diagram of the structure of a storage device provided in an embodiment of the present application is shown.
[0175] As an example, Figure 2 As shown, the storage device includes an interface, a control component, a memory (such as DRAM), and an NVM chip. The interface in the storage device is equivalent to Figure 1A The interface 103 shown; the host interface in the control component is equivalent to Figure 1B The control component also includes a CPU group 1, which includes at least one CPU. The CPU group 1 is coupled to the media interface controller and the host interface, and the CPU in the CPU group 1 is used to process NVMe commands (such as NVMe read commands, NVMe write commands, or custom commands that meet the NVMe protocol, etc.) transmitted based on the PCIe link. As an example, in response to receiving an NVMe command sent by the host through the interface, the storage device sends the NVMe command to the CPU group 1 through the PCIe link. The firmware running in the CPU group 1 provides the following Figure 1BThe host command processing unit, storage command processing unit and storage medium management unit are shown. CPU group 1 processes the NVMe command. For example, the NVMe command is an NVMe read command, the host command processing unit parses the NVMe read command, generates a storage command according to the parsing result, and sends the generated storage command to the storage command processing unit; the storage command processing unit parses the storage command in response to receiving the storage command to obtain the logical address and / or namespace information; the storage medium management unit determines the physical address of the NVM chip corresponding to the data to be read according to the logical address and / or namespace information, generates a media interface command based on the physical address, and sends the media interface command to the media interface controller, the media interface controller generates a storage medium access command that complies with the NVM chip interface protocol based on the media access command, and sends the generated storage medium access command to the NVM chip coupled to the control component, so that the NVM chip reads the data based on the storage medium access command.
[0176] As another example, in order to enable CPU group 1 to process NVMe commands transmitted through the PCIe link, the CPU in CPU group 1 runs a dedicated operating system (such as a real-time operating system RTOS) designed by the provider of the control component, and runs firmware in the dedicated operating system. By running the firmware, CPU group 1 implements the processing of NVMe commands, as well as operations such as reading, programming, and erasing of NVMe chips.
[0177] In addition to implementing read / write operations through storage devices, in some scenarios, users also want to control storage devices to implement some specified functions, such as storing or accessing KV key-value pairs, searching for images, matching, hardware acceleration, etc. In order to enable storage devices to implement user-specified operations according to user needs, and to avoid or reduce the additional workload introduced by redeveloping or modifying the firmware of control components according to different user needs, according to the embodiments of the present application, Figure 2 The control unit shown further includes a CPU group 2, which also includes at least one CPU. The CPU group 2 supports the development of user-specified operations by running a standard operating system.
[0178] As an example, the CPU in CPU group 2 runs a standard operating system such as Linux or Windows. Standard operating systems such as Linux or Windows support the function of users loading program codes or applications (such as APP) thereto according to actual needs. When the control component lacks the function to meet the user's specified needs, the user can compile the program code or load the program code based on the actual needs. The CPU in CPU group 2 loads the program code compiled or loaded by the user by running the standard operating system, and runs the loaded user compiled or loaded program code. CPU group 2 implements the user-specified operation by running, for example, the loaded program code or application.
[0179] In order to facilitate understanding of the above process of users loading program codes or applications into the control component through the standard operating system, the structure and working process of the control component are described in detail below by way of example.
[0180] Figure 3 A schematic diagram of the structure of the control component provided in an embodiment of the present application is shown.
[0181] As an example, Figure 3 As shown, the control component includes a control circuit 301 and a control circuit 302, wherein the control circuit 301 includes a CPU group 1 and a media interface controller, which are used to process NVMe commands such as NVMe write commands or NVMe read commands, so as to access the NVM chip based on the NVMe command. The control circuit 302 includes a CPU group 2, which is used to process user-specified operations. The host interacts with the control circuit 301 through a PCIe link. For example, if a user wants to access data in the NVM chip, an NVMe read command or an NVMe write command is generated by the host, and then the NVMe read command or the NVMe write command is sent to the control circuit 301 through the PCIe link between the host and the control circuit 301. The host command processing unit, the storage command processing unit, the storage medium management unit, and the media interface controller in the control circuit 301 process the NVMe read command or the NVMe write command and access the NVM chip. Specifically, the process of the host command processing unit, the storage command processing unit, the storage medium management unit, and the media interface controller processing the NVMe command can be found in Figure 1B , I will not go into details here.
[0182] Continue to see Figure 3For example, CPU group 1 includes four CPU cores, namely CPU 1-0, CPU 1-1, CPU 1-2, and CPU 1-3. Optionally, a real-time operating system (RTOS) is run on the four CPU cores of CPU group 1. CPU group 1 implements a host command processing unit, a storage command processing unit, and a storage medium management unit under the support of the operating system, and also provides functions such as managing an FTL table or garbage collection GC. It can be understood that the host command processing unit, the storage command processing unit, and the storage medium management unit may not rely on the operating system.
[0183] As an example, Figure 3 As shown, CPU group 2 includes four CPU cores, CPU 2-0, CPU 2-1, CPU 2-2, and CPU 2-3. A standard operating system (such as Linux) runs on the four CPU cores of CPU group 2. Remote connection tools (such as Secure Shell SSH), applications, etc. are provided on the standard operating system. The host and the control circuit 302 in the control component communicate via, for example, SSH.
[0184] As an example, see Figure 3 , the control component includes a serial port or a network port, and the host and the control circuit 302 (such as CPU group 2) can communicate directly through the serial port or the network port, so that the host and CPU group 2 can communicate directly through the serial port or the network port (such as SSH communication). The user sends the program code or application with a specific function to be installed to the host, and the host sends the program code or application to be installed by the user (such as KV storage system, image search algorithm, matching algorithm or application acceleration program) to the remote connection tool on the standard operating system running by CPU group 2 through the serial port or the network port, so as to deploy the program code or application to be installed by the user to the standard operating system of CPU group 2.
[0185] In addition, in addition to deploying the program code or application to be installed by the user on the standard operating system of CPU group 2, the host also deploys the application programming interface (Application Programming Interface, API) that provides specific functions on the standard operating system. For example, the host directly sends a call request for the user-specified program to CPU group 2 in the control circuit 302 through the serial port or the network port, and the CPU in CPU group 2 receives the call request sent by the host, controls the operation of the user-specified program based on the call request to implement the user-specified operation, and returns the call result. For another example, the user operates the host to call the application programming interface (Application Programming Interface, API) of the application through the serial port, and controls the application to be called to run on the standard operating system by calling the application's API to implement the user-specified operation and return the call result.
[0186] Figure 3 In the example of FIG. 3 , the control circuit 301 and the control circuit 302 each include 4 CPU cores. It is understandable that each control circuit may include other numbers of CPU cores, which may be the same or different from each other. The number of CPU cores of the control circuit 301 and the control circuit 302 does not have to be the same.
[0187] Still as an example, in addition to communicating with the operating system / application in the control circuit 2 through the serial port / network, the host can also communicate through the PCIe link between the control component 1 and the host, thereby eliminating the serial port / network to reduce the cost of the control component. For example, the host carries a communication or call request to the control circuit 302 through a custom command that complies with the NVMe protocol, and the control circuit 301 forwards such communication or call request to the control circuit 302, and the corresponding response made by the control circuit 302 is also returned to the host through the control circuit 301 as a response to the custom command.
[0188] Since the control circuit 302 runs a standard operating system, it is possible for the user, rather than the provider of the control component, to develop a program running in the control circuit 302 based on the standard operating system. Even without the assistance of the provider of the control circuit 302, the user can use the development tools of the prior art and / or the development tools provided by the provider of the control component to develop a program running in the control circuit 302. In addition to calling the services of the standard operating system through the API, such a program can also use the storage device services based on, for example, the NVMe protocol provided by the control circuit 1, and when using the storage device services, the transmission path of the read and write data occurs inside the storage device without being transmitted to the outside of the storage device via the PCIe link, so that the data throughput can exceed the bandwidth that the PCIe link can provide, as well as lower processing delays.
[0189] The hardware accelerator of the control circuit 302 can also be used by user-developed programs running in the control circuit 302. The hardware accelerator is a device compatible with a standard operating system and can be operated by user-developed applications through a standard operating system, a hardware abstraction layer and / or a board support package (BSP).
[0190] Figure 4A A flowchart of a specified operation for processing user needs provided in an embodiment of the present application is shown.
[0191] As an example, Figure 4A As shown, an application program that implements user-specific requirements has been run in the control component 302. The user sends a request to the storage device through the host to instruct the implementation of specific requirements. The host can encapsulate the user's request to implement specific requirements into a custom command that complies with the NVMe protocol, and the host sends the encapsulated custom command to the control circuit 301 in the control component through the PCIe link, which is represented as process (4.1). In response to receiving the custom command, the host command processing unit in the control circuit 301 parses the custom command to obtain information about specific requirements, generates an API call request for calling the application program that implements the specific requirements based on the specific requirement information, and sends the API call request to the corresponding API of the control circuit 302, which is represented as process (4.2). In response to receiving the API call request, the control circuit 302 runs the corresponding application program on the standard operating system to process the API call request to implement the user-specified operation, and obtains the call result, and feeds the call result back to the host command processing unit in the control circuit 301 through the API, which is represented as process (4.3). The host command processing unit in the control circuit 301 generates completion information (CPL) of the custom command based on the call result, and sends the completion information to the host, so that the host obtains the specific function API call result according to the completion information, which is represented as process (4.4).
[0192] As another example, CPU group 1 can directly forward the received custom command that meets the NVMe protocol to CPU group 2 (instead of generating an API call request), and CPU group 2 will process the custom command. For example, the control component does not include an interface such as a serial port or a network port for direct communication with the host. The host converts SSH communication into a custom command that meets the NVMe protocol and provides it to CPU group 1; CPU group 1 forwards the custom command to CPU group 2; CPU group 2 processes the SSH communication carried by the custom hit.
[0193] Optionally, if the user-specified application is to provide services to the host, the host uses the services provided by the application through the serial port, network card, or a custom command that satisfies the NVMe protocol; the host issues a command to call the service, which is directly given to CPU group 2 through the serial port or network port, or is given to CPU group 1 through a custom command that satisfies the NVMe protocol, and then transferred from CPU group 1 to CPU group 2; CPU group 2 processes the command (such as a command to call the service or a custom command) by running the application, and gives the result of calling the service.
[0194] Furthermore, in the process of running applications on a standard operating system to process API call requests for specific needs, achieving specific needs may require the use of NVM chips to access or store data. The use of NVM chips in the control component is implemented by the host command processing unit, storage command processing unit, storage medium management unit and medium interface controller in the control circuit 301, and processing of API call requests for user specific needs is implemented by applications running on the standard operating system of CPU group 2. In order to enable the storage space provided by the NVM chip to be used in the process of running applications to process API call requests for specific needs, CPU group 2 is required to exchange data with CPU group 1, but CPU group 1 is used to process NVMe protocol commands. In order to enable the commands sent by CPU group 2 to be recognized by CPU group 1, the embodiment of the present application provides the following Figure 4B control components.
[0195] Figure 4B A structural schematic diagram of another control component provided in an embodiment of the present application is shown.
[0196] As an example, Figure 4BAs shown, in addition to deploying various applications on the standard operating system of CPU group 2, a file system and an NVMe driver are also deployed. In the process of running user-installed applications on the standard operating system to process API call requests for specific needs, if the application needs to use the storage space provided by the NVM chip, the storage space is mounted to the standard operating system in the form of a standard storage device, and then the application uses the common method in the standard operating system to use the storage device, such as using the storage space provided by the storage device in a file manner. The application is run on the standard operating system to generate file information, and the file information is sent to the file system running on the standard operating system. The file system determines the logical address and / or namespace (NameSpace, NS) to be accessed based on the file information, and the NVMe driver generates a custom command or a standard NVMe command (such as an NVMe read command or an NVMe write command) that satisfies the NVMe command based on the logical address and / or namespace to be accessed. The generated NVMe command is provided to the control circuit 301 inside the control component without passing through the PCIe link.
[0197] For example, in response to a program running in a standard operating system accessing a file in a file system, the file system determines the logical address and / or namespace information to be accessed based on the file, and generates a custom command or standard NVMe command that satisfies the NVMe protocol based on the logical address and / or namespace information (NS, NameSpace). The NVMe driver sends a custom command or standard NVMe command that satisfies the NVMe protocol to the host command processing unit in the control circuit 301 in NS and / or LBA mode. The host command processing unit parses the custom command or standard NVMe command in response to receiving the custom command or standard NVMe command, generates a storage command based on the parsing result, and sends the storage command to the storage command processing unit. The storage command processing unit parses the storage command in response to receiving the storage command to obtain LBA and / or NS information. The storage medium management unit determines the physical address of the NVM chip to be accessed based on the LBA and / or NS information, generates a media interface command based on the physical address, and sends the media interface command to the media interface controller; the media interface controller generates a storage medium access command based on the media interface command, sends the storage medium access command to the NVM chip, and accesses the NVM chip based on the storage medium access command.
[0198] For another example, the NVMe driver sends a custom command or a standard NVMe command to the host command processing unit in the control circuit 301 through a block device to access the NVM chip.
[0199] Optionally, in response to the completion of processing of a custom command or a standard NVMe command sent to the NVMe driver, the control circuit 301 generates a response corresponding to the custom command or the standard NVMe command, and the response is an access result of the file to be accessed in the file system.
[0200] Optionally, the storage device accessed by the NVMe driver is the same as or different from the storage device presented by the CPU group 1 processing the NVMe command. For example, the storage device accessed by the host is distinguished from the storage device accessed by the standard operating system in the control circuit 302 by the command space indicated by the NVMe command.
[0201] According to the embodiment of the present application, the command received and processed by the host command processing unit in the control circuit 301 may come from the host (such as a command that complies with the NVMe protocol and is sent by the host via a PCIe link), or from an application running on a standard operating system in the control circuit 302. Figure 4B As shown, two pairs of command queues SQ and message queues CQ (SQ1 and CQ1, SQ2 and CQ2) are deployed, wherein the command queue SQ1 is used to store commands from the host, and the message queue CQ1 is used to store response data of commands from the host; the command queue SQ2 is used to store commands from applications running on a standard operating system in the control circuit 302, and CQ2 is used to store responses to commands in SQ2. When the host needs to access the storage space provided by the NVM chip, the generated NVMe command is stored in the message queue SQ1, the host command processing unit obtains the NVMe command from the host from the message queue SQ1, and the processing result of the NVMe command from the host is stored in CQ1, and the host obtains the corresponding processing result from CQ1. When the application needs to access the storage space provided by the NVM chip, the corresponding command (such as a custom command or NVMe command that satisfies the NVMe command) is stored in the message queue SQ2, the host command processing unit obtains the command from the application from the message queue SQ2, and stores the processing result of the command from the application to CQ2, and the application obtains the corresponding processing result from CQ2. Optionally, the memory used by the application in the control circuit 302 (for example, Figure 4B A cache is allocated in DRAM2) to replace the host memory to be used by the NVMe command (for example, the host memory indexed by the PRP / SGL carried by the NVMe command).
[0202] As another example, in order to enable applications deployed on a standard operating system to use the storage space provided by the NVM chip, for example, a dedicated access path is added to CPU group 1, and applications of CPU group 2 access the NVM chip based on the dedicated access path.
[0203] Continue to see Figure 4B As an example, the storage device includes a memory, and the memory includes DRAM1 and DRAM2, wherein CPU group 1 is coupled to DRAM1, and CPU group 2 is coupled to DRAM2. The storage spaces provided by DRAM1 and DRAM2 are isolated from each other. CPU group 1 uses the storage space provided by DRAM1, and CPU group 2 uses the storage space provided by DRAM2. CPU group 1 can perform DMA operations to move data between the storage space provided by DRAM1 and the storage space provided by DRAM2, and to move data between the storage space provided by DRAM1 and the host.
[0204] As mentioned above, users can Figure 2 or Figure 3 The standard operating system (such as Linux) running in CPU group 2 loads the KV storage system to the control component, and realizes the function of reading KV key-value pairs or storing KV key-value pairs by running the loaded KV storage system on the standard operating system. The following is an example of user-instructed storage or reading of KV key-value pairs.
[0205] The solution provided in the embodiment of the present application introduces the Star DB system, which is a storage system product or software similar to Rocks DB. The Star DB system can be used to process KV key-value pairs, such as storing KV key-value pairs, reading KV key-value pairs, or compressing data. The data structure of the Star DB system for storing KV key-value pairs is similar to that of the Rocks DB system, for example, the LSM tree structure is used to store data. The functions that can be implemented by the Star DB system and the way to implement the functions are different from those of the Rocks DB system. Please refer to the following for details and will not be elaborated here.
[0206] Figure 5A A schematic diagram of loading the Star DB system provided in an embodiment of the present application into a host is shown.
[0207] As an example, Figure 5AAs shown, the user uses an application running in the host, and the application issues an access request to use, for example, a file or KV service. If the access request indicates that a file is to be accessed, the host determines the logical address LBA of the block device to be accessed based on the access request through the file system, generates an NVMe command (called NVMe command A1) based on the LBA, such as NVMe command A1 is a standard NVMe read command or NVMe write command, and sends the NVMe command A1 to the storage device so that the control component accesses the NVM chip based on the NVMe command A1. If the access request is, for example, an access request related to a KV key-value pair, the access request is provided to the StarDB system, and the Star DB system parses the access request, repackages and generates a specified command that can be recognized by the NVMe driver in the host, and sends the specified command to the NVMe driver. In response to receiving the specified command, the NVMe driver parses the specified command and generates, for example, an NVMe command (referred to as NVMe command A2) or a custom command that complies with the NVMe protocol based on the information indicated by the specified command, and sends the NVMe command A2 or the custom command to the storage device, so that the control component reads the KV key-value pair or stores the KV key-value pair based on the NVMe command A2 or the custom command.
[0208] Understandably, Figure 5A In the figure, the file system also generates the NVMe command A1 through the NVMe driver. For the purpose of clarity, the connection line between the file system and the NVMe driver is not drawn, and an arrow representing the NVMe command A1 is directly drawn between the file system and the control circuit 301.
[0209] It should be understood that the NVMe command A2 generated by the StarDB system through the NVMe driver and the NVMe command A1 generated by the file system through the NVMe driver are both standard NVMe read commands or NVMe write commands. In addition, the custom commands that meet the NVMe protocol generated by the StarDB system through the NVMe driver can be used to access the KV key-value pairs stored by the storage device. For the process of generating NVMe command A2 or custom commands by the StarDB system through the NVMe driver, please refer to the following, which will not be repeated here.
[0210] Figure 5B A schematic diagram of a host controlling writing of KV key-value pairs to a storage device provided in an embodiment of the present application is shown.
[0211] As an example, Figure 5BAs shown, the user uses an application running in the host, and the application issues an access command C for accessing a KV key-value pair. For example, the access command C is a Put (Key, Value) command for writing a KV key-value pair. The access command C is provided to the StarDB system, and the Star DB system parses the access command C to obtain the keyword and the value corresponding to the keyword in the KV key-value pair to be written (such as<Key,Value> ),Will<Key,Value> For example, the Star DB system allocates storage unit A in the host memory for access command C. The Star DB system<Key,Value> The pair is stored in the allocated storage unit A (represented as process 5.1).
[0212] The Star DB system uses a Rocks DB-like approach to manage and maintain storage units A and B in the host memory. For example, the KV key-value pairs in storage unit A are sorted and the sorted KV key-value pairs are stored in storage unit B (represented as process 5.2).
[0213] It can be understood that the storage unit A provided in the embodiment of the present application has the same structure and operation mode as the MemTable in the RocksDB system, and the storage unit B has the same structure and operation mode as the ImmuTable in the RocksDB system. The keywords in the KV key-value pairs stored in the storage unit A are unordered. The KV key-value pairs stored in the storage unit B are sorted by keywords.
[0214] As another example, due to the limited storage space of the host memory, the StarDB system also maintains the SST data area in which the KV key-value pairs in the storage unit B are written to the NVM chip. It can be understood that the sorted KV key-value pairs are stored non-volatilely in the form of SST data areas on the NVM chip, and the SST data area has a hierarchical structure. In the StarDB system, the file system is not used to manage the SST data area to eliminate the additional overhead introduced by the file system. As an alternative, a data area (hereinafter collectively referred to as the SST data area) is used to replace the SST file in RocksDB. The SST data area is a storage space with continuous logical addresses on the NVM chip. The StarDB system maintains multiple SST data areas, and the storage space sizes of each SST data area are the same or different from each other. According to an embodiment of the present application, the StarDB system only uses a single index to access each SST data area, thereby eliminating the need to use a file system. For each SST data area, the StarDB system records the logical address or NSID (namespace identifier) of the SST data area as an index of the SST data area. Optionally, the length of the corresponding SST data area, the value range of all keywords in the SST data area (referred to as keyword range, which can be represented by the upper and lower limits of the values of all keywords in the SST data area) and its level are recorded together with the logical address or NSID. When the SST data area is indexed by NSID, the entire namespace is exclusively occupied by the corresponding SST data area, so there is no need to record the length of the SST data area.
[0215] The StarDB system also performs a flush operation to move the storage unit B in the memory to the NVM chip to form an SST data area. For example, when the storage unit B is fully stored or reaches a preset condition, the Star DB system maintenance is triggered to flush the entire storage unit B to the NVM chip to form an SST data area. As an example, in response to triggering the flush operation, the Star DB system determines the LBA address corresponding to the data to be flushed, generates an NVMe write command based on the LBA address, and sends the NVMe write command to the storage device; or determines the command space identifier NSID corresponding to the data to be flushed, generates an NVMe write command based on the command space identifier NSID, and the logical address of the NVMe write command indicates a specific location in the namespace (for example, LBA=0), and sends it to the storage device; represented as process (5.4), in which the data carried by the NVMe write command is the entire storage unit B. In response to receiving the NVMe write command, the storage device processes the NVMe write command, and the storage unit B carried by the write command is flushed as a whole to the NVM chip physical address corresponding to the LBA address indicated by the NVMe write command or the indicated namespace.
[0216] As another example, the Star DB system responds to the KV key-value pairs stored in storage unit B being written as a whole to the NVM chip, and then deletes the storage unit B from the host memory. In addition, the Star DB system also records the information of the SST data area. In the process of maintaining the entire writing of storage unit B to the SST data area, the SST data area index, LBA address range, and Key range stored in the SST data area corresponding to the current written data are also recorded in the host memory, which is represented as process (5.3). As an example, the Star DB system maintains Table 1 in the host memory, and Table 1 includes multiple entries, each of which records an SST data area index, logical address information corresponding to the SST data area (such as LBA address range), and Key range stored in the SST data area. In addition to using storage devices in LBA mode, the Star DB system can also use storage devices to store SST data areas in a namespace manner, so that the SST data area corresponds to the namespace according to the NVMe protocol one by one. If the SST data area is stored in a namespace manner, a namespace is allocated for each SST data area to be stored on the storage device, and the SST data area is written to the allocated namespace. Each entry in Table 1 records the SST data area index corresponding to an SST data area, namespace information (such as namespace identifier (NSID) and namespace size), and the Key range stored in the SST data area.
[0217] Figure 5C A schematic diagram of a host reading a KV key-value pair from a storage device provided by an embodiment of the present application is shown.
[0218] As an example, Figure 5C As shown, the application running in the host issues an access command Q1 to access the KV key-value pair. For example, the access command Q1 is a Get(Key) command to read the value corresponding to the keyword in the KV key-value pair. The access command Q1 is provided to the StarDB system, and the Star DB system parses the access command Q1 to obtain the information of the KV key-value pair to be read indicated by the access command Q1 (such as the keyword in the KV key-value pair to be read), and determines whether the KV key-value pair to be read is stored in the storage unit A or storage unit B in the host memory based on the keyword Key to be read, which is represented as process (5-1). Based on the keyword Key to be read, it is determined whether the KV key-value pair to be read is stored in the storage unit A or storage unit B in the host memory, and the value corresponding to the keyword in the KV key-value pair to be read is directly read from the storage unit A or storage unit B, and the value corresponding to the keyword is fed back to the application.
[0219] If the KV key-value pairs to be read are not stored in storage unit A or storage unit B of the host memory, the Star DB system running on the host queries one or more entries in Table 1 according to the keyword indicated by access command Q1 to determine the SST data area index corresponding to the keyword Key indicated by access command Q1 based on the Key range stored and recorded in the SST data area. A read command Q2 recognizable by the NVMe driver is generated based on the keyword Key indicated by access command Q1 and its corresponding SST data area index, and the read command Q2 is sent to the NVMe driver. For example, the read command Q2 is a Read(SST data area index, SST data area length) command. The NVMe driver generates an NVMe read command compliant with the NVMe standard according to the read command Q2 and sends it to the storage device (represented as process 5-2) to read the entire SST data area corresponding to the SST data area index carried by the read command Q2 from the storage device and transfer it to the host memory (represented as process 5-5). Next, the StarDB system searches for the value corresponding to the keyword Key indicated by access command Q1 from this SST data area in the host memory as the response to access command Q1.
[0220] In yet another embodiment, the read command Q2 is a Get(key, SST data area index) command. It should be understood that the Get(Key) command corresponding to access command Q1 and the Get(Key, SST data area index) command corresponding to read command Q2 have different formats. The Get(Key, SST data area index) command corresponding to read command Q2 can be recognized by the NVMe driver. In response to receiving the read command Q2, the NVMe driver generates a custom command VU3 compliant with the NVMe protocol according to the keyword Key indicated by the read command Q2 and its corresponding SST data area index, and sends the custom command VU3 to the storage device, where the custom command VU3 includes the keyword Key and its corresponding SST data area index (VU3<Key, SST data area index>).
[0221] The control component receives the custom command VU3 sent by the host through the host interface, which is represented as process (5-2); in response to receiving the custom command VU3, the host interface sends the custom command VU3 to the host command processing unit on the control circuit 301, and in response to receiving the custom command VU3, the host command processing unit forwards the custom command VU3 to the control circuit 302, which is represented as process (5-3). The application in the control circuit 302 generates one or more read commands Q4 based on the custom command VU3 (represented as process 5-4). The control circuit 302 searches the SST data area corresponding to the SST data area index carried by the custom command VU3 for a key-value pair that matches the keyword Key carried by the custom command VU3 through one or more read commands Q4, and feeds back the value in the key-value pair to the host as a response to the custom command VU3.
[0222] It should be understood that when the KV key-value pair to be read is not stored in storage unit A or storage unit B of the host memory, the Star DB system can also generate a standard NVMe read command through the NVMe driver. The Star DB system determines the corresponding LBA address according to the KV key-value pair to be accessed and the corresponding SST data area index, generates an NVMe read command according to the LBA address, and sends the NVMe read command to the control circuit 301 through process (5-2). The control circuit 301 processes the NVMe read command without transferring it to the control circuit 302. The process of processing the NVMe read command by the control circuit 301 is similar to the process of processing the NVMe read command by the control component in the prior art, which will not be repeated here.
[0223] Figure 5D A schematic diagram showing a host provided in an embodiment of the present application controlling the compression processing of the SST data area through the Star DB system.
[0224] As an example, Figure 5D, the Star DB system generates a command P1 instructing the storage device to perform a data compression operation. Command P1 indicates the SST data area index to be compressed. For example, command P1 <SST_i data area index, SST_j data area index, and SST_j+1 data area index>, where the SST_i data area is located in the nth layer (Level n) of the LSM tree structure, and the SST_j data area and SST_j+1 data area are located in the (n+1)th layer (Level n+1). Command P1 can be recognized by the NVMe driver, and the Star DB system sends command P1 to the NVMe driver. In response to receiving command P1, the NVMe driver generates a custom command VU1 compliant with the NVMe protocol based on each SST data area index indicated by command P1, and sends the custom command VU1 to the control component (represented as process (5-1-1)). The custom command VU1 includes all SST data area indexes indicated by command P1 (VU4 <SST_i data area index, SST_j data area index, and SST_j+1 data area index>).
[0225] The control component receives the custom command VU1 sent by the host through the host interface; in response to receiving the custom command VU1, the host interface sends the custom command VU1 to the host command processing unit on the control circuit 301. In response to receiving the custom command VU1, the host command processing unit forwards the custom command VU1 to the control circuit 302, represented as process (5-1-2), control circuit 304. The application program in control circuit 302 generates multiple read commands P2 based on the custom command VU1 and sends the multiple read commands P2 to the storage command processing unit in control circuit 301, represented as process (5-1-3). The read command P2 indicates the logical address obtained from the SST data area index indicated by the definition command VU4. The control component 301 processes each read command P2, reads each SST data area from the NVM chip, and caches the read SST data area in the memory (such as DRAM) of the storage device.
[0226] The control circuit 302 runs the application program to compress the read SST_i data area, SST_j data area, and SST_j+1 data area to obtain a new SST_j data area (new SST_j) and a new SST_j+1 data area (new SST_j+1). The new SST_j data area and new SST_j+1 data area are located in the (n+1)th layer of the LSM tree structure. This process is represented as (5-1-4).
[0227] In response to compressing the SST_i data area, the SST_j data area, and the SST_j+1 data area to obtain a new SST_j data area and a new SST_j+1 data area, the control circuit 302 determines the LBA address corresponding to the new SST_j data area and the new SST_j+1 data area, and generates one or more write commands P3 based on the LBA address, and sends the write command P3 to the storage command processing unit, which is represented as process (5-1-5). These write commands P3 indicate that the new SST_j data area and the new SST_j+1 data area are stored in the storage space corresponding to the LBA address. The control component 301 completes the operation indicated by the write command P3.
[0228] It can be understood that in response to the compressed data area (new SST_j data area and new SST_j+1 data area) being stored in the NVM chip, the Star DB system also updates Table 1, recording the information corresponding to the new SST_j data area and the new SST_j+1 data area in Table 1 (such as SST data area index, logical address or namespace information, and Key range, etc.).
[0229] Fig. 6A A schematic diagram of a Star DB system provided in an embodiment of the present application is shown in a storage device.
[0230] As an example, Fig. 6A As shown, the Star DB system is run in the storage device, such as running the Star DB system on the standard operating system of the control circuit 302. The host can send an NVMe command (such as an NVMe read command or an NVMe write command) to the storage device, and the control circuit 301 in the storage device receives the NVMe command that satisfies the NVMe protocol sent by the host through the host interface, which is represented as process (6-1). The process of processing the NVMe command by the control circuit 301 is similar to the process of processing the NVMe command by the existing control component, which will not be repeated here.
[0231] As another example, the host may also send the command to be sent to the storage device directly to the storage device (such as directly to the control circuit 302 in the control component of the storage device) without encapsulating it in the NVMe protocol format, which is represented as process (6-2). The Star DB system in the control circuit 302 processes the commands received from the host, such as a Put (Key, Value) command indicating the writing of a KV key-value pair or a Get (Key) command indicating the reading of the value corresponding to the keyword in the KV key-value pair. See below for the process of the Star DB system processing commands such as Put (Key, Value) or Get (Key) commands sent by the host. Figure 6B As shown, no further elaboration is given here.
[0232] Figure 6BA schematic diagram showing the coupling of another host and a storage device according to an embodiment of the present application is shown.
[0233] As an example, Figure 6B As shown, for example, an application running in the host generates an access command L for accessing a KV key-value pair, for example, the access command L is a Put (Key, Value) command for writing a KV key-value pair. The host directly sends the access command L to the StarDB system in the control circuit 302 in the control component of the storage device, for example, by calling an API or through a serial port or a network port.
[0234] In response to receiving the Put(Key, Value) command corresponding to the access command L, the StarDB system parses the Put(Key, Value) command to obtain the value Value and the keyword Key corresponding to the keyword to be written, and writes the key-value pair<Key,Value> The pair is stored in the memory of the storage device (such as DRAM). For example,<Key,Value> The pair is stored in storage unit A.
[0235] Understandably, Figure 6B The Star DB system shown manages and maintains storage unit A and storage unit B in the memory of the storage device, such as moving the KV key-value pairs stored in storage unit A to storage unit B or writing the KV key-value pairs stored in storage unit B to the NVM chip. And manages and maintains Table 1 in the memory. Figure 6B The Star DB system shown in FIG. 1 manages and maintains storage unit A, storage unit B, and the process of Table 1. Figure 5B Similar, I will not go into details here.
[0236] As another example, the access command L is a Get(Key) command for reading the value corresponding to the keyword in the KV key-value pair. The host sends the Get(Key) command directly to the control circuit 302 in the control component of the storage device by calling an API or through a serial port or a network port.
[0237] In response to receiving the Get(Key) command, the StarDB system parses the Get(Key) command to obtain the keyword Key in the KV key-value pair to be read. If the keyword Key is recorded in storage unit A or storage unit B, the StarDB system obtains the value corresponding to the keyword Key from storage unit A or storage unit B, and returns it to the host as a response to the Get(Key) command. If the keyword Key is not recorded in storage unit A or storage unit B, the SST data area storage Key range recorded by one or more entries in Table 1 is queried according to the keyword indicated by the Get(Key) command, the SST data area index corresponding to the keyword Key and the logical address length or namespace size recorded by the determined entry in Table 1 are determined, and the value corresponding to the keyword indicated by the Get(Key) command is read from the SST data area indexed by the SST data area index, and the read value is fed back to the host as a response to the access command L.
[0238] Figure 6B The StarDB system presented also initiates and processes the compression of the SST data area. The compression operation merges the SST_i data area at level n in the LSMtree structure with the SST_j data area and SST_j+1 data area at level n+1, and generates a new SST_j data area and a new SST_j+1 data area at level n+1. The compression process is the same as Figure 5D The compression process shown in is similar to that of FIG. 3 , except that it is initiated by the StarDB system in the control circuit 302 rather than by the host.
[0239] Fig. 7A A schematic diagram of writing a KV key-value pair to a storage device according to another embodiment of the present application is shown.
[0240] exist Fig. 7A In the embodiment, StarDB system 1 runs in the host, and control circuit 302 runs StarDB system 2, and StarDB system 1 and StarDB system 2 work together to complete the process of writing KV key-value pairs to the storage device.
[0241] As an example, Fig. 7AAs shown, the application running in the host issues an access command M1 for accessing the KV key-value pair. For example, the access command M1 is a Put (Key, Value) command for writing the KV key-value pair, and the access command M1 is provided to the StarDB system 1 on the host. In response to receiving the access command M1, the Star DB system 1 parses the access command M1 to obtain the keyword and the value corresponding to the keyword in the KV key-value pair to be written indicated by the access command M1, and generates a command M2 recognizable by the NVMe driver based on the KV key-value pair to be written, and sends the command M2 to the NVMe driver. It should be understood that the information expressed by the command M2 and the command M1 can be the same (both indicate Put (Key, Value)), but the command format is different. In response to receiving the command M2, the NVMe driver generates a custom command VU1 that complies with the NVMe protocol. For example, the custom command VU1 carries the keyword Key and the value Value, and indicates the Put (Key, Value) operation. The Star DB system 1 sends the custom command VU1 to the storage device through the NVMe driver.
[0242] The control component of the storage device receives the custom command VU1 sent by the host through the host interface, which is represented as process (7.1); in response to receiving the custom command VU1, the host interface sends the custom command VU1 to the host command processing unit on the control circuit 301, and the host command processing unit forwards the custom command VU1 to the control circuit 302 in response to receiving the custom command VU1, which is represented as process (7.2).
[0243] In response to receiving the custom command VU1, the Star DB system 2 running on the control circuit 302 parses the custom command VU1 to obtain the value Value and the keyword Key corresponding to the keyword to be written indicated by the custom command VU1, and<Key,Value> The custom command VU1 is stored in a memory (such as DRAM). For example, the memory includes a storage unit A and a storage unit B. In response to receiving the custom command VU1, the Star DB system 2 parses the custom command VU1 to obtain<Key,Value> Yes,<Key,Value> The pair is stored in storage unit A (represented as process 7.3).
[0244] Similar to the aforementioned embodiment, the StarDB system 2 manages storage unit A and storage unit B in a manner similar to RocksDB. For example, the KV key-value pairs in storage unit A are sorted and the sorted KV key-value pairs are stored in storage unit B (represented as process 7.4). The StarDB system 2 also maintains the SST data area in which the KV key-value pairs in storage unit B are written to the NVM chip, which is represented as process (7.5). In addition, the Star DB system 2 also records the information of the SST data area. In the process of maintaining the entire writing of storage unit B to the SST data area, the SST data area index, LBA address range, and Key range stored in the SST data area corresponding to the currently written SST data area are also recorded in Table 1 in the memory (such as DRAM), which is represented as process (7.6). The StarDB system 2 executes processes (7.4), (7.5), and (7.6) and Figure 5B The Star DB system is similar and will not be described here.
[0245] Figure 7B A schematic diagram of reading a KV key-value pair from a storage device according to another embodiment of the present application is shown.
[0246] As an example, Figure 7B As shown, if the access command M1 is a Get(Key) command that reads the value corresponding to the keyword in the KV key-value pair, the access command M1 is sent to the Star DB system 1 in the host. In response to receiving the access command M1, the Star DB system 1 parses the access command M1 to obtain the information of the KV key-value pair to be read indicated by the access command M1 (such as the keyword in the KV key-value pair to be read), and generates a command M3 recognizable by the NVMe driver based on the information of the KV key-value pair to be read, and sends the command M3 to the NVMe driver, for example, the command M3 is a Get(Key) command. It should be understood that the information contained in the Get(Key) command corresponding to the access command M1 and the Get(Key) command corresponding to the command M3 can be the same, but the command format is different, and the Get(Key) command corresponding to the command M3 can be recognized by the NVMe driver. In response to receiving the command M3, the NVMe driver generates a custom command VU2 that complies with the NVMe protocol according to the command M3, and sends the custom command VU2 to the control component in the storage device.
[0247] The control component receives the custom command VU2 sent by the host through the host interface, which is represented as process (7.1.1); in response to receiving the custom command VU2, the host interface sends the custom command VU2 to the host command processing unit on the control circuit 301, and the host command processing unit forwards the custom command VU2 to the control circuit 302 in response to receiving the custom command VU2, which is represented as process (7.1.2).
[0248] In response to receiving the custom command VU2, the Star DB system 2 running on the control circuit 302 parses the custom command VU2 to obtain the keyword Key in the KV key-value pair to be read, and determines whether the KV key-value pair to be read is stored in the storage unit A or the storage unit B in the memory based on the keyword Key to be read, which is represented as process (7.1.3). If the KV key-value pair to be read is stored in the storage unit A or the storage unit B in the memory, the value corresponding to the keyword in the KV key-value pair to be read is directly read from the storage unit A or the storage unit B, and the value corresponding to the keyword is fed back to the control circuit 301, and the control circuit 301 feeds back the value corresponding to the keyword to the host as a response to the access command M1, and the process ends. If the KV key-value pair to be read is not stored in the storage unit A or the storage unit B in the memory, the Star DB system 2 determines the SST data area corresponding to the KV key-value pair to be read based on the keyword (Key) to be read. For example, the Star DB system stores the SST data area stored and recorded in one or more entries in Table 1 through a Key range query to determine the SST data area index corresponding to the keyword Key indicated by the custom command VU2 and the LBA length or namespace size corresponding to the SST data area, which is represented as process (7.1.4).
[0249] Further, Star DB system 2 generates a read command M4 based on the LBA address or NSID, and sends the read command M4 to the storage command processing unit in the control circuit 301, which is represented as process (7.1.5). In response to receiving the read command M4, the storage command processing unit processes the read command M4 and reads the value Value corresponding to the keyword from the NVM chip through the media interface controller as a response to the read command M4. And StarDB system 2 feeds back the value Value to the host, and StarDB system 1 in the host obtains the value and generates a response to the access command M1 (this process Figure 7B not marked in the table).
[0250] Figure 8 A schematic diagram showing the Star DB system of the storage device provided in an embodiment of the present application for processing SST data area compression operations.
[0251] Rocks DB performs data compression (Compaction) in the background. According to the Star DB system in the storage device of the embodiment of the present application, the SST data area in the NVM chip is also compressed. For example, the SST data area to be compressed in two adjacent layers of the SST data area organized according to the LSMtree structure is read from the NVM chip, the read SST data area to be compressed is compressed (merged), and the compressed SST data area is stored in the NVM chip. The timing of compressing the SST data area is determined by the Star DB system. As an example, Figure 8 As shown, if the Star DB system running the standard operating system on the control circuit 302 performs data compression operations on the SST_i data area in the nth level (Level n) and the SST_j data area and SST_j+1 data area in the n+1th level (Level n+1) in the LSM tree structure. The Star DB system determines the LBA address range or NSID corresponding to the SST_i data area, SST_File_j data area and SST_File_j+1 data area (where the SST_i data area is in the nth level of the LSM tree, and the SST_File_j data area and SST_File_j+1 data area are in the n+1th level of the LSM tree) from the index query of the SST data area stored and recorded by one or more storage units in the cache, which is represented as process (8.1). The Star DB system generates one or more read commands 1 based on the LBA address range or NSID, and sends the read command 1 to the storage command processing unit in the control circuit 301, which is represented as process (8.2). In response to receiving one or more read commands 1, the storage command processing unit reads the SST_i data area, SST_j data area and SST_j+1 data area from the NVM chip, and moves the SST_i data area, SST_j data area and SST_j+1 data area to the memory of the storage device. The Star DB system then compresses the SST_i data area, SST_j data area and SST_j+1 data area to obtain a new SST_j data area (new SST_j) and a new SST_j+1 data area (new SST_j+1), wherein the new SST_j data area and the new SST_j+1 data area are located at the n+1th layer in the LSM tree structure.
[0252] Further, the Star DB system running on the standard operating system on the control circuit 302 responds to compressing the SST_i data area, the SST_j data area and the SST_j+1 data area to obtain a new SST_j data area and a new SST_j+1 data area, determines the LBA address corresponding to the new SST_j data area and the new SST_j+1 data area, and generates one or more write commands 2 based on the LBA address, and sends the write command 2 to the storage command processing unit, which is represented as process (8.3). One or more write commands 2 indicate that the new SST_j data area and the new SST_j+1 data area are stored in the physical address corresponding to the LBA address. In addition, in response to generating the write command 2, the StarDB system also allocates 2 entries for the new SST_j data area and the new SST_j+1 data area in Table 1, and stores the index, Key range and LBA address range of the new SST_j data area and the new SST_j+1 data area through the allocated entries. In response to receiving the write command 2, the storage command processing unit stores the new SST_j data area and the new SST_j+1 data area in the NVM chip.
[0253] As another example, if the SST data area provided by the NVM chip corresponds to the namespace one by one, such as the SST_i data area corresponds to the namespace NS0, the SST_j data area corresponds to the namespace NS1, and the SST_j+1 data area corresponds to the namespace NS2. Based on multiple read commands (such as read command 1), the data of the namespaces NS0, NS1, and NS2 are read out as a whole from the NVM chip and stored in the memory. The Star DB system performs data compression processing on the data in the read namespaces NS0, NS1, and NS2 to achieve data compression of the SST_i data area, the SST_j data area, and the SST_j+1 data area.
[0254] According to another embodiment of the present application, the host is coupled to multiple storage devices to manage and maintain operations such as storage, reading, and compression of KV key-value pairs on multiple storage devices. The host can control the storage, reading, and compression of KV key-value pairs by running the Star DB system provided in the embodiment of the present application, and transfer the storage, reading, or compression of KV key-value pairs to the storage device by running the Star DB system provided in the embodiment of the present application on the storage device, so as to reduce the burden on the host.
[0255] Fig.9A A schematic diagram of coupling a host and a storage device provided in an embodiment of the present application is shown.
[0256] As an example, Fig.9A As shown, the host is coupled to storage device 1 and storage device 2 respectively. The StarDB system running in the host is connected to Fig. 7AThe StarDB system 1 in the storage device is substantially the same, and is used to generate a custom command that complies with the NVMe protocol format through the NVMe driver from the access command issued by the application and send it to the storage device. The custom command carries the same semantics as the access command issued by the application, for example, Get(Key) or Put(Key, Value). The StarDB system is run in the control circuit 302 of each storage device, and a table 1 recording the SST data area index of each SST data area is maintained in the DRAM of the storage device. The StarDB system in the control circuit 302 processes the Get(Key) or Put(Key, Value) parsed from the custom command.
[0257] The host can send the NVMe command generated by the Star DB system through the NVMe driver or the custom command that satisfies the NVMe command to one of the storage devices 1 and 2 coupled thereto, or can send the generated NVMe command or custom command to both storage device 1 and storage device 2 at the same time.
[0258] As another example, the storage device identification information to be accessed is indicated in the NVMe command, and the storage device corresponding to the storage device identification information indicated in the NVMe command processes the NVMe command. For example, the NVMe command sent by the host indicates that the storage device identification information to be accessed is the identification information of storage device 1, the host sends the NVMe command to storage device 2, there is an inter-device communication link between storage device 1 and storage device 2, and storage device 2 forwards the received NVMe command to storage device 1 through the inter-device communication link. For another example, the host sends the NVMe command to storage device 1 and storage device 2 at the same time, storage device 1 processes the NVMe command, and storage device 2 does not process the NVMe command.
[0259] As another example, if the storage unit B in the storage device 1 is fully stored or reaches a preset condition, the Star DB system in the trigger control circuit 302 will flash the storage unit B as a whole to the SST data area in the NVM chip. For example, the storage device 1 generates and executes a flash operation to flash the storage unit B stored in the memory of the storage device 1 to the NVM chip of the storage device 2; or the storage device 2 generates and executes a flash operation to flash the storage unit B stored in the memory of the storage device 1 to the NVM chip of the storage device 2.
[0260] Fig. 9B A schematic diagram of coupling a host and a storage device according to another embodiment of the present application is shown.
[0261] As an example, Fig. 9BAs shown, the host is coupled to storage device 3 and storage device 4 respectively. StarDB system 1 is run in the host, and StarDB system 2 is run only in storage device 3 (not storage device 4). StarDB system 1 is the same as Fig.9A The StarDB system in the host is basically the same. The host sends a custom command 1 (represented as process (9.1)) that satisfies the NVMe protocol to the storage device 3. The custom command 1 indicates to read the value corresponding to the keyword in the KV key-value pair, which carries the keyword of the KV key-value pair to be read. For example, the custom command 1 <key>。In response to receiving the custom command 1, the storage device 3 parses the custom command 1 to obtain the keyword of the KV key-value pair to be read, and determines that the keyword indicated by the custom command 1 corresponds to entry 0 in Table 1 by querying Table 1 recorded in the memory of the storage device 3. Fig. 9B In Figure 7B is similar to processes (7.1.2), (7.1.3), (7.1.4), and (7.1.5) in
[0262] As an example, each entry in Table 1 also records a storage device identifier, which characterizes the storage device where the SST data area corresponding to the SST data area index recorded in each entry is located. For example, entry 0 records that the KV key-value pair to be read by the custom command 1 is located in the storage device 3 and the SST data area index 1 storing the KV key-value pair. The storage device 3 determines the SST data area 1 according to the SST data area index 1, reads the value corresponding to the keyword from the SST data area 1 according to the keyword in the KV key-value pair indicated by the custom command 1, and feeds back the value to the host.
[0263] For another example, entry 0 records that the KV key-value pair to be read by the custom command 1 is located in the storage device 4 and the SST data area index 1 storing the KV key-value pair. The storage device 3 generates a custom command S1<Key, SST data area index 1> that complies with the NVMe protocol according to the SST data area index 1 and the keyword in the KV key-value pair to be read, and sends the custom command S1 to the storage device 4 (denoted as process (9.6)). The storage device 4 receives the custom command S1, parses the read command S1 to obtain the indicated SST data area index 1 and the keyword in the KV key-value pair to be read. The storage device 4 determines the SST data area 1 according to the SST data area index 1, and reads the value corresponding to the keyword from the SST data area 1 according to the keyword in the KV key-value pair to be read, and feeds back the value to the storage device 3 (denoted as process (9.7)). In response to receiving the value corresponding to the keyword read from the SST data area 1, the storage device 3 feeds it back to the host.
[0264] For another example, storage device 3 determines the logical address or namespace corresponding to the SST data area 1 to be accessed based on the SST data area index 1, the keyword in the KV key-value pair to be read, and the logical address information or namespace information indicated in entry 0. Storage device 3 generates an NVMe read command based on the logical address or namespace, and sends the NVMe read command to storage device 4. In response to receiving the NVMe read command, storage device 4 reads the SST data area 1 corresponding to the logical address or namespace indicated by the NVMe read command as a whole and sends it to storage device 3; in response to receiving the SST data area 1 sent by storage device 4, storage device 3 determines the value corresponding to the keyword from the SST data area 1, and feeds back to the host based on the value.
[0265] Optionally, the host is coupled to multiple storage devices. According to the embodiment of the present application, the SST data area can be stored in multiple storage devices. When the storage device compresses multiple SST data areas in response to a compression command, it is hoped that these SST data areas are located in the same storage device. Thus, the compression (Compaction) operation implemented by the Star DB system occurs between the NVM chip and the DRAM memory of the same storage device, so that during the compression process, the distance that the data in the SST data area is moved can be very close in space (several centimeters), thereby having a larger data movement bandwidth and rate, and thus being able to efficiently complete the compression operation. When the SST data area to be compressed is not in the same storage device, the host also sends a data move command to the storage device, and moves the data to be compressed to the same storage device through the data move command. In response to moving the data to be compressed to the same storage device, the storage device then performs compression processing on the SST data area to be compressed.
[0266] It should be understood that the above Fig.9A and Fig. 9B This is only an example and does not mean that the host can only be coupled to two storage devices. In addition, the multiple storage devices coupled to the host may all be loaded with the Star DB system, or some of the storage devices may be loaded with the Star DB system, which is not limited here.
[0267] Fig.10 A schematic diagram of coupling another host and a storage device provided in an embodiment of the present application is shown.
[0268] As an example, Fig.10 As shown, the host is coupled to storage device 0, storage device 1, and storage device 2. The Star DB system 3 is running in the host, and the Star DB system 4 is running at least in storage device 0. The Star DB system 3 generates a command K1 instructing storage device 0 to perform a data compression operation. Among them, the command K1 indicates the SST data area index to be compressed. For example, the command K1 is a Compaction command, and the Compaction command <SST_i data area index, SST_j data area index, and SST_j+1 data area index>. Among them, the SST_i data area is located in the nth layer (Level n) of the LSM tree structure, and the SST_j data area and the SST_j+1 data area are located in the n+1th layer (Level n+1). The Star DB system 3 determines that the SST_i data area is located in storage device 0, the SST_j data area is located in storage device 1, and the SST_j+1 data area is located in storage device 2 by querying Table 1 managed in the host memory. To implement data compression for the SST_i data area, SST_j data area, and SST_j+1 data area, the Star DB system 3 generates data transfer commands 1 and 2 that can be recognized by the NVMe driver (move(source address 2, destination address 2)). For example, data transfer command 1 is move command 1, which indicates the source address 1 and destination address 1 of the SST_j data area to be transferred, move command 1 (source address 1, destination address 1); data transfer command 2 is move command 2, which indicates the source address 2 and destination address 2 of the SST_j+1 data area to be transferred, move command 2 (source address 2, destination address 2); and sends data transfer command 1 and data transfer command 2 to the NVMe driver. In response to receiving data transfer command 1 and data transfer command 2, the NVMe driver parses data transfer command 1 and data transfer command 2 respectively, and generates a custom command CMD1 that complies with the NVMe protocol, for example, based on the information indicated by data transfer command 1, and a custom command CMD2 that complies with the NVMe protocol, for example, based on the information indicated by data transfer command 2, and sends the custom commands CMD1 and CMD2 to storage device 0. For example, the host command processing unit of the control circuit 301 in storage device 0 sends it to the control circuit 302 in storage device 0 in response to receiving the custom command CMD1. In response to receiving command CMD1, the control circuit 302, the Star DB system 4 generates an NVMe read command E1 based on command CMD1 and sends the NVMe read command E1 to storage device 1. Storage device 1 reads out the SST_j data area from its coupled NVM chip in response to receiving the NVMe read command E1 and feeds it back to storage device 0, expressed as process (10-1).In response to receiving the custom command CMD2, the host command processing unit of the control circuit 301 in the storage device 0 forwards it to the control circuit 302. The Star DB system 4 of the control circuit 302 generates an NVMe read command E2 based on the command CMD2, and sends the NVMe read command E2 to the storage device 2. In response to receiving the NVMe read command E2, the storage device 2 reads the SST_j+1 data area from the NVM chip coupled thereto, and feeds it back to the storage device 0, which is represented as process (10-2). In response to receiving the SST_j data area, the storage device 0 feeds back to the host a message that the processing of the custom command CMD1 is completed. In response to receiving the SST_j+1 data area, the storage device 0 feeds back to the host a message that the processing of the custom command CMD2 is completed.
[0269] In response to receiving the message that the processing of the custom command CMD1 is completed and the message that the processing of the custom command CMD2 is completed, the Star DB system 3 generates a custom command CMD3 that meets the NVMe protocol through the NVMe driver. The custom command CMD3 is used to instruct the storage device 0 to perform a data compression operation on the SST_i data area, the SST_j data area, and the SST_j+1 data area. In response to receiving the custom command CMD3, the storage device 0 reads the SST_i data area from the NVM chip coupled to it and stores it in the memory, and performs a compression operation on the SST_SST_i data area, the SST_j data area, and the SST_j+1 data area through the Star DB system 4. The process of performing compression on the SST data area through the Star DB system 4 is the same as the above Figure 5D The process shown is similar and will not be described again here.
[0270] It can be understood that the data move command 1 may indicate the source address and optional destination address of the namespace storing the SST_j data area, the data move command 2 may indicate the source address and optional destination address of the namespace storing the SST_j+1 data area, the storage device 0 processes the custom command CMD1 corresponding to the data move command 1 to move the SST_j data area (e.g., the entire namespace) as a whole from the storage device 1 to the storage device 0, and the storage device 0 processes the custom command CMD2 corresponding to the data move command 2 to move the SST_j+1 data area as a whole from the storage device 2 to the storage device 0. In the process of processing the custom command CMD3, the storage device 0 reads out the SST_i data area as a whole, and then performs compression operations on the SST_SST_i data area, the SST_j data area, and the SST_j+1 data area.
[0271] It can be understood that when storing KV key-value pairs, reading values corresponding to keywords in KV key-value pairs, or compressing KV key-value pairs based on the Star DB system, the control component of the storage device does not necessarily include the control circuit 302, and the Star DB system is run on the control circuit 302. As long as the Star DB system provided by the embodiment of the present application can be loaded in the control component to implement the functions of the Star DB system provided by the embodiment of the present application, it is within the protection scope of the present application and is not limited here.
[0272] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they are aware of the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present application. Obviously, those skilled in the art may make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.< / key>
Claims
1. A storage device, characterized in that: It includes a control component and a memory; the control component includes: a first CPU group and a second CPU group, wherein; The first CPU group processes the received NVMe command; The second CPU group loads a program specified by a user by running a standard operating system, and implements a specified operation by running the program.
2. The storage device according to claim 1, wherein: in, The second CPU group receives a first call request for the program sent by the host, processes the first call request, controls the program to implement a specified operation, and returns a call result.
3. The storage device according to claim 1 or 2, characterized in that: Also includes: The second CPU group receives a second call request for the program generated by the first CPU group based on the received custom command that meets the NVMe protocol, processes the second call request, controls the program to implement the specified operation, and feeds back the call result to the first CPU group.
4. The storage device according to any one of claims 1 to 3, characterized in that: Also includes: The standard operating system running on the second CPU group includes a file system and an NVMe driver, wherein the NVMe driver is used to access the first storage device, and the file system manages the storage space provided by the first storage device.
5. The storage device according to claim 4, characterized in that: in, In response to a program running in the standard operating system accessing a file in the file system, determining a logical address and / or namespace information for the first storage device based on the file through the file system; An access command is generated based on the logical address and / or namespace information, and the access command is sent to the first CPU group through the NVMe driver.
6. The storage device according to any one of claims 1 to 5, characterized in that: Also includes: Hardware accelerator; wherein, The hardware accelerator is coupled to the second CPU group, and the second CPU group uses the hardware accelerator by running the program.
7. The storage device according to claim 6, characterized in that: in, The second CPU group loads and installs the application program specified by the user and the driver program for the accelerator by running a standard operating system; The second CPU group runs the application program in a standard operating system to use the hardware accelerator through a driver.
8. The storage device according to claim 7, characterized in that: in, If the application is used to provide services to the host, the host uses the services provided by the application through a serial port, a network card, or a custom command that satisfies the NVMe protocol; The host sends a command to call the service, which is directly given to the second CPU group through the serial port or network port, or is given to the first CPU group through a custom command that meets the NVMe protocol, and then transferred from the first CPU group to the second CPU group; The second CPU group processes the command through the application program and gives a result of calling the service.
9. The storage device according to any one of claims 1 to 8, characterized in that: The second CPU group receives a KV key-value pair access command sent by the host, processes the KV key-value pair access command to read a value corresponding to a keyword in a KV key-value pair stored in a storage device, or writes a KV key-value pair to the storage device.
10. A method for accessing a storage device, characterized in that: The method includes: Receive NVMe commands and process the received NVMe commands; The standard operating system is run to load and install the program specified by the user, and the specified operation is implemented by running the program.
