Command processing method and device for multi-port solid state disk, equipment and medium
By determining the target processing core based on the write latency data of the CPU core in the multi-port SSD and dynamically managing the DM module, the problem of high write request latency caused by CPU core load pressure is solved and processing efficiency and user experience are improved.
Patent Information
- Application Number
- CN202410703536.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-08-27
AI Technical Summary
In multi-port solid-state drives, the CPU core load pressure is high, resulting in high write request processing delays, affecting user experience.
By determining the target processing core based on the write latency data of the CPU core of each port, write requests are only sent to the target processing core for execution under predetermined pressure scenarios, and the DM module is dynamically switched to optimize processing requests.
It effectively reduces the processing delay of write requests and improves the processing efficiency and user experience of multi-port hard disks.
Smart Images

Figure CN118550469A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of storage technology, and in particular to a command processing method for a multi-port solid-state hard disk, a command processing device for a multi-port solid-state hard disk, an electronic device, and a computer-readable storage medium. Background Art
[0002] With the continuous expansion of the user base in the Internet era and the deep penetration of the Artificial Intelligence (AI) era, a vast amount of data is emerging at an unprecedented rate, creating a new landscape of unprecedented opportunities and challenges for Internet companies and even manufacturers in all walks of life. Solid State Drive (SSD) is widely used in various scenarios due to its outstanding storage performance, including high-speed reading and writing, compact and portable, and energy-saving and power-saving advantages, and strongly supports the demand for efficient data storage and exchange in the big data era.
[0003] In a solid-state storage controller, the Flash Translation Layer (FTL) is responsible for the conversion of logical addresses to physical addresses, as well as the allocation, recycling, garbage collection (GC), wear leveling and other tasks of the logical address space. FTL is usually composed of the following modules, each responsible for a specific task: the Write Manager (WM) module responsible for wear leveling and garbage collection; the Journal Manager (JM) module responsible for logging and system recovery; the Data Manager (DM) module responsible for managing IO read and write data flows; and the Recovery Manager (RM) module responsible for data recovery and error correction.
[0004] With the rapid development of solid-state drive technology, the application of multi-port technology in enterprise-level SSD has become an inevitable development trend in the future. Compared with single-port SSD hard drives, multi-port SSD hard drives provide multiple independent physical interface channels, allowing the host system to access the SSD simultaneously or alternately through multiple different paths. Multiple ports can serve one host at the same time, or they can serve different hosts separately. In the scenario of a multi-port hard drive, when multiple ports receive read / write requests at the same time, the host will first put the non-volatile memory host controller interface specification (NVM Express, NVMe) command into the submission queue (Submission Queue, SQ) through the high-speed serial computer expansion bus (Peripheral Component Interconnect Express, PCIe). When the submission message manager (Submission Queue Manager, SubQMgr) detects that a new message has been written, it will distribute the message to the DM.
[0005] In the relevant solution, when SubQ Mgr distributes NVMe commands, it polls all DM modules to send and process them in turn. Some CPU cores run DM modules and other modules such as WM and JM at the same time. These modules will run the logical physical address mapping (LBA to PBA, L2P) table and background tasks such as garbage collection in the background, which has a large load pressure, so it takes a long time to process requests. When SubQ Mgr distributes requests to these CPU cores running many modules, the computing resources of these CPU cores are limited, and the processing time is long, which leads to high read / write latency, greatly affecting the user experience. Summary of the invention
[0006] In view of the above problems, embodiments of the present invention are proposed to provide a method for processing commands of a multi-port solid-state hard disk, a command processing device of a multi-port solid-state hard disk, an electronic device, and a computer-readable storage medium that overcome the above problems or at least partially solve the above problems. In a first aspect, an embodiment of the present invention discloses a method for processing commands of a multi-port solid-state hard disk, which is applied to a multi-port solid-state hard disk, and the method comprises:
[0007] Determine a target processing core according to the write latency data of each CPU core of each port, wherein the target processing core is used to process write requests under a predetermined pressure scenario;
[0008] Determine whether the solid state drive is in a predetermined stress scenario, and if so, send the write request to the target processing core for execution upon receiving the write request.
[0009] As in the above method, optionally, the predetermined stress scenario includes: the load of the write request is less than a first preset command load threshold;
[0010] And the loads of all processing cores in the port meet the preset light load scenario.
[0011] As in the above method, optionally, the determining whether the solid state drive is in a predetermined stress scenario, and if so, when receiving a write request, sending the write request to the target processing core for execution includes:
[0012] Determining whether the load of the write request is less than the first preset command load threshold;
[0013] If yes, determining whether no read request is executed on all processing cores in the port;
[0014] If yes, determining whether the number of write requests on the processing core running the write request in the port is less than a preset value;
[0015] If so, the write request is sent to the target processing core for execution.
[0016] As in the above method, optionally, before determining the target processing core according to the write latency data of each CPU core of each port, the method further includes:
[0017] For each port, an optimization scenario array corresponding to the port is set, wherein the optimization scenario array includes a flag bit corresponding to each processing core;
[0018] The flag bit corresponding to each of the processing cores is set to a first preset value.
[0019] As the above method, optionally, it also includes:
[0020] If the load of the write request is greater than a second preset command load threshold, the write request is sent to all processing cores in the port for execution, wherein the second preset command load threshold is greater than the first preset command load threshold.
[0021] As the above method, optionally, it also includes:
[0022] Determine whether the solid-state drive is a predetermined separate processing scenario, and if so, upon receiving an IO request, send the IO request to a first processing core for execution, and set a flag bit corresponding to the first processing core to a second preset value, wherein the first processing core is any one of the processing cores in the port;
[0023] After determining that the first processing core has completed processing the IO request, setting a flag bit corresponding to the first processing core to the first preset threshold;
[0024] The separate processing scenario includes any of the following scenarios:
[0025] The IO request is a read request and the load of the read request is less than the second preset command load threshold;
[0026] The IO request is a write request and the load of the write request is greater than the first preset command load threshold and less than the second preset command load threshold;
[0027] The IO request is a write request and the load of the write request is less than the second preset command load threshold and the optimization scenario array corresponding to the port has at least one flag bit that is the second preset value.
[0028] As in the above method, optionally, the loads of all processing cores in the port meet a preset light load scenario, including:
[0029] All flag bits in the optimization scenario array corresponding to the port are the first preset values.
[0030] As in the above method, optionally, determining the target processing core according to the write latency data of each CPU core of each port includes:
[0031] Obtaining latency statistical historical data of write requests of each CPU core in the multi-port solid-state hard disk;
[0032] For each port, the processing core with the lowest delay in the delay statistical historical data is used as the target processing core corresponding to the port.
[0033] In a second aspect, an embodiment of the present invention discloses a command processing device for a multi-port solid-state hard disk, which is applied to a multi-port solid-state hard disk. The device includes:
[0034] A determination module, used to determine a target processing core according to the write latency data of each CPU core of each port, wherein the target processing core is used to process a write request under a predetermined pressure scenario;
[0035] The processing module is used to determine whether the solid state drive is in a predetermined stress scenario, and if so, when receiving a write request, send the write request to the target processing core for execution.
[0036] In a third aspect, the present invention further discloses an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the command processing method of the multi-port solid-state hard disk are implemented as described above.
[0037] In a fourth aspect, the present invention further discloses a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the command processing method for a multi-port solid-state hard disk as described above are implemented.
[0038] The embodiments of the present invention include the following advantages:
[0039] When it is determined that the predetermined pressure scenario is met, write requests are processed only through the target processing core, which effectively solves the problem of high latency in processing write requests caused by the original SubQ Mgr sending messages to the DM module in a polling manner. This enables multi-port hard drives to process write requests with the highest efficiency, reduces latency, and improves user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 is a flowchart of the steps of a command processing method for a multi-port solid state drive provided by an embodiment of the present invention;
[0041] Figure 2 is a structural block diagram of a multi-port solid-state hard disk provided by an embodiment of the present invention;
[0042] Figure 3 is a flowchart of another method for processing commands of a multi-port solid state drive provided by an embodiment of the present invention;
[0043] Figure 4 It is a flowchart of the steps of a write request optimization method in a command processing method of a multi-port solid state drive provided by an embodiment of the present invention;
[0044] Figure 5 It is a structural block diagram of a command processing device for a multi-port solid state hard disk provided by an embodiment of the present invention;
[0045] Figure 6 is a structural block diagram of an electronic device provided by an embodiment of the present invention;
[0046] Figure 7 It is a structural block diagram of a computer-readable storage medium provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0047] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0048] In addition to the DM module, each CPU core of the SSD also has WM, JM and other modules, resulting in different load pressures on each CPU core. When the host sends a read / write request to the hard disk, the read / write request will be assigned to each CPU core in a round-robin manner. In scenarios where the read / write request load is small, when the read / write request is assigned to some CPU cores with more running modules, it will bring higher latency. In this case, there is a better CPU core for processing read / write requests that can be selected, so there is a lot of room for optimization of read / write latency.
[0049] One of the core concepts of the embodiment of the present invention is to pre-select the processing core with the lowest latency in each port as the target processing core. When it is determined that the predetermined pressure scenario is met, the write request is processed only by the target processing core, which effectively solves the problem of high latency in processing write requests caused by the original SubQ Mgr sending messages to the DM module in a polling manner, so that the multi-port hard disk can process write requests with the highest efficiency, reduce latency, and improve user experience.
[0050] like Figure 1 , shows a flowchart of a command processing method for a multi-port solid-state hard disk provided by an embodiment of the present invention, which is applied to a multi-port solid-state hard disk. The method may include the following steps:
[0051] Step 101, determining a target processing core according to the write latency data of each CPU core of each port, wherein the target processing core is used to process write requests under a predetermined pressure scenario;
[0052] Specifically, a multi-port SSD hard disk provides multiple independent physical interface channels, allowing the host system to access the SSD simultaneously or alternately through multiple different paths. Multiple ports can serve one host at the same time or serve different hosts separately.
[0053] The target processing core is determined in advance based on the write latency data of each CPU core of each port. Each port corresponds to a target processing core, and the target processing core is used to process write requests under a predetermined pressure scenario. For example, the target processing core can be the processing core with the lowest write latency in the port. The processing core can be a DM module. When the processing core is a DM module, the target processing core can also be called a preparatory DM module, that is, each port corresponds to a preparatory DM module.
[0054] Step 102, determining whether the solid state drive is in a predetermined stress scenario, and if so, when receiving a write request, sending the write request to the target processing core for execution.
[0055] Specifically, if the solid-state hard disk is currently in a predetermined stress scenario, when a write request is received, the write request is sent to a target processing core corresponding to the port that receives the write request for execution.
[0056] Figure 2 is a structural block diagram of a multi-port solid state hard disk provided by an embodiment of the present invention, such as Figure 2 As shown in FIG. 1 , if a multi-port solid-state drive SSD has n ports, there are n PCIe ports (PCIE_PORT1 to PCIE_PORTn) inside the SSD for receiving IO messages from the host. For example, PCIE_PORT1 receives IO requests sent by the host through port 1. Each PCIe port corresponds to a submission message manager SubQ Mgr (SubQ Mgr1 to SubQ Mgrn), which is used to parse IO requests, generate IO request preparation CmdReady messages, and send them to the data manager DM module. Each PCIe port corresponds to multiple DM modules (DM0 to DMp1, etc.), where each port has only one preparation DM module, such as Figure 2 DM0, DMp2 and DMp3 in the DM module are used to process IO requests.
[0057] In a multi-port hard disk scenario, when multiple ports receive IO requests at the same time, the host first puts the IO request into the submission queue SQ through the PCIe port. When the submission message manager SubQ Mgr detects that a new message is written, it takes the message out of SQ and parses it into an IO request preparation CmdReady message. SubQ Mgr sends the CmdReady message to the DM module in the port that can receive the CmdReady message, for example. Figure 2 As shown, for the IO request received by port 1, SubQ Mgr sends a CmdReady message to the DM modules among DM0 to DMp1 that can receive the CmdReady message.
[0058] It should be noted that SubQ Mgr can send IO requests to the DM module only when the message body MsgBody exists in the message queue of SubQ Mgr and the corresponding DM module. If MsgBody does not exist in the message queue of SubQ Mgr and the DM, it means that the DM module is closed and no longer receives IO requests.
[0059] After receiving the CmdReady message sent by SubQ Mgr, the DM module parses the CmdReady message, determines the IO request, and determines the non-volatile memory host controller interface specification NVMe command according to the IO request.
[0060] After the DM module determines the NVMe command, it determines whether the current scenario meets the predetermined stress scenario. For example, the predetermined stress scenario may include: the NVMe command load meets the optimized load requirements, the dynamic DM switch is turned on in the port, etc., which can be set in advance according to the scenario to be optimized. If the predetermined stress scenario is met, the dynamic DM strategy is turned on, and only the reserve DM is used to process the NVMe command. If the predetermined stress scenario is not met, the dynamic DM strategy is turned off, and the NVMe command is processed according to the original method.
[0061] If the predetermined pressure scenario is met, the DM module determines whether it is the standby DM module corresponding to the port, where the standby DM module is the DM module that processes the NVMe command best among all DM modules corresponding to the port determined by each port, such as Figure 2 DM0, DMp2, DMp3, etc., for example, the standby DM module can be the DM module with the smallest latency. In which, each port in the solid-state drive runs multiple central processing unit (CPU) cores, each CPU core has a DM module, each port will correspond to a standby DM module, and multiple ports have the same number of standby DM modules as the number of ports. The standby DM module corresponding to each port can be determined in advance, and the standby DM module can also be determined according to the real-time load of the CPU core.
[0062] If the current scenario meets the predetermined stress scenario and it is a standby DM module, the NVMe command is processed normally.
[0063] For other non-target processing cores in the port, the processing core is turned off and the write request is no longer processed.
[0064] For example, in the write request scenario of a dual-port solid-state drive, in the relevant solution, when SubQ Mgr distributes NVMe write requests, it will poll all DM modules to send and process them in turn, which may cause the write request processing to be time-consuming. To solve this problem, the embodiment of the present invention can pre-select the reserve DM module corresponding to each port in the dual port. When an NVMe write request is received and it is determined that the predetermined pressure scenario is met, the NVMe write request is only processed by the reserve DM module, so that the dual-port solid-state drive can process the write request with the highest efficiency, reduce the delay, and effectively solve the problem of high delay in processing write messages caused by the original SubQ Mgr sending messages to DM in a polling manner, thereby improving the user experience.
[0065] The command processing method for a multi-port solid-state hard disk provided in an embodiment of the present invention determines the target processing core according to the write latency data of each CPU core of each port, and the target processing core is used to process write requests under a predetermined pressure scenario; it is determined whether the solid-state hard disk is a predetermined pressure scenario, and if so, when receiving a write request, the write request is sent to the target processing core for execution. It can be seen from this that in an embodiment of the present invention, after it is determined that the predetermined pressure scenario is optimized, only the preparatory DM is enabled to process the NVMe command write request through the target processing core module, which effectively solves the problem of high latency in processing IO message write requests caused by the original SubQ Mgr sending messages to the DM module in a polling manner, so that the multi-port hard disk can process IO write requests with the highest efficiency, reduce latency, and improve user experience.
[0066] On the basis of the above embodiment, further, the predetermined stress scenario includes: the load of the write request is less than a first preset command load threshold;
[0067] And the loads of all processing cores in the port meet the preset light load scenario.
[0068] Specifically, when the DM module receives the CmdReady message, it generates a command prompt Cmd context to process the NVMe command. The DM module determines the command type of the NVMe command by matching the command state machine. For example, the NVMe command type can be a read command, a write request, or a special command of write type 0.
[0069] After the DM module determines the command type of the NVMe command, it determines whether the command type is a write request. If so, it is eligible for subsequent optimization processing, otherwise it is not eligible for optimization processing.
[0070] After the DM module determines that the command type of the NVMe command is a write request, it is also necessary to determine the size of the NVMe command load, that is, whether the concurrent command request volume is large. If the write request load is large, it is not suitable to use only one DM module for processing. Only in a small pressure scenario with a small write request load, the optimization strategy is enabled. A threshold is set in advance, for example, a threshold is obtained when testing the solid-state drive in a real scenario, or a heuristic algorithm or a deep learning algorithm can be used to determine a more reasonable threshold for switching dynamic DM, and the threshold is recorded as the first preset command load threshold to divide whether it is a small pressure scenario. If the write request load is less than the first preset command load threshold, the current scenario is a small pressure scenario. The DM module continues to determine whether the load of all DM modules in the port where it is located meets the preset small load scenario, where the preset small load scenario is that no other types of NVMe commands are run on all DM modules, and the number of commands on the DM module running the write request in the port is less than the preset value, that is, the current port is in a small pressure scenario, and it is determined that the current scenario meets the predetermined pressure scenario. That is, in the embodiment of the present invention, the dynamic DM strategy is enabled only when the NVMe command is a write request and the NVMe command is in a low-pressure scenario and all DM modules are in a low-load scenario; otherwise, the dynamic DM strategy is disabled.
[0071] For example, if the write request load is less than the first preset command load threshold, and no read commands are running on all DM modules in the port, and the number of write requests on the DM modules running write requests in the port is less than the preset value, the dynamic DM strategy is enabled, and the write request is processed only through the standby DM module, thereby reducing the user's latency in low-pressure write scenarios.
[0072] In the embodiment of the present invention, through the strategy of dynamically switching DM, in a low-pressure scenario, only the optimal standby DM module for processing write requests is enabled on each port, which effectively reduces the delay of processing commands and optimizes the user experience.
[0073] On the basis of the above embodiments, further, determining the target processing core according to the write latency data of each CPU core of each port includes:
[0074] Obtaining latency statistical historical data of write requests of each CPU core in the multi-port solid-state hard disk;
[0075] For each port, the processing core with the lowest delay in the delay statistical historical data is used as the target processing core corresponding to the port.
[0076] Specifically, taking the preparatory DM module as an example, the preparatory DM module can be the DM module with the lowest command processing latency in the port. The latency statistics of the DM module corresponding to each port of the solid-state drive processing NVMe command requests are collected in advance, and based on historical data, the DM module with the lowest NVMe command processing latency is selected on each port as the preparatory DM module.
[0077] For example, there are 8 CPU cores in a dual-port SSD, and there is a DM module on each CPU core. The latency statistics of each DM module processing write requests are collected. According to historical data, the DM module on the CPU core with the lowest write latency is selected on each port as the standby DM module. That is, only two DM modules in the dual-port SSD will be used to process write requests in a low-pressure write scenario, and the other DM modules will be turned off.
[0078] In an embodiment of the present invention, based on historical data, the processing core with the lowest latency in processing write requests is used as the target processing core, and only the optimal DM module for processing write requests is enabled, thereby further reducing the latency in processing write requests in low-pressure and low-load scenarios and optimizing the user experience.
[0079] On the basis of the above embodiments, further, the target processing core is determined according to the write latency data of each CPU core of each port, and the target processing core is used to process the write request under the predetermined pressure scenario, and the target processing core also includes:
[0080] Get the load characteristics of each CPU core in each port;
[0081] Calculating a load value of each CPU core based on the load characteristics;
[0082] The processing core on the CPU core with the smallest load value is used as the target processing core corresponding to the port.
[0083] Specifically, in addition to obtaining the processing core with the lowest latency as the target processing core through historical data, the processing core on the CPU core with the smallest load can also be used as the target processing core according to the load of the CPU core. For example, first, determine the performance parameters that can measure the load of the CPU core, characterize the load characteristics of the CPU core through these performance parameters, obtain the load characteristics of each CPU core in each port, calculate the load value of the CPU core through these load characteristics and the corresponding influence coefficients, and use the DM module on the CPU core with the smallest load value in each port as the reserve DM module corresponding to the port.
[0084] In the embodiment of the present invention, according to the different characteristics of the processing core loads running on different CPU cores, when the pressure is low, the processing core with low processing delay is used preferentially. On each port, only the processing core on the CPU core that best processes write requests is enabled. This method can dynamically select the best processing core to process write requests under low pressure scenarios according to the load pressure, optimize the write request processing delay to the greatest extent, and improve the user experience.
[0085] On the basis of the above embodiments, further,
[0086] The determining whether the solid state drive is in a predetermined stress scenario, and if so, when receiving a write request, sending the write request to the target processing core for execution, includes:
[0087] Determining whether the load of the write request is less than the first preset command load threshold;
[0088] If yes, determining whether no read request is executed on all processing cores in the port;
[0089] If yes, determining whether the number of write requests on the processing core running the write request in the port is less than a preset value;
[0090] If so, the write request is sent to the target processing core for execution.
[0091] Specifically, it is determined whether the load of the write request is less than a first preset command load threshold; if so, it is determined whether no read request is executed on all processing cores in the port; if so, it is determined whether the number of write requests on the processing cores in the port that execute the write request is less than a preset value; if so, the write request is sent to the target processing core for execution. It should be noted that the latency reduction processing of the read request can also be processed in the same way.
[0092] Take the preparatory DM module as an example. Figure 3 FIG. 1 is a flowchart of another method for processing commands of a multi-port solid state drive provided by an embodiment of the present invention. Figure 3 As shown, the method may include the following steps:
[0093] Step 301, receiving a CmdReady message sent by SubQ Mgr through a message body MsgBody;
[0094] When SubQ Mgr receives a write message from the host, it takes the message out of SQ and parses it into a CmdReady message. SubQ Mgr sends the CmdReady message to the DM module via the MsgBody message and consumes a MsgBody structure. Only when MsgBody exists in the message queues of SubQ Mgr and the corresponding DM can SubQ Mgr send IO requests to the DM. If MsgBody does not exist in the message queues of SubQ Mgr and the DM, it means that the DM is closed and no longer receives IO requests.
[0095] Step 302, parse the CmdReady message, determine the non-volatile memory host controller interface specification NVMe command, and execute step 3031 or 3032;
[0096] When the DM module receives the CmdReady message, it generates a Cmd context to process the NVMe command and determines the command type of the NVMe command according to the NVMe command state machine of Cmd.
[0097] Step 3031, determine whether the NVMe command is a write request, if so, execute step S3041, otherwise execute step S310;
[0098] Step 3041, determining whether the write request load is less than a first preset command load threshold, if so, executing step S3051, otherwise executing step S310;
[0099] Step 3051, determine whether all DM modules in the port have not executed the read command, if so, execute step S3061, otherwise execute step S310;
[0100] Step 3061, determining whether the number of write requests on the DM module running the write request in the port is less than a preset value, if so, executing step S3071, otherwise executing step S310;
[0101] Step 3071, determine whether the current DM module is the standby DM module corresponding to the port, if so, execute step S3081, otherwise execute step S309;
[0102] Step 3081, the DM module returns the MsgBody to the SubQ Mgr to process the read command;
[0103] Step 3032, determine whether the NVMe command is a read command, if so, execute step S3042, otherwise execute step S310;
[0104] Step 3042, determining whether the read command load is less than a first preset command load threshold, if so, executing step S3052, otherwise executing step S310;
[0105] Step 3052, determine whether all DM modules in the port are not running write requests, if so, execute step S3062, otherwise execute step S310;
[0106] Step 3062, determining whether the number of read commands on the DM module running the read command in the port is less than a preset value, if so, executing step S3072, otherwise executing step S310;
[0107] Step 3072, determine whether the current DM module is the standby DM module corresponding to the port, if so, execute step S3082, otherwise execute step S309;
[0108] Step 3082, the DM module returns the MsgBody to the SubQ Mgr to process the read command;
[0109] Step 309: The DM module temporarily stores MsgBody.
[0110] When any MsgBody of the communication message queue between SubQ Mgr and the DM module is temporarily stored, the DM module cannot process IO requests, that is, the DM module is shut down.
[0111] Step 310, determine that it does not meet the optimization scenario, turn off the dynamic DM switch policy, and process the NVMe command in a conventional manner.
[0112] In an embodiment of the present invention, a dynamic DM switch strategy can ensure that read / write requests are distributed to the optimal DM for processing, and the DM modules on other CPU cores are turned off, which can effectively reduce the read / write request latency of a multi-port solid-state drive in a low-pressure read / write scenario.
[0113] On the basis of the above embodiments, further, before determining the target processing core according to the write latency data of each CPU core of each port, the method further includes:
[0114] For each port, an optimization scenario array corresponding to the port is set, wherein the optimization scenario array includes a flag bit corresponding to each processing core;
[0115] The flag bit corresponding to each of the processing cores is set to a first preset value.
[0116] Specifically, for each individual processing core, the predetermined pressure scenario condition is met when no other NVMe commands are running on the current processing core and the number of running write requests is less than a preset value, indicating that the current solid-state drive is in a low-pressure write request scenario.
[0117] Taking the preparation DM module as an example, in order to more clearly determine whether each DM module meets the requirements for enabling the dynamic DM strategy, for each port, an optimization scenario array corresponding to the port is set. The array can be named dm_without_other_bmp. The dm_without_other_bmp array includes m flags, each flag is a flag of a corresponding DM module, and m is the total number of DM modules in a port. During initialization, the flag corresponding to each DM module is set to the first preset value, for example, to 1. When the flags corresponding to all DM modules in the optimization scenario array are the first preset value, it indicates that each DM module in the current port meets the requirements for enabling the dynamic DM strategy, that is, the loads of all DM modules in the port meet the preset small load scenario. By maintaining the dm_without_other_bmp array to record whether each DM meets the requirements for enabling the dynamic DM strategy, the dynamic DM function will be enabled only when all CPU cores in a port meet the requirements for enabling the dynamic DM strategy, that is, when the flags of all DM modules in a port in the array are set to 1.
[0118] For example, for a dual-port solid-state drive, the preset optimization command type is NVMe write request, and the optimization scenario array is set to dm_without_read_bmp. The dual-port has a total of 8 CPU cores, each CPU core corresponds to a DM module, and a total of 8 DM modules.
[0119] For each individual DM module, the conditions for enabling the dynamic DM policy are that no read request is running on the current DM and the number of running write requests is less than a certain threshold, indicating that the current hard disk is in a write request scenario with low pressure.
[0120] Each DM module first sets its corresponding flag position in the dm_without_read_bmp array to 1 during initialization. After all DMs are initialized, the flag bits in the corresponding arrays are all 1, indicating that the hard disk meets the conditions for enabling the dynamic DM policy.
[0121] When the SSD detects a low-stress scenario, it will enable the dynamic DM strategy. At this time, each port will shut down all DM modules except the standby DM module. The dynamic DM strategy function will only be enabled when all 8 CPU cores meet the conditions for enabling the dynamic DM strategy, that is, when the corresponding flag bits of the 8 DM modules in the array dm_without_read_bmp are set to 1.
[0122] In an embodiment of the present invention, by setting a flag bit for each processing core in the optimization scenario array, when all flag bits are at the first preset value, it is determined that all processing core loads in the port meet the preset small load scenario, and the judgment of the predetermined pressure scenario is more convenient and reasonable, which can effectively reduce the delay of the hard disk processing command in the scenario.
[0123] On the basis of the above embodiments, it further includes: if the load of the write request is greater than a second preset command load threshold, the write request is sent to all processing cores in the port for execution, wherein the second preset command load threshold is greater than the first preset command load threshold.
[0124] Specifically, in order to ensure that the concurrent performance of NVMe commands under high pressure is not affected, in an embodiment of the present invention, when it is determined that the NVMe command load is greater than the second preset command load threshold, the dynamic DM strategy is turned off, and all DM modules in the port are used to process NVMe commands, wherein the second preset command load threshold is greater than the first preset command load threshold, for example, a threshold is obtained when testing a solid-state drive in a real scenario, and if it is greater than the threshold, it means that it is currently in a high-pressure scenario, or a heuristic algorithm or a deep learning algorithm can be used to determine a more reasonable threshold for switching all DM modules, and the threshold is recorded as the second preset command load threshold, so as to divide whether it is a high-pressure scenario. Among them, NVMe commands greater than the second preset command load threshold include both write requests and other command types, that is, no matter what type of NVMe command, if it meets the high-pressure scenario, it is necessary to turn on all DM modules for processing to ensure the maximum concurrent performance of processing NVMe commands.
[0125] The embodiment of the present invention can effectively reduce the latency of dual-port solid-state drives in processing NVMe commands under low-pressure scenarios. Since some CPU cores have a high latency in processing NVMe commands, the dynamic DM switch strategy can ensure that NVMe commands are distributed to the optimal DM module for processing, and the DM on other CPU cores is turned off. At the same time, the embodiment of the present invention can also ensure that when the DM module receives a high pressure of NVMe commands, the CPU core can respond quickly and turn on all DM modules to process NVMe commands. In this way, the response speed of the solid-state drive to NVMe commands is greatly improved, while ensuring the read and write performance of the solid-state drive in other scenarios.
[0126] On the basis of the above embodiments, further comprising:
[0127] Determine whether the solid-state drive is a predetermined separate processing scenario, and if so, upon receiving an IO request, send the IO request to a first processing core for execution, and set a flag bit corresponding to the first processing core to a second preset value, wherein the first processing core is any one of the processing cores in the port;
[0128] After determining that the first processing core has completed processing the IO request, setting a flag bit corresponding to the first processing core to the first preset threshold;
[0129] The separate processing scenario includes any of the following scenarios:
[0130] The IO request is a read request and the load of the read request is less than the second preset command load threshold;
[0131] The IO request is a write request and the load of the write request is greater than the first preset command load threshold and less than the second preset command load threshold;
[0132] The IO request is a write request and the load of the write request is less than the second preset command load threshold and the optimization scenario array corresponding to the port has at least one flag bit that is the second preset value.
[0133] Specifically, in addition to processing dynamic DM policies and enabling all DM modules to process NVMe commands, there are some occasions where a separate DM module is required for processing. After receiving the IO request, the SubQ Mgr sends the CmdReady message to the DM module. The DM module parses the NVMe command, determines that it meets the separate processing scenario, and sets the flag bit corresponding to the current DM module to the second preset value, for example, to 0, indicating that the DM module currently does not meet the requirements for enabling the dynamic DM policy.
[0134] The DM module returns MsgBody to SubQ Mgr, processes the NVMe command, and after processing is completed, sets the flag bit corresponding to the DM module to the first preset threshold, for example, to 1, indicating that the DM module currently meets the requirements for enabling the dynamic DM policy.
[0135] The separate processing scenario includes any of the following scenarios:
[0136] (1) The NVMe command is not a preset optimization command type and the NVMe command load is less than the second preset command load threshold, that is, the NVMe command neither belongs to a high-pressure scenario nor belongs to an optimization command type.
[0137] (2) The NVMe command is a preset optimization command type and the NVMe command load is greater than the first preset command load threshold and less than the second preset command load threshold, that is, although the NVMe command belongs to the optimization command type, it belongs to neither a low-pressure scenario nor a high-pressure scenario.
[0138] (2) The NVMe command is of the preset optimization command type and the NVMe command load is less than the second preset command load threshold and the optimization scenario array corresponding to the port has at least one flag bit that is the second preset value, that is, although the NVMe command belongs to the optimization command type and belongs to a low-pressure scenario, not all DM modules meet the requirements for enabling the dynamic DM policy.
[0139] Among them, the preset optimization command type can be a write request or a read request.
[0140] Take the optimization of write performance of dual-port solid-state drives as an example. Figure 4 is a flowchart of the steps of a write performance optimization method in a command processing method for a multi-port solid state drive provided by an embodiment of the present invention. Figure 4 As shown, the following steps are included:
[0141] Step S401, pre-collect the latency statistics of the DM module on each CPU core of the solid-state drive processing write requests. According to historical data, select the DM module on the CPU core with the lowest write latency on each port as the standby DM module of the port, that is, only two DM modules will be used to process write requests in a low-pressure write scenario, and other DM modules will be closed at this time.
[0142] When the hard disk detects a low-stress scenario, it will enable the dynamic DM strategy. At this time, each port will shut down all DM modules except the standby DM module. An array is maintained to record whether each DM meets the conditions for enabling the dynamic DM strategy. The array is named dm_without_read_bmp. The dynamic DM function will only be enabled when all 8 CPU cores meet the conditions for enabling the dynamic DM strategy, that is, when the corresponding bits of the 8 DMs in the array are set to 1.
[0143] For each individual DM module, the conditions for enabling the dynamic DM policy are that no read request is running on the current DM module and the number of running write requests is less than a certain threshold, indicating that the current hard disk is in a write request scenario with low pressure.
[0144] Step S402, when each DM module is initialized, it sets its corresponding flag bit dm_without_read_bmp[x] in the dm_without_read_bmp array to 1, indicating that no read command is running on the current DM module. After all DM modules are initialized, the flag bits in the corresponding array are all 1, indicating that the SSD meets the conditions for enabling the dynamic DM policy.
[0145] Step S403: When the SubQ Mgr receives the write message sent by the host, it takes the message out of the SQ and parses it into a CmdReady message.
[0146] Step S404, SubQ Mgr sends the CmdReady message to the DM module via the MsgBody message, and consumes a MsgBody structure. Only when there is MsgBody in the message queue of SubQ Mgr and the corresponding DM, can SubQ Mgr send an IO request to the DM. If there is no MsgBody in the message queue of SubQ Mgr and the DM, it means that the DM is closed and no longer receives IO requests.
[0147] Step S405: When the DM module receives the CmdReady message, it generates a Cmd context to process the NVMe command and determines the command type of the NVMe command according to the NVMe command state machine of Cmd.
[0148] Step S406, the DM module determines whether the current disk is an NVMe read command, an NVMe Verify command, or an NVMeWrite Zero command. If so, execute step S407, otherwise execute step S408;
[0149] Step S407, clear the flag bit corresponding to dm_without_read_bmp of the DM module, indicating that a read request is currently running on the DM module, and send the MsgBody message body temporarily stored by the DM module to the SubQ Mgr.
[0150] Step S408: If the NVMe command is not any of the above commands, determine whether the NVMe command is an NVMe write request. If so, execute step S409; otherwise, execute step S410.
[0151] Step S409: The DM module returns the MsgBody to the SubQ Mgr.
[0152] Step S410, determining which DM module is currently processing the command;
[0153] Step S411, when the hard disk meets the conditions for enabling the dynamic DM strategy, for non-prepared DM modules, the DM module will temporarily store MsgBody. When all MsgBody in the communication message queue between SubQ Mgr and the DM module are temporarily stored, the DM module cannot process IO requests and is closed. When a read message is received, the DM module will clear the flag corresponding to dm_without_read_bmp to 0, indicating that the current hard disk no longer meets the conditions for enabling the dynamic DM strategy. All DM modules will send MsgBody to SubQ Mgr, and all DM modules will be enabled to process IO requests. Secondly, when the write message received by the preparatory DM is higher than the threshold, the corresponding flag of the DM module in the array will also be cleared, and all DM modules will be enabled to process write messages.
[0154] Step S412: If the current DM is a standby DM, the message writing is processed normally and the MsgBody is returned to the SubQ Mgr.
[0155] Under normal circumstances, the DM module needs to return the MsgBody to the SubQ Mgr to ensure normal communication between the SubQ Mgr and the DM. After the dynamic DM function is enabled, only the standby DM will process the write request to ensure a low write processing latency.
[0156] The embodiment of the present invention proposes a dynamic switch DM strategy for optimizing write latency. For write requests sent from each port, only the DM module on the CPU core with the lowest processing latency is enabled on each port for processing, while the DM modules on other CPU cores are disabled. This reduces the latency of users in low-pressure write scenarios and improves the processing efficiency of other modules running tasks in the background. On each port, the DM module with the lowest write request latency is selected based on the historical data of the latency for processing write requests. In order to ensure that the concurrent performance of writes and the performance of read requests under high pressure are not affected, the dynamic switch DM strategy can also quickly identify these two scenarios and quickly enable all DM modules to process the maximum concurrent performance of read and write requests. This can effectively reduce the latency of the hard disk in processing write requests in this scenario, while ensuring the read and write performance of the solid-state drive in other scenarios, thereby improving the user experience.
[0157] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0158] like Figure 5, shows a structural block diagram of a command processing device for a multi-port solid-state hard disk provided by an embodiment of the present invention, which is applied to a multi-port solid-state hard disk, and the device includes:
[0159] A determination module 501 is used to determine a target processing core according to the write latency data of each CPU core of each port, wherein the target processing core is used to process a write request under a predetermined pressure scenario;
[0160] The processing module 502 is used to determine whether the solid state drive is in a predetermined stress scenario, and if so, when receiving a write request, send the write request to the target processing core for execution.
[0161] As in the above device, optionally, the predetermined stress scenario includes: the load of the write request is less than a first preset command load threshold;
[0162] And the loads of all processing cores in the port meet the preset light load scenario.
[0163] As in the above device, optionally, the processing module 502 is specifically used for:
[0164] Determining whether the load of the write request is less than the first preset command load threshold;
[0165] If yes, determining whether no read request is executed on all processing cores in the port;
[0166] If yes, determining whether the number of write requests on the processing core running the write request in the port is less than a preset value;
[0167] If so, the write request is sent to the target processing core for execution.
[0168] As in the above device, optionally, the determining module 501 is further used for:
[0169] For each port, an optimization scenario array corresponding to the port is set, wherein the optimization scenario array includes a flag bit corresponding to each processing core;
[0170] The flag bit corresponding to each of the processing cores is set to a first preset value.
[0171] As in the above device, optionally, the processing module 502 is further used for:
[0172] If the load of the write request is greater than a second preset command load threshold, the write request is sent to all processing cores in the port for execution, wherein the second preset command load threshold is greater than the first preset command load threshold.
[0173] As in the above device, optionally, the processing module 502 is further used for:
[0174] Determine whether the solid-state drive is a predetermined separate processing scenario, and if so, upon receiving an IO request, send the IO request to a first processing core for execution, and set a flag bit corresponding to the first processing core to a second preset value, wherein the first processing core is any one of the processing cores in the port;
[0175] After determining that the first processing core has completed processing the IO request, setting a flag bit corresponding to the first processing core to the first preset threshold;
[0176] The separate processing scenario includes any of the following scenarios:
[0177] The IO request is a read request and the load of the read request is less than the second preset command load threshold;
[0178] The IO request is a write request and the load of the write request is greater than the first preset command load threshold and less than the second preset command load threshold;
[0179] The IO request is a write request and the load of the write request is less than the second preset command load threshold and the optimization scenario array corresponding to the port has at least one flag bit that is the second preset value.
[0180] As in the above device, optionally, the determining module 501 is specifically used for:
[0181] Obtaining latency statistical historical data of write requests of each CPU core in the multi-port solid-state hard disk;
[0182] For each port, the processing core with the lowest delay in the delay statistical historical data is used as the target processing core corresponding to the port.
[0183] like Figure 6 , showing a structural block diagram of an electronic device 60 provided in an embodiment of the present invention, including:
[0184] A processor 601, a memory 602, and a computer program 6021 stored in the memory 602 and capable of running on the processor 601. When the computer program 6021 is executed by the processor 601, each process of the command processing method embodiment of the multi-port solid-state hard disk is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0185] like Figure 7, shows a structural block diagram of a computer-readable storage medium 70 provided in an embodiment of the present invention. A computer program 701 is stored on the computer-readable storage medium 70. When the computer program 701 is executed by the processor, each process of the command processing method embodiment of the multi-port solid-state hard disk is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0186] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0187] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0188] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0189] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0190] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable terminal device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0191] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. 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 embodiments of the present invention.
[0192] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0193] The above is a detailed introduction to a command processing method for a multi-port solid-state hard disk, a command processing device for a multi-port solid-state hard disk, an electronic device and a computer-readable storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A command processing method for a multi-port solid state drive, It is characterized in that Applied to a multi-port solid state drive, the method comprises: Determine a target processing core according to the write latency data of each CPU core of each port, wherein the target processing core is used to process write requests under a predetermined pressure scenario; Determine whether the solid state drive is in a predetermined stress scenario, and if so, send the write request to the target processing core for execution upon receiving the write request.
2. The method according to claim 1, It is characterized in that The predetermined stress scenario includes: the load of the write request is less than a first preset command load threshold; And the loads of all processing cores in the port meet the preset light load scenario.
3. The method according to claim 2, It is characterized in that The determining whether the solid state drive is in a predetermined stress scenario, and if so, sending the write request to the target processing core for execution upon receiving the write request, includes: Determining whether the load of the write request is less than the first preset command load threshold; If yes, determining whether no read request is executed on all processing cores in the port; If yes, determining whether the number of write requests on the processing core running the write request in the port is less than a preset value; If so, the write request is sent to the target processing core for execution.
4. The method according to claim 2, It is characterized in that Before determining the target processing core according to the write latency data of each CPU core of each port, the method further includes: For each port, an optimization scenario array corresponding to the port is set, wherein the optimization scenario array includes a flag bit corresponding to each processing core; The flag bit corresponding to each of the processing cores is set to a first preset value.
5. The method according to claim 4, It is characterized in that Also includes: If the load of the write request is greater than a second preset command load threshold, the write request is sent to all processing cores in the port for execution, wherein the second preset command load threshold is greater than the first preset command load threshold.
6. The method according to claim 5, It is characterized in that Also includes: Determine whether the solid-state drive is a predetermined separate processing scenario, and if so, upon receiving an IO request, send the IO request to a first processing core for execution, and set a flag bit corresponding to the first processing core to a second preset value, wherein the first processing core is any one of the processing cores in the port; After determining that the first processing core has completed processing the IO request, setting a flag bit corresponding to the first processing core to the first preset threshold; The separate processing scenario includes any of the following scenarios: The IO request is a read request and the load of the read request is less than the second preset command load threshold; The IO request is a write request and the load of the write request is greater than the first preset command load threshold and less than the second preset command load threshold; The IO request is a write request and the load of the write request is less than the second preset command load threshold and the optimization scenario array corresponding to the port has at least one flag bit that is the second preset value.
7. The method according to claim 6, It is characterized in that The loads of all processing cores in the port meet the preset light load scenario, including: All flag bits in the optimization scenario array corresponding to the port are the first preset values.
8. The method according to any one of claims 1 to 7, It is characterized in that The determining the target processing core according to the write latency data of each CPU core of each port includes: Obtaining latency statistical historical data of write requests of each CPU core in the multi-port solid-state hard disk; For each port, the processing core with the lowest delay in the delay statistical historical data is used as the target processing core corresponding to the port.
9. A command processing device for a multi-port solid state hard disk, It is characterized in that Applied to a multi-port solid state hard disk, the device comprises: A determination module, used to determine a target processing core according to the write latency data of each CPU core of each port, wherein the target processing core is used to process write requests under a predetermined pressure scenario; The processing module is used to determine whether the solid state drive is in a predetermined stress scenario, and if so, when receiving a write request, send the write request to the target processing core for execution.
10. An electronic device, It is characterized in that include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the command processing method for a multi-port solid-state hard disk as described in any one of claims 1 to 8 are implemented.
11. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the command processing method of the multi-port solid-state hard disk according to any one of claims 1 to 8 are implemented.
Citation Information
Cited By
Data storage device with directional data traffic management
US12769483B2
Data storage device with directional data traffic management
WO2026075673A1
