Data processing method, system, host and storage medium of namespace
By adjusting the data processing method of flash memory devices based on namespace priority and IO queue depth, the lack of standardization in multi-namespace flow control is solved, thereby improving the performance stability and overall efficiency of flash memory devices.
Patent Information
- Application Number
- CN202411581425.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-07
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2044-11-07
AI Technical Summary
In the existing technology, there is a lack of standard flow control schemes for multiple namespaces. This leads to a situation where excessive data traffic in some namespaces affects the performance stability of other namespaces, especially when there are large differences in IO concurrency and pressure, resulting in a decrease in the performance of flash memory devices.
By determining the IO queue depth based on the namespace priority, and then determining the maximum number of concurrent IO requests and the amount of data for each block device based on the queue depth, the IO queue depth is dynamically adjusted to control data flow and prevent excessive data flow in some namespaces from affecting the performance of other namespaces.
It improves the performance stability of flash memory devices, prevents excessive data traffic in some namespaces from causing performance degradation in other namespaces, and enhances the overall stability and efficiency of the device.
Smart Images

Figure CN119620936B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a namespace data processing method, system, host, and storage medium. Background Technology
[0002] As SSD capacities increase, larger SSDs are typically divided into multiple smaller namespaces for host use. Each namespace represents an independent physical storage device on the host. For example, on Linux, each namespace corresponds to an independent block device, while on Windows, each namespace is an independent physical volume. Each namespace can meet the data storage needs of different applications on the host. However, because each namespace performs I / O reads and writes, there is no good solution for flow control, resulting in the host not fully utilizing the characteristics of namespaces.
[0003] Currently, there is no standard flow control scheme for multiple namespaces in SSDs. The existing technical solution is that each manufacturer provides its own unique commands to configure the bandwidth and IOPS of the namespace. This solution is effective when the number of IO concurrent requests and the pressure on each namespace are similar. However, when the business of each namespace is different and the number of IO concurrent requests and the pressure vary greatly, that is, when the data traffic of some namespaces is too large, it will lead to the performance degradation of other namespaces, thereby reducing the stability of the flash memory device's performance. For example, if the total number of IO resources in an SSD is 1024, and the 2GB namespace has a large business volume and a high number of IO concurrent requests, occupying 1000 IO resources, even if the 4GB namespace is scheduled with high priority, only 24 IO resources will remain. The limited resources will also affect the performance of the 4GB namespace. Summary of the Invention
[0004] This application provides a namespace data processing method, system, host, and storage medium. By determining the IO queue depth of a namespace based on its priority, and then determining the number of concurrent IO requests corresponding to each namespace based on the IO queue depth, and determining the first IO data volume to be sent to each block device based on the first maximum concurrent IO request volume corresponding to each block device, this application can prevent excessive data traffic in some namespaces from causing performance degradation in other namespaces, thereby improving the stability of flash memory device performance.
[0005] The embodiments of this application provide the following technical solutions:
[0006] In a first aspect, embodiments of this application provide a namespace data processing method applied to a flash memory device, the flash memory device including at least two namespaces, each namespace corresponding one-to-one with a block device, the method including:
[0007] Get the priority of each namespace;
[0008] Determine the depth of the first IO queue corresponding to each namespace based on the priority of each namespace.
[0009] Based on the depth of the first IO queue corresponding to each namespace, determine the first maximum concurrent IO request count for each block device;
[0010] The first IO data volume to be sent to each block device is determined based on the first maximum concurrent IO request volume corresponding to each block device, wherein the first IO data volume is less than or equal to the first maximum concurrent IO request volume.
[0011] In some embodiments, the number of first maximum concurrent IO requests for each device is equal to the first IO queue depth corresponding to its namespace;
[0012] Before retrieving the priority of each namespace, the method also includes:
[0013] The first configuration command sets the priority for each namespace.
[0014] In some embodiments, the priority of each namespace corresponds to a coefficient, and the depth of the first IO queue corresponding to each namespace is determined based on the priority of each namespace, including:
[0015] Get the queue depth of the submission queue;
[0016] The depth of the first IO queue is determined based on the queue depth of the submission queue and the coefficient corresponding to the priority of the namespace, where the depth of the first IO queue = the coefficient corresponding to the priority of the namespace * the depth of the submission queue.
[0017] In some embodiments, based on the priority of each namespace, the priority of the namespace includes a first priority, a second priority, and a third priority, where the first priority corresponds to a first coefficient, the second priority corresponds to a second coefficient, and the third priority corresponds to a third coefficient.
[0018] The depth of the first IO queue is determined based on the queue depth of the submission queue and the coefficient corresponding to the priority of the namespace, including:
[0019] If the namespace has the highest priority, then the depth of the first IO queue corresponding to the namespace is determined as the first coefficient multiplied by the depth of the submission queue.
[0020] If the priority of the namespace is the second priority, then the depth of the first IO queue corresponding to the namespace is determined as the second coefficient * the depth of the submission queue, where the second coefficient is less than the first coefficient.
[0021] If the namespace has the third priority, then the depth of the first IO queue corresponding to the namespace is determined as the third coefficient multiplied by the depth of the submission queue, where the third coefficient is less than the second coefficient.
[0022] In some embodiments, the method further includes:
[0023] Check whether the number of concurrent IO requests corresponding to the current namespace exceeds a preset threshold, where the preset threshold = (the sum of concurrent IO requests corresponding to all namespaces / the total number of namespaces) * preset coefficient;
[0024] When the number of concurrent IO requests corresponding to the current namespace is detected to exceed the preset threshold, the IO queue depth corresponding to the namespace is adjusted to the second IO queue depth;
[0025] Based on the second IO queue depth, the maximum number of concurrent IO requests corresponding to the block device is adjusted to the second maximum number of concurrent IO requests.
[0026] In some embodiments, adjusting the maximum concurrent IO request count corresponding to the block device to the second maximum concurrent IO request count based on the second IO queue depth includes:
[0027] After receiving the first asynchronous event notification from the flash device, a namespace identification command is sent to the flash device to cause the flash device to return to the second IO queue depth;
[0028] Based on the second IO queue depth, the maximum concurrent IO request count corresponding to the block device is adjusted to the second maximum concurrent IO request count, where the second maximum concurrent IO request count corresponding to each block device is equal to the second IO queue depth corresponding to its namespace.
[0029] In some embodiments, the method further includes:
[0030] Send a second configuration command to the flash memory device, wherein the second configuration command includes the changed priority corresponding to the namespace;
[0031] Based on the changed priority, the namespace's IO queue depth will be adjusted to the third IO queue depth;
[0032] Based on the depth of the third IO queue, determine the third maximum concurrent IO request count for each device;
[0033] The amount of third IO data sent to each block device is determined based on the number of third maximum concurrent IO requests corresponding to each block device, wherein the amount of third IO data is less than or equal to the number of third maximum concurrent IO requests.
[0034] In some embodiments, determining the third maximum concurrent I / O request count for each block device based on the third I / O queue depth includes:
[0035] After receiving the second asynchronous event notification from the flash device, a namespace identification command is sent to the flash device to cause the flash device to return to the third IO queue depth;
[0036] Based on the depth of the third IO queue, determine the third maximum concurrent IO request count for each device, where the third IO data volume is less than or equal to the third maximum concurrent IO request count.
[0037] Secondly, embodiments of this application provide a namespace data processing system, the system comprising:
[0038] The flash memory device is connected to the host and is used to receive a first configuration command sent by the host. The first configuration command includes the priority corresponding to each namespace. Based on the priority of each namespace, the first IO queue depth corresponding to each namespace is determined, and a first asynchronous event notification is sent to the host. Here, one namespace corresponds to one first IO queue depth, and the priority is positively correlated with the first IO queue depth.
[0039] The host, which is connected to the flash memory device, is used to send a namespace identification command to the flash memory device after receiving a first asynchronous event notification from the flash memory device, so that the flash memory device returns a first IO queue depth to the host; determine the first maximum concurrent IO request number corresponding to the block device based on the first IO queue depth; and determine the first IO data volume to be sent to each block device based on the first maximum concurrent IO request number corresponding to each block device, wherein the first IO data volume is less than or equal to the first maximum concurrent IO request number.
[0040] In some embodiments, the host includes a block device driver module, which is configured to determine the first maximum concurrent IO request quantity corresponding to the block device based on the first IO queue depth; and to determine the first IO data quantity to be sent to each block device based on the first maximum concurrent IO request quantity corresponding to each block device, wherein the first IO data quantity is less than or equal to the first maximum concurrent IO request quantity.
[0041] In some embodiments, the flash memory device includes a firmware module, which is used to detect whether the concurrent IO requests corresponding to the current namespace exceed a preset threshold, wherein the preset threshold = (the sum of the concurrent IO requests corresponding to all namespaces / the total number of namespaces) * a preset coefficient;
[0042] The flash memory device is also used to adjust the IO queue depth corresponding to the namespace from the first IO queue depth to the second IO queue depth when it detects that the IO concurrent requests corresponding to a certain device exceed a preset threshold, and to send a second asynchronous event notification to the host.
[0043] The host is also used to send a namespace identification command to the flash memory device after receiving a second asynchronous event notification from the flash memory device, so that the flash memory device returns a second IO queue depth to the host; determine the second maximum concurrent IO request quantity corresponding to the block device based on the second IO queue depth; and determine the second IO data quantity to be sent to the block device based on the second maximum concurrent IO request quantity corresponding to the block device, wherein the second IO data quantity is less than or equal to the second maximum concurrent IO request quantity.
[0044] Thirdly, embodiments of this application provide a host, including:
[0045] At least one processor; and
[0046] A memory that is communicatively connected to at least one processor; wherein,
[0047] The memory stores instructions that can be executed by at least one processor, which enables the at least one processor to perform data processing methods for the namespace as described in the first aspect.
[0048] Fourthly, embodiments of this application provide a non-volatile computer-readable storage medium storing a computer program or instructions. When the computer program or instructions are executed, they implement a data processing method for a namespace as described in any of the first aspects.
[0049] The beneficial effects of the embodiments of this application are as follows: Unlike the prior art, the embodiments of this application provide a namespace data processing method applied to a flash memory device. The flash memory device includes at least two namespaces, each namespace corresponding to a block device. The method includes: obtaining the priority of each namespace; determining the first IO queue depth corresponding to each namespace based on its priority; determining the first maximum concurrent IO request count corresponding to each block device based on the first IO queue depth corresponding to each namespace; and determining the first IO data volume to be sent to each block device based on the first maximum concurrent IO request count corresponding to each block device, wherein the first IO data volume is less than or equal to the first maximum concurrent IO request count. This application can prevent excessive data traffic in some namespaces from causing performance degradation in other namespaces, thereby improving the stability of flash memory device performance. Attached Figure Description
[0050] One or more embodiments are illustrated by way of example with reference to the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements having the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.
[0051] Figure 1 This is a schematic diagram of the structure of a namespace data processing system provided in an embodiment of this application;
[0052] Figure 2 This is a flowchart illustrating a namespace data processing method provided in an embodiment of this application;
[0053] Figure 3 This is a flowchart illustrating a method for setting the priority of a namespace, as provided in an embodiment of this application.
[0054] Figure 4 yes Figure 2 A detailed flowchart of step S202 in the process;
[0055] Figure 5 yes Figure 4 A detailed flowchart of step S222 in the process;
[0056] Figure 6 This is a flowchart illustrating a process for detecting whether the amount of IO data corresponding to the current namespace exceeds a preset threshold, provided in an embodiment of this application.
[0057] Figure 7 yes Figure 6 A detailed flowchart of step S605 in the process;
[0058] Figure 8 This is a flowchart illustrating an embodiment of the present application for adjusting the IO queue depth of a namespace based on a changed priority.
[0059] Figure 9 yes Figure 8 A detailed flowchart of step S803 in the process;
[0060] Figure 10 This is a timing diagram illustrating the interaction between a host and a flash memory device, as provided in an embodiment of this application.
[0061] Figure 11 This is another timing diagram of the interaction between a host and a flash memory device provided in an embodiment of this application;
[0062] Figure 12 This is a schematic diagram of the structure of a host provided in an embodiment of this application.
[0063] Explanation of icon numbers:
[0064] Detailed Implementation
[0065] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0066] Furthermore, the technical features involved in the various embodiments of this application described below can be combined with each other as long as they do not conflict with each other.
[0067] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. The term "and / or" as used in this specification includes any and all combinations of one or more of the associated listed items.
[0068] The technical solution of this application is described in detail below with reference to the accompanying drawings:
[0069] Please see Figure 1 , Figure 1 This is a schematic diagram of the structure of a namespace data processing system provided in an embodiment of this application;
[0070] like Figure 1 As shown, the data processing system 100 of this namespace includes a host 10 and a flash memory device 20, with the host 10 communicatively connected to the flash memory device 20. Figure 1 Taking a host 10 and a flash memory device 20 as an example, it can be understood that the data processing system 100 of the namespace may also include multiple flash memory devices 20. For example, the host 10 may be connected to multiple flash memory devices 20 respectively. The types of flash memory devices 20 include, but are not limited to, solid state drives (SSDs), key-value solid state drives (KV SSDs), computational storage drives (CSDs), graphics processing units (GPUs), and data processing units (DPUs).
[0071] Host 10 is connected to flash memory device 20. After receiving a first asynchronous event notification from flash memory device 20, host 10 sends a namespace identification command to flash memory device 20, so that flash memory device 20 returns a first IO queue depth to host 10. Based on the first IO queue depth, host 10 determines the first maximum concurrent IO request count corresponding to each block device. Based on the first maximum concurrent IO request count corresponding to each block device, host 10 determines the first IO data volume to be sent to each block device, wherein the first IO data volume is less than or equal to the first maximum concurrent IO request count. Specifically, host 10 first sets the priority corresponding to each namespace through a first configuration command. The first configuration command refers to the NVMe Set Feature command, which is a command used to configure and manage the features of NVMe solid-state drives (SSDs). Through the NVMe Set Feature command, host 10 can obtain the status information of flash memory device 20 and modify certain settings in flash memory device 20.
[0072] In this embodiment, the first configuration command is used to set the priority of each namespace. The host sets the priority of each namespace by sending the first configuration command to the flash memory device. For example, the priority of namespace A is set to the first priority, the priority of namespace B is set to the second priority, and the priority of namespace C is set to the third priority. The first priority is higher than the second priority, and the second priority is higher than the third priority. After the flash memory device receives the first configuration command, it sends a first asynchronous event notification to the host. After receiving the first asynchronous event notification from the flash memory device, the host sends a namespace identification command to the flash memory device to make the flash memory device return the first IO queue depth to the host. Based on the first IO queue depth, the first maximum concurrent IO request count corresponding to the block device is determined. The first maximum concurrent IO request count corresponding to each block device is equal to the first IO queue depth corresponding to its corresponding namespace. For example, assuming the first IO queue depth is 128, the first maximum concurrent IO request count is determined to be 128. Based on the first maximum concurrent IO request count corresponding to each block device, the first IO data volume sent to each block device is determined. The first IO data volume is less than or equal to the first maximum concurrent IO request count.
[0073] In this embodiment, the host 10 includes a block device driver module 101. The block device driver module 101 is used to determine the first maximum concurrent IO request count corresponding to the block device based on the first IO queue depth; and to determine the first IO data volume sent to each block device based on the first maximum concurrent IO request count corresponding to each block device, wherein the first IO data volume is less than or equal to the first maximum concurrent IO request count. Specifically, the device driver module determines the first IO data volume sent to each block device based on the first maximum concurrent IO request count corresponding to each block device, wherein the first IO data volume is less than or equal to the first maximum concurrent IO request count. Assuming there are currently 3 block devices: the first block device, the second block device, and the third block device, the first maximum concurrent IO request count corresponding to the first block device is 512, the first maximum concurrent IO request count corresponding to the second block device is 256, and the first maximum concurrent IO request count corresponding to the third block device is 128. At this time, several situations exist:
[0074] (1) When the total amount of IO data to be sent is greater than the sum of the first maximum concurrent IO requests for all block devices, for example, when the total amount of IO data to be sent is 996, then the first IO data amount sent to the first block device is determined to be 512, the first IO data amount sent to the second block device is 256, the first IO data amount sent to the third block device is 128, and the remaining IO data amount is 100. Since the current IO data amount of all block devices is equal to the first maximum concurrent IO request for each block device, the remaining IO data will enter the waiting queue, that is, the IO data will be suspended on the host (IO... (Pending) can be understood as follows: on the host, input / output operations are suspended for some reason and cannot be completed in time. The suspended IO operations can only be processed after the previous IO operations are completed. After the first 896 IO data are sent to the corresponding block devices, the remaining 100 IO data will be sent to the block device with the largest number of concurrent IO requests to ensure that IO data is sent to the block device corresponding to the highest priority namespace first.
[0075] (2) When the total amount of IO data to be sent is equal to the sum of the first maximum concurrent IO requests of all block devices, the block device with the largest number of first maximum concurrent IO requests is selected first, i.e., the first block device, and the amount of first IO data sent to the first block device is 512. Then the second block device is selected and the amount of first IO data sent to the second block device is 256. Finally, the block device with the smallest number of first maximum concurrent IO requests is selected, i.e., the third block device, and the amount of first IO data sent to the third block device is 128.
[0076] (3) When the total amount of IO data to be sent is less than the sum of the first maximum concurrent IO requests of all block devices, for example, if the total amount of IO data to be sent is 500, then the block device with the largest number of first maximum concurrent IO requests, i.e., the first block device, is selected first, and the first IO data sent to the first block device is 500. There is no need to send IO data to the second and third blocks. For another example, if the total amount of IO data to be sent is 700, then the block device with the largest number of first maximum concurrent IO requests, i.e., the first block device, is selected first, and the first IO data sent to the first block device is 512. At this time, there are still 188 IO data left. Then the second block device is selected, and the first IO data sent to the second block device is 188. There is no need to send IO data to the third block device.
[0077] Flash device 20 is connected to host 10. Flash device 20 is used to receive a first configuration command sent by the host, wherein the first configuration command includes the priority corresponding to each namespace; determine the first IO queue depth of the namespace according to the priority of the namespace, and send a first asynchronous event notification to the host, wherein one namespace corresponds to one first IO queue depth, and the priority is positively correlated with the first IO queue depth.
[0078] In this embodiment, the flash memory device 20 includes a firmware module 201. The firmware module 201 is used to detect whether the concurrent IO requests corresponding to the current namespace exceed a preset threshold. The preset threshold is defined as (the sum of concurrent IO requests corresponding to all namespaces / the total number of namespaces) * a preset coefficient. Specifically, the firmware module includes firmware, which is software embedded in a hardware device and is usually stored in the device's non-volatile memory, such as flash memory or read-only memory (ROM). Its main functions include controlling the device's boot process, initializing the device's basic functions, controlling hardware operations, and communicating with other devices. In this embodiment, the firmware module (FW) in the flash memory device detects whether the number of concurrent IO requests corresponding to the current namespace exceeds the preset threshold. The preset threshold is defined as (the sum of concurrent IO requests corresponding to all namespaces / the total number of namespaces) * a preset coefficient. The sum of concurrent IO requests corresponding to all namespaces / the total number of namespaces is the average value of the number of concurrent IO requests corresponding to each namespace. The preset coefficient can be set according to actual needs, for example, the preset coefficient can be set to 2. This application does not limit this setting. If the number of concurrent I / O requests corresponding to a detected block device does not exceed the preset threshold, it means that no block device has a concurrent I / O request count exceeding the preset threshold, and it will not affect the bandwidth and latency of I / O in other namespaces. Therefore, there is no need to adjust the I / O queue depth corresponding to the namespace. If the number of concurrent I / O requests corresponding to a detected block device exceeds the preset threshold, the I / O queue depth corresponding to that block device will be adjusted from the first I / O queue depth to the second I / O queue depth. The second I / O queue depth is less than the first I / O queue depth. For example, if the first I / O queue depth is 256, the second I / O queue depth can be adjusted to 128.
[0079] In this embodiment, by detecting whether the number of concurrent IO requests corresponding to a certain block device exceeds a preset threshold, the depth of the IO queue corresponding to the block device is dynamically adjusted. This application can limit the concurrent IO requests sent to the block device from the host side. This application can prevent excessive data traffic in some namespaces and improve the stability of flash memory device performance.
[0080] The flash memory device 20 is also used to adjust the IO queue depth corresponding to the namespace from the first IO queue depth to the second IO queue depth when it detects that the number of concurrent IO requests corresponding to the namespace exceeds a preset threshold, and to send a first asynchronous event notification to the host. Specifically, after the flash memory device detects that the number of concurrent IO requests corresponding to the block device exceeds the preset threshold and adjusts the IO queue depth corresponding to the namespace, it sends a first asynchronous event notification to the host, so that after receiving the first asynchronous event notification sent by the flash memory device, the host sends a namespace identification command to the flash memory device. Here, the first asynchronous event refers to the asynchronous event defined by the NVMe protocol. The flash memory device can notify the host to update the IO queue depth corresponding to the namespace by sending the asynchronous event defined by the NVMe protocol to the host.
[0081] The host 10 is further configured to, after receiving a second asynchronous event notification from the flash memory device, send a namespace identification command to the flash memory device to cause the flash memory device to return a second IO queue depth to the host; determine the second maximum concurrent IO request count corresponding to the block device based on the second IO queue depth; and determine the amount of second IO data to be sent to the block device based on the second maximum concurrent IO request count corresponding to the block device, wherein the amount of second IO data is less than or equal to the second maximum concurrent IO request count. Specifically, after receiving a first asynchronous event notification from the flash memory device, the host sends a namespace identification command to the flash memory device to cause the flash memory device to return a second IO queue depth to the host, and determines the second maximum concurrent IO request count corresponding to the block device based on the second IO queue depth, wherein the second IO queue depth is equal to the second maximum concurrent IO request count. Finally, based on the second maximum concurrent IO request count corresponding to the block device, the host determines the amount of second IO data to be sent to the block device, wherein the amount of second IO data is less than or equal to the second maximum concurrent IO request count. For example, when the second maximum concurrent IO request count is 128, the amount of second IO data to be sent to the block device can be 100.
[0082] It is understood that the first asynchronous event notification or the second asynchronous event notification in the embodiments of this application means that when an event occurs, the system or application does not need to wait for the operation to complete, but sends a notification to the relevant components or users through a certain mechanism (such as callback, message queue, signal, etc.). This mechanism allows the system to respond to the event in a timely manner while processing other tasks, thereby improving efficiency and user experience.
[0083] Please see Figure 2 , Figure 2 This is a flowchart illustrating a namespace data processing method provided in an embodiment of this application;
[0084] The data processing method for this namespace is applied to a host connected to a flash memory device, which includes a solid-state drive.
[0085] like Figure 2 As shown, the data processing methods for this namespace include:
[0086] Step S201: Obtain the priority of each namespace;
[0087] Specifically, the priority of a namespace is determined by the host. The host uses different namespaces for different business types. The host can define the priority of each namespace according to the business type corresponding to each namespace. For example, suppose the host creates three namespaces: namespace A, namespace B, and namespace C, and sets the priority of each namespace. The priority of namespace A is set as the first priority, the priority of namespace B is set as the second priority, and the priority of namespace C is set as the third priority. The first priority is higher than the second priority, and the second priority is higher than the third priority.
[0088] Please refer to the following: Figure 3 , Figure 3 This is a flowchart illustrating a method for setting the priority of a namespace, as provided in an embodiment of this application.
[0089] like Figure 3 As shown, the process for setting namespace priority includes:
[0090] Step S301: Set the priority of each namespace using the first configuration command;
[0091] Specifically, the first configuration command refers to the NVMe Set Feature command, which is a command used to configure and manage the features of NVMe solid-state drives (SSDs). Through this command, the host can obtain the status information of the flash memory device and modify certain settings in the flash memory device. In this embodiment, the first configuration command is used to set the priority corresponding to each namespace. The host sets the priority corresponding to each namespace by sending the first configuration command to the flash memory device. For example, the priority corresponding to namespace A is set to the first priority, the priority corresponding to namespace B is set to the second priority, and the priority corresponding to namespace C is set to the third priority. The first priority is higher than the second priority, and the second priority is higher than the third priority.
[0092] In this embodiment, the host sends the priority corresponding to each namespace to the flash memory device through a first configuration command, thereby enabling the flash memory device to set the IO queue depth corresponding to the namespace according to the priority. This application can control the data traffic of each namespace according to the priority corresponding to the namespace sent by the host, thereby improving traffic control efficiency.
[0093] Step S202: Determine the depth of the first IO queue corresponding to each namespace based on the priority of each namespace;
[0094] For details, please refer to [link / reference]. Figure 4 , Figure 4 yes Figure 2 A detailed flowchart of step S202 in the process;
[0095] like Figure 4 As shown, step S202: Determine the depth of the first IO queue corresponding to each namespace based on the priority of each namespace, including:
[0096] Step S221: Obtain the queue depth of the submission queue;
[0097] Specifically, the host obtains the queue depth of the submission queue. The Submission Queue (SQ) in the NVMe protocol is a key component of NVMe technology. It is responsible for carrying commands submitted by the host to the NVMe controller. These commands can be I / O operations, such as reading and writing data, refreshing data, etc., or management commands, such as obtaining SSD capabilities, querying attributes, etc. The queue depth refers to the maximum number of commands that can exist simultaneously in the submission queue. Furthermore, the Submission Queue (SQ) and its associated Completion Queue (CQ) together form a queue pair in the NVMe protocol, used to handle command submissions and status feedback between the host and the controller.
[0098] Step S222: Determine the depth of the first IO queue based on the queue depth of the submission queue and the coefficient corresponding to the priority of the namespace;
[0099] For details, please refer to [link / reference]. Figure 5 , Figure 5 yes Figure 4 A detailed flowchart of step S222 in the process;
[0100] like Figure 5 As shown, step S222: Determine the depth of the first IO queue based on the queue depth of the submission queue and the coefficient corresponding to the priority of the namespace, including:
[0101] Step S2221: Obtain the priority of the namespace and the coefficient corresponding to the priority of the namespace;
[0102] Specifically, the priority of a namespace is determined by the host. The host uses different namespaces for different service types. That is, the host can define the priority of each namespace according to the service type corresponding to each namespace. For example, suppose the host creates three namespaces: namespace A, namespace B, and namespace C, and sets the priority of each namespace. The priority of namespace A is set as the first priority, the priority of namespace B is set as the second priority, and the priority of namespace C is set as the third priority. The first priority is higher than the second priority, and the second priority is higher than the third priority. The host sets and retrieves the priority of the namespace through the first configuration command. The priority of each namespace corresponds to a coefficient. For example, the first priority corresponds to the first coefficient, the second priority corresponds to the second coefficient, and the third priority corresponds to the third coefficient. The higher the priority, the larger the coefficient corresponding to the priority. If the first priority is higher than the second priority, and the second priority is higher than the third priority, then the first coefficient is greater than the second coefficient, and the second coefficient is greater than the third coefficient.
[0103] In this embodiment, the first configuration command includes the NVMe Set Feature command. The NVMe Set Feature command is a command used to configure and manage the features of an NVMe solid-state drive (SSD). Through this command, the host can obtain the status information of the flash memory device and modify certain settings in the flash memory device. In this embodiment, the NVMe Set Feature command is used to set the priority corresponding to each namespace. The host sets the priority corresponding to each namespace by sending the first configuration command to the flash memory device. For example, the priority corresponding to namespace A is set to the first priority, the priority corresponding to namespace B is set to the second priority, and the priority corresponding to namespace C is set to the third priority. The first priority is higher than the second priority, and the second priority is higher than the third priority.
[0104] Step S2222: If the priority of the namespace is the first priority, then the depth of the first IO queue corresponding to the namespace is determined as the first coefficient * the depth of the submission queue;
[0105] Specifically, the namespace priority is divided into three levels: first priority, second priority, and third priority. First priority is higher than second priority, and second priority is higher than third priority. In other words, the namespace priority includes first, second, and third priorities. If the namespace has a first priority, the depth of the first IO queue corresponding to that namespace is determined as a first coefficient multiplied by the depth of the submission queue. The first coefficient can be set according to actual needs; for example, it can be set to 0.5.
[0106] Step S2223: If the priority of the namespace is the second priority, then the depth of the first IO queue corresponding to the namespace is determined as the second coefficient * the depth of the submission queue;
[0107] Specifically, if the priority of the namespace is the second priority, then the depth of the first IO queue corresponding to the namespace is determined as the second coefficient * the depth of the submission queue. The second coefficient is less than the first coefficient. The second coefficient can be set according to actual needs. For example, when the first coefficient is 0.5, the second coefficient can be set to 0.25.
[0108] Step S2224: If the priority of the namespace is the third priority, then the depth of the first IO queue corresponding to the namespace is determined as the third coefficient * the depth of the submission queue;
[0109] Specifically, if the priority of the namespace is the third priority, then the depth of the first IO queue corresponding to the namespace is determined as the third coefficient * the depth of the submission queue. The second coefficient is less than the first coefficient. The second coefficient can be set according to actual needs. For example, when the second coefficient is 0.25, it can be set to 0.125.
[0110] In this embodiment, the depth of the first IO queue corresponding to the namespace is determined according to the priority of the namespace. Preferably, the higher the priority of the namespace, the greater the depth of the first IO queue. For example, assuming the depth of the submission queue is 1024, and the first coefficient, the second coefficient, and the third coefficient are set to 0.5, 0.25, and 0.125 respectively, then the depth of the first IO queue of the first priority namespace is determined to be 0.5*1024, i.e., 512; the depth of the first IO queue of the second priority namespace is determined to be 0.25*1024, i.e., 256; and the depth of the first IO queue of the third priority namespace is determined to be 0.125*1024, i.e., 128.
[0111] In this embodiment, there is a correspondence between priority and coefficient. The first priority corresponds to the first coefficient, the second priority corresponds to the second coefficient, and the third priority corresponds to the third coefficient. The first, second, and third coefficients can all be set according to actual needs. The higher the priority, the larger its corresponding coefficient, that is, the first coefficient is greater than the second coefficient, and the second coefficient is greater than the third coefficient.
[0112] In some embodiments, the priority of a namespace can be divided into three or more, for example, the priority of a namespace can be divided into first priority, second priority, third priority and fourth priority. It is understood that the number of priorities of a namespace can be set according to actual needs, and this application does not limit this.
[0113] It is understandable that each priority corresponds to a coefficient, and there is a correspondence between priority and coefficient. The higher the priority, the larger its corresponding coefficient, which allows namespaces with higher priorities to use higher queue depths.
[0114] In this embodiment, the submission queue is a circular queue stored in a contiguous block of memory space, used to store data for which I / O operations will be performed. The queue depth of the submission queue is the maximum amount of I / O data it can store. By determining the first IO queue depth based on the queue depth of the submission queue and the coefficient corresponding to the priority of the namespace, this application can better control the data flow of the namespace.
[0115] Step S203: Determine the first maximum concurrent IO request count for each block device based on the first IO queue depth corresponding to each namespace;
[0116] Specifically, a block device refers to a flash memory device that is divided into multiple independent storage units in the form of blocks. Each block device can perform read and write operations independently. This division method allows the operating system to manage storage space more effectively, improving storage efficiency and performance. The working principle of a block device is mainly based on the flash memory storage mechanism. It manages data read and write operations through a controller to achieve high-speed data access.
[0117] In this embodiment of the application, each namespace corresponds to a block device. After obtaining the first IO queue depth corresponding to the namespace according to the priority of the namespace, the first maximum concurrent IO request count corresponding to each block device is determined according to the first IO queue depth corresponding to each namespace. The first maximum concurrent IO request count corresponding to the block device refers to the maximum number of IO requests that the block device can process at the same time. The first IO data volume is less than or equal to the first maximum concurrent IO request count. For example, if the first IO queue depth corresponding to a certain namespace is 512, then the first maximum concurrent IO request count of the block device corresponding to that namespace is determined to be 512.
[0118] Step S204: Determine the amount of first IO data to be sent to each block device based on the first maximum concurrent IO request count corresponding to each block device;
[0119] Specifically, based on the maximum concurrent IO requests corresponding to each block device, the amount of the first IO data sent to each block device is determined. The amount of the first IO data is less than or equal to the maximum concurrent IO requests. Assuming there are three block devices: the first, second, and third devices, with the first maximum concurrent IO requests for the first device being 512, the second device being 256, and the third device being 128, several scenarios exist:
[0120] (1) When the total amount of IO data to be sent is greater than the sum of the first maximum concurrent IO requests for all block devices, for example, when the total amount of IO data to be sent is 996, then the first IO data amount sent to the first block device is determined to be 512, the first IO data amount sent to the second block device is 256, the first IO data amount sent to the third block device is 128, and the remaining IO data amount is 100. Since the current IO data amount of all block devices is equal to the first maximum concurrent IO request for each block device, the remaining IO data will enter the waiting queue, that is, the IO data will be suspended on the host (IO... (Pending) can be understood as follows: on the host, input / output operations are suspended for some reason and cannot be completed in time. The suspended IO operations can only be processed after the previous IO operations are completed. After the first 896 IO data are sent to the corresponding block devices, the remaining 100 IO data will be sent to the block device with the largest number of concurrent IO requests to ensure that IO data is sent to the block device corresponding to the highest priority namespace first.
[0121] (2) When the total amount of IO data to be sent is equal to the sum of the first maximum concurrent IO requests of all block devices, the block device with the largest number of first maximum concurrent IO requests is selected first, i.e., the first block device, and the amount of first IO data sent to the first block device is 512. Then the second block device is selected and the amount of first IO data sent to the second block device is 256. Finally, the block device with the smallest number of first maximum concurrent IO requests is selected, i.e., the third block device, and the amount of first IO data sent to the third block device is 128.
[0122] (3) When the total amount of IO data to be sent is less than the sum of the first maximum concurrent IO requests of all block devices, for example, if the total amount of IO data to be sent is 500, then the block device with the largest number of first maximum concurrent IO requests, i.e., the first block device, is selected first, and the first IO data sent to the first block device is 500. There is no need to send IO data to the second and third blocks. For another example, if the total amount of IO data to be sent is 700, then the block device with the largest number of first maximum concurrent IO requests, i.e., the first block device, is selected first, and the first IO data sent to the first block device is 512. At this time, there are still 188 IO data left. Then the second block device is selected, and the first IO data sent to the second block device is 188. There is no need to send IO data to the third block device.
[0123] Please refer to the following: Figure 6 , Figure 6 This is a flowchart illustrating a process for detecting whether the amount of IO data corresponding to the current namespace exceeds a preset threshold, provided in an embodiment of this application.
[0124] like Figure 6 As shown, the process for detecting whether the amount of IO data corresponding to the current namespace exceeds a preset threshold includes:
[0125] Step S601: Obtain the number of concurrent IO requests corresponding to the current namespace;
[0126] Specifically, it retrieves the IO data corresponding to the current namespace, where the IO data corresponding to the namespace refers to the IO data currently being sent to the block device corresponding to the namespace.
[0127] Step S602: Detect whether the number of concurrent IO requests corresponding to the current namespace exceeds a preset threshold;
[0128] Specifically, the firmware module (FW) in the flash memory device detects whether the number of concurrent I / O requests corresponding to the current namespace exceeds a preset threshold. The preset threshold is calculated as (the sum of the number of concurrent I / O requests corresponding to all namespaces / the total number of namespaces) * a preset coefficient. The sum of the number of concurrent I / O requests corresponding to all namespaces / the total number of namespaces is the average number of concurrent I / O requests for each namespace. This preset coefficient can be set according to actual needs; for example, it can be set to 2. This application does not limit this setting. If the number of concurrent I / O requests corresponding to the current namespace exceeds the preset threshold, the process proceeds to step S604; if the number of concurrent I / O requests corresponding to the current namespace does not exceed the preset threshold, the process proceeds to step S603.
[0129] In this embodiment, when the firmware module detects that the number of concurrent IO requests in a certain namespace is too large, that is, the number of concurrent IO requests in a certain namespace exceeds a preset threshold, affecting the bandwidth and latency of IO in other namespaces, it will adjust the IO queue depth corresponding to the namespace, thereby realizing the flow control of IO data in the namespace. By detecting whether the amount of IO data corresponding to the current namespace exceeds the preset threshold, the IO queue depth corresponding to the namespace is dynamically adjusted. Since the larger the IO queue depth corresponding to the namespace, the higher the priority, this dynamic adjustment operation can indirectly adjust the priority of the namespace according to the current amount of IO data in the namespace.
[0130] Step S603: Do not adjust the depth of the IO queue corresponding to the namespace;
[0131] Specifically, if the number of concurrent IO requests corresponding to the current namespace does not exceed the preset threshold, it means that the number of concurrent IO requests in any namespace does not exceed the preset threshold, and it will not affect the bandwidth and latency of IO in other namespaces. Therefore, it is not necessary to adjust the IO queue depth corresponding to the namespace.
[0132] Step S604: Adjust the IO queue depth corresponding to the namespace to the second IO queue depth;
[0133] Specifically, if the number of concurrent IO requests corresponding to the current namespace exceeds a preset threshold, the IO queue depth corresponding to the namespace will be adjusted from the first IO queue depth to the second IO queue depth, wherein the second IO queue depth is less than the first IO queue depth. For example, if the first IO queue depth is 256, the second IO queue depth can be adjusted to 128.
[0134] Step S605: Based on the second IO queue depth, adjust the maximum concurrent IO request count corresponding to the block device to the second maximum concurrent IO request count;
[0135] For details, please refer to [link / reference]. Figure 7 , Figure 7 yes Figure 6 A detailed flowchart of step S605 in the process;
[0136] like Figure 7 As shown, step S605: Based on the second IO queue depth, adjust the maximum concurrent IO request count corresponding to the block device to the second maximum concurrent IO request count, including:
[0137] Step S651: After receiving the first asynchronous event notification sent by the flash memory device, send a namespace identification command to the flash memory device to make the flash memory device return to the second IO queue depth;
[0138] Specifically, after the flash memory device detects that the number of concurrent I / O requests corresponding to the current namespace exceeds a preset threshold and adjusts the I / O queue depth corresponding to the namespace, it sends a first asynchronous event to the host. After receiving the first asynchronous event notification from the flash memory device, the host sends a namespace identification command to the flash memory device, so that the flash memory device returns a second I / O queue depth to the host. Here, the first asynchronous event refers to the asynchronous event defined by the NVMe protocol. The flash memory device can notify the host to update the I / O queue depth corresponding to the namespace by sending an asynchronous event defined by the NVMe protocol. For example, it can notify the host to update the I / O queue depth of the namespace from the first I / O queue depth to the second I / O queue depth. The namespace identification command includes the nvme identify name space command in the NVMe protocol. The host sends the nvmeidentify name space command to the flash memory device, and the flash memory device returns the second I / O queue depth of the namespace, so that the host can adjust the maximum number of concurrent I / O requests corresponding to the block device to the second maximum number of concurrent I / O requests (nr_requst) based on the second I / O queue depth.
[0139] Step S652: Based on the second IO queue depth, adjust the maximum concurrent IO request count corresponding to the block device to the second maximum concurrent IO request count;
[0140] Specifically, after receiving the second IO queue depth sent by the flash memory device, the host adjusts the maximum concurrent IO request count corresponding to the block device from the first maximum concurrent IO request count to the second maximum concurrent IO request count based on the second IO queue depth. The second maximum concurrent IO request count is equal to the second IO queue depth. For example, assuming the second IO queue depth is 256, the second maximum concurrent IO request count is determined to be 256.
[0141] Please refer to the following: Figure 8 , Figure 8 This is a flowchart illustrating an embodiment of the present application for adjusting the IO queue depth of a namespace based on a changed priority.
[0142] like Figure 8 As shown, the process of adjusting the IO queue depth of a namespace based on the changed priority includes:
[0143] Step S801: Send a second configuration command to the flash memory device;
[0144] Specifically, the second configuration command refers to the NVMe Set Feature command. The NVMe Set Feature command is a command used to configure and manage the features of NVMe solid-state drives (SSDs). Through this command, the host can obtain the status information of the flash memory device and modify certain settings in the flash memory device. In this embodiment, the NVMe Set Feature command is used to set the priority corresponding to each namespace to the changed priority. The second configuration command includes the changed priority. The host sets the priority corresponding to each namespace to the changed priority by sending the second configuration command to the flash memory device. For example, if the priority of namespace A before the change was the first priority and the priority of namespace B before the change was the second priority, if the priority of namespace A after the change is the second priority and the priority of namespace B after the change is the first priority, then the priority of namespace A is changed from the first priority to the second priority, and the priority of namespace B is changed from the second priority to the first priority.
[0145] Step S802: Adjust the namespace's IO queue depth to the third IO queue depth according to the changed priority;
[0146] Specifically, based on the changed priority, the IO queue depth of the namespace is adjusted from the first IO queue depth to the third IO queue depth. For example, assuming that when namespace A is the first priority, the first IO queue depth corresponding to namespace A is 512, and when namespace B is the second priority, the first IO queue depth corresponding to namespace B is 256, the second configuration command changes the priority of namespace A to the second priority, changes the priority of namespace B to the first priority, and adjusts the first IO queue depth corresponding to namespace A to 256 and the first IO queue depth corresponding to namespace B to 512.
[0147] Step S803: Determine the third maximum concurrent IO request count for each block device based on the third IO queue depth;
[0148] For details, please refer to [link / reference]. Figure 9 , Figure 9 yes Figure 8 A detailed flowchart of step S803 in the process;
[0149] like Figure 9 As shown, step S803: Based on the depth of the third IO queue, determine the third maximum concurrent IO request count for each block device, including:
[0150] Step S831: After receiving the second asynchronous event notification sent by the flash memory device, send a namespace identification command to the flash memory device to make the flash memory device return to the third IO queue depth;
[0151] Specifically, after the flash memory device adjusts the namespace's IO queue depth to the third IO queue depth according to the changed priority, it sends a second asynchronous event notification to the host. After receiving the second asynchronous event notification from the flash memory device, the host sends a namespace identification command to the flash memory device, causing the flash memory device to return the third IO queue depth to the host. Here, the second asynchronous event refers to the asynchronous event defined by the NVMe protocol. The flash memory device can notify the host to update the IO queue depth corresponding to the namespace by sending asynchronous events defined by the NVMe protocol. For example, it can notify the host to update the namespace's IO queue depth from the first IO queue depth to the third IO queue depth. The namespace identification command includes the nvme identify name space command in the NVMe protocol. The host sends the nvme identify name space command to the flash memory device, and the flash memory device returns the third IO queue depth of the namespace, so that the host can adjust the maximum concurrent IO request count corresponding to the block device to the third maximum concurrent IO request count (nr_requst) according to the third IO queue depth.
[0152] Step S832: Determine the third maximum concurrent IO request count corresponding to the block device based on the third IO queue depth;
[0153] Specifically, after receiving the third IO queue depth sent by the flash memory device, the host adjusts the maximum concurrent IO request count corresponding to the block device from the first maximum concurrent IO request count to the third maximum concurrent IO request count based on the third IO queue depth. The third maximum concurrent IO request count is equal to the third IO queue depth. For example, assuming the third IO queue depth is 512, the third maximum concurrent IO request count is determined to be 512.
[0154] Step S804: Determine the amount of third IO data to be sent to each block device based on the third maximum concurrent IO request quantity corresponding to each block device;
[0155] Specifically, based on the third maximum concurrent I / O request count corresponding to each block device, the amount of third I / O data sent to each block device is determined. The third I / O data amount is less than or equal to the third maximum concurrent I / O request count. Assuming there are three block devices: Block Device 1, Block Device 2, and Block Device 3, with the third maximum concurrent I / O request count for Block Device 1 being 512, for Block Device 2 being 256, and for Block Device 3 being 128, several scenarios exist:
[0156] (1) When the total amount of IO data to be sent is greater than the sum of the maximum concurrent IO requests for all block devices, for example, when the total amount of IO data to be sent is 996, then the amount of third IO data sent to the first block device is determined to be 512, the amount of third IO data sent to the second block device is 256, the amount of third IO data sent to the third block device is 128, and the amount of IO data remaining is 100. Since the amount of IO data for all block devices is equal to the maximum concurrent IO requests for each block device, the remaining IO data will enter the waiting queue, that is, the IO data will be suspended on the host (IO... (Pending) can be understood as follows: on the host, input / output operations are suspended for some reason and cannot be completed in time. The suspended IO operations can only be processed after the previous IO operations are completed. After the first 896 IO data are sent to the corresponding block devices, the remaining 100 IO data will be sent to the block device with the third largest number of concurrent IO requests to ensure that IO data is sent to the block device corresponding to the highest priority namespace first.
[0157] (2) When the total amount of IO data to be sent is equal to the sum of the third maximum concurrent IO requests of all block devices, the block device with the largest number of third maximum concurrent IO requests is selected first, i.e., the first block device, and the amount of third IO data sent to the first block device is 512. Then the second block device is selected, and the amount of third IO data sent to the second block device is 256. Finally, the block device with the smallest number of third maximum concurrent IO requests is selected, i.e., the third block device, and the amount of third IO data sent to the third block device is 128.
[0158] (3) When the total amount of IO data to be sent is less than the sum of the third maximum concurrent IO requests of all block devices, for example, if the total amount of IO data to be sent is 500, then the block device with the largest third maximum concurrent IO request is selected first, i.e., the first block device, and the amount of third IO data sent to the first block device is 500. There is no need to send IO data to the second and third blocks. For another example, if the total amount of IO data to be sent is 700, then the block device with the largest third maximum concurrent IO request is selected first, i.e., the first block device, and the amount of third IO data sent to the first block device is 512. At this time, there are still 188 IO data left. Then the second block device is selected, and the amount of third IO data sent to the second block device is 188. There is no need to send IO data to the third block device.
[0159] In this embodiment, by changing the priority of the namespace on the host, the IO queue depth corresponding to the block device can be adjusted. This does not require major modifications or adaptations to the host, nor does it require flow control from the host's upper-layer application. This application can control the data traffic of the namespace in real time, improving the system's flexibility.
[0160] Please refer to the following: Figure 10 , Figure 10 This is a timing diagram illustrating the interaction between a host and a flash memory device, as provided in an embodiment of this application.
[0161] like Figure 10 As shown, the interaction timing between the host and the flash memory device includes:
[0162] Step S1001: The host sends a second configuration command to the flash memory device;
[0163] Specifically, the second configuration command refers to the NVMe Set Feature command. The NVMe Set Feature command is a command used to configure and manage the features of NVMe solid-state drives (SSDs). Through this command, the host can obtain the status information of the flash memory device and modify certain settings in the flash memory device. In this embodiment, the NVMe Set Feature command is used to set the priority corresponding to each namespace to the changed priority. The second configuration command includes the changed priority. The host sets the priority corresponding to each namespace to the changed priority by sending the second configuration command to the flash memory device. For example, if the priority of namespace A before the change was the first priority and the priority of namespace B before the change was the second priority, if the priority of namespace A after the change is the second priority and the priority of namespace B after the change is the first priority, then the priority of namespace A is changed from the first priority to the second priority, and the priority of namespace B is changed from the second priority to the first priority.
[0164] Step S1002: Adjust the namespace's IO queue depth to the third IO queue depth according to the changed priority;
[0165] Specifically, after receiving the second configuration command from the host, the flash memory device adjusts the I / O queue depth of the namespace from the first I / O queue depth to the third I / O queue depth according to the changed priority. For example, assuming that when namespace A is the first priority, the first I / O queue depth corresponding to namespace A is 512, and when namespace B is the second priority, the first I / O queue depth corresponding to namespace B is 256, the second configuration command changes the priority of namespace A to the second priority, changes the priority of namespace B to the first priority, and adjusts the first I / O queue depth corresponding to namespace A to 256 and the first I / O queue depth corresponding to namespace B to 512.
[0166] Step S1003: The flash memory device sends a second asynchronous event notification to the host;
[0167] Specifically, after the flash memory device adjusts the namespace's IO queue depth to the third IO queue depth according to the changed priority, it sends a second asynchronous event notification to the host.
[0168] Step S1004: The host sends a namespace identification command to the flash memory device;
[0169] Specifically, after receiving the second asynchronous event notification from the flash memory device, the host sends a namespace identification command to the flash memory device, so that the flash memory device returns the third IO queue depth to the host.
[0170] Step S1005: The flash memory device sends the third IO queue depth to the host;
[0171] Specifically, the namespace identification command includes the nvme identify name space command in the NVMe protocol. The host sends the nvme identify name space command to the flash memory device, and the flash memory device returns the third IO queue depth of the namespace. This allows the host to adjust the maximum concurrent IO request count corresponding to the block device to the third maximum concurrent IO request count (nr_requst) based on the third IO queue depth. For example, assuming the third IO queue depth is 512, the third maximum concurrent IO request count is determined to be 512.
[0172] Step S1006: Generate a block device based on the depth of the third IO queue;
[0173] Specifically, after receiving the third IO queue depth sent by the flash memory device, the host generates a block device based on the third IO queue depth. Here, generating a block device refers to the maximum number of concurrent IO requests generated for the block device (nr_requst field). The nr_requst field and the nr_requests field are parameters that control the number of requests that can be queued for each IO operation of the block device, i.e., the maximum number of concurrent IO requests. The maximum number of concurrent IO requests corresponding to the block device is adjusted from the first maximum number of concurrent IO requests to the third maximum number of concurrent IO requests, where the third maximum number of concurrent IO requests is equal to the third IO queue depth.
[0174] Please refer to the following: Figure 11 , Figure 11 This is another timing diagram of the interaction between a host and a flash memory device provided in an embodiment of this application;
[0175] like Figure 11 As shown, the interaction timing between the host and the flash memory device includes:
[0176] Step S1101: Detect that the number of concurrent IO requests corresponding to the current namespace exceeds a preset threshold;
[0177] Specifically, the firmware module (FW) in the flash memory device detects whether the number of concurrent IO requests corresponding to the current namespace exceeds a preset threshold. When the number of concurrent IO requests corresponding to the current namespace exceeds the preset threshold, the process proceeds to step S1002. The preset threshold is calculated as (the sum of the number of concurrent IO requests corresponding to all namespaces / the total number of namespaces) * a preset coefficient. The sum of the number of concurrent IO requests corresponding to all namespaces / the total number of namespaces is the average number of concurrent IO requests corresponding to each namespace. The preset coefficient can be set according to actual needs, for example, the preset coefficient can be set to 2. This application does not limit this setting.
[0178] Step S1102: Adjust the IO queue depth corresponding to the namespace to the second IO queue depth;
[0179] Specifically, if the flash memory device detects that the number of concurrent IO requests corresponding to the current namespace exceeds a preset threshold, the IO queue depth corresponding to the namespace will be adjusted from the first IO queue depth to the second IO queue depth, wherein the second IO queue depth is less than the first IO queue depth. For example, if the first IO queue depth is 256, the second IO queue depth can be adjusted to 128.
[0180] Step S1103: The flash memory device sends a first asynchronous event notification to the host;
[0181] Specifically, after the flash memory device adjusts the namespace's IO queue depth to the second IO queue depth according to the changed priority, it sends the first asynchronous event notification to the host.
[0182] Step S1104: The host sends a namespace identification command to the flash memory device;
[0183] Specifically, after receiving the second asynchronous event notification from the flash memory device, the host sends a namespace identification command to the flash memory device, so that the flash memory device returns the third IO queue depth to the host.
[0184] Step S1105: The flash memory device sends the second IO queue depth to the host;
[0185] Specifically, the namespace identification command includes the nvme identify name space command in the NVMe protocol. The host sends the nvme identify name space command to the flash memory device, and the flash memory device returns the second IO queue depth of the namespace, so that the host can adjust the maximum concurrent IO request count corresponding to the block device to the second maximum concurrent IO request count (nr_requst) based on the second IO queue depth.
[0186] Step S1106: Generate a block device based on the depth of the second IO queue;
[0187] Specifically, after receiving the second IO queue depth sent by the flash memory device, the host generates a block device based on the second IO queue depth. Here, generating a block device refers to generating the maximum number of concurrent IO requests for the block device (nr_requst field). The nr_requst field and the nr_requests field are parameters that control the number of requests that can be queued for each IO operation of the block device, i.e., the maximum number of concurrent IO requests. The maximum number of concurrent IO requests corresponding to the block device is adjusted from the first maximum number of concurrent IO requests to the second maximum number of concurrent IO requests. The second maximum number of concurrent IO requests is equal to the second IO queue depth. For example, assuming the second IO queue depth is 256, then the second maximum number of concurrent IO requests is determined to be 256.
[0188] In this application embodiment, a namespace data processing method is provided, applied to a flash memory device. The flash memory device includes at least two namespaces, each namespace corresponding to a block device. The method includes: obtaining the priority of each namespace; determining the first IO queue depth corresponding to each namespace based on the priority of each namespace; determining the first maximum concurrent IO request count corresponding to each block device based on the first IO queue depth corresponding to each namespace; and determining the first IO data volume to be sent to each block device based on the first maximum concurrent IO request count corresponding to each block device, wherein the first IO data volume is less than or equal to the first maximum concurrent IO request count. This application can prevent excessive data traffic in some namespaces from causing performance degradation in other namespaces, thereby improving the stability of flash memory device performance.
[0189] Please refer to the following: Figure 12 , Figure 12 This is a schematic diagram of the structure of a host provided in an embodiment of this application;
[0190] like Figure 12 As shown, the host 10 includes one or more processors 11 and a memory 12. Wherein, Figure 12 Take a processor 11 as an example.
[0191] Processor 11 and memory 12 can be connected via a bus or other means. Figure 12Taking the example of a connection between China and Israel via a bus.
[0192] Processor 11 provides computing and control capabilities to control host 10 to perform corresponding tasks, such as controlling host 10 to execute the namespace data processing method in any of the above method embodiments. This namespace data processing method is applied to a flash memory device, which includes at least two namespaces, each corresponding to a block device. The method includes: obtaining the priority of each namespace; determining the first IO queue depth corresponding to each namespace based on its priority; determining the first maximum concurrent IO request quantity corresponding to each block device based on the first IO queue depth corresponding to each namespace; and determining the first IO data quantity to be sent to each block device based on the first maximum concurrent IO request quantity corresponding to each block device, wherein the first IO data quantity is less than or equal to the first maximum concurrent IO request quantity.
[0193] Based on the priority of the namespace, the IO queue depth of the namespace is determined. Then, based on the IO queue depth, the number of concurrent IO requests corresponding to each namespace is determined. Based on the first maximum concurrent IO request number corresponding to each block device, the first IO data volume sent to each block device is determined. This application can prevent excessive data traffic in some namespaces from causing performance degradation in other namespaces, thereby improving the stability of flash memory device performance.
[0194] Processor 11 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), a hardware chip, or any combination thereof; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The aforementioned PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0195] Memory 12, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as program instructions / modules corresponding to the namespace data processing method in the embodiments of this application. Processor 11 can implement the namespace data processing method in any of the above method embodiments by running the non-transitory software programs, instructions, and modules stored in memory 12. Specifically, memory 12 may include volatile memory (VM), such as random access memory (RAM); memory 12 may also include non-volatile memory (NVM), such as read-only memory (ROM), flash memory, hard disk drive (HDD), solid-state drive (SSD), or other non-transitory solid-state storage devices; memory 12 may also include combinations of the above types of memory.
[0196] Memory 12 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 12 may optionally include memory remotely located relative to processor 11, which can be connected to processor 11 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0197] One or more modules are stored in memory 12. When executed by one or more processors 11, they perform the namespace data processing methods in any of the above method embodiments, for example, the methods described above. Figure 2 The steps shown.
[0198] In this embodiment, the host 10 may also have wired or wireless network interfaces, keyboards, and input / output interfaces for input and output. The host 10 may also include other components for implementing device functions, which will not be described in detail here.
[0199] This application also provides a non-volatile computer-readable storage medium, such as a memory including program code, which can be executed by a processor to complete the namespace data processing method in the above embodiments. For example, the non-volatile computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CDROM), magnetic tape, floppy disk, and optical data storage device, etc.
[0200] This application also provides a non-volatile computer-readable storage medium, such as a memory including program code, which can be executed by a processor to complete the namespace data processing method in the above embodiments. For example, the non-volatile computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CDROM), magnetic tape, floppy disk, and optical data storage device, etc.
[0201] This application also provides a computer program product comprising one or more lines of program code stored in a non-volatile computer-readable storage medium. A processor of a flash memory device reads the program code from the non-volatile computer-readable storage medium and executes the program code to complete the method steps of the namespace data processing method provided in the above embodiments.
[0202] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware, or by a program or program code related to hardware. The program can be stored in a non-volatile computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0203] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software and a general-purpose hardware platform, or of course, using hardware. Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium. When executed, the program can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0204] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and not to limit them; under the concept of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations as described above in different aspects of this application, which are not provided in detail for the sake of brevity; although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A namespace data processing method, characterized in that, Applied to a flash memory device, the flash memory device comprising at least two namespaces, each namespace corresponding one-to-one with a block device, the method comprising: Obtain the priority of each of the aforementioned namespaces; Based on the priority of each namespace, determine the depth of the first IO queue corresponding to each namespace. Based on the first IO queue depth corresponding to each namespace, determine the first maximum concurrent IO request count for each block device; Based on the first maximum concurrent IO request count corresponding to each block device, the first IO data volume to be sent to each block device is determined, wherein the first IO data volume is less than or equal to the first maximum concurrent IO request count. The first maximum concurrent IO request count corresponding to each block device is equal to the first IO queue depth corresponding to its namespace; the priority of each namespace corresponds to a coefficient. The step of determining the depth of the first IO queue corresponding to each namespace based on the priority of each namespace includes: Get the queue depth of the submission queue; The depth of the first IO queue is determined based on the queue depth of the submission queue and the coefficient corresponding to the priority of the namespace, wherein the depth of the first IO queue = the coefficient corresponding to the priority of the namespace * the depth of the submission queue.
2. The method according to claim 1, characterized in that, Before obtaining the priority of each of the namespaces, the method further includes: The priority of each namespace is set using the first configuration command.
3. The method according to claim 1, characterized in that, The priority of the namespace includes a first priority, a second priority, and a third priority, where the first priority corresponds to a first coefficient, the second priority corresponds to a second coefficient, and the third priority corresponds to a third coefficient. Determining the depth of the first IO queue based on the queue depth of the submission queue and the coefficient corresponding to the priority of the namespace includes: If the priority of the namespace is the first priority, then the depth of the first IO queue corresponding to the namespace is determined as the first coefficient * the queue depth of the submission queue; If the priority of the namespace is the second priority, then the depth of the first IO queue corresponding to the namespace is determined as the second coefficient * the depth of the submission queue, wherein the second coefficient is less than the first coefficient; If the priority of the namespace is the third priority, then the depth of the first IO queue corresponding to the namespace is determined as the third coefficient * the queue depth of the submission queue, wherein the third coefficient is less than the second coefficient.
4. The method according to claim 1, characterized in that, The method further includes: Detect whether the number of concurrent IO requests corresponding to the current namespace exceeds a preset threshold, wherein the preset threshold = (the sum of concurrent IO requests corresponding to all namespaces / the total number of namespaces) * a preset coefficient; When the number of concurrent IO requests corresponding to the current namespace is detected to exceed a preset threshold, the IO queue depth corresponding to the namespace is adjusted to the second IO queue depth. Based on the second IO queue depth, the maximum number of concurrent IO requests corresponding to the block device is adjusted to the second maximum number of concurrent IO requests.
5. The method according to claim 4, characterized in that, The step of adjusting the maximum concurrent IO request count corresponding to the block device to the second maximum concurrent IO request count based on the second IO queue depth includes: After receiving the first asynchronous event notification from the flash memory device, a namespace identification command is sent to the flash memory device to cause the flash memory device to return to the second IO queue depth; Based on the second IO queue depth, the maximum concurrent IO request count corresponding to the block device is adjusted to the second maximum concurrent IO request count, wherein the second maximum concurrent IO request count corresponding to each block device is equal to the second IO queue depth corresponding to its namespace.
6. The method according to claim 3, characterized in that, The method further includes: Send a second configuration command to the flash memory device, wherein the second configuration command includes the changed priority corresponding to the namespace; Based on the changed priority, the IO queue depth of the namespace is adjusted to the third IO queue depth; Based on the third IO queue depth, determine the third maximum concurrent IO request count for each device; The amount of third IO data to be sent to each block device is determined based on the third maximum concurrent IO request count corresponding to each block device.
7. The method according to claim 6, characterized in that, The step of determining the third maximum concurrent IO request count for each device based on the third IO queue depth includes: After receiving the second asynchronous event notification from the flash memory device, a namespace identification command is sent to the flash memory device to cause the flash memory device to return to the third IO queue depth; Based on the depth of the third IO queue, the third maximum concurrent IO request count for each device is determined, wherein the third IO data volume is less than or equal to the third maximum concurrent IO request count.
8. A namespace-based data processing system, characterized in that, The system includes: A flash memory device, communicatively connected to a host, is used to receive a first configuration command sent by the host, wherein the first configuration command includes a priority corresponding to each namespace; based on the priority of each namespace, a first IO queue depth corresponding to each namespace is determined, and a first asynchronous event notification is sent to the host, wherein one namespace corresponds to one first IO queue depth, and the priority is positively correlated with the first IO queue depth; A host, communicatively connected to the flash memory device, is configured to, upon receiving a first asynchronous event notification from the flash memory device, send a namespace identification command to the flash memory device, causing the flash memory device to return a first IO queue depth to the host; determine a first maximum concurrent IO request count corresponding to a block device based on the first IO queue depth; and determine a first IO data volume to be sent to each block device based on the first maximum concurrent IO request count corresponding to each block device, wherein the first IO data volume is less than or equal to the first maximum concurrent IO request count. The first maximum concurrent IO request count corresponding to each block device is equal to the first IO queue depth corresponding to its namespace; the priority of each namespace corresponds to a coefficient. The flash memory device is specifically used to obtain the queue depth of the submission queue; and to determine the depth of the first IO queue based on the queue depth of the submission queue and the coefficient corresponding to the priority of the namespace, wherein the depth of the first IO queue = the coefficient corresponding to the priority of the namespace * the depth of the submission queue.
9. The system according to claim 8, characterized in that, The host includes a block device driver module, which is used to determine the first maximum concurrent IO request quantity corresponding to the block device based on the first IO queue depth; and to determine the first IO data quantity to be sent to each block device based on the first maximum concurrent IO request quantity corresponding to each block device, wherein the first IO data quantity is less than or equal to the first maximum concurrent IO request quantity.
10. The system according to claim 8, characterized in that, The flash memory device includes a firmware module, which is used to detect whether the concurrent IO requests corresponding to the current namespace exceed a preset threshold, wherein the preset threshold = (the sum of concurrent IO requests corresponding to all namespaces / the total number of namespaces) * a preset coefficient; The flash memory device is also used to adjust the IO queue depth corresponding to the namespace from the first IO queue depth to the second IO queue depth when it detects that the IO concurrent requests corresponding to a certain device exceed a preset threshold, and to send a second asynchronous event notification to the host. The host is further configured to, after receiving a second asynchronous event notification from the flash memory device, send a namespace identification command to the flash memory device to cause the flash memory device to return the second IO queue depth to the host; determine the second maximum concurrent IO request quantity corresponding to the block device based on the second IO queue depth; and determine the second IO data quantity to be sent to the block device based on the second maximum concurrent IO request quantity corresponding to the block device, wherein the second IO data quantity is less than or equal to the second maximum concurrent IO request quantity.
11. A host computer, comprising: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform a namespace data processing method as described in any one of claims 1-7.
12. A non-volatile computer-readable storage medium, characterized in that, The non-volatile computer storage medium stores a computer program or instructions, which, when executed, implement the data processing method for the namespace as described in any one of claims 1-7.
Citation Information
Patent Citations
Methods and device for implementing QoS (Quality of Service)
CN107346265A
Storage system based on NVMe equipment
CN111722786A