A disk detection method, device, equipment and storage medium

CN115470059BActive Publication Date: 2026-09-18INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211156973.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-22
Publication Date
2026-09-18
Estimated Expiration
2042-09-22

AI Technical Summary

Technical Problem

当硬盘Glist(增长坏道表)写满被弃用、碟片滑落、震动、高温等情况时,会导致硬盘性能下降,这些问题不能被smart等磁盘诊断工具发现,在一定时间内磁盘还能正常访问,但是性能会受到一定影响,这些盘还会继续使用

Benefits of technology

[0043] As can be seen, this application provides a disk detection method, including: obtaining the current read/write count per second of the disk within a preset time period, and determining whether the current read/write count per second is greater than a preset threshold to obtain a judgment result; determining whether the disk meets preset conditions based on the judgment result; if the disk meets the preset conditions, obtaining the target I/O latency and comparing the target latency with the standard latency corresponding to the target I/O; if the target latency is greater than the standard latency, determining that the disk is a slow disk. Therefore, this application determines whether to compare the latency of a target I/O by judging whether the disk meets preset conditions. If the target latency is greater than the standard latency, the disk is determined to be a slow disk, effectively distinguishing disk problems, improving the accuracy of problem judgment, and better balancing the functions of storage services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115470059B_ABST
    Figure CN115470059B_ABST
Patent Text Reader

Abstract

This application discloses a disk detection method, apparatus, device, and storage medium, relating to the field of disk storage technology. The method includes: acquiring the current read / write count per second of the disk within a preset time period; determining whether the current read / write count per second is greater than a preset threshold, and obtaining a determination result; determining whether the disk meets preset conditions based on the determination result; if the disk meets the preset conditions, acquiring the target I / O latency and comparing the target latency with the standard latency corresponding to the target I / O; if the target latency is greater than the standard latency, determining that the disk is a slow disk. This application determines whether to compare the latency of a target I / O by judging whether the disk meets preset conditions. If the target latency is greater than the standard latency, the disk is determined to be a slow disk, effectively distinguishing disk problems, improving the accuracy of problem judgment, and better balancing the functions of storage services.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of disk storage technology, and in particular to a disk testing method, apparatus, device, and storage medium. Background Technology

[0002] With the widespread use of hard disks in storage devices, storage systems have developed several solutions for detecting hard disk failures, typically addressing issues such as media errors and disk access failures. However, there are no diagnostic tools specifically for disk performance. When a hard drive's Glist (growing bad sector table) is full and abandoned, platters slip, or there is vibration or high temperature, hard drive performance will degrade. These problems cannot be detected by disk diagnostic tools like SMART. The disk may still be accessible for a period of time, but performance will be affected, and these disks will continue to be used.

[0003] When disk access performance slows down and cannot keep up with the system's processing capacity, problems arise. For example, in RAID (Redundant Arrays of Independent Disks), some stripes may experience slow access, leading to a performance decrease in the RAID array itself and consequently, a decrease in system performance. Additionally, even if the disk itself is functioning normally, overload from higher layers can slow down disk response, causing unprocessed I / O (Input / Output) to accumulate. New I / O requests must queue, and the more accumulated the queue, the longer it takes, resulting in I / O timeouts. Therefore, it's difficult to distinguish whether poor disk performance is caused by a slow disk or by overload. Summary of the Invention

[0004] In view of this, the purpose of this invention is to provide a disk detection method, apparatus, device, and storage medium that can effectively distinguish disk problems, improve the accuracy of problem identification, and better balance storage service functions. The specific solution is as follows:

[0005] Firstly, this application discloses a disk detection method, including:

[0006] Obtain the current number of read / write operations per second of the disk within a preset time period, and determine whether the current number of read / write operations per second is greater than a preset threshold to obtain a determination result;

[0007] Based on the judgment result, determine whether the disk meets the preset conditions;

[0008] If the disk meets the preset conditions, the target time of the target I / O is obtained, and the target time is compared with the standard time corresponding to the target I / O.

[0009] If the target time is longer than the standard time, the disk is determined to be a slow disk.

[0010] Optionally, determining whether the disk meets the preset conditions based on the determination result includes:

[0011] If the determination result is that the current number of read / write operations per second is greater than the preset threshold, then it is directly determined that the disk does not meet the preset condition and that the disk is not a slow disk;

[0012] If the determination result is that the current number of read / write operations per second is less than or equal to the preset threshold, then the total time consumed by the disk in the first unit of time is obtained, and the disk is judged to meet the preset condition based on the total time consumed.

[0013] Optionally, if the determination result is that the current number of read / write operations per second is greater than the preset threshold, then directly determining that the disk does not meet the preset condition and that the disk is not a slow disk, the method further includes:

[0014] Get the total IO queuing time in the second unit of time;

[0015] The total IO queuing time is compared with a preset standard value for the total IO queuing time.

[0016] If the total IO queuing time is greater than the standard value of the total IO queuing time, it is determined that the upper layer pressure exceeds the preset pressure threshold, and a preset disk adjustment operation is performed.

[0017] If the total IO queuing time is less than or equal to the standard value of the total IO queuing time, then remain unchanged.

[0018] Optionally, determining whether the disk meets the preset condition based on the total time consumed includes:

[0019] Compare the total time consumed with a preset standard value for the total time consumed;

[0020] If the total time consumed is greater than the preset total time consumption standard value, then the disk is determined to not meet the preset condition and is determined to be a slow disk;

[0021] If the total time consumed is less than the preset total time consumption standard value, then the corresponding peak time is obtained;

[0022] If the peak time does not meet the preset slow disk peak judgment rule, then the disk is determined to meet the preset condition;

[0023] If the peak time consumption meets the preset slow disk peak judgment rule, then the disk is determined not to meet the preset condition and is determined to be a slow disk.

[0024] Optionally, before obtaining the target I / O duration, the process further includes:

[0025] Send a first OTUR instruction to the disk so that the disk generates the corresponding first OTUR result and returns it after performing all IO operations.

[0026] Optionally, if the disk meets the preset conditions, obtaining the target I / O duration includes:

[0027] When the disk meets the preset conditions and receives the first OTUR result, a preset number of target IOs are obtained from the IO queuing queue, and all target IOs are concurrently sent to the disk;

[0028] Send a second OTUR instruction to the disk so that the disk generates a second OTUR result and returns after executing all the target IO;

[0029] When the second OTUR result is received, the difference between the IO sending time and the second OTUR result receiving time is calculated to obtain the target time required to complete all the target IO.

[0030] Optionally, before comparing the target time duration with the standard time duration corresponding to the target I / O, the method further includes:

[0031] Calculate the standard time required to execute all the target I / O operations under preset standard conditions;

[0032] Accordingly, after comparing the target time duration with the standard time duration corresponding to the target I / O, the process further includes:

[0033] If the target time is less than or equal to the standard time, then the disk is determined not to be a slow disk.

[0034] Secondly, this application discloses a disk detection device, comprising:

[0035] The first judgment module is used to obtain the current number of read / write operations per second of the disk within a preset time period, and to determine whether the current number of read / write operations per second is greater than a preset threshold, so as to obtain a judgment result;

[0036] The second judgment module is used to determine whether the disk meets the preset conditions based on the judgment result;

[0037] The duration comparison module is used to obtain the target duration of the target IO if the disk meets the preset conditions, and compare the target duration with the standard duration of the target IO.

[0038] The slow disk determination module is used to determine that the disk is a slow disk if the target time duration is greater than the standard time duration.

[0039] Thirdly, this application discloses an electronic device, including:

[0040] Memory, used to store computer programs;

[0041] A processor is configured to execute the computer program to implement the steps of the disk detection method disclosed above.

[0042] Fourthly, this application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the disk detection method disclosed above.

[0043] As can be seen, this application provides a disk detection method, including: obtaining the current read / write count per second of the disk within a preset time period, and determining whether the current read / write count per second is greater than a preset threshold to obtain a judgment result; determining whether the disk meets preset conditions based on the judgment result; if the disk meets the preset conditions, obtaining the target I / O latency and comparing the target latency with the standard latency corresponding to the target I / O; if the target latency is greater than the standard latency, determining that the disk is a slow disk. Therefore, this application determines whether to compare the latency of a target I / O by judging whether the disk meets preset conditions. If the target latency is greater than the standard latency, the disk is determined to be a slow disk, effectively distinguishing disk problems, improving the accuracy of problem judgment, and better balancing the functions of storage services. Attached Figure Description

[0044] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0045] Figure 1 This is a flowchart of a disk detection method disclosed in this application;

[0046] Figure 2 This is a flowchart of a specific disk testing method disclosed in this application;

[0047] Figure 3 This is a flowchart of a specific disk testing method disclosed in this application;

[0048] Figure 4This is a schematic diagram of the disk testing device provided in this application;

[0049] Figure 5 This application provides a structural diagram of an electronic device. Detailed Implementation

[0050] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0051] Currently, when disk access performance slows down and cannot keep up with the system's processing capacity, several problems arise. For example, in RAID, some stripes may experience slow access, leading to a decrease in RAID performance and consequently, a decrease in system performance. Additionally, even when the disk itself is functioning normally, overload from higher layers can slow down disk response, causing unprocessed I / O to accumulate. New I / O entries then have to queue, and the more accumulated the queue, the longer it takes, resulting in I / O timeouts. Therefore, it is difficult to distinguish whether poor disk performance is caused by a slow disk or by overload. To address this, this application provides a disk detection method that can effectively identify disk problems, improve the accuracy of problem diagnosis, and better balance the functions of storage services.

[0052] This invention discloses a disk detection method, see [link to relevant documentation]. Figure 1 As shown, the method includes:

[0053] Step S11: Obtain the current number of read / write operations per second of the disk within a preset time period, and determine whether the current number of read / write operations per second is greater than a preset threshold to obtain a determination result.

[0054] In this embodiment, the current read / write operations per second (I / O) of the disk within a preset time period are obtained, and it is determined whether the current I / O operations per second are greater than a preset threshold to obtain a judgment result. For example, the disk IOPS (Input / Output Operations Per Second) within the past 1 second is obtained, and compared with the disk IOPS limit given by the disk manufacturer to see if it is within the normal range. If the preset threshold is the limit value of 100 within 1 second, the current I / O operations per second of the disk within 1 second are obtained, and the current I / O operations per second are compared with the limit value of 100 to obtain the corresponding judgment result. It can be understood that the step of obtaining the current I / O operations per second of the disk within a preset time period is started when the upper layer detects an IO timeout. In addition, when performing disk performance statistics, it is necessary to collect disk IOPS, bandwidth, total disk time, maximum time, block length information for reading and writing, time spent queuing IO before sending to the disk, and the number of queued IOs. The more precise the granularity, the better. For example, all the above data within 1 second can be obtained.

[0055] Step S12: Based on the judgment result, determine whether the disk meets the preset conditions.

[0056] In this embodiment, it is determined whether the current read / write count per second is greater than a preset threshold. After obtaining the determination result, it is determined whether the disk meets preset conditions based on the determination result. It can be understood that this solution is divided into two stages. The first stage is determining whether the disk meets the preset conditions based on the determination result. If the disk meets the preset conditions, the second stage of determination begins. The first stage can detect whether the upper-level pressure on the disk is too high, or it can detect whether the disk is a slow disk based on the determination result. It should be noted that the determination result can also be a probability that the disk is a slow disk, i.e., the current disk may be a slow disk. In this case, the second stage of slow disk detection is initiated to diagnose whether the current disk is a slow disk.

[0057] Step S13: If the disk meets the preset conditions, obtain the target time of the target IO and compare the target time with the standard time corresponding to the target IO.

[0058] In this embodiment, after determining whether the disk meets the preset conditions based on the judgment result, if the disk meets the preset conditions, the target I / O time is obtained, and the target time is compared with the standard I / O time corresponding to the target I / O. It is understood that if the disk meets the preset conditions, it indicates that it is impossible to definitively determine whether the disk is slow or not; that is, the current disk may be slow. In this case, it is necessary to proceed to stage two for further slow disk detection. Specifically, the target I / O time is obtained, and the target time is compared with the standard I / O time corresponding to the target I / O. The comparison result between the target time and the standard time determines whether the current disk is slow.

[0059] Step S14: If the target time duration is greater than the standard time duration, then the disk is determined to be a slow disk.

[0060] In this embodiment, after comparing the target latency with the standard latency corresponding to the target I / O, if the target latency is longer than the standard latency, the disk is determined to be a slow disk. It is understood that, since it is impossible to determine whether poor disk performance is due to a slow disk or overload in the prior art, the first stage determines whether the disk is overloaded. If so, there is no need to perform the second stage slow disk detection process. If it is not overloaded, the second stage slow disk detection process is entered, and the disk is determined to be slow based on the comparison result between the target latency and the standard latency. This completes the detection of whether the disk is slow, effectively reducing the problem of false slow disk judgments. Furthermore, it prompts the user to adjust or control the services on the storage system based on the type of problem. For example, if it is overloaded, the user is prompted to adjust or control the services on the storage system, or replace other disks to alleviate the pressure. This simple and convenient approach promotes the coordination of disk performance and service I / O, fully utilizes disk efficiency, and better balances storage services. It should be noted that this solution is implemented in C language and uses IO statistics, disk performance data, and performance limits provided by disk manufacturers to ensure a reasonable range of extracted data and the accuracy of the judgment.

[0061] As can be seen, this application provides a disk detection method, including: obtaining the current read / write count per second of the disk within a preset time period, and determining whether the current read / write count per second is greater than a preset threshold to obtain a judgment result; determining whether the disk meets preset conditions based on the judgment result; if the disk meets the preset conditions, obtaining the target I / O latency and comparing the target latency with the standard latency corresponding to the target I / O; if the target latency is greater than the standard latency, determining that the disk is a slow disk. Therefore, this application determines whether to compare the latency of a target I / O by judging whether the disk meets preset conditions. If the target latency is greater than the standard latency, the disk is determined to be a slow disk, effectively distinguishing disk problems, improving the accuracy of problem judgment, and better balancing the functions of storage services.

[0062] See Figure 2 As shown, this embodiment of the invention discloses a disk detection method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution.

[0063] Step S21: Obtain the current number of read / write operations per second of the disk within a preset time period, and determine whether the current number of read / write operations per second is greater than a preset threshold to obtain a determination result.

[0064] Step S22: If the judgment result is that the current number of read / write operations per second is greater than the preset threshold, then it is directly determined that the disk does not meet the preset condition and that the disk is not a slow disk.

[0065] In this embodiment, it is determined whether the current read / write count per second is greater than a preset threshold. After obtaining the determination result, if the determination result is that the current read / write count per second is greater than the preset threshold, it is directly determined that the disk does not meet the preset condition and that the disk is not a slow disk. It can be understood that if the current preset threshold is 100, then when the current read / write count per second is greater than 100, it can be directly determined that the disk is not a slow disk, and simultaneously, it is determined that the disk does not meet the preset condition. It should be noted that the preset condition is that it is impossible to accurately determine whether the current disk is a slow disk. However, if the current read / write count per second is greater than the preset threshold, it can be accurately determined that the current disk is not a slow disk, therefore the preset condition is not met.

[0066] Step S23: Obtain the total IO queuing time within the second unit time period, and compare the total IO queuing time with the preset standard value of the total IO queuing time.

[0067] In this embodiment, if the judgment result is that the current number of read / write operations per second is greater than the preset threshold, then it is directly determined that the disk does not meet the preset condition. After determining that the disk is not a slow disk, the total IO queuing time within the second unit time is obtained, and the total IO queuing time is compared with the preset standard value of the total IO queuing time. It can be understood that when the current number of read / write operations per second is greater than 100, it is necessary to perform a step to determine whether the pressure is overloaded, that is, to determine whether the pressure is overloaded by the total IO queuing time. Specifically, for example, if the standard waiting time for each IO (i.e., queuing time) is 400ms in advance, and the preset threshold is 100, then the total queuing time for 100 IOs in 1 second under the standard condition can be calculated as 100 * 400ms = 40000ms = 40s, that is, the standard queuing time is 40s. Then, the total IO queuing time for the second unit of time is obtained, that is, the total queuing time for the current 100 IOs is obtained. The total IO queuing time is compared with the standard queuing time of 40 seconds to obtain the corresponding comparison result. If the total IO queuing time is less than or equal to the standard value of the total IO queuing time (i.e., the standard queuing time of 40 seconds), it means that the disk performance is normal, and the second stage of detecting whether the disk is slow is not entered.

[0068] Step S24: If the total IO queuing time is greater than the standard value of the total IO queuing time, it is determined that the upper layer pressure exceeds the preset pressure threshold, and a preset disk adjustment operation is performed.

[0069] In this embodiment, after comparing the total IO queuing time with a preset standard value for the total IO queuing time, if the total IO queuing time is greater than the standard value, it is determined that the upper-layer pressure exceeds a preset pressure threshold, and a preset disk adjustment operation is performed. That is, if the total IO queuing time is greater than 40 seconds, it is considered that the upper-layer pressure is too high (i.e., pressure overload), because the disk performance is normal. Therefore, it is determined that too many IOs are being sent down from the upper layer, resulting in a lot of IO queuing and thus a long queuing time. It can be understood that if the upper-layer pressure is too high, the disk is no longer checked for slow disks, that is, it does not enter stage two, but directly prompts the user to adjust the upper-layer pressure, such as replacing the disk, or adding a high-performance disk such as an SSD (Solid State Drive), or adding an HDD (Hard Disk Drive), etc.

[0070] Step S25: If the disk meets the preset conditions, obtain the target time of the target IO and compare the target time with the standard time corresponding to the target IO.

[0071] Step S26: If the target time duration is greater than the standard time duration, then the disk is determined to be a slow disk.

[0072] For details regarding steps S21, S25, and S26, please refer to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.

[0073] As can be seen, this embodiment of the application obtains the current read / write count per second of the disk within a preset time period and determines whether the current read / write count per second is greater than a preset threshold to obtain a judgment result; if the judgment result is that the current read / write count per second is greater than the preset threshold, then it is directly determined that the disk does not meet the preset condition and that the disk is not a slow disk; the total IO queuing time within a second unit time period is obtained and compared with a preset standard value for the total IO queuing time; if the total IO queuing time is greater than the standard value for the total IO queuing time, then it is determined that the upper-layer pressure exceeds a preset pressure threshold and a preset disk adjustment operation is executed; if the disk meets the preset condition, then the target IO latency is obtained and compared with the standard latency corresponding to the target IO; if the target latency is greater than the standard latency, then it is determined that the disk is a slow disk, effectively distinguishing the problems existing in the disk, improving the accuracy of problem judgment, and better balancing the functions of storage services.

[0074] See Figure 3 As shown, this embodiment of the invention discloses a disk detection method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution.

[0075] Step S31: Obtain the current number of read / write operations per second of the disk within a preset time period, and determine whether the current number of read / write operations per second is greater than a preset threshold to obtain a determination result.

[0076] Step S32: If the judgment result is that the current number of read / write operations per second is less than or equal to the preset threshold, then obtain the total time consumed by the disk in the first unit time, and determine whether the disk meets the preset condition based on the total time consumed.

[0077] In this embodiment, after determining whether the current number of read / write operations per second is greater than a preset threshold, if the determination result is that the current number of read / write operations per second is less than or equal to the preset threshold, the total time consumed by the disk in the first unit of time is obtained, and the disk is determined to meet the preset condition based on the total time consumed. Specifically, the total time consumed is compared with a preset standard value for the total time consumed. If the total time consumed is greater than the preset standard value for the total time consumed, the disk is determined to not meet the preset condition and is identified as a slow disk. If the total time consumed is less than the preset standard value for the total time consumed, the corresponding peak time is obtained. If the peak time consumed does not meet the preset slow disk peak judgment rule, the disk is determined to meet the preset condition. If the peak time consumed meets the preset slow disk peak judgment rule, the disk is determined to not meet the preset condition and is identified as a slow disk.

[0078] Understandably, a pre-calculated standard value for the total time consumption is obtained. For example, if the preset threshold is 100 and the standard value for the time consumption of each I / O operation is 10ms, then the standard value for the total time consumption of 100 I / O operations within 1 second is 100 * 10ms = 1000ms. Then, the total time consumption within the current 1 second is obtained. If the total time consumption is greater than the standard value of 1000ms, the disk is directly determined to be a slow disk. At this point, the disk has been accurately determined to be a slow disk, meaning that the disk does not meet the preset conditions, so there is no need to proceed to stage two. If the total latency is less than the standard value of 1000ms, it's possible that there was no I / O traffic at the beginning, and I / O traffic only started appearing later in the 1 second. For example, the latency might suddenly increase at the last I / O operation. In this case, check the most recent latency peak, i.e., obtain the latency peak within 1 second. If the latency peak does not meet the preset slow disk peak judgment rule, then the disk is determined to meet the preset condition. If the latency peak meets the preset slow disk peak judgment rule, then the disk does not meet the preset condition, and the disk is determined to be a slow disk. For example, if a single I / O operation takes a long time, it does not necessarily mean the disk is slow, but it may be. Observe whether there are consecutive slow I / O operations. If consecutive slow I / O operations meet the preset slow disk peak judgment rule, then the disk does not meet the preset condition, i.e., the disk is a slow disk; if consecutive slow I / O operations do not meet the preset slow disk peak judgment rule, then the disk meets the preset condition, i.e., the disk may be a slow disk.

[0079] Step S33: When the disk meets the preset conditions, send a first OTUR command to the disk.

[0080] In this embodiment, after determining whether the disk meets the preset conditions based on the total time consumed, when the disk meets the preset conditions, a first OTUR (Ordered Test Unit Ready) instruction is sent to the disk. It can be understood that when the disk meets the preset conditions, it enters stage two, first sending the first OTUR instruction to the disk, and then generating and returning the corresponding first OTUR result after processing all current disk I / O.

[0081] Step S34: Upon receiving the first OTUR result, obtain the target IO duration.

[0082] In this embodiment, after sending the first OTUR command to the disk, upon receiving the first OTUR result, the target time for the target IO is obtained. It is understood that when the first OTUR result is received, it indicates that the disk currently has no pending IOs. At this time, a preset number of target IOs are retrieved from the IO queue, and all target IOs are concurrently sent to the disk. Then, a second OTUR command is sent to the disk so that the disk generates a second OTUR result and returns after executing all the target IOs. When the second OTUR result is received, the difference between the IO sending time and the second OTUR result receiving time is calculated to obtain the target time required to execute all the target IOs.

[0083] For example, the first 26 I / Os (the number of I / Os in the disk queue) are selected from the queued I / Os and marked, thus obtaining 26 target I / Os. These 26 target I / Os are then concurrently sent to the disk. After the target I / Os are sent, an OTUR instruction (i.e., the second OTUR instruction) is sent to the disk again. After the disk processes these 26 target I / Os, it generates the second OTUR result and returns it. Then, the difference between the I / O sending time and the second OTUR result receiving time is calculated to obtain the target time required to complete all the target I / Os. This target time is the disk time of this OTUR. It can be understood that the disk time of this OTUR is equal to the disk time of these 26 target I / Os. The disk time is compared with the standard time; if the disk time is longer than the standard time, the disk is determined to be a slow disk.

[0084] Step S35: Calculate the standard time required to execute all the target IOs under the preset standard conditions.

[0085] In this embodiment, the standard time required to complete all the target I / Os under preset standard conditions is calculated. It can be understood that the standard time for 26 target I / Os = (1 + 2 + 3 + ... + 26) * the average disk processing time for a single target I / O. For example, if the IOPS limit is 100 and the average disk processing time for a single target I / O is 10ms, then the total time for these 26 I / Os = 351 * 10ms = 3510ms, i.e., the standard time is 3510ms. It should be noted that the time for the second I / O is the sum of the waiting time for the first I / O and the time for the second I / O itself, and so on.

[0086] Step S36: Compare the target time duration with the standard time duration corresponding to the target IO.

[0087] In this embodiment, after calculating the standard time required to complete all the target I / O operations under preset standard conditions, the target time is compared with the standard time corresponding to the target I / O. If the target time is less than or equal to the standard time (3510ms), the disk is determined not to be a slow disk.

[0088] Step S37: If the target time duration is greater than the standard time duration, then the disk is determined to be a slow disk.

[0089] For details regarding steps S31 and S37, please refer to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.

[0090] As can be seen, this embodiment of the application obtains the current read / write count per second of the disk within a preset time period and determines whether the current read / write count per second is greater than a preset threshold to obtain a judgment result; if the judgment result is that the current read / write count per second is less than or equal to the preset threshold, the total time consumed by the disk in the first unit time period is obtained, and the disk is judged to meet the preset condition based on the total time consumed; when the disk meets the preset condition, a first OTUR instruction is sent to the disk; when the first OTUR result is received, the target time consumption of the target IO is obtained; the standard time consumption required to execute all the target IO under a preset standard condition is calculated; the target time consumption is compared with the standard time consumption corresponding to the target IO; if the target time consumption is greater than the standard time consumption, the disk is determined to be a slow disk, which effectively distinguishes the problems existing in the disk, improves the accuracy of problem judgment, and better balances the functions of storage services.

[0091] See Figure 4 As shown in the figure, this application also discloses a disk detection device, including:

[0092] The first judgment module 11 is used to obtain the current number of read and write operations per second of the disk within a preset time period, and to determine whether the current number of read and write operations per second is greater than a preset threshold, so as to obtain a judgment result;

[0093] The second judgment module 12 is used to determine whether the disk meets the preset conditions based on the judgment result;

[0094] The duration comparison module 13 is used to obtain the target duration of the target IO if the disk meets the preset conditions, and compare the target duration with the standard duration of the target IO.

[0095] The slow disk determination module 14 is used to determine that the disk is a slow disk if the target time duration is greater than the standard time duration.

[0096] As can be seen, this application includes: obtaining the current read / write count per second of the disk within a preset time period, and determining whether the current read / write count per second is greater than a preset threshold to obtain a determination result; determining whether the disk meets a preset condition based on the determination result; if the disk meets the preset condition, obtaining the target duration of the target IO, and comparing the target duration with the standard duration corresponding to the target IO; if the target duration is greater than the standard duration, determining that the disk is a slow disk. Therefore, this application determines whether to compare the duration of the target IO by judging whether the disk meets the preset condition. If the target duration is greater than the standard duration, the disk is determined to be a slow disk, effectively distinguishing disk problems, improving the accuracy of problem judgment, and better balancing the functions of storage services.

[0097] In some specific embodiments, the first determining module 11 specifically includes:

[0098] The first judgment unit is used to obtain the current number of read / write operations per second of the disk within a preset time period, and to determine whether the current number of read / write operations per second is greater than a preset threshold, so as to obtain a judgment result.

[0099] In some specific embodiments, the second determination module 12 specifically includes:

[0100] The first disk determination unit is used to determine that if the determination result is that the current number of read / write operations per second is greater than the preset threshold, the disk does not meet the preset condition and the disk is not a slow disk.

[0101] The queuing time sum acquisition unit is used to obtain the total IO queuing time within the second unit of time.

[0102] The total queuing time comparison unit is used to compare the total IO queuing time with a preset standard value for the total IO queuing time.

[0103] The disk adjustment unit is used to determine that the upper-layer pressure exceeds a preset pressure threshold and to perform a preset disk adjustment operation if the total IO queuing time is greater than the standard value of the total IO queuing time.

[0104] The disk holding unit is configured to hold the disk if the total IO queuing time is less than or equal to a standard value for the total IO queuing time.

[0105] The total time consumption acquisition unit is used to acquire the total time consumption of the disk in the first unit of time if the judgment result is that the current number of read and write operations per second is less than or equal to the preset threshold.

[0106] A time-to-sum comparison unit is used to compare the total time consumption with a preset time-to-sum standard value.

[0107] The second disk determination unit is used to determine that the disk does not meet the preset condition and is a slow disk if the total time consumed is greater than the preset total time consumption standard value.

[0108] The peak time acquisition unit is used to acquire the corresponding peak time if the total time is less than the preset total time standard value.

[0109] The third disk determination unit is used to determine that the disk meets the preset condition if the peak time does not meet the preset slow disk peak determination rule.

[0110] The fourth disk determination unit is used to determine that the disk does not meet the preset condition and is a slow disk if the peak time consumption meets the preset slow disk peak determination rule.

[0111] In some specific embodiments, the duration comparison module 13 specifically includes:

[0112] The first instruction sending unit is configured to send a first OTUR instruction to the disk if the disk meets the preset conditions, so that the disk generates the corresponding first OTUR result and returns it after performing all the IO operations;

[0113] The target IO acquisition unit is used to acquire a preset number of target IOs from the IO queue when the first OTUR result is received;

[0114] The target I / O distribution unit is used to concurrently distribute all the target I / Os to the disk;

[0115] The second instruction sending unit is used to send a second OTUR instruction to the disk so that the disk generates a second OTUR result and returns after executing all the target IO;

[0116] The target time calculation unit is used to calculate the difference between the IO sending time and the second OTUR result receiving time when the second OTUR result is received, so as to obtain the target time required to complete all the target IO.

[0117] The standard time consumption calculation unit is used to calculate the standard time consumption required to execute all the target IO under preset standard conditions;

[0118] The time consumption comparison unit is used to compare the target time consumption with the standard time consumption corresponding to the target IO.

[0119] In some specific embodiments, the slow disk determination module 14 specifically includes:

[0120] The fifth disk determination unit is used to determine that the disk is not a slow disk if the target time is less than or equal to the standard time.

[0121] The sixth disk determination unit is used to determine that the disk is a slow disk if the target time duration is greater than the standard time duration.

[0122] Furthermore, embodiments of this application also provide an electronic device. Figure 5 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.

[0123] Figure 5 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the disk detection method disclosed in any of the foregoing embodiments. Furthermore, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0124] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.

[0125] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0126] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the disk detection method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs capable of performing other specific tasks.

[0127] Furthermore, this application also discloses a storage medium storing a computer program, which, when loaded and executed by a processor, implements the disk detection method steps disclosed in any of the foregoing embodiments.

[0128] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0129] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0130] The disk detection method, apparatus, device, and storage medium provided by the present invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A disk detection method, characterized in that... include: Obtain the current number of read / write operations per second of the disk within a preset time period, and determine whether the current number of read / write operations per second is greater than a preset threshold to obtain a determination result; Based on the judgment result, determine whether the disk meets the preset conditions; If the disk meets the preset conditions, the target time of the target I / O is obtained, and the target time is compared with the standard time corresponding to the target I / O. If the target latency is longer than the standard latency, the disk is determined to be a slow disk. The step of determining whether the disk meets the preset conditions based on the determination result includes: If the determination result is that the current number of read / write operations per second is greater than the preset threshold, then it is directly determined that the disk does not meet the preset condition and that the disk is not a slow disk; If the determination result is that the current read / write count per second is greater than the preset threshold, then directly determine that the disk does not meet the preset condition and determine that the disk is not a slow disk, the method further includes: Get the total IO queuing time in the second unit of time; The total IO queuing time is compared with a preset standard value for the total IO queuing time. If the total IO queuing time is greater than the standard value of the total IO queuing time, it is determined that the upper layer pressure exceeds the preset pressure threshold, and a preset disk adjustment operation is performed; the preset disk adjustment operation includes replacing the disk, adding a high-performance disk, and adding a hard disk drive; If the total IO queuing time is less than or equal to the standard value of the total IO queuing time, then remain unchanged.

2. The disk detection method according to claim 1, characterized in that, The step of determining whether the disk meets the preset conditions based on the determination result includes: If the judgment result is that the current number of read / write operations per second is less than or equal to the preset threshold, then the total time consumed by the disk in the first unit of time is obtained, and the total time consumed is compared with the preset total time consumed standard value; If the total time consumed is greater than the preset total time consumption standard value, then the disk is determined to not meet the preset condition and is determined to be a slow disk; If the total time consumed is less than the preset total time consumption standard value, then the corresponding peak time is obtained; If the peak time does not meet the preset slow disk peak judgment rule, then the disk is determined to meet the preset condition; If the peak time consumption meets the preset slow disk peak judgment rule, then the disk is determined not to meet the preset condition and is determined to be a slow disk.

3. The disk detection method according to claim 1 or 2, characterized in that, Before obtaining the target I / O time, the process also includes: Send a first OTUR instruction to the disk so that the disk generates the corresponding first OTUR result and returns it after performing all IO operations.

4. The disk detection method according to claim 3, characterized in that, If the disk meets the preset conditions, then the target I / O time is obtained, including: When the disk meets the preset conditions and receives the first OTUR result, a preset number of target IOs are obtained from the IO queuing queue, and all target IOs are concurrently sent to the disk; Send a second OTUR instruction to the disk so that the disk generates a second OTUR result and returns after executing all the target IO; When the second OTUR result is received, the difference between the IO sending time and the second OTUR result receiving time is calculated to obtain the target time required to complete all the target IO.

5. The disk detection method according to claim 4, characterized in that, Before comparing the target time duration with the standard time duration corresponding to the target I / O, the method further includes: Calculate the standard time required to execute all the target I / O operations under preset standard conditions; Accordingly, after comparing the target time duration with the standard time duration corresponding to the target I / O, the process further includes: If the target time is less than or equal to the standard time, then the disk is determined not to be a slow disk.

6. A disk detection device, characterized in that, include: The first judgment module is used to obtain the current number of read / write operations per second of the disk within a preset time period, and to determine whether the current number of read / write operations per second is greater than a preset threshold, so as to obtain a judgment result; The second judgment module is used to determine whether the disk meets the preset conditions based on the judgment result; The duration comparison module is used to obtain the target duration of the target IO if the disk meets the preset conditions, and compare the target duration with the standard duration of the target IO. The slow disk determination module is used to determine that the disk is a slow disk if the target time duration is greater than the standard time duration. The second judgment module specifically includes: The first disk determination unit is used to determine that if the determination result is that the current number of read / write operations per second is greater than the preset threshold, the disk does not meet the preset condition and the disk is not a slow disk. The queuing time sum acquisition unit is used to obtain the total IO queuing time within the second unit of time. The total queuing time comparison unit is used to compare the total IO queuing time with a preset standard value for the total IO queuing time. The disk adjustment unit is used to determine that the upper-layer pressure exceeds a preset pressure threshold if the total IO queuing time is greater than the standard value of the total IO queuing time, and to perform a preset disk adjustment operation; the preset disk adjustment operation includes replacing the disk, adding a high-performance disk, and adding a hard disk drive; The disk holding unit is used to hold the disk if the total IO queuing time is less than or equal to a standard value for the total IO queuing time.

7. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the disk detection method as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, Used to store computer programs; wherein, when the computer programs are executed by a processor, they implement the disk detection method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Raid slow disk screening method and device, equipment and medium

    CN110688063A

  • Slow disk detection method, device and equipment and storage medium

    CN112416639A