Slow-disk detection method and apparatus
Abstract
A slow-disk detection method is disclosed, the method includes: periodically performing sampling in a detection period; each time sampling is performed, obtaining a first delay of data reading or writing that is performed on a hard disk in current sampling, and a first-delay-related indicator value; determining a first range to which the first-delay-related indicator value belongs; and if the first range is full, calculating a first ratio of the first delay to an average delay in a range; and each time after one detection period ends and before a next detection period starts, if a quantity of all delay-related indicator values fall within all full ranges is greater than or equal to a second threshold, calculating an average value of first ratios; and if the average value of the first ratios is greater than or equal to a third threshold, determining that the hard disk is a slow disk.
Claims
exact text as granted — not AI-modifiedWhat is claimed is:
1 . A slow-disk detection method, wherein the method comprises:
periodically performing sampling in a detection period, and performing the following method in each sampling period: obtaining a first delay of data reading or writing that is performed on a hard disk in the current sampling period, and a first-delay-related indicator value, wherein the first-delay-related indicator value is a specific value of a delay-related indicator value, and the delay-related indicator value is a delay-varying value; determining a first range to which the first-delay-related indicator value belongs, wherein the first range is one of multiple ranges into which a maximum delay-related indicator value is pre-divided; and if the first range is a full range, calculating a ratio of the first delay to an average delay in a range, to obtain a first ratio, wherein the full range is a range in which a quantity of all delay-related indicator values that are obtained in all sampling periods and that fall within the range reaches a first threshold, the average delay in a range is an average value of multiple second delays in the first range, the multiple second delays are in a one-to-one correspondence with multiple first sampling periods, each second delay is obtained in a sampling period corresponding to the second delay, and each sampling period is corresponding to one delay-related indicator value; and performing the following method each time after one detection period ends and before a next detection period starts: if a quantity of all delay-related indicator values that are obtained in all sampling periods in the current detection period and that fall within all full ranges is greater than or equal to a second threshold, calculating an average value of multiple first ratios that are calculated in multiple second sampling periods, to obtain an average value of first ratios, wherein the multiple second sampling periods are sampling periods in which multiple delay-related indicator values that fall within all the full ranges are obtained; and if the average value of the first ratios is greater than or equal to a third threshold, determining that the hard disk is a slow disk.
2 . The method according to claim 1 , wherein in each sampling period, after the determining a first range to which the first-delay-related indicator value belongs, the method further comprises:
recording, after the current sampling is performed, that the quantity of all delay-related indicator values that are obtained in all sampling periods and that fall within the first range is a first number, wherein each sampling period is corresponding to one delay-related indicator value; determining whether the first number reaches the first threshold; and if the first number reaches the first threshold, determining that the first range is a full range; or if the first number does not reach the first threshold, determining that the first range is not a full range, and proceeding to a next sampling period for sampling.
3 . The method according to claim 1 , wherein
the delay-related indicator value is utilization of the hard disk in data reading or writing; or the delay-related indicator value is a read or write speed of the hard disk in data reading or writing.
4 . The method according to claim 1 , wherein the first threshold is N, the first range is corresponding to N second delays, N is an integer greater than or equal to 1, and before the calculating a ratio of the first delay to an average delay in a range, the method further comprises:
calculating the average value of the multiple second delays of the N second delays, to obtain the average delay in a range.
5 . The method according to claim 4 , wherein
the N second delays are sequentially arranged in a sampling order, the multiple second delays are the first M second delays of the N second delays, M is an integer, N/3≤M≤2N/3, and both N/3 and 2N/3 are rounded to integers.
6 . The method according to claim 5 , wherein M=N/2; and
the multiple second delays are the first N/2 second delays of the N second delays, and N/2 is rounded to an integer.
7 . The method according to claim 1 , wherein
the average value of the multiple second delays is an arithmetic average value of the multiple second delays or a geometric average value of the multiple second delays; and the average value of the multiple first ratios is an arithmetic average value of the multiple first ratios or a geometric average value of the multiple first ratios.
8 . The method according to claim 1 , wherein the method is applied to a scenario in which there are multiple hard disks and is performed on a first hard disk, and the first hard disk is one of the multiple hard disks; the method further comprises:
obtaining multiple average values that are of first ratios and that are in a one-to-one correspondence with other hard disks of the multiple hard disks except the first hard disk, wherein a method for obtaining an average value of first ratios that is corresponding to each of the other hard disks is the same as a method for obtaining an average value of first ratios that is corresponding to the first hard disk; and when an average value of first ratios that is corresponding to each of the multiple hard disks is less than the third threshold, the method further comprises: calculating an average value of multiple average values that are of first ratios and that are in a one-to-one correspondence with the multiple hard disks, to obtain a first average value; calculating a ratio of the average value of the first ratios that is corresponding to each of the multiple hard disks, to the first average value, so as to obtain multiple second ratios; and determining that a hard disk corresponding to a second ratio of the multiple second ratios that is greater than or equal to a fourth threshold is a slow disk.
9 . A slow-disk detection apparatus, wherein the apparatus comprises:
a sampling unit, configured to: periodically perform sampling in a detection period, and complete the following process in each sampling period: obtaining a first delay of data reading or writing that is performed on a hard disk in the current sampling period, and a first-delay-related indicator value, wherein the first-delay-related indicator value is a specific value of a delay-related indicator value, and the delay-related indicator value is a delay-varying value; determining a first range to which the first-delay-related indicator value belongs, wherein the first range is one of multiple ranges into which a maximum delay-related indicator value is pre-divided; and if the first range is a full range, calculating a ratio of the first delay to an average delay in a range, to obtain a first ratio, wherein the full range is a range in which a quantity of all delay-related indicator values that are obtained in all sampling periods and that fall within the range reaches a first threshold, the average delay in a range is an average value of multiple second delays in the first range, the multiple second delays are in a one-to-one correspondence with multiple first sampling periods, each second delay is obtained in a sampling period corresponding to the second delay, and each sampling period is corresponding to one delay-related indicator value; and a detection unit, configured to complete the following process each time after one detection period ends and before a next detection period starts: if a quantity of all delay-related indicator values that are obtained in all sampling periods in the current detection period and that fall within all full ranges is greater than or equal to a second threshold, calculating an average value of multiple first ratios that are calculated by the sampling unit in multiple second sampling periods, to obtain an average value of first ratios, wherein the multiple second sampling periods are sampling periods in which multiple delay-related indicator values that fall within all the full ranges are obtained; and if the average value of the first ratios is greater than or equal to a third threshold, determining that the hard disk is a slow disk.
10 . The apparatus according to claim 9 , wherein
the sampling unit is further configured to: in each sampling period, after determining the first range to which the first-delay-related indicator value belongs, record, after the current sampling is performed, that the quantity of all delay-related indicator values that are obtained in all sampling periods and that fall within the first range is a first number; determine whether the first number reaches the first threshold; and if the first number reaches the first threshold, determine that the first range is a full range; or if the first number does not reach the first threshold, determine that the first range is not a full range, and proceed to a next sampling period for sampling, wherein each sampling period is corresponding to one delay-related indicator value.
11 . The apparatus according to claim 9 , wherein
the delay-related indicator value is utilization of the hard disk in data reading or writing; or the delay-related indicator value is a read or write speed of the hard disk in data reading or writing.
12 . The apparatus according to claim 9 , wherein the first threshold is N, the first range is corresponding to N second delays, and N is an integer greater than or equal to 1; and
the sampling unit is further configured to: before calculating the ratio of the first delay to the average delay in a range, calculate the average value of the multiple second delays of the N second delays, to obtain the average delay in a range.
13 . The apparatus according to claim 12 , wherein
the N second delays are sequentially arranged in a sampling order, the multiple second delays are the first M second delays of the N second delays, M is an integer, N/3≤M≤2N/3, and both N/3 and 2N/3 are rounded to integers.
14 . The apparatus according to claim 13 , wherein M=N/2; and
the multiple second delays are the first N/2 second delays of the N second delays, and N/2 is rounded to an integer.
15 . The apparatus according to claim 9 , wherein
the average value of the multiple second delays that is calculated by the sampling unit is an arithmetic average value of the multiple second delays or a geometric average value of the multiple second delays; and the average value of the multiple first ratios that is calculated by the detection unit is an arithmetic average value of the multiple first ratios or a geometric average value of the multiple first ratios.
16 . The apparatus according to claim 9 , wherein the apparatus is applied to a scenario in which there are multiple hard disks, the apparatus performs detection on a first hard disk, and the first hard disk is one of the multiple hard disks; and
the detection unit is further configured to: obtain multiple average values that are of first ratios and that are in a one-to-one correspondence with other hard disks of the multiple hard disks except the first hard disk; when an average value of first ratios that is corresponding to each of the multiple hard disks is less than the third threshold, calculate an average value of multiple average values that are of first ratios and that are in a one-to-one correspondence with the multiple hard disks, to obtain a first average value; calculate a ratio of the average value of the first ratios that is corresponding to each of the multiple hard disks, to the first average value, so as to obtain multiple second ratios; and determine that a hard disk corresponding to a second ratio of the multiple second ratios that is greater than or equal to a fourth threshold is a slow disk, wherein a method for obtaining an average value of first ratios that is corresponding to each of the other hard disks is the same as a method for obtaining an average value of first ratios that is corresponding to the first hard disk.Join the waitlist — get patent alerts
Track US2018157438A1 — get alerts on status changes and closely related new filings.
We store only your email — no account needed. See our privacy policy.