Solid state hard disk flow control method and device, storage medium and electronic device
By calculating the expected bandwidth ratio and adjusting the upper limits of host write bandwidth and GC write bandwidth of the solid-state drive, the problem of low accuracy of solid-state drive traffic control methods when switching between read and write modes is solved, and performance is maximized and traffic control is stabilized.
Patent Information
- Application Number
- CN202411001590.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2044-07-25
AI Technical Summary
Existing SSD flow control methods are too slow to adjust when switching between read and write modes, resulting in low control accuracy. They cannot guarantee the performance limits of GC writes and host writes within a given bandwidth limit, and their adaptability to different read and write modes is poor.
By acquiring the actual host write bandwidth, actual garbage collection (GC) write bandwidth, and average effective GC data volume of the tested hard drive during the first time period, the expected bandwidth ratio is calculated, and the upper limits of host write bandwidth and GC write bandwidth are adjusted to ensure the accuracy of traffic control during the second time period.
It improves the accuracy of SSD traffic control, avoids the problem of slow bandwidth adjustment, and ensures maximum performance and stability under different read and write modes.
Smart Images

Figure CN118519591B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of solid-state hard disk flow control, and more specifically, to a solid-state hard disk flow control method and device, a storage medium, and an electronic device. Background Art
[0002] NAND (Not AND) SSD is a SSD that uses NAND flash storage technology. The characteristics of NAND determine that flash memory cannot perform overwrite operations. Therefore, the GC (Garbage Collection) module is used to clear invalid data and recycle data blocks to ensure the sustainability of host write operations. When the free space of the SSD is small, it is necessary to ensure that the speed at which GC generates free data blocks is equal to the speed at which the host writes and consumes free data blocks.
[0003] In the related art, a benchmark bandwidth is set, the ratio of GC write and host write bandwidth is calculated according to the number of free data blocks and the average amount of valid data recovered by GC, the weight factor is adjusted based on the number of free data blocks (the weight factor is adjusted by adding or subtracting a fixed value), and the GC write and host write bandwidth are determined according to the benchmark bandwidth and the weight factor.
[0004] The above method can obtain relatively stable GC write and host write bandwidths. However, the above method has poor adaptability to different read and write modes, and the fixed weight adjustment speed may cause the adjustment to be too slow when the read and write modes are switched. Therefore, the flow control method of the solid state drive in the related art has the problem of low control accuracy. Summary of the invention
[0005] The embodiments of the present application provide a flow control method and device for a solid-state hard disk, a storage medium, and an electronic device, so as to at least solve the problem of low control accuracy in the flow control method for a solid-state hard disk in the related art.
[0006] According to one aspect of an embodiment of the present application, a flow control method for a solid-state hard disk is provided, comprising: obtaining an actual host write bandwidth, an actual garbage collection (GC) write bandwidth, and an average GC effective data volume of a tested hard disk within a first time period, wherein the tested hard disk is a non-NAND solid-state hard disk, and the GC average effective data volume is an average value of the effective data volume in garbage-collected data blocks; when the actual host write bandwidth is not zero, determining an expected bandwidth ratio based on a single writable data volume and the GC average effective data volume, wherein the single writable data volume is the writable data volume of a single block in the tested hard disk, and the expected bandwidth ratio is the average value of the effective data volume of the tested hard disk. the expected ratio of the host write bandwidth of the hard disk and the sum of the host write bandwidth of the hard disk under test and the GC write bandwidth of the hard disk under test; according to the actual bandwidth ratio and the expected bandwidth ratio, adjusting the host write bandwidth upper limit of the hard disk under test and the GC write bandwidth upper limit of the hard disk under test to obtain a target host write bandwidth upper limit and a target GC write bandwidth upper limit, wherein the actual bandwidth ratio is the ratio of the actual host write bandwidth and the sum of the actual host write bandwidth and the actual GC write bandwidth; according to the target host write bandwidth upper limit and the target GC write bandwidth upper limit, performing flow control on the host write and GC write of the hard disk under test in a second time period after the first time period.
[0007] According to another aspect of an embodiment of the present application, a flow control device for a solid-state hard disk is provided, comprising: an acquisition unit, used to acquire an actual host write bandwidth, an actual garbage collection (GC) write bandwidth, and an average GC effective data volume of a tested hard disk within a first time period, wherein the tested hard disk is a non-NAND solid-state hard disk, and the GC average effective data volume is an average value of the effective data volume in garbage-collected data blocks; a first determination unit, used to determine an expected bandwidth ratio based on a single writable data volume and the GC average effective data volume when the actual host write bandwidth is not zero, wherein the single writable data volume is the writable data volume of a single block in the tested hard disk, and the expected bandwidth ratio is the expected bandwidth ratio of the tested hard disk. an expected ratio of the host write bandwidth of the hard disk and the sum of the host write bandwidth of the hard disk under test and the GC write bandwidth of the hard disk under test; a first adjustment unit, used to adjust the host write bandwidth upper limit of the hard disk under test and the GC write bandwidth upper limit of the hard disk under test according to the actual bandwidth ratio and the expected bandwidth ratio, so as to obtain a target host write bandwidth upper limit and a target GC write bandwidth upper limit, wherein the actual bandwidth ratio is a ratio between the actual host write bandwidth and the sum of the actual host write bandwidth and the actual GC write bandwidth; a control unit, used to perform flow control on the host write and GC write of the hard disk under test in a second time period after the first time period according to the target host write bandwidth upper limit and the target GC write bandwidth upper limit.
[0008] According to another aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in any of the above method embodiments.
[0009] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when executed.
[0010] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0011] Through the present application, in order to improve the accuracy of the flow control method of the solid-state hard disk, it is necessary to make the speed at which the GC generates free data blocks equivalent to the speed at which the host writes and consumes free data blocks. In this embodiment, the expected bandwidth ratio is the expected ratio of the host write bandwidth of the hard disk under test to the GC write bandwidth of the hard disk under test, and the expected bandwidth ratio is obtained based on the single writable data amount and the GC average effective data amount. For a single block, the amount of data that can be recovered by the GC write bandwidth is the GC average effective data amount, and the amount of data that the host can write is the amount of data obtained by subtracting the GC average effective data amount from the single writable data amount. Therefore, the expected bandwidth ratio obtained based on the single writable data amount and the GC average effective data amount can reflect the actual situation of the host writable bandwidth and the GC writable bandwidth of the hard disk under test in the first time period. The host write bandwidth upper limit and the GC write bandwidth upper limit are determined based on the expected bandwidth ratio, and the flow control of the hard disk under test is performed according to the host write bandwidth upper limit and the GC write bandwidth upper limit. While ensuring maximum performance, the problem of too slow bandwidth adjustment can be avoided, thereby solving the problem of low control accuracy in the flow control method of the solid-state hard disk in the related art, and improving the accuracy of flow control of the solid-state hard disk. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 It is a hardware environment diagram of an optional solid-state hard disk flow control method according to an embodiment of the present application.
[0013] Figure 2 It is a flow chart of an optional solid-state hard disk flow control method according to an embodiment of the present application.
[0014] Figure 3 It is a schematic diagram of an optional flow control method of a solid state drive according to an embodiment of the present application.
[0015] Figure 4 It is a schematic diagram of an optional flow control device of a solid state hard disk according to an embodiment of the present application.
[0016] Figure 5 It is a structural block diagram of an optional flow control device for a solid state hard disk according to an embodiment of the present application.
[0017] Figure 6 It is a structural block diagram of a computer system of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0018] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0019] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0020] The method embodiments provided in the embodiments of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 1 1 is a hardware structure block diagram of a server device of a solid state drive flow control method according to an embodiment of the present application. Figure 1 As shown, the server device may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the above-mentioned server device may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0021] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the flow control method of the solid-state hard disk in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the server device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0022] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the server device. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0023] Optionally, the flow control method for the solid state drive in this embodiment may be executed by a server, where the server refers to the server as a whole, including relevant components and a processor in the server that need to execute the flow control method for the solid state drive; the flow control method for the solid state drive in this embodiment may also be executed by the processor 102. In some examples of this embodiment, the flow control method for the solid state drive is described by taking execution by a server as an example.
[0024] The flow control method of the solid state drive in this embodiment can be applied to the scenario of flow control for NAND solid state drives. NAND solid state drives are solid state drives that use NAND flash memory storage technology. NAND solid state drives require special control logic for control. FTL (Flash Translation Layer) maintains an L2P (Logical address To Physical address) table that maps from logical addresses to physical addresses. It is necessary to asymmetrically map logical block addresses and physical block addresses according to actual needs to perform addressing operations. When performing write and read operations, the L2P table needs to be read and updated at the same time. The NAND characteristics determine that flash memory cannot perform overwrite operations. Only after a flash block (data block) is erased as a whole can the flash block be re-written. Some data in the flash block will become invalid data as the logical data changes, and still occupy physical space until the block is erased. Therefore, the NAND solid state drive needs to reserve OP (Over-Provisioning) space, and the FTL needs to include a GC module to clear invalid data and recycle blocks to ensure the sustainability of the host write operation. Here, flow control of the NAND SSD refers to flow control during the host's read and write operations on the NAND SSD and the GC module of the NAND SSD clearing invalid data and recycling blocks.
[0025] When there is less free space on the SSD, FTL will start GC, organize and summarize the valid data in some blocks and then erase them to generate writable free blocks. When the GC pressure is relatively high, it is necessary to ensure that the speed at which GC generates free blocks is equivalent to the speed at which the host writes and consumes free blocks. Therefore, it is necessary to introduce an arbitration algorithm for host writes and GC to control the host write and GC traffic. After a long period of random writing, the SSD will enter a steady state. At this time, it is necessary to control the IOPS (Input / Output Per Second) of host writes and GC to keep the two balanced and keep the IOPS of host reads, writes, or mixed reads and writes relatively stable for a long time.
[0026] In the related art, a bandwidth weight arbitration method is provided, which first sets a base bandwidth, calculates the bandwidth ratio of GC write and host write according to the number of free data blocks and the average amount of valid data recovered by GC, adjusts the weight factor based on the number of free data blocks (the weight factor is adjusted by adding or subtracting a fixed value), and determines the GC write and host write bandwidth according to the base bandwidth and the weight factor; this method cannot guarantee that GC write and host write can reach the performance upper limit under the given bandwidth upper limit control, and at the same time, the method has poor adaptability to different read and write modes, and the fixed weight adjustment speed may cause problems such as too slow adjustment and timeout when switching read and write modes. Therefore, the flow control method of solid-state hard disk in the related art has the problem of low control accuracy.
[0027] In order to at least partially solve the above problems, a flow control method of a solid state drive is provided in this embodiment. Figure 2 is a flow chart of an optional solid state hard disk flow control method according to an embodiment of the present application, such as Figure 2 As shown, the above method includes steps S202 to S208.
[0028] Step S202, obtaining the actual host write bandwidth, actual garbage collection GC write bandwidth and GC average effective data volume of the hard disk under test in the first time period, wherein the hard disk under test is a non-NAND solid state drive, and the GC average effective data volume is the average value of the effective data volume in the garbage collected data blocks.
[0029] The host is the core part of the computer system, including the central processing unit, memory, input and output devices, etc. The solid-state drive is connected to the host. The host reads and writes data through the solid-state drive to realize data storage and access functions; the actual host write bandwidth is used to indicate the amount of data actually processed and written by the host to the hard disk under test after the host sends a write command in the first time period; the actual GC write bandwidth is used to indicate the amount of data actually written by the GC module during the garbage collection process of the hard disk under test in the first time period.
[0030] Optionally, in this embodiment, the value of the first time period may be 1 second.
[0031] The GC average valid data volume is the average value of the valid data volume in the garbage collected data blocks. For example, in the first time period, 3 data blocks are processed during the GC process, the amount of data that can be written to each data block is a, and the amount of valid data contained in the 3 data blocks is x, y, and z respectively. Then the GC average valid data volume is (x+y+z) / 3.
[0032] The hard disk under test is a non-NAND solid state drive. The relevant explanation of the NAND solid state drive has been described above and will not be repeated here. The above-mentioned bandwidth data can be obtained by using a monitoring tool to monitor the bandwidth usage of the host and the hard disk under test. The specific monitoring tool is not limited in this embodiment.
[0033] Step S204, when the actual host write bandwidth is not zero, determine the expected bandwidth ratio based on the single writable data amount and the GC average effective data amount, wherein the single writable data amount is the writable data amount of a single block in the hard disk under test, and the expected bandwidth ratio is the expected ratio of the host write bandwidth of the hard disk under test to the sum of the host write bandwidth of the hard disk under test and the GC write bandwidth of the hard disk under test.
[0034] When the actual host write bandwidth is zero, that is, when the actual host write bandwidth of the hard disk under test in the first time period is zero, it means that the host does not write data to the hard disk under test at this time, which will not affect the number of free data blocks in the hard disk under test. Not starting GC at this time will not cause the number of free data blocks in the hard disk under test to decrease. Therefore, GC can be paused at this time. When only the host reads data from the hard disk under test, the data transmission of the host read can be given priority.
[0035] When the actual host write bandwidth is not zero, that is, when the actual host write bandwidth of the hard disk under test in the first time period is not zero, it means that the host writes data to the hard disk under test, which will affect the number of free data blocks in the hard disk under test. At this time, the host write bandwidth and GC write bandwidth need to be controlled to make the speed at which GC generates free data blocks equal to the speed at which the host writes and consumes free data blocks.
[0036] Specifically, the expected bandwidth ratio can be determined based on the single writable data volume and the GC average effective data volume; here, the single writable data volume is the writable data volume of a single block in the hard disk under test, the hard disk under test contains a group of data blocks, and the writable data volume of each data block is the single writable data volume; the expected bandwidth ratio is the expected ratio of the host write bandwidth of the hard disk under test and the sum of the host write bandwidth of the hard disk under test and the GC write bandwidth of the hard disk under test. In subsequent steps, the host write bandwidth of the hard disk under test and the GC write bandwidth of the hard disk under test need to be adjusted according to the expected bandwidth ratio.
[0037] As an optional solution, when the actual host write bandwidth is not zero, the difference between the single writable data volume and the GC average valid data volume is divided by the single writable data volume to determine the expected bandwidth ratio.
[0038] The amount of data that can be written to a single file is DF. blk , the average effective data volume of GC is DF src, let the expected value of host write be IOPS, and the total write bandwidth be IOPS tot , then the expected bandwidth ratio is IOPS / IOPS tot =(DF blk -DF src ) / DF blk .
[0039] Here, the total write bandwidth IOPS tot Refers to the total write bandwidth, which is the sum of the host write bandwidth and the GC write bandwidth.
[0040] Step S206, according to the actual bandwidth ratio and the expected bandwidth ratio, the host write bandwidth upper limit of the hard disk under test and the GC write bandwidth upper limit of the hard disk under test are adjusted to obtain the target host write bandwidth upper limit and the target GC write bandwidth upper limit, wherein the actual bandwidth ratio is the ratio between the actual host write bandwidth and the sum of the actual host write bandwidth and the actual GC write bandwidth.
[0041] In this embodiment, according to the actual bandwidth ratio and the expected bandwidth ratio measured in the first time period, the host write bandwidth upper limit of the hard disk under test and the GC write bandwidth upper limit of the hard disk under test are adjusted, so that the ratio between the host write bandwidth upper limit of the hard disk under test and the sum of the host write bandwidth upper limit of the hard disk under test and the GC write bandwidth upper limit of the hard disk under test is close to or equal to the expected bandwidth ratio, thereby making the speed at which the GC generates free data blocks close to or the same as the speed at which the host writes and consumes free data blocks.
[0042] It should be noted that the purpose of adjusting the host write bandwidth upper limit and the GC write bandwidth upper limit of the hard disk under test is to make the ratio of the host write bandwidth upper limit of the hard disk under test and the sum of the host write bandwidth upper limit and the GC write bandwidth upper limit of the hard disk under test close to or equal to the expected bandwidth ratio, that is, to make the ratio of the target host write bandwidth upper limit and the sum of the target host write bandwidth upper limit and the target GC write bandwidth upper limit close to or equal to the expected bandwidth ratio; here, the specific way of adjustment can be achieved by adjusting the host write bandwidth upper limit of the hard disk under test, or by adjusting the GC write bandwidth upper limit of the hard disk under test; illustratively, when the actual bandwidth ratio is greater than the expected bandwidth ratio, the host write bandwidth upper limit of the hard disk under test can be increased, the GC write bandwidth upper limit of the hard disk under test can be reduced, or the host write bandwidth upper limit of the hard disk under test can be increased while the GC write bandwidth upper limit of the hard disk under test is reduced, so that the ratio of the target host write bandwidth upper limit and the sum of the target host write bandwidth upper limit and the target GC write bandwidth upper limit is close to or equal to the expected bandwidth ratio.
[0043] Optionally, the adjustment range of the host write bandwidth upper limit and the GC write bandwidth upper limit of the hard disk under test can be directly adjusted to a ratio of the target host write bandwidth upper limit and the target GC write bandwidth upper limit equal to the expected bandwidth ratio. The advantage of this adjustment method is that when the read-write mode is switched, the host write bandwidth upper limit and the GC write bandwidth upper limit of the hard disk under test can quickly converge to the bandwidth ratio corresponding to the current read-write mode. The disadvantage is that when the actual bandwidth ratio and the expected bandwidth ratio are greatly different, the write bandwidth will fluctuate greatly, affecting the stability of the write bandwidth.
[0044] Optionally, the adjustment range of the host write bandwidth upper limit and the GC write bandwidth upper limit of the hard disk under test can be based on the gap between the actual bandwidth ratio and the expected bandwidth ratio, and the host write bandwidth upper limit and the GC write bandwidth upper limit of the hard disk under test can be adaptively adjusted; illustratively, when the gap between the actual bandwidth ratio and the expected bandwidth ratio is large, the target host write bandwidth upper limit and the target GC write bandwidth upper limit can be adjusted to a larger extent, so that the ratio between the target host write bandwidth upper limit and the target GC write bandwidth upper limit approaches or is equal to the expected bandwidth ratio more quickly, thereby preventing the host write bandwidth upper limit and the GC write bandwidth upper limit of the hard disk under test from being adjusted too slowly, resulting in too few free data blocks in the hard disk under test or timeout problems; when the gap between the actual bandwidth ratio and the expected bandwidth ratio is small, the target host write bandwidth upper limit and the target GC write bandwidth upper limit can be adjusted slightly to avoid large fluctuations in the write bandwidth.
[0045] Step S208 , according to the target host write bandwidth upper limit and the target GC write bandwidth upper limit, flow control is performed on the host write and GC write of the hard disk under test in a second time period after the first time period.
[0046] According to the relevant data of the hard disk under test in the first time period, based on the calculated target host write bandwidth upper limit and target GC write bandwidth upper limit, the host write and GC write flow of the hard disk under test in the second time period are controlled, that is, the host write bandwidth upper limit of the hard disk under test in the second time period is controlled to be the target host write bandwidth upper limit, and the GC write bandwidth upper limit of the hard disk under test in the second time period is controlled to be the target GC write bandwidth upper limit.
[0047] It should be noted that, in this embodiment, the write bandwidth upper limit refers to the upper limit value of the amount of data written per unit time.
[0048] Through the embodiments provided by the present application, the actual host write bandwidth, actual garbage collection GC write bandwidth and GC average effective data volume of the hard disk under test in the first time period are obtained, wherein the hard disk under test is a non-NAND solid-state drive, and the GC average effective data volume is the average value of the effective data volume in the garbage collected data blocks; when the actual host write bandwidth is not zero, based on the single writable data volume and the GC average effective data volume, the expected bandwidth ratio is determined, wherein the single writable data volume is the writable data volume of a single block in the hard disk under test, and the expected bandwidth ratio is the sum of the host write bandwidth of the hard disk under test and the host write bandwidth of the hard disk under test and the GC write bandwidth of the hard disk under test. and expected ratio; according to the actual bandwidth ratio and the expected bandwidth ratio, the host write bandwidth upper limit of the tested hard disk and the GC write bandwidth upper limit of the tested hard disk are adjusted to obtain the target host write bandwidth upper limit and the target GC write bandwidth upper limit, wherein the actual bandwidth ratio is the ratio between the actual host write bandwidth and the sum of the actual host write bandwidth and the actual GC write bandwidth; according to the target host write bandwidth upper limit and the target GC write bandwidth upper limit, the host write and GC write of the tested hard disk in a second time period after the first time period are flow controlled, which solves the problem of low control accuracy in the flow control method of the solid-state hard disk in the related art and improves the accuracy of flow control of the solid-state hard disk.
[0049] As an optional solution, when the actual host write bandwidth is not zero, the expected bandwidth ratio is determined based on the single writable data amount and the GC average valid data amount, and also includes S11.
[0050] S11, adjusting the expected bandwidth ratio according to the difference between the actual number of free blocks in the tested hard disk and the expected number of free blocks in the tested hard disk to obtain an adjusted expected bandwidth ratio, wherein the adjustment direction of the expected bandwidth ratio corresponds to the difference between the actual number and the expected number, and the adjustment amplitude of the expected bandwidth ratio is positively correlated with the absolute value of the difference between the actual number and the expected number.
[0051] When the difference between the actual number and the expected number is a positive number, the expected bandwidth ratio is adjusted to increase, and the larger the absolute value of the difference between the actual number and the expected number is, the larger the adjustment of the expected bandwidth ratio is; when the difference between the actual number and the expected number is a negative number, the expected bandwidth ratio is adjusted to decrease, and the larger the absolute value of the difference between the actual number and the expected number is, the larger the adjustment of the expected bandwidth ratio is.
[0052] Through the embodiments provided in the present application, the stability of the number of free blocks in the hard disk under test can be ensured, thereby improving the stability of the flow control method of the solid state hard disk.
[0053] As an optional solution, the expected bandwidth ratio is adjusted according to the difference between the actual number of free blocks in the tested hard disk and the expected number of free blocks in the tested hard disk to obtain an adjusted expected bandwidth ratio, including S21.
[0054] S21, multiplying the sum of 1 and the adjustment coefficient by the expected bandwidth ratio to determine the adjusted expected bandwidth ratio, wherein the adjustment coefficient is a result obtained by dividing the difference between the actual number and the expected number by a specified factor.
[0055] In this embodiment, the actual number of free blocks in the hard disk under test is n. free , the expected number of free blocks in the tested hard disk is n crit , specify the factor as n fac , here, specify the factor n fac This is a data block related factor and needs to be determined based on the total number of data blocks on the SSD.
[0056] For example, let the adjusted expected bandwidth ratio be r, then r=(1+(n free -n crit ) / n fac )*Expected bandwidth ratio.
[0057] Through the embodiments provided by the present application, when the sum of 1 and the adjustment coefficient is higher, there are more free blocks in the hard disk under test, and the obtained adjusted expected bandwidth ratio is higher, that is, the upper limit of the host write bandwidth is increased; when the sum of 1 and the adjustment coefficient is lower, there are fewer free blocks in the hard disk under test, and the obtained adjusted expected bandwidth ratio is higher, that is, the upper limit of the host write bandwidth is increased; through the above steps, the stability of the number of free data blocks in the hard disk under test is ensured while maximizing the host write performance.
[0058] As an optional solution, the host write bandwidth upper limit and the GC write bandwidth upper limit of the hard disk under test are adjusted according to the actual bandwidth ratio and the expected bandwidth ratio to obtain the target host write bandwidth upper limit and the target GC write bandwidth upper limit, including S31 to S33.
[0059] S31, when the actual bandwidth ratio is greater than the expected bandwidth ratio, lowering the host write bandwidth upper limit of the hard disk under test to obtain a target host write bandwidth upper limit.
[0060] S32, when the actual bandwidth ratio is less than the expected bandwidth ratio, increase the host write bandwidth upper limit of the hard disk under test to obtain the target host write bandwidth upper limit.
[0061] S33: Determine the difference between the reference bandwidth and the upper limit of the target host write bandwidth as the upper limit of the target GC write bandwidth, wherein the reference bandwidth is a reference bandwidth for bandwidth control.
[0062] In this embodiment, the ratio of the host write bandwidth upper limit of the hard disk under test to the GC write bandwidth upper limit of the hard disk under test is adjusted by adjusting the host write bandwidth upper limit of the hard disk under test, so that the ratio of the host write bandwidth upper limit of the hard disk under test and the sum of the host write bandwidth upper limit of the hard disk under test and the GC write bandwidth upper limit of the hard disk under test in the second time period is closer to the expected bandwidth ratio than the actual bandwidth ratio in the first time period.
[0063] When the actual bandwidth ratio is greater than the expected bandwidth ratio, the host write bandwidth upper limit of the hard disk under test is lowered to obtain the target host write bandwidth upper limit; when the actual bandwidth ratio is less than the expected bandwidth ratio, the host write bandwidth upper limit of the hard disk under test is increased to obtain the target host write bandwidth upper limit; here, the adjusted value of the host write bandwidth upper limit of the hard disk under test can be a pre-set fixed value, or can be determined based on the difference between the actual bandwidth ratio and the expected bandwidth ratio. For example, the adjusted value of the host write bandwidth upper limit of the hard disk under test can be positively correlated with the difference between the actual bandwidth ratio and the expected bandwidth ratio.
[0064] After obtaining the target host write bandwidth upper limit, the target host write bandwidth upper limit may be subtracted from the benchmark bandwidth to obtain the target GC write bandwidth upper limit. Here, the benchmark bandwidth is a pre-set reference bandwidth for bandwidth control.
[0065] Through the embodiments provided in the present application, the host write bandwidth upper limit is adjusted according to the situation between the actual bandwidth ratio and the expected bandwidth ratio, so that the target host write bandwidth upper limit can be accurately adjusted, thereby improving the accuracy of the obtained target host write bandwidth upper limit and the target GC write bandwidth upper limit.
[0066] As an optional solution, when the actual bandwidth ratio is greater than the expected bandwidth ratio, the host write bandwidth upper limit of the hard disk under test is lowered to obtain the target host write bandwidth upper limit, including S41 to S42.
[0067] S41, when the actual bandwidth ratio is greater than the expected bandwidth ratio, and the ratio between the actual bandwidth ratio and the expected bandwidth ratio is less than or equal to the first specified ratio, lower the host write bandwidth upper limit of the hard disk under test according to a first percentage to obtain a target host write bandwidth upper limit, wherein the bandwidth value to which the host write bandwidth upper limit of the hard disk under test is lowered is less than or equal to the first bandwidth threshold, and the first specified ratio is greater than 1.
[0068] S42: When the actual bandwidth ratio is greater than the expected bandwidth ratio and the ratio between the actual bandwidth ratio and the expected bandwidth ratio is greater than the first specified ratio, the product of the expected bandwidth ratio and the reference bandwidth is determined as the target host write bandwidth upper limit.
[0069] Optionally, the first specified ratio is 1.1.
[0070] For example, let the actual host write bandwidth be BW host , the actual GC write bandwidth is BW GC , the expected bandwidth ratio is r, and the first percentage is c dec %; when the actual bandwidth ratio is greater than the expected bandwidth ratio, and the ratio between the actual bandwidth ratio and the expected bandwidth ratio is less than or equal to the first specified ratio, that is, BW host With BW GC The ratio is greater than r, and (BW host / BW GC ) / r≤1.1, according to c dec %Lower the host write bandwidth upper limit of the hard disk under test to obtain the target host write bandwidth upper limit. The bandwidth value to which the host write bandwidth upper limit of the hard disk under test is lowered is less than or equal to the first bandwidth threshold.
[0071] When the actual bandwidth ratio is greater than the expected bandwidth ratio, and the ratio between the actual bandwidth ratio and the expected bandwidth ratio is greater than the first specified ratio, that is, BW host With BW GC The ratio is greater than r, and (BW host / BW GC ) / r>1.1, the product of the expected bandwidth ratio and the benchmark bandwidth is determined as the upper limit of the target host write bandwidth.
[0072] Through the embodiments provided by the present application, when the actual bandwidth ratio is greater than the expected bandwidth ratio and the gap between the actual bandwidth ratio and the expected bandwidth ratio is too large, the target host write bandwidth upper limit is adjusted to quickly converge to the expected bandwidth ratio, which can prevent the host write bandwidth upper limit and the GC write bandwidth upper limit from being adjusted too slowly, resulting in too few free blocks or timeout in the tested hard disk.
[0073] As an optional solution, when the actual bandwidth ratio is less than the expected bandwidth ratio, the host write bandwidth upper limit of the hard disk under test is increased to obtain the target host write bandwidth upper limit, including S51 to S52.
[0074] S51, when the actual bandwidth ratio is less than the expected bandwidth ratio, and the ratio between the actual bandwidth ratio and the expected bandwidth ratio is greater than or equal to the second specified ratio, increase the host write bandwidth upper limit of the hard disk under test by a second percentage to obtain the target host write bandwidth upper limit, wherein the bandwidth value increased by the host write bandwidth upper limit of the hard disk under test is less than or equal to the second bandwidth threshold, and the second specified ratio is less than 1.
[0075] S52: When the actual bandwidth ratio is less than the expected bandwidth ratio and the ratio between the actual bandwidth ratio and the expected bandwidth ratio is less than a second specified ratio, the product of the expected bandwidth ratio and the reference bandwidth is determined as the upper limit of the target host write bandwidth.
[0076] Optionally, the first specified ratio is 0.9.
[0077] For example, let the actual host write bandwidth be BW host , the actual GC write bandwidth is BW GC , the expected bandwidth ratio is r, and the first percentage is c inc %; when the actual bandwidth ratio is less than the expected bandwidth ratio, and the ratio between the actual bandwidth ratio and the expected bandwidth ratio is greater than or equal to the first specified ratio, that is, BW host With BW GC The ratio is less than r, and (BW host / BW GC ) / r≥1.1, according to c inc % Increase the host write bandwidth upper limit of the hard disk under test to obtain the target host write bandwidth upper limit. The bandwidth value increased by the host write bandwidth upper limit of the hard disk under test is less than or equal to the second bandwidth threshold.
[0078] When the actual bandwidth ratio is less than the expected bandwidth ratio, and the ratio between the actual bandwidth ratio and the expected bandwidth ratio is less than the first specified ratio, that is, BW host With BW GC The ratio is less than r, and (BW host / BW GC ) / r<0.9, the product of the expected bandwidth ratio and the benchmark bandwidth is determined as the upper limit of the target host write bandwidth.
[0079] Through the embodiments provided by the present application, when the actual bandwidth ratio is less than the expected bandwidth ratio and the gap between the actual bandwidth ratio and the expected bandwidth ratio is too large, the target host write bandwidth upper limit is adjusted to quickly converge to the expected bandwidth ratio, which can prevent the host write bandwidth upper limit and the GC write bandwidth upper limit from being adjusted too slowly, resulting in too many free blocks in the hard disk under test, and ensure performance maximization while quickly adjusting.
[0080] As an optional solution, before determining the difference between the reference bandwidth and the target host write bandwidth upper limit as the target GC write bandwidth upper limit, the method further includes S61 to S63.
[0081] S61: When the actual write bandwidth is greater than the product of the reference bandwidth and the first ratio, increase the reference bandwidth to obtain an adjusted reference bandwidth.
[0082] S62: When the actual write bandwidth is less than the product of the reference bandwidth and the second ratio, determine an average value of the reference bandwidth and the actual write bandwidth as the adjusted reference bandwidth.
[0083] S63: When the actual write bandwidth is greater than or equal to the product of the reference bandwidth and the second ratio, and less than or equal to the ratio of the reference bandwidth to the first ratio, lower the reference bandwidth to obtain an adjusted reference bandwidth.
[0084] The actual write bandwidth is the sum of the actual host write bandwidth and the actual GC write bandwidth.
[0085] In this embodiment, the actual write bandwidth is the sum of the actual host write bandwidth and the actual GC write bandwidth. Before the difference between the benchmark bandwidth and the target host write bandwidth upper limit is determined as the target GC write bandwidth upper limit, the benchmark bandwidth is determined based on the actual write bandwidth.
[0086] When the actual write bandwidth is greater than the product of the reference bandwidth and the first ratio, that is, when the actual write bandwidth in the first time period is larger, the reference bandwidth needs to be appropriately increased so that the adjusted reference bandwidth will not be lower than the actual write bandwidth.
[0087] Exemplarily, the first ratio is C 0 , the base bandwidth is BW bench , the actual write bandwidth is BW real , here, C 0 is a positive real number less than 1 and close to 1, such as 0.99; in BW real >C 0 *W bench In this case, increase the baseline bandwidth.
[0088] When the actual write bandwidth is less than the product of the baseline bandwidth and the second ratio, that is, when the actual write bandwidth in the first time period is small, the baseline bandwidth needs to be appropriately lowered so that the adjusted baseline bandwidth does not exceed the actual write bandwidth excessively. Otherwise, the target host write bandwidth upper limit and the target GC write bandwidth upper limit calculated subsequently will be too high, resulting in problems such as read and write timeouts.
[0089] Exemplarily, the first ratio is C 1 , the base bandwidth is BW bench , the actual write bandwidth is BW real , here, C 1 is the proportional coefficient, which determines the timing of adjusting the reference bandwidth for the current step. 1 is less than C 0 A positive real number; in BW real <C 1 *W benchIn the case of , the average value of the benchmark bandwidth and the actual write bandwidth is determined as the adjusted benchmark bandwidth, that is, the benchmark bandwidth and the actual write bandwidth are averaged so that the adjusted benchmark bandwidth quickly approaches the actual write bandwidth.
[0090] When the actual write bandwidth is greater than or equal to the product of the reference bandwidth and the second ratio, and less than or equal to the ratio of the reference bandwidth to the first ratio, it indicates that the reference bandwidth is slightly too high. In this case, the reference bandwidth is lowered to make it closer to the actual write bandwidth.
[0091] Through the embodiments provided in the present application, rapid convergence can be achieved to obtain a stable benchmark bandwidth for the current write mode. The adjusted benchmark bandwidth is approximately equal to the actual write bandwidth that reaches the upper limit of the hardware performance of the current read-write mode, and can be used as the benchmark bandwidth for subsequent arbitration of the host write bandwidth and the GC write bandwidth.
[0092] As an optional solution, after adjusting the host write bandwidth upper limit of the hard disk under test and the GC write bandwidth upper limit of the hard disk under test according to the actual bandwidth ratio and the expected bandwidth ratio, the method further includes S71.
[0093] S71, when the actual number of free blocks in the hard disk under test is less than or equal to the specified number threshold, half of the target host write bandwidth upper limit is determined as the adjusted target host write bandwidth upper limit, wherein the host write flow control of the hard disk under test in the second time period is performed using the adjusted target host write bandwidth upper limit.
[0094] In this embodiment, a host write zero prevention mechanism is included. When the read / write mode between the host and the hard disk under test changes, if the adjustment speed of the flow control method of the solid-state hard disk is too slow, the host write bandwidth upper limit of the hard disk under test and the GC write bandwidth upper limit of the hard disk under test do not quickly converge to the bandwidth ratio corresponding to the current read / write mode, which may cause the number of free data blocks in the hard disk under test to decrease, resulting in a host write timeout problem. In this case, when the actual number of free blocks (free data blocks) in the hard disk under test is less than or equal to the danger threshold (specified number threshold), the expected bandwidth ratio can be adjusted to maintain the stability of the number of free blocks in the hard disk under test by reducing the expected bandwidth ratio.
[0095] It should be noted that the danger threshold (specified quantity threshold) is smaller than the expected quantity.
[0096] For example, in this embodiment, the risk threshold of the free blocks in the hard disk under test is n dnag , the actual number of free blocks in the tested hard disk is less than n dnagWhen the host write bandwidth upper limit of the hard disk under test is halved, that is, half of the target host write bandwidth upper limit is determined as the adjusted target host write bandwidth upper limit to reduce the expected bandwidth ratio, thereby avoiding the problem of host write timeout caused by too few free blocks in the hard disk under test.
[0097] Through the embodiments provided in the present application, the problem of host write timeout caused by host write bandwidth dropping to zero can be effectively avoided, thereby improving the stability of the flow control method of the solid-state hard disk.
[0098] As an optional solution, the second time period is divided into multiple sub-time periods, and when flow control in the second time period starts, the target host write bandwidth upper limit and the target GC write bandwidth upper limit are evenly distributed in the multiple sub-time periods.
[0099] According to the target host write bandwidth upper limit and the target GC write bandwidth upper limit, flow control is performed on host writes and GC writes of the hard disk under test in a second time period after the first time period, including S81.
[0100] S81, taking each of the multiple sub-time periods as the current sub-time period and performing the following flow control operations respectively: if the host write data volume in the current sub-time period is greater than or equal to the host write bandwidth upper limit corresponding to the current sub-time period, suspending the host write operation; if the GC write data volume in the current sub-time period is greater than or equal to the host write bandwidth upper limit corresponding to the current sub-time period, suspending the GC write operation.
[0101] If the host write data volume in the current sub-time period is greater than or equal to the host write bandwidth upper limit corresponding to the current sub-time period, it means that the host write data volume in the previous sub-time period is too large, and the host write operation in the current sub-time period is suspended; if the GC write data volume in the current sub-time period is greater than or equal to the host write bandwidth upper limit corresponding to the current sub-time period, it means that the GC write data volume in the previous sub-time period is too large, and the GC write operation in the current sub-time period is suspended.
[0102] Through the embodiments provided in the present application, the second time period is divided into a plurality of sub-time periods, and each of the plurality of sub-time periods is managed, thereby effectively improving the accuracy of flow control.
[0103] As an optional solution, according to the target host write bandwidth upper limit and the target GC write bandwidth upper limit, flow control is performed on the host write and GC write of the hard disk under test in a second time period after the first time period, which also includes S91 to S92.
[0104] S91, when the host write data amount from the first sub-time period to the current sub-time period among the multiple sub-time periods is less than the target host write bandwidth upper limit, reallocate the remaining host write bandwidth of the second time period to the sub-time period after the current sub-time period, wherein the remaining host write bandwidth is the difference between the target host write bandwidth upper limit and the host write data amount from the first sub-time period to the current sub-time period.
[0105] S92: When the amount of GC write data from the first sub-time period to the current sub-time period is less than the target GC write bandwidth upper limit, reallocate the remaining GC write bandwidth of the second time period to the sub-time period after the current sub-time period, wherein the remaining GC write bandwidth is the difference between the target GC write bandwidth upper limit and the amount of GC write data from the first sub-time period to the current sub-time period.
[0106] In this embodiment, the second time period is assumed to be 1s, and the second time period is divided into n t sub-time periods, the time interval length of each sub-time period is t, n t *t=1s, the upper limit of the target host write bandwidth is BW host , the target GC write bandwidth upper limit is BW GC , the upper limit of host write bandwidth corresponding to each sub-time period is bw host =BW host / n t The upper limit of GC write bandwidth corresponding to each sub-time period is bw GC =BW GC / n t , T rmn Refers to the time remaining after the current sub-period in the second time period.
[0107] The amount of host write data from the first sub-time period to the current sub-time period (in In the case where the host write bandwidth of the second time period is less than the upper limit of the target host write bandwidth, and the host write data volume in the current sub-time period is greater than or equal to the upper limit of the host write bandwidth corresponding to the current sub-time period, the remaining host write bandwidth of the second time period is reallocated to the sub-time period after the current sub-time period, that is, In the case of a sub-time period after the current sub-time period, the host write bandwidth limit corresponding to the sub-time period is reallocated. .
[0108] The amount of GC data written from the first sub-period to the current sub-period (in Indicates that the second time period is less than the target GC write bandwidth upper limit, and in the current sub-time period, the host write data volume is greater than or equal to the host write bandwidth upper limit corresponding to the current sub-time period, the remaining GC write bandwidth of the second time period is reallocated to the sub-time period after the current sub-time period, that is, In the case of a sub-time period after the current sub-time period, the host write bandwidth limit corresponding to the sub-time period is reallocated. .
[0109] Through the embodiments provided by the present application, by dividing the second time period into multiple sub-time periods for flow control, the host can continue to write and the GC can continue to write, while ensuring that the delay is not too high, thereby achieving flow control with a fixed ratio of the host write data volume to the GC write data volume.
[0110] As an optional solution, in the process of performing flow control on host write and GC write of the hard disk under test in the second time period according to the target host write bandwidth upper limit and the target GC write bandwidth upper limit, the method further includes S101.
[0111] S101, before the end of the second time period, if the host write data volume in the second time period is greater than or equal to the target host write bandwidth upper limit, and the GC write data volume in the second time period is greater than or equal to the target GC write bandwidth upper limit, reallocate the host write bandwidth and the GC write bandwidth for the second time period.
[0112] In this embodiment, before the end of the second time period, if the host write data volume and the GC write data volume have reached the corresponding write bandwidth upper limit, in order to avoid the system processor idling in the remaining time, the bandwidth should continue to be allocated. At this time, the bandwidth upper limits of the host write bandwidth and the GC write bandwidth in the next sub-time period can be calculated to prevent the bandwidth from falling to 0 in the remaining time.
[0113] The embodiments provided in the present application ensure that the system processor does not idle during the control process, thereby improving the stability of the flow control method of the solid-state hard disk.
[0114] As an optional solution, after obtaining the actual host write bandwidth, the actual garbage collection GC write bandwidth and the GC average valid data volume of the hard disk under test in the first time period, the method further includes S111 to S112.
[0115] S111, when the actual host write bandwidth is zero and the actual host read bandwidth of the hard disk under test in the first time period is not zero, suspend the execution of the GC write operation, set the host write bandwidth upper limit of the hard disk under test to the specified host write bandwidth upper limit, and perform flow control on the host write of the hard disk under test in the second time period according to the specified host write bandwidth upper limit.
[0116] S112, when the actual host write bandwidth is zero and the actual host read bandwidth of the hard disk under test in the first time period is zero, the GC write bandwidth upper limit of the hard disk under test is set to the specified GC write bandwidth upper limit, and the GC write flow of the hard disk under test in the second time period is controlled according to the specified GC write bandwidth upper limit.
[0117] When the actual host write bandwidth is zero and the actual host read bandwidth of the hard disk under test in the first time period is not zero, the solid-state drive only has the action of reading data, which will not affect the number of free blocks in the solid-state drive. At this time, not starting GC will not lead to a decrease in the number of free blocks. Therefore, for the case of only reading, GC can be paused to give priority to host reading. At the same time, the host write bandwidth upper limit of the hard disk under test is set to the specified host write bandwidth upper limit, and the host write flow of the hard disk under test in the second time period is controlled according to the specified host write bandwidth upper limit.
[0118] Optionally, specify the host write bandwidth upper limit to 50K DF (Data Frame) / s.
[0119] When the actual host write bandwidth is zero and the actual host read bandwidth of the hard disk under test in the first time period is zero, it means that the host has no read or write action at this time. The GC write bandwidth upper limit of the hard disk under test can be set to the specified GC write bandwidth upper limit, and the GC write flow of the hard disk under test in the second time period can be controlled according to the specified GC write bandwidth upper limit to perform garbage collection on the disk under test.
[0120] Through the embodiments provided in the present application, the flow control method can be adaptively changed for different read and write modes of the host, thereby improving the rationality of the flow control method of the solid state drive.
[0121] The flow control method of the solid state drive in this application is explained below with reference to optional examples.
[0122] See also Figure 3 , Figure 3 It is a schematic diagram of an optional flow control method for a solid-state hard disk according to an embodiment of the present application. This embodiment provides a flow control method for a solid-state hard disk, which can control the flow of the host write IOPS and GC rate of the next second (second time period) according to the current (first time period) host write IOPS (corresponding to the actual host write bandwidth of the above embodiment) and GC rate (corresponding to the actual GC write bandwidth of the above embodiment), while ensuring that the hard disk under test reaches the performance upper limit and the performance and latency remain stable. Specifically, it includes the following steps 1 to 5.
[0123] Step 1: Bandwidth statistics, that is, statistics on the host write bandwidth, GC bandwidth, etc. in the previous few seconds.
[0124] Step 2: Bandwidth configuration, that is, calculating a benchmark bandwidth based on statistical data.
[0125] Step 3: read-write mode adaptation, that is, adjusting the arbitration method according to different read-write modes given by statistical data.
[0126] Step 4: Bandwidth adjustment, that is, calculate the host write bandwidth and GC bandwidth upper limit for the next step based on statistical data.
[0127] Step 5: Flow control, that is, flow control for host writes and GC.
[0128] See also Figure 4 , Figure 4 It is a schematic diagram of an optional flow control device for a solid-state hard disk according to an embodiment of the present application; this embodiment also provides a flow control device for a solid-state hard disk based on the above-mentioned flow control method, which includes the following three parts.
[0129] (I) Statistics module: This module counts the write commands successfully processed by the FTL and the amount of data processed by the GC to ensure the performance of the processor when processing a large amount of IO (input / output).
[0130] (II) Calculation module. This module processes bandwidth statistics, determines the current read / write mode based on the statistics, calculates the baseline bandwidth and expected bandwidth limit for host write and GC, and makes additional bandwidth adjustments for some special cases to ensure that the baseline bandwidth converges quickly. This module also calculates the bandwidth limits for the second and secondary time intervals in flow control, in order to achieve rapid convergence of the second-level bandwidth limit and smooth and accurate flow control.
[0131] (III) Flow control module: This module controls the flow of host writes and GC to ensure latency and IO performance stability.
[0132] Combine the following Figure 3 and Figure 4 The flow control method of the solid state hard disk is described.
[0133] Step 1: Bandwidth statistics. Use the statistics module to count the host write bandwidth, GC bandwidth, and GC average VDFC (GC average valid data volume) in the previous few seconds. Specifically, after GC is started, the host write bandwidth, host read bandwidth, and GC bandwidth need to be counted. The bandwidth values that need to be counted are as follows.
[0134] Host write bandwidth: that is, the amount of DF (DataFrame) actually processed and written after the host sends a write command within the current second.
[0135] Host read bandwidth: that is, the amount of DF actually processed and read after the host sends a read command within the current second.
[0136] GC bandwidth: refers to the amount of data actually written during the GC process within the current second.
[0137] Average VDFC (average GC valid data volume): obtained by averaging the valid data volume during GC processing within the current second and the total number of data blocks where the valid data volume is located.
[0138] After the GC is started, the bandwidth statistics module starts to count the above bandwidth and VDFC value per second and passes it to the bandwidth processing module.
[0139] Step 2, bandwidth configuration, that is, using the bandwidth counted in step 1 and the VDFC value, a calculation module is used to calculate a reference bandwidth value.
[0140] The baseline bandwidth is the bandwidth reference value for bandwidth control in the next second. It needs to have the following characteristics: it must be large enough, and its value should be no less than the actual bandwidth upper limit when the CPU computing power, backend physical bandwidth, and other bottlenecks are reached; it cannot be too large, and it must not exceed the actual bandwidth upper limit. Otherwise, the calculated expected bandwidth for host writes and GC will be too high, which may cause problems such as I / O timeouts.
[0141] The specific steps of calculating the reference bandwidth value include the following steps.
[0142] (1) Set a reasonable baseline backend write bandwidth initial value BW during initialization ini ,The backend write bandwidth is equal to the sum of the host write bandwidth and the GC write bandwidth.,The initial value of the benchmark backend write bandwidth is determined by the real backend write bandwidth in the actual,performance test.
[0143] (2) Based on the initial value of the baseline backend write bandwidth, the baseline backend write bandwidth is dynamically adjusted according to the maximum value of the actual backend write bandwidth counted by the current statistics module.
[0144] The first ratio is C 0 , the base bandwidth is BW bench , the actual write bandwidth is BW real , here, C 0 is a positive real number less than 1 and close to 1, such as 0.99; in BW real >C 0 *W bench In this case, increase the baseline bandwidth.
[0145] The first ratio is C 1 , here, C 1 is the proportional coefficient, which determines the timing of adjusting the reference bandwidth for the current step. 1 is less than C 0 A positive real number; in BW real <C 1 *W benchIn the case of , the average value of the benchmark bandwidth and the actual write bandwidth is determined as the adjusted benchmark bandwidth, that is, the benchmark bandwidth and the actual write bandwidth are averaged so that the adjusted benchmark bandwidth quickly approaches the actual write bandwidth.
[0146] When the actual write bandwidth is greater than or equal to the product of the reference bandwidth and the second ratio, and less than or equal to the ratio of the reference bandwidth to the first ratio, it indicates that the reference bandwidth is slightly too high. In this case, the reference bandwidth is lowered to make it closer to the actual write bandwidth.
[0147] By repeating the above two steps, we can quickly converge to obtain a stable baseline backend write bandwidth value suitable for the current write mode. At this time, the baseline backend write bandwidth value is approximately equal to the real backend write bandwidth value that reaches the hardware performance upper limit of the current read-write mode. It can be used as the backend write bandwidth value for arbitration to allocate host write bandwidth and GC bandwidth.
[0148] Step 3: Read / write mode adaptation. Generally speaking, the current read / write mode can be divided into the following situations according to the different host read / write commands.
[0149] (1) Read only. When NAND SSD is only reading, since the host does not write data to NAND, it will not affect the number of free blocks. At this time, not starting GC will not lead to a decrease in free blocks. Therefore, in the case of only reading, you can pause GC and give priority to host read IO.
[0150] (2) Only write. When there is host write, continuous write will cause the number of free blocks to decrease. When the number of free blocks is lower than the free block threshold and GC is started, arbitration must ensure that the rate at which GC generates free blocks is the same as the rate at which host + GC write consumes free blocks. Therefore, the algorithm needs to perform regular arbitration at this time to give the bandwidth upper limit of GC and host write.
[0151] (3) Mixed read and write. There is host write, which is the same as the second case. The algorithm needs to perform regular arbitration.
[0152] (4) When there is no reading or writing, only the GC bandwidth is set.
[0153] Step 4, bandwidth adjustment, that is, using the statistical data in step 1 and the benchmark bandwidth calculated in step 2, and adapting according to the read and write mode given in step 3, and then calculating the upper limit of the GC data volume and the upper limit of the host write data volume in the next second through the calculation module.
[0154] If the mode given in step 3 is read-only, GC is paused and BW is set hostSet the value to a small value, such as 50K DF / s. Go directly to step 5.
[0155] If the mode given in step 3 is write-only or mixed read-write, the subsequent steps are executed normally.
[0156] Using the average number of VDFCs given in step 1 and the baseline backend write bandwidth given in step 2, this step dynamically adjusts the upper limit of the GC and host write data volume in the next second. The steady-state feature is that the amount of DF written by the host per unit time is the same as the amount of idle DF generated by the GC. Based on this, the expected host write IOPS can be calculated by the source data volume of the GC: IOPS = IOPS tot *(DF blk -DF src ) / DF blk Here, host IOPS refers to the expected IOPS of host writes, and total IOPS refers to the total write IOPS, which is the sum of the host write DF amount and the GC write DF amount per unit time. blk Refers to the amount of DF that can be written to a single block (data block). src Represents the average amount of source data per block in the current GC.
[0157] Calculate the reference ratio r of write bandwidth to GC bandwidth, r=(1+(n free -n crit ) / n fac )* expected bandwidth ratio, where the expected bandwidth ratio is (DF blk -DF src ) / DF blk , where the actual number of free blocks in the hard disk under test is n free , the expected number of free blocks in the tested hard disk is n crit , specify the factor as n fac , here, specify the factor n fac This is a data block related factor and needs to be determined based on the total number of data blocks on the SSD.
[0158] If you have just entered arbitration, you need to use the initial baseline backend bandwidth value to write the host bandwidth limit BW host And GC bandwidth upper limit BW GC Initialize BW host =BW ini *(DF blk -DF src ) / DF blk , B.W. GC =BW ini *DF src / DF blk ,
[0159] Among them, BW host Indicates the upper limit of the host write bandwidth, BW GC Indicates the GC bandwidth upper limit, DF blk Indicates the amount of DF (data frame) data that can be written to a single block, DF src Indicates the average amount of source data per block in the current GC, BW ini Indicates the initial value of the benchmark backend write bandwidth (the initial value of the benchmark backend write bandwidth is determined by the actual backend write bandwidth in the actual performance test).
[0160] Assume the actual host write bandwidth is BW host , the actual GC write bandwidth is BW GC , the expected bandwidth ratio is r, and the first percentage is c dec %; when the actual bandwidth ratio is greater than the expected bandwidth ratio, and the ratio between the actual bandwidth ratio and the expected bandwidth ratio is less than or equal to the first specified ratio, that is, BW host With BW GC The ratio is greater than r, and (BW host / BW GC ) / r≤1.1, according to c dec %Lower the host write bandwidth upper limit of the hard disk under test to obtain the target host write bandwidth upper limit. The bandwidth value to which the host write bandwidth upper limit of the hard disk under test is lowered is less than or equal to the first bandwidth threshold.
[0161] When the actual bandwidth ratio is greater than the expected bandwidth ratio, and the ratio between the actual bandwidth ratio and the expected bandwidth ratio is greater than the first specified ratio, that is, BW host With BW GC The ratio is greater than r, and (BW host / BW GC ) / r>1.1, the product of the expected bandwidth ratio and the benchmark bandwidth is determined as the upper limit of the target host write bandwidth.
[0162] Assume the actual host write bandwidth is BW host , the actual GC write bandwidth is BW GC , the expected bandwidth ratio is r, and the first percentage is c inc %; when the actual bandwidth ratio is less than the expected bandwidth ratio, and the ratio between the actual bandwidth ratio and the expected bandwidth ratio is greater than or equal to the first specified ratio, that is, BW host With BW GC The ratio is less than r, and (BW host / BW GC ) / r≥1.1, according to c inc% Increase the host write bandwidth upper limit of the hard disk under test to obtain the target host write bandwidth upper limit. The bandwidth value increased by the host write bandwidth upper limit of the hard disk under test is less than or equal to the second bandwidth threshold.
[0163] When the actual bandwidth ratio is less than the expected bandwidth ratio, and the ratio between the actual bandwidth ratio and the expected bandwidth ratio is less than the first specified ratio, that is, BW host With BW GC The ratio is less than r, and (BW host / BW GC ) / r<0.9, the product of the expected bandwidth ratio and the benchmark bandwidth is determined as the upper limit of the target host write bandwidth.
[0164] The first ratio is C 0 , the base bandwidth is BW bench , the actual write bandwidth is BW real , here, C 0 is a positive real number less than 1 and close to 1, such as 0.99; in BW real >C 0 *W bench In this case, increase the baseline bandwidth.
[0165] The first ratio is C 1 , the base bandwidth is BW bench , the actual write bandwidth is BW real , here, C 1 is the proportional coefficient, which determines the timing of adjusting the reference bandwidth for the current step. 1 is less than C 0 A positive real number; in BW real <C 1 *W bench In the case of , the average value of the benchmark bandwidth and the actual write bandwidth is determined as the adjusted benchmark bandwidth.
[0166] Introduce a mechanism to prevent IOPS from dropping to zero. The danger threshold of free blocks in the hard disk under test is n dnag , the actual number of free blocks in the tested hard disk is less than n dnag When the host write bandwidth upper limit of the hard disk under test is halved, that is, half of the target host write bandwidth upper limit is determined as the adjusted target host write bandwidth upper limit to reduce the expected bandwidth ratio, thereby avoiding the problem of host write timeout caused by too few free blocks in the hard disk under test.
[0167] Step 5: Flow control, that is, flow control for host writes and GC.
[0168] Assume that the second time period is 1s, and the second time period is divided into n t sub-time periods, the time interval length of each sub-time period is t, nt *t=1s, the upper limit of the target host write bandwidth is BW host , the target GC write bandwidth upper limit is BW GC , the upper limit of host write bandwidth corresponding to each sub-time period is bw host =BW host / n t The upper limit of GC write bandwidth corresponding to each sub-time period is bw GC =BW GC / n t , T rmn Refers to the time remaining after the current sub-period in the second time period.
[0169] The amount of host write data from the first sub-time period to the current sub-time period (in In the case where the host write bandwidth of the second time period is less than the upper limit of the target host write bandwidth, and the host write data volume in the current sub-time period is greater than or equal to the upper limit of the host write bandwidth corresponding to the current sub-time period, the remaining host write bandwidth of the second time period is reallocated to the sub-time period after the current sub-time period, that is, In the case of a sub-time period after the current sub-time period, the host write bandwidth limit corresponding to the sub-time period is reallocated. .
[0170] The amount of GC data written from the first sub-period to the current sub-period (in Indicates that the second time period is less than the target GC write bandwidth upper limit, and in the current sub-time period, the host write data volume is greater than or equal to the host write bandwidth upper limit corresponding to the current sub-time period, the remaining GC write bandwidth of the second time period is reallocated to the sub-time period after the current sub-time period, that is, In the case of a sub-time period after the current sub-time period, the host write bandwidth limit corresponding to the sub-time period is reallocated. .
[0171] Before the end of the second time period, if the host write data volume and the GC write data volume have reached the corresponding write bandwidth upper limit, that is, and In order to avoid the system processor from idling in the remaining time, bandwidth should continue to be allocated. At this time, the bandwidth upper limit of the host write bandwidth and GC write bandwidth in the next sub-time period can be calculated to prevent the bandwidth from falling to 0 in the remaining time. In this way, by taking an appropriate secondary time interval (sub-time period) length t, the host and GC can be guaranteed to continue writing, and the delay is not too high and the system processor does not idle, and finally the flow control with a fixed ratio of host write and GC write data volume can be achieved.
[0172] Understandably, some commonly used steady-state flow control algorithms, such as fixed bandwidth methods and bandwidth weight adjustment methods, cannot have the characteristics of fast bandwidth adjustment and performance maximization at the same time, and may cause timeout problems in extreme cases. Compared with the above methods, the dynamic write arbitration strategy and device provided by the present invention can maintain second-level IOPS stability while ensuring performance maximization; can avoid problems such as too few free blocks or timeouts caused by slow bandwidth adjustment; and can also respond quickly when switching between read and write modes, making timely and rapid adjustments to the host write bandwidth and GC bandwidth.
[0173] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, disk, CD), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.
[0174] In this embodiment, a flow control device for a solid state drive is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0175] Figure 5 is a structural block diagram of an optional solid state hard disk flow control device according to an embodiment of the present application, such as Figure 5 As shown, the device includes an acquisition unit 502 , a first determination unit 504 , a first adjustment unit 506 and a control unit 508 .
[0176] The acquisition unit 502 is used to obtain the actual host write bandwidth, actual garbage collection GC write bandwidth and GC average effective data volume of the hard disk under test in the first time period, wherein the hard disk under test is a non-NAND solid state drive, and the GC average effective data volume is the average value of the effective data volume in the garbage collected data blocks.
[0177] The first determination unit 504 is used to determine the expected bandwidth ratio based on the single writable data amount and the GC average effective data amount when the actual host write bandwidth is not zero, wherein the single writable data amount is the writable data amount of a single block in the hard disk under test, and the expected bandwidth ratio is the expected ratio of the host write bandwidth of the hard disk under test and the sum of the host write bandwidth of the hard disk under test and the GC write bandwidth of the hard disk under test.
[0178] The first adjustment unit 506 is used to adjust the host write bandwidth upper limit of the hard disk under test and the GC write bandwidth upper limit of the hard disk under test according to the actual bandwidth ratio and the expected bandwidth ratio to obtain a target host write bandwidth upper limit and a target GC write bandwidth upper limit, wherein the actual bandwidth ratio is a ratio between the actual host write bandwidth and the sum of the actual host write bandwidth and the actual GC write bandwidth.
[0179] The control unit 508 is used to perform flow control on the host write and GC write of the hard disk under test in a second time period after the first time period according to the target host write bandwidth upper limit and the target GC write bandwidth upper limit.
[0180] It should be noted that the acquisition unit 502 in this embodiment can be used to execute the above step S202, the first determination unit 504 in this embodiment can be used to execute the above step S204, the first adjustment unit 506 in this embodiment can be used to execute the above step S206, and the control unit 508 in this embodiment can be used to execute the above step S208.
[0181] Through the embodiments provided by the present application, the actual host write bandwidth, actual garbage collection GC write bandwidth and GC average effective data volume of the hard disk under test in the first time period are obtained, wherein the hard disk under test is a non-NAND solid-state drive, and the GC average effective data volume is the average value of the effective data volume in the garbage collected data blocks; when the actual host write bandwidth is not zero, based on the single writable data volume and the GC average effective data volume, the expected bandwidth ratio is determined, wherein the single writable data volume is the writable data volume of a single block in the hard disk under test, and the expected bandwidth ratio is the sum of the host write bandwidth of the hard disk under test and the host write bandwidth of the hard disk under test and the GC write bandwidth of the hard disk under test. and expected ratio; according to the actual bandwidth ratio and the expected bandwidth ratio, the host write bandwidth upper limit of the tested hard disk and the GC write bandwidth upper limit of the tested hard disk are adjusted to obtain the target host write bandwidth upper limit and the target GC write bandwidth upper limit, wherein the actual bandwidth ratio is the ratio between the actual host write bandwidth and the sum of the actual host write bandwidth and the actual GC write bandwidth; according to the target host write bandwidth upper limit and the target GC write bandwidth upper limit, the host write and GC write of the tested hard disk in a second time period after the first time period are flow controlled, which solves the problem of low control accuracy in the flow control method of the solid-state hard disk in the related art and improves the accuracy of flow control of the solid-state hard disk.
[0182] Optionally, the first determination unit includes: a first determination module, which, when the actual host write bandwidth is not zero, divides the difference between the single writable data volume and the GC average valid data volume by the single writable data volume to determine the expected bandwidth ratio.
[0183] Optionally, the first determination unit also includes: a first adjustment module, used to adjust the expected bandwidth ratio according to the difference between the actual number of free blocks in the tested hard disk and the expected number of free blocks in the tested hard disk, so as to obtain an adjusted expected bandwidth ratio, wherein the adjustment direction of the expected bandwidth ratio corresponds to the difference between the actual number and the expected number, and the adjustment amplitude of the expected bandwidth ratio is positively correlated with the absolute value of the difference between the actual number and the expected number.
[0184] Optionally, the first adjustment module includes: a first determination submodule, used to determine the result of multiplying the sum of 1 and the adjustment coefficient by the expected bandwidth ratio as the adjusted expected bandwidth ratio, wherein the adjustment coefficient is the result obtained by dividing the difference between the actual number and the expected number by a specified factor.
[0185] Optionally, the first adjustment unit includes: a second adjustment module, used to lower the host write bandwidth upper limit of the hard disk under test when the actual bandwidth ratio is greater than the expected bandwidth ratio, so as to obtain the target host write bandwidth upper limit; a third adjustment module, used to increase the host write bandwidth upper limit of the hard disk under test when the actual bandwidth ratio is less than the expected bandwidth ratio, so as to obtain the target host write bandwidth upper limit; a second determination module, used to determine the difference between the baseline bandwidth and the target host write bandwidth upper limit as the target GC write bandwidth upper limit, wherein the baseline bandwidth is a reference bandwidth for bandwidth control.
[0186] Optionally, the second adjustment module includes: a first adjustment submodule, used to lower the host write bandwidth upper limit of the hard disk under test by a first percentage to obtain a target host write bandwidth upper limit when the actual bandwidth ratio is greater than the expected bandwidth ratio and the ratio between the actual bandwidth ratio and the expected bandwidth ratio is less than or equal to a first specified ratio, wherein the bandwidth value to which the host write bandwidth upper limit of the hard disk under test is lowered is less than or equal to a first bandwidth threshold, and the first specified ratio is greater than 1; and a second determination submodule, used to determine the product of the expected bandwidth ratio and the benchmark bandwidth as the target host write bandwidth upper limit when the actual bandwidth ratio is greater than the first specified ratio.
[0187] Optionally, the third adjustment module includes: a second adjustment submodule, used to increase the host write bandwidth upper limit of the hard disk under test by a second percentage to obtain a target host write bandwidth upper limit when the actual bandwidth ratio is less than the expected bandwidth ratio and the ratio between the actual bandwidth ratio and the expected bandwidth ratio is greater than or equal to the second specified ratio, wherein the bandwidth value adjusted to the host write bandwidth upper limit of the hard disk under test is less than or equal to the second bandwidth threshold, and the second specified ratio is less than 1; a third determination submodule, used to determine the product of the expected bandwidth ratio and the benchmark bandwidth as the target host write bandwidth upper limit when the actual bandwidth ratio is less than the second specified ratio.
[0188] Optionally, the device also includes: a second adjustment unit, used to increase the baseline bandwidth to obtain an adjusted baseline bandwidth when the actual write bandwidth is greater than the product of the baseline bandwidth and the first ratio before determining the difference between the baseline bandwidth and the upper limit of the target host write bandwidth as the upper limit of the target GC write bandwidth; a second determination unit, used to determine the average value of the baseline bandwidth and the actual write bandwidth as the adjusted baseline bandwidth when the actual write bandwidth is less than the product of the baseline bandwidth and the second ratio; a third adjustment unit, used to lower the baseline bandwidth to obtain an adjusted baseline bandwidth when the actual write bandwidth is greater than or equal to the product of the baseline bandwidth and the second ratio, and less than or equal to the baseline bandwidth and the first ratio; wherein the actual write bandwidth is the sum of the actual host write bandwidth and the actual GC write bandwidth.
[0189] Optionally, the device also includes: a third determination unit, which is used to determine half of the target host write bandwidth upper limit as the adjusted target host write bandwidth upper limit after adjusting the host write bandwidth upper limit and the GC write bandwidth upper limit of the hard disk under test according to the actual bandwidth ratio and the expected bandwidth ratio, when the actual number of free blocks in the hard disk under test is less than or equal to a specified number threshold, wherein flow control of host writes to the hard disk under test in the second time period is performed using the adjusted target host write bandwidth upper limit.
[0190] Optionally, the second time period is divided into multiple sub-time periods, and when the flow control of the second time period starts, the target host write bandwidth upper limit and the target GC write bandwidth upper limit are evenly distributed in the multiple sub-time periods; the control unit includes: an execution module, used to perform the following flow control operations on each of the multiple sub-time periods as the current sub-time period: when the host write data volume in the current sub-time period is greater than or equal to the host write bandwidth upper limit corresponding to the current sub-time period, suspend the host write operation; when the GC write data volume in the current sub-time period is greater than or equal to the host write bandwidth upper limit corresponding to the current sub-time period, suspend the GC write operation.
[0191] Optionally, the control unit also includes: a first allocation module, used to reallocate the remaining host write bandwidth of the second time period to the sub-time period after the current sub-time period when the host write data volume from the first sub-time period to the current sub-time period among the multiple sub-time periods is less than the target host write bandwidth upper limit, wherein the remaining host write bandwidth is the difference between the target host write bandwidth upper limit and the host write data volume from the first sub-time period to the current sub-time period; a second allocation module, used to reallocate the remaining GC write bandwidth of the second time period to the sub-time period after the current sub-time period when the GC write data volume from the first sub-time period to the current sub-time period is less than the target GC write bandwidth upper limit, wherein the remaining GC write bandwidth is the difference between the target GC write bandwidth upper limit and the GC write data volume from the first sub-time period to the current sub-time period.
[0192] Optionally, the device also includes: an allocation unit, which is used to reallocate the host write bandwidth and GC write bandwidth for the second time period when, during the process of performing flow control on the host write and GC write of the hard disk under test within the second time period according to the target host write bandwidth upper limit and the target GC write bandwidth upper limit, before the end of the second time period, the host write data volume within the second time period is greater than or equal to the target host write bandwidth upper limit, and the GC write data volume within the second time period is greater than or equal to the target GC write bandwidth upper limit.
[0193] Optionally, the device also includes: a first execution unit, which is used to, after obtaining the actual host write bandwidth, actual garbage collection GC write bandwidth and GC average effective data volume of the hard disk under test in the first time period, suspend the execution of GC write operations when the actual host write bandwidth is zero and the actual host read bandwidth of the hard disk under test in the first time period is not zero, set the host write bandwidth upper limit of the hard disk under test to a specified host write bandwidth upper limit, and perform flow control on the host write of the hard disk under test in the second time period according to the specified host write bandwidth upper limit; a second execution unit, which is used to, when the actual host write bandwidth is zero and the actual host read bandwidth of the hard disk under test in the first time period is zero, set the GC write bandwidth upper limit of the hard disk under test to the specified GC write bandwidth upper limit, and perform flow control on the GC write of the hard disk under test in the second time period according to the specified GC write bandwidth upper limit.
[0194] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0195] According to another aspect of the present application, a computer program product is also provided, the computer program product comprising a computer program / instruction, the computer program / instruction comprising a program code for executing the above method. Figure 6 The computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processor 601, various functions provided by the embodiments of the present application are executed. The serial numbers of the embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments.
[0196] refer to Figure 6 , Figure 6 It is a structural block diagram of a computer system of an optional electronic device according to an embodiment of the present application.
[0197] Figure 6 The computer system structure block diagram of the electronic device used to implement the embodiment of the present application is schematically shown. Figure 6 As shown, the computer system 600 includes a central processing unit 601 (CPU), which can perform various appropriate actions and processes according to the program stored in the read-only memory 602 (ROM) or the program loaded from the storage part 608 to the random access memory 603 (RAM). Various programs and data required for system operation are also stored in the random access memory 603. The central processing unit 601, the read-only memory 602 and the random access memory 603 are connected to each other through a bus 604. The input / output interface 605 (Input / Output interface, i.e., I / O interface) is also connected to the bus 604.
[0198] The following components are connected to the input / output interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the input / output interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed so that a computer program read therefrom is installed into the storage section 608 as needed.
[0199] In particular, according to an embodiment of the present application, the process described in each method flow chart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer readable medium, and the computer program contains a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processor 601, various functions defined in the system of the present application are executed.
[0200] It should be noted that Figure 6 The computer system 600 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0201] According to another aspect of the present application, a computer-readable storage medium is provided. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the above method.
[0202] Optionally, in the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories), or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0203] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a ROM (Read-Only Memory), a RAM (Random Access Memory), a disk or an optical disk, etc.
[0204] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which may be personal computers, servers or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
[0205] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0206] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0207] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0208] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0209] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A flow control method for a solid state hard disk, characterized in that: include: Obtaining the actual host write bandwidth, actual GC write bandwidth, and GC average effective data volume of the hard disk under test in the first time period, wherein the hard disk under test is a NAND solid-state drive, and the GC average effective data volume is the average value of the effective data volume in the garbage collected data blocks; In the case where the actual host write bandwidth is not zero, an expected bandwidth ratio is determined based on a single writable data amount and the GC average effective data amount, wherein the single writable data amount is the writable data amount of a single block in the hard disk under test, and the expected bandwidth ratio is an expected ratio of the host write bandwidth of the hard disk under test and the sum of the host write bandwidth of the hard disk under test and the GC write bandwidth of the hard disk under test; According to the actual bandwidth ratio and the expected bandwidth ratio, the host write bandwidth upper limit of the hard disk under test and the GC write bandwidth upper limit of the hard disk under test are adjusted to obtain a target host write bandwidth upper limit and a target GC write bandwidth upper limit, wherein the actual bandwidth ratio is a ratio between the actual host write bandwidth and the sum of the actual host write bandwidth and the actual GC write bandwidth; According to the target host write bandwidth upper limit and the target GC write bandwidth upper limit, flow control is performed on host writes and GC writes of the hard disk under test in a second time period after the first time period.
2. The method according to claim 1, characterized in that The step of determining the expected bandwidth ratio based on the single writable data amount and the GC average valid data amount when the actual host write bandwidth is not zero includes: When the actual host write bandwidth is not zero, the result of dividing the difference between the single writable data amount and the GC average valid data amount by the single writable data amount is determined as the expected bandwidth ratio.
3. The method according to claim 2, characterized in that The determining of the expected bandwidth ratio based on the single writable data amount and the GC average valid data amount when the actual host write bandwidth is not zero also includes: According to the difference between the actual number of free blocks in the tested hard disk and the expected number of free blocks in the tested hard disk, the expected bandwidth ratio is adjusted to obtain the adjusted expected bandwidth ratio, wherein the adjustment direction of the expected bandwidth ratio corresponds to the difference between the actual number and the expected number, and the adjustment amplitude of the expected bandwidth ratio is positively correlated with the absolute value of the difference between the actual number and the expected number.
4. The method according to claim 3, characterized in that The adjusting the expected bandwidth ratio according to the difference between the actual number of free blocks in the hard disk under test and the expected number of free blocks in the hard disk under test to obtain the adjusted expected bandwidth ratio includes: The result of multiplying the expected bandwidth ratio by the sum of 1 and the adjustment coefficient is determined as the adjusted expected bandwidth ratio, wherein the adjustment coefficient is a result obtained by dividing the difference between the actual number and the expected number by a specified factor.
5. The method according to claim 1, characterized in that The step of adjusting the host write bandwidth upper limit of the hard disk under test and the GC write bandwidth upper limit of the hard disk under test according to the actual bandwidth ratio and the expected bandwidth ratio to obtain a target host write bandwidth upper limit and a target GC write bandwidth upper limit includes: When the actual bandwidth ratio is greater than the expected bandwidth ratio, lowering the host write bandwidth upper limit of the hard disk under test to obtain the target host write bandwidth upper limit; When the actual bandwidth ratio is less than the expected bandwidth ratio, the host write bandwidth upper limit of the hard disk under test is increased to obtain the target host write bandwidth upper limit; The difference between the benchmark bandwidth and the target host write bandwidth upper limit is determined as the target GC write bandwidth upper limit, wherein the benchmark bandwidth is a reference bandwidth for bandwidth control.
6. The method according to claim 5, characterized in that When the actual bandwidth ratio is greater than the expected bandwidth ratio, lowering the host write bandwidth upper limit of the hard disk under test to obtain the target host write bandwidth upper limit, includes: When the actual bandwidth ratio is greater than the expected bandwidth ratio, and the ratio between the actual bandwidth ratio and the expected bandwidth ratio is less than or equal to a first specified ratio, lowering the host write bandwidth upper limit of the hard disk under test according to a first percentage to obtain the target host write bandwidth upper limit, wherein the bandwidth value by which the host write bandwidth upper limit of the hard disk under test is lowered is less than or equal to a first bandwidth threshold, and the first specified ratio is greater than 1; When the actual bandwidth ratio is greater than the expected bandwidth ratio, and the ratio between the actual bandwidth ratio and the expected bandwidth ratio is greater than the first specified ratio, the product of the expected bandwidth ratio and the reference bandwidth is determined as the target host write bandwidth upper limit.
7. The method according to claim 5, characterized in that When the actual bandwidth ratio is less than the expected bandwidth ratio, increasing the host write bandwidth upper limit of the hard disk under test to obtain the target host write bandwidth upper limit, including: When the actual bandwidth ratio is less than the expected bandwidth ratio, and the ratio between the actual bandwidth ratio and the expected bandwidth ratio is greater than or equal to a second specified ratio, the host write bandwidth upper limit of the hard disk under test is increased according to a second percentage to obtain the target host write bandwidth upper limit, wherein the bandwidth value increased by the host write bandwidth upper limit of the hard disk under test is less than or equal to a second bandwidth threshold, and the second specified ratio is less than 1; When the actual bandwidth ratio is smaller than the expected bandwidth ratio, and the ratio between the actual bandwidth ratio and the expected bandwidth ratio is smaller than the second specified ratio, the product of the expected bandwidth ratio and the reference bandwidth is determined as the target host write bandwidth upper limit.
8. The method according to claim 5, characterized in that Before determining the difference between the benchmark bandwidth and the target host write bandwidth upper limit as the target GC write bandwidth upper limit, the method further includes: When the actual write bandwidth is greater than the product of the reference bandwidth and the first ratio, the reference bandwidth is increased to obtain the adjusted reference bandwidth; When the actual write bandwidth is less than the product of the reference bandwidth and the second ratio, an average value of the reference bandwidth and the actual write bandwidth is determined as the adjusted reference bandwidth; When the actual write bandwidth is greater than or equal to the product of the reference bandwidth and the second ratio, and less than or equal to the reference bandwidth and the first ratio, lowering the reference bandwidth to obtain the adjusted reference bandwidth; The actual write bandwidth is the sum of the actual host write bandwidth and the actual GC write bandwidth.
9. The method according to claim 1, characterized in that: After adjusting the host write bandwidth upper limit of the hard disk under test and the GC write bandwidth upper limit of the hard disk under test according to the actual bandwidth ratio and the expected bandwidth ratio, the method further includes: When the actual number of free blocks in the hard disk under test is less than or equal to the specified number threshold, half of the target host write bandwidth upper limit is determined as the adjusted target host write bandwidth upper limit, wherein flow control of host writes to the hard disk under test in the second time period is performed using the adjusted target host write bandwidth upper limit.
10. The method according to claim 1, characterized in that The second time period is divided into a plurality of sub-time periods, and when flow control of the second time period starts, the target host write bandwidth upper limit and the target GC write bandwidth upper limit are evenly distributed in the plurality of sub-time periods; The performing flow control on host write and GC write of the hard disk under test in a second time period after the first time period according to the target host write bandwidth upper limit and the target GC write bandwidth upper limit includes: Each of the multiple sub-time periods is used as the current sub-time period to perform the following flow control operations: If the amount of host write data in the current sub-time period is greater than or equal to the upper limit of the host write bandwidth corresponding to the current sub-time period, suspending the host write operation; When the amount of GC write data in the current sub-time period is greater than or equal to the upper limit of the host write bandwidth corresponding to the current sub-time period, the GC write operation is suspended.
11. The method according to claim 10, characterized in that The performing flow control on host write and GC write of the hard disk under test in a second time period after the first time period according to the target host write bandwidth upper limit and the target GC write bandwidth upper limit also includes: In a case where the amount of host write data from the first sub-time period of the multiple sub-time periods to the current sub-time period is less than the upper limit of the target host write bandwidth, reallocating the remaining host write bandwidth of the second time period to the sub-time period after the current sub-time period, wherein the remaining host write bandwidth is the difference between the upper limit of the target host write bandwidth and the amount of host write data from the first sub-time period to the current sub-time period; When the amount of GC write data from the first sub-time period to the current sub-time period is less than the target GC write bandwidth upper limit, the remaining GC write bandwidth of the second time period is reallocated to the sub-time period after the current sub-time period, wherein the remaining GC write bandwidth is the difference between the target GC write bandwidth upper limit and the amount of GC write data from the first sub-time period to the current sub-time period.
12. The method according to claim 1, characterized in that In the process of performing flow control on host writes and GC writes of the hard disk under test in the second time period according to the target host write bandwidth upper limit and the target GC write bandwidth upper limit, the method further includes: Before the end of the second time period, if the host write data volume in the second time period is greater than or equal to the target host write bandwidth upper limit, and the GC write data volume in the second time period is greater than or equal to the target GC write bandwidth upper limit, the host write bandwidth and GC write bandwidth are reallocated for the second time period.
13. The method according to any one of claims 1 to 12, characterized in that After obtaining the actual host write bandwidth, the actual garbage collection (GC) write bandwidth, and the GC average effective data volume of the hard disk under test in the first time period, the method further includes: When the actual host write bandwidth is zero and the actual host read bandwidth of the hard disk under test in the first time period is not zero, suspend the execution of the GC write operation, set the host write bandwidth upper limit of the hard disk under test to the specified host write bandwidth upper limit, and perform flow control on the host write of the hard disk under test in the second time period according to the specified host write bandwidth upper limit; When the actual host write bandwidth is zero and the actual host read bandwidth of the hard disk under test in the first time period is zero, the GC write bandwidth upper limit of the hard disk under test is set to the specified GC write bandwidth upper limit, and the GC write flow of the hard disk under test in the second time period is controlled according to the specified GC write bandwidth upper limit.
14. A flow control device for a solid state hard disk, characterized in that: include: an acquisition unit, configured to acquire an actual host write bandwidth, an actual garbage collection (GC) write bandwidth, and an average GC valid data volume of the hard disk under test in a first time period, wherein the hard disk under test is a non-NAND solid state drive, and the average GC valid data volume is an average value of the valid data volume in the garbage collected data blocks; A first determining unit is used to determine an expected bandwidth ratio based on a single writable data amount and the GC average effective data amount when the actual host write bandwidth is not zero, wherein the single writable data amount is the writable data amount of a single block in the hard disk under test, and the expected bandwidth ratio is an expected ratio of the host write bandwidth of the hard disk under test and the sum of the host write bandwidth of the hard disk under test and the GC write bandwidth of the hard disk under test; A first adjustment unit is configured to adjust the host write bandwidth upper limit of the hard disk under test and the GC write bandwidth upper limit of the hard disk under test according to the actual bandwidth ratio and the expected bandwidth ratio, so as to obtain a target host write bandwidth upper limit and a target GC write bandwidth upper limit, wherein the actual bandwidth ratio is a ratio between the actual host write bandwidth and the sum of the actual host write bandwidth and the actual GC write bandwidth; A control unit is used to perform flow control on host writes and GC writes of the tested hard disk in a second time period after the first time period according to the target host write bandwidth upper limit and the target GC write bandwidth upper limit.
15. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 13 are implemented.
16. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer-readable storage medium includes a stored program, wherein the program executes the steps of the method according to any one of claims 1 to 13 when executed by a processor.
17. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 13 are implemented.
Citation Information
Patent Citations
Method and device for adjusting writing bandwidths of solid-state disks
CN107422995A
Hard disk pressure testing method, system and equipment and medium
CN114550798A
Method and device for adjusting code rate, electronic equipment and readable storage medium
CN114625317A
Flow control method and device of solid state disk (SSD), storage medium and equipment
CN116126253A
Control method and apparatus for storage apparatus
WO2023035113A1
