Method for reducing write performance variation and preventing IO blocking

文档序号:1296036 发布日期:2020-08-07 浏览:6次 中文

阅读说明:本技术 减少写入效能变化并防止io阻塞的方法 (Method for reducing write performance variation and preventing IO blocking ) 是由 张柏坚 许嫣兰 谢坤龙 于 2019-01-31 设计创作,主要内容包括:本发明揭露在固态硬盘里减少写入效能变化并防止IO阻塞的方法,减少写入效能变化并防止IO阻塞的方法包括接收一写入请求的步骤。然后,判断一固态硬盘的状态是正常或受限。若固态硬盘的状态是正常,则处理此写入请求。若固态硬盘的状态是受限,则把此写入请求插入写入请求队列。若第一写入请求的已耗时间小于预计等待时间,则等待一段时间,然后回到监视在写入请求队列的第一写入请求并计算预计等待时间的步骤。若第一写入请求的已耗时间大于或等于预计等待时间,则处理第一写入请求,并从写入请求队列移除第一写入请求。若写入请求队列不空,则回到等待一段时间的步骤。若写入请求队列已空,则结束。(The invention discloses a method for reducing write performance variation and preventing IO blocking in a solid state disk, which comprises the step of receiving a write request. Then, the state of a solid state disk is judged to be normal or limited. And if the state of the solid state disk is normal, processing the write request. And if the state of the solid state disk is limited, inserting the write request into a write request queue. If the elapsed time of the first write request is less than the expected wait time, wait for a period of time, and then return to the step of monitoring the first write request in the write request queue and calculating the expected wait time. If the elapsed time of the first write request is greater than or equal to the expected wait time, the first write request is processed and removed from the write request queue. If the write request queue is not empty, the step of waiting for a period of time is returned. If the write request queue is empty, the process is ended.)

1. A method for reducing write performance variation and preventing IO blocking, comprising the steps of:

receiving a write request;

judging whether the state of a solid state disk is normal or limited;

if the state of the solid state disk is normal, processing the write-in request;

if the state of the solid state disk is limited, inserting the write-in request into a write-in request queue;

monitoring a first write request in a write request queue and calculating an expected wait time;

determining whether the elapsed time of the first write request is greater than or equal to the expected wait time;

waiting for a period of time if the elapsed time of the first write request is less than the expected wait time, and then returning to the step of monitoring the first write request in the write request queue and calculating the expected wait time;

if the elapsed time of the first write request is greater than or equal to the expected wait time, processing the first write request and removing the first write request from the write request queue;

judging whether the write request queue is empty;

if the write request queue is not empty, returning to the step of waiting for a period of time; and

if the write request queue is empty, the process is ended.

2. The method of reducing write performance variation and preventing IO blocking as claimed in claim 1, further comprising the steps of:

before the step of receiving a write request, setting the state of the solid fixed state hard disk as normal; and

and setting the state of the solid state disk to be normal or limited at the same time or after the step of receiving a write request.

3. The method of claim 2, wherein the step of setting the state of the solid state disk to normal or limited comprises the steps of:

monitoring the amount of free blocks;

judging whether the quantity of the free blocks is less than or equal to a first threshold value;

if the amount of the free blocks is smaller than or equal to a first threshold value, setting the state of the solid state disk as limited; and

if the free block size is larger than the first threshold, go back to the step of monitoring the free block size.

4. The method for reducing write performance variation and preventing IO blocking as claimed in claim 3, further comprising the following steps after the step of setting the state of the solid state disk to be limited:

reclaiming a block and making it a free block;

calculating the amount of blocks recycled; and

judging whether the quantity of the free blocks is larger than or equal to a second threshold value or not;

if the amount of the free blocks is smaller than the second threshold value, returning to the step of recovering the blocks; and

and if the quantity of the free blocks is larger than or equal to the second threshold value, setting the state of the solid state disk as normal.

5. The method of claim 4, wherein the second threshold is greater than or equal to the first threshold.

6. The method of reducing write performance variation and preventing IO blocking as claimed in claim 4, further comprising the step of calculating garbage collection efficiency after the step of setting the state of the solid state disk to be limited.

7. The method of reducing write performance variation and preventing IO blocking as claimed in claim 6, further comprising the steps of, before the step of calculating garbage collection efficiency:

starting a timer after the step of recycling a block; and

after the step of reclaiming a block, the amount of garbage reclaimed is calculated.

8. The method of claim 6, wherein the step of calculating garbage collection efficiency comprises the steps of:

the amount of trash recovered is divided by the time measured by the timer.

Technical Field

The present invention relates to a solid state drive, and more particularly, to a method for reducing write performance variation and preventing IO blocking in a solid state drive.

Background

The firmware of the solid state disk needs to perform some system tasks and/or read/write system data. These tasks or reads/writes degrade write performance for some time. Solid state disk manufacturers want to avoid this variation in write performance. Solid state disk manufacturers also want to avoid the IOPS (input/output per second) dropping to zero. The condition where the IOPS is zero is called "IO blocking", which makes the user feel that the system is unresponsive. The main reason for low or zero IOPS is that the garbage collection task occupies most of the bandwidth of the flash memory. One solution is to delay the garbage collection task. However, delaying the garbage collection task may make the available storage space of the solid state disk insufficient. The other solution is to make the solid state disk have multiple cores, and use one of the cores to perform read/write tasks and the other core to perform garbage collection tasks. However, using one core increases the cost of the solid state disk.

Disclosure of Invention

In view of the above-mentioned problems of the prior art, it is an object of the present invention to provide an efficient and cost-effective method for reducing the write performance variation and preventing IO blocking.

To achieve the above objective, the method for reducing write performance variation and preventing IO blocking includes the step of receiving a write request. Then, the status of a solid state disk is determined to be "normal" or "restricted". If the status of the solid state disk is "normal", the write request is realized. If the status of the solid state disk is "limited", the write request is inserted into the write request queue. The first write request in the write request queue is monitored and the expected latency is calculated. It is determined whether the elapsed time of the first write request is greater than or equal to the expected wait time. If the elapsed time of the first write request is less than the expected wait time, wait for a period of time, and then return to the step of monitoring the first write request in the write request queue and calculating the expected wait time. If the elapsed time of the first write request is greater than or equal to the expected wait time, the first write request is fulfilled and removed from the write request queue. It is determined whether the write request queue is empty. If the write request queue is not empty, the step of waiting for a period of time is returned. If the write request queue is empty, the process is ended.

Further, the method also comprises the following steps: before the step of receiving a write request, setting the state of the solid fixed state hard disk as normal; and setting the state of the solid state disk to be normal or limited at the same time or after the step of receiving a write request.

Further, the step of setting the state of the solid state disk as normal or limited includes the following steps: monitoring the amount of free blocks; judging whether the quantity of the free blocks is less than or equal to a first threshold value; if the amount of the free blocks is smaller than or equal to a first threshold value, setting the state of the solid state disk as limited; and returning to the step of monitoring the amount of the free blocks if the amount of the free blocks is larger than the first threshold value.

Further, after the step of setting the state of the solid state disk as limited, the method further comprises the following steps: reclaiming a block and making it a free block; calculating the amount of blocks recycled; judging whether the quantity of the free blocks is larger than or equal to a second threshold value or not; if the amount of the free blocks is smaller than the second threshold value, returning to the step of recovering the blocks; and if the quantity of the free blocks is larger than or equal to the second threshold value, setting the state of the solid state disk as normal.

Further, the second threshold is greater than or equal to the first threshold.

Further, the method also comprises a step of calculating the garbage recovery efficiency after the step of setting the state of the solid state disk as limited.

Further, before the step of calculating the garbage recycling efficiency, the method further comprises the following steps: starting a timer after the step of recycling a block; and calculating the amount of garbage collected after the step of collecting a block.

Further, the step of calculating the garbage recycling efficiency comprises the following steps: the amount of trash recovered is divided by the time measured by the timer.

The invention has the beneficial effects that: the present invention provides an efficient and cost effective method of reducing write performance variation and preventing IO blocking.

Drawings

FIG. 1 is a block diagram of a data storage device that can perform the method of reducing write performance variation and preventing IO blocking of the preferred embodiment of the present invention;

FIG. 2 is a flow chart of a method for reducing write performance variation and preventing IO blocking according to a preferred embodiment of the present invention;

FIG. 3 is a flow chart of a subroutine of the method shown in FIG. 2;

FIG. 4 is a flow chart of another subroutine of the method shown in FIG. 2;

fig. 5 is a flow chart of another subroutine of the method shown in fig. 2.

The corresponding names in the figure are marked as follows: 10. host computer, 11, central processing unit, 12, firmware, 13, central processing unit, 14, firmware, 15, memory, 16, solid state disk controller.

Detailed Description

The following description will further describe a preferred embodiment of the method for reducing write performance variation and preventing IO blocking according to the present invention with reference to the accompanying drawings. To facilitate an understanding of the invention, like components are identified below with like reference numerals.

Referring to fig. 1, a host 10 is connected to a solid state disk controller 16. The solid state disk controller 16 includes two central processing units 11 and 13 and a shared memory 15. The central processing unit 11 is generally referred to as Core 1 and is connected to a host 10. The central processing unit 13 is generally referred to as Core 0 and is connected to the central processing unit 11. The memory 15 is connected to the CPU 11 and 13.

In operation, the CPU 11 executes the firmware 12 and receives a write request from the host 10. The CPU 13 executes the firmware 14 and receives instructions from the CPU 11. The CPU 13 also generates two variables, i.e., "" flow control "" and "" garbage collection efficiency "", and stores the two variables into the memory 15. And controlling the state of the corresponding solid state disk by the process. The process control has two values, normal or restricted. The "garbage collection efficiency" is the amount of data collected per unit time. The solid state hard disk controller 16 may perform the method of reducing write performance variation and preventing IO blocking of the preferred embodiment of the present invention. Flow control and garbage collection efficiency are used in the method of the preferred embodiment of the present invention to reduce write performance variation and prevent IO blocking.

FIG. 2 shows a method for reducing write performance variation and preventing IO blocking according to a preferred embodiment of the present invention. At S10, power is supplied to the solid state hard disk controller 16. Then, the process goes to S20.

Referring to fig. 3, S20 represents an initialization procedure. In this initialization procedure, at S22, the central processing unit 13 executes the firmware 14. Then, the process goes to S24.

At S24, the memory 15 is initialized. Then, the process goes to S26.

At S26, the flow control is set to "normal". Then, the process goes to S28.

At S28, the "garbage collection efficiency" is set to N. N represents a predetermined value. Then, the process goes to S30.

At S30, the central processing unit 13 wakes up the central processing unit 11. The central processing unit 11 executes the firmware 12. Then, the central processing unit 13 performs S40, and the central processing unit 11 performs S70 (fig. 2).

Referring to fig. 2, at S40, the central processing unit 13 monitors the amount of free blocks. Then, the process goes to S42.

At S42, it is determined whether the amount of free blocks is less than or equal to a first threshold. If the number of free blocks is less than or equal to the first threshold, the process goes to S44 to recycle the garbage. If the amount of free blocks is greater than the first threshold, the process returns to S40.

At S44, the process control is "limited". As mentioned above, the amount of free blocks is smaller than the first threshold, so that data cannot be written at a normal rate. Therefore, the process control is set to "limited". Then, the process goes to S46.

At S46, a tile is picked and trash is reclaimed, and a timer is started. Then, the process goes to S48. The recycled block becomes a free block.

At S48, the amount of garbage collected for this block is calculated. Then, the process goes to S50.

At S50, the timer is stopped, the garbage collection efficiency is calculated, and the garbage collection efficiency is stored in the memory 15. The garbage collection efficiency is calculated by dividing the amount of garbage collected by the time recorded by the timer. The process then proceeds to S52.

At S52, it is determined whether the number of free blocks is greater than or equal to a second threshold comparison. If the amount of free blocks is smaller than the second threshold, the process returns to S46. If the number of free blocks is greater than or equal to the second threshold, the process goes to S54. The second threshold should be moderately higher than the first threshold, otherwise the frequency of garbage collection will be high and the time per round will be short.

In S54, the flow control is set to "normal". The process then returns to S40.

Referring to fig. 4 and 5, S70 represents another subroutine. At S70, the central processing unit 11 processes the write request.

In this subroutine, at S72, the central processing unit 11 receives a write request from the host 10. Then, the process goes to S74.

At S74, it is determined whether or not the flow control is normal. If so, the process goes to S76, otherwise, the process goes to S78.

S76, the write request is fulfilled. Specifically, the central processing unit 11 sends a write request to the central processing unit 13. The central processing unit 13 then fulfills this write request. The "enable" write request is a write request to write data to the solid state drive.

At S78, the write request is inserted into the write request queue. That is, the write request is queued after other write requests and awaits fulfillment. Then, the process goes to S80.

At S80, the first write request in the write request queue is monitored and the expected wait time is calculated. The "expected wait time" is the calculated time that the first write request should wait to be fulfilled. The expected latency is calculated by the CPU 11 reading the garbage collection efficiency from the memory 15 and dividing the data size of the first write request by the garbage collection efficiency. The process then proceeds to S82.

At S82, it is determined whether the elapsed time for the first write request is greater than or equal to the expected wait time. The "elapsed time" is the time the first write request has elapsed waiting to be fulfilled. The elapsed time of the first write request is calculated from the central processing unit 11 monitoring the first write request. If so, the process goes to S86, otherwise, the process goes to S84.

At S84, a suitable period of time is waited for. This suitable period of time may be a few seconds. Then, the process returns to S80.

At S86, the first write request is fulfilled and removed from the write request queue. The first write request is implemented by the central processing unit 11 sending the first write request to the central processing unit 13. Then, the central processing unit 13 implements the first write request. Then, the process goes to S88.

At S88, it is determined whether the write request queue is empty. If so, the process goes to S90, otherwise, the process goes back to S84.

At S90, the routine ends.

The above description is only for the purpose of illustrating the preferred embodiments of the present invention, and is not intended to limit the scope of the embodiments of the present invention, which is defined by the claims, and equivalents thereof, which are obvious to those skilled in the art, and which are within the scope of the present invention.

11页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:用于在存储器系统中传输映射信息的装置和方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类