Hard disk removal method and apparatus, non-volatile readable storage medium, and electronic device
In hard disk detection, the hard disk slowness level is determined based on the response time of operation instructions and the detection results, the problem of misjudgment in the existing technology is solved, and more accurate hard disk removal and system stability are achieved.
Patent Information
- Application Number
- PCT/CN2024/095588
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-01-16
- Filing Date
- 2024-05-27
- Publication Date
- 2025-07-24
AI Technical Summary
In the prior art, by comparing the operation time during the preset period with the preset value, it is detected whether the hard disk is slow. The preset value is often set too large, resulting in errors in the detection result, and it is impossible to accurately determine whether the hard disk needs to be removed.
By determining the response time of the target operation instruction, if the first preset time exceeds the first detection instruction, a first detection instruction is initiated to determine whether the hard disk is a slow disk. If the slow disk standard is met, a second detection instruction is sent to determine the slow level of the hard disk, and finally decide whether to remove the hard disk based on the second detection result.
It realizes a more accurate judgment of whether the hard disk needs to be eliminated, reduces misjudgment, improves the accuracy of hard disk detection and system stability, and reduces maintenance costs caused by hard disk failure.
Smart Images

Figure CN2024095588_24072025_PF_FP_ABST
Abstract
Description
Hard disk removal method and device, non-volatile readable storage medium and electronic device
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to a Chinese patent application filed with the Patent Office of China on January 16, 2024, with application number 202410062569.4 and entitled “Method and device for removing a hard disk, storage medium and electronic device”, the entire contents of which are incorporated herein by reference. Technical Field
[0003] The embodiments of the present application relate to the field of computer hardware, and in particular, to a method and device for removing a hard disk, a non-volatile readable storage medium, and an electronic device. Background Art
[0004] The slow disk detection function ensures storage disk latency. It prevents a single slow disk from degrading the performance of the entire array or even amplifying the latency of the entire stack, leading to host CA asserts (Certificate Authority Assertion, code assertions), hung I / O (a state in which input / output operations are suspended or blocked while waiting for a response), and service interruptions.
[0005] Generally, in order to reduce the impact of slow disks on the read and write performance of a storage system, during the operation of the storage system, the delay of each hard disk in the storage system performing I / O (Input / Output) operations can be monitored in real time to detect whether these hard disks are slow disks. Optionally, taking a hard disk as an example, the average delay of the hard disk performing I / O operations in each first cycle is counted, and the average delay is compared with a preset time threshold. If the average delay is greater than or equal to the time threshold, it is recorded as a threshold event; and the number of threshold events occurring in each second cycle of the hard disk (the second cycle is greater than the first cycle) is counted, and the number is compared with a preset number threshold. If the number is greater than or equal to the preset number threshold, it can be determined that the hard disk is a slow disk. However, in order to avoid the phenomenon of increased average delay when the hard disk reads and writes large data, resulting in detection errors, the time threshold is usually set relatively large, which may reduce the accuracy of detecting slow disks.
[0006] In related fields, when detecting slow disks, the operation time within a preset period is often compared with a preset value to determine whether the hard disk is a slow disk. In order to avoid misjudgment, the preset value is often set too large, resulting in errors in the slow disk detection results, which has not yet been effectively solved.
[0007] Summary of the Invention
[0008] The embodiments of the present application provide a method and device for removing a hard disk, a non-volatile readable storage medium, and an electronic device. When detecting a slow disk, the operation duration within a preset period is often compared with a preset value to determine whether the hard disk is a slow disk. In order to avoid misjudgment, the preset value is often set too large, resulting in the problem that the slow disk detection result is prone to errors.
[0009] According to a first aspect, a method for removing a hard disk is provided, comprising: determining a first response duration corresponding to a target operation instruction; in a case where the first response duration is greater than a first preset duration, initiating a first detection instruction for determining whether the target hard disk is a slow disk to the target hard disk corresponding to the target operation instruction; in a case where a first detection result corresponding to the first detection instruction indicates that the latency index of the target hard disk meets the slow disk standard, sending a second detection instruction for determining the slowness level of the hard disk to the target hard disk; and determining whether to remove the target hard disk based on a second detection result corresponding to the second detection instruction.
[0010] In an exemplary embodiment, when the first response duration is greater than the first preset duration, before initiating a first detection instruction for determining whether the target hard disk is a slow disk to the target hard disk corresponding to the target operation instruction, the method also includes: when it is determined that there are multiple data blocks in the target hard disk, obtaining a second response duration corresponding to the operation instruction in each data block; when it is determined that the instruction attribute corresponding to the target operation instruction is determined, determining the first preset duration corresponding to the target operation instruction according to the instruction attribute, wherein the instruction attribute includes at least one of the following: a read instruction, a write instruction, and the first preset duration includes at least one of the following: a preset read duration, a preset write duration; determining whether to send the first detection instruction based on the second response duration and the first preset duration.
[0011] In an exemplary embodiment, a first detection instruction for determining whether the target hard disk is a slow disk is initiated to the target hard disk corresponding to the target operation instruction, including: copying the first operation data corresponding to the target operation instruction to the verification block corresponding to the target hard disk; sending the first detection instruction to the verification block to determine whether the target hard disk is a slow disk.
[0012] In an exemplary embodiment, after sending a first detection instruction to the check block to determine whether the target hard disk is a slow disk, the method further includes: obtaining the execution result of the check block on the first detection instruction; determining whether the target hard disk is a slow disk based on the execution result, wherein the first detection instruction is used to detect the response efficiency of the first operation data in the check block.
[0013] In an exemplary embodiment, a first detection time period corresponding to a first detection instruction is obtained; if a first execution result indicating that the first detection instruction has passed the detection is not received within the first detection time period, a target execution result corresponding to the first detection instruction that appears within a second detection time period is determined; if the target execution result is the same as the first execution result, the set first detection time period corresponding to the first detection instruction is canceled.
[0014] In an exemplary embodiment, after initiating a first detection instruction for determining whether the target hard disk is a slow disk to the target operation instruction, the method further includes: determining a detection duration of the first detection instruction; when initiating the first detection instruction to the target hard disk, determining all first operation instructions running on the target hard disk; and determining a first detection result corresponding to the first detection instruction based on the first running duration and detection duration corresponding to all the first operation instructions.
[0015] In an exemplary embodiment, before determining the detection result corresponding to the first detection instruction based on the first running time and detection time corresponding to all the first operating instructions, the method also includes: determining the number of instructions of all the first operating instructions; when the number of instructions is greater than a first preset value, allowing the detection result corresponding to the first detection instruction to be determined based on the first running time and detection time, and determining whether the target hard disk is a slow disk based on the detection result; when the number of instructions is less than or equal to the first preset value, prohibiting the determination of the detection result corresponding to the first detection instruction based on the first running time and detection time, and identifying the target hard disk as a slow disk.
[0016] In an exemplary embodiment, a detection result corresponding to the first detection instruction is determined based on the first operating time and detection time corresponding to all the first operating instructions, including: determining the first average operating time corresponding to all the first operating instructions within a first preset time period; if the target conditions are met, determining that the target hard disk is a slow disk, wherein the target conditions are at least one of the following: the detection time is greater than a first preset multiple of the first average operating time; the detection time is greater than a second preset value; the first operating time is greater than a second preset multiple of the first average operating time; the first operating time is greater than a third preset value; if the target conditions are not met, determining that the target hard disk is not a slow disk.
[0017] In an exemplary embodiment, the method also includes: searching for the input and output queue with the longest time from the input and output queues of the target hard disk, wherein the input and output queues include queues that have been sent to the target hard disk, queues with current limiting, and queues for error handling; waiting and counting the time consumed by the input and output queue with the longest time as the first running time, wherein the time consumed includes the sum of the input and output scheduling time and the target hard disk processing time.
[0018] In an exemplary embodiment, before sending a second detection instruction for determining the slowness level of the hard disk to the target hard disk, the method also includes: determining a check block corresponding to the second detection instruction; when performing an initialization operation on the check block to obtain an initial check block, determining all second operation instructions running on the target hard disk, and determining the second running time corresponding to each second operation instruction; sorting the second running times in descending order to obtain a sorting result; determining the second detection instruction based on the target second operation instructions corresponding to the first M second running times in the sorting result, where M is an integer and M>1.
[0019] In an exemplary embodiment, the second detection instruction is determined based on the target second operation instructions corresponding to the first M second running times in the sorting result, including: determining the second detection sub-instruction corresponding to each target second operation instruction to obtain M second detection sub-instructions; and combining the M second detection sub-instructions to obtain the second detection instruction.
[0020] In an exemplary embodiment, before sending a second detection instruction for determining the slowness level of the hard disk to the target hard disk, the method also includes: determining a check block corresponding to the second detection instruction; when performing an initialization operation on the check block to obtain an initial check block, determining an operation set carrying M sub-operation instructions randomly determined from a preset operation instruction library; and determining the second detection instruction based on the operation set.
[0021] In an exemplary embodiment, after sending a second detection instruction for determining the hard disk slowness level to the target hard disk, the method also includes: determining a second average running time of the second detection instruction running on the check block; determining a third average running time corresponding to all first operation instructions within a third preset time period; if the second target condition is met, determining the target hard disk as level one slow, wherein the second target condition includes at least one of the following: the second average running time is greater than the third preset multiple of the third average running time, the second average running time is greater than the fourth preset value, and the third average running time is greater than the fifth preset value; if the second target condition is not met, determining the target hard disk as an alternative level two slow, wherein the hard disk response efficiency corresponding to the level one slow is less than the hard disk response efficiency corresponding to the alternative level two slow.
[0022] In an exemplary embodiment, determining the second average running time of the second detection instruction running on the check block includes: searching for the longest input and output command from the second detection instruction queue and clearing the remaining second detection instructions, wherein the number of the longest input and output commands is less than or equal to 10; waiting and counting the average time consumed by the longest input and output command as the second average running time.
[0023] In an exemplary embodiment, determining the third average running time corresponding to all first operation instructions within a third preset time period includes: sending 10 first detection instructions in sequence, and detecting the average processing time of the target hard disk for processing the 10 first detection instructions as the third average running time, wherein the first detection instructions include a read command and a write command issued in pairs, the read command is used to read the last block of the disk capacity, and the write command is used to write the last block of the disk capacity.
[0024] In an exemplary embodiment, after determining that the target hard disk is an alternative secondary slowness, the method also includes: determining the alternative secondary slowness as the target secondary slowness when a third target condition is met, wherein the third target condition includes at least one of the following: the third average operating length is greater than a sixth preset value, the second average operating length is greater than a fourth preset multiple of the third average operating length, and the third average operating length is greater than a seventh preset value.
[0025] In an exemplary embodiment, after determining whether to remove the target hard disk based on the second detection result corresponding to the second detection instruction, the method also includes: in the case of determining to remove the target hard disk, obtaining hard disk information corresponding to the target hard disk, wherein the hard disk information includes at least one of the following: hard disk model, hard disk location; sending a prompt message carrying the hard disk information to the target object, wherein the prompt message is used to indicate that the target object has determined the hard disk to be removed.
[0026] According to a second aspect, a hard disk removal device is provided, comprising: a determination module, configured to determine a first response duration corresponding to a target operation instruction; a first detection module, configured to initiate a first detection instruction for determining whether the target hard disk is a slow disk to the target hard disk corresponding to the target operation instruction when the first response duration is greater than a first preset duration; a second detection module, configured to send a second detection instruction for determining the slowness level of the hard disk to the target hard disk when a first detection result corresponding to the first detection instruction indicates that the latency index of the target hard disk meets the slow disk standard; and a removal module, configured to determine whether to remove the target hard disk based on a second detection result corresponding to the second detection instruction.
[0027] According to a third aspect, a non-volatile readable storage medium is further 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 running.
[0028] According to a fourth aspect, an electronic device is further provided, comprising a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0029] Through the present application, the first response duration corresponding to the target operation instruction is determined; when the first response duration is greater than the first preset duration, a first detection instruction for determining whether the target hard disk is a slow disk is initiated to the target hard disk corresponding to the target operation instruction; when the first detection result corresponding to the first detection instruction indicates that the latency index of the target hard disk meets the slow disk standard, a second detection instruction for determining the slowness level of the hard disk is sent to the target hard disk; and whether to remove the target hard disk is determined based on the second detection result corresponding to the second detection instruction. Therefore, it can be solved that in the related field, the operation duration within a preset period is often compared with a preset value to determine whether the hard disk is a slow disk. In order to avoid misjudgment, the preset value is often set too large, which makes the slow disk detection result prone to errors and cannot determine whether the hard disk needs to be removed. The effect of determining whether a hard disk needs to be removed by determining the slowness level of the hard disk is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] FIG1 is a hardware structure block diagram of a computer terminal for a method of removing a hard disk according to an embodiment of the present application;
[0031] FIG2 is a flow chart of a method for removing a hard disk according to an embodiment of the present application;
[0032] FIG3 is a schematic diagram of the execution process of the method for removing a hard disk according to an embodiment of the present application;
[0033] FIG4 is a schematic diagram of a slow disk detection triggered by a write instruction in a hard disk removal method according to an embodiment of the present application;
[0034] FIG5 is a structural block diagram of a hard disk removal device according to an embodiment of the present application. DETAILED DESCRIPTION
[0035] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0036] It should be noted that the terms "first", "second", etc. in the description 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.
[0037] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking operation on a computer terminal as an example, FIG1 is a hardware structure block diagram of a computer terminal for a method of removing a hard disk in an embodiment of the present application. As shown in FIG1 , the computer terminal may include one or more (only one is shown in FIG1 ) processors 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 configured to store data, wherein the above-mentioned computer terminal may also include a transmission device 106 and an input / output device 108 configured to have a communication function. It will be understood by those skilled in the art that the structure shown in FIG1 is only for illustration, and it does not limit the structure of the above-mentioned computer terminal. For example, the computer terminal may also include more or fewer components than those shown in FIG1 , or have a configuration different from that shown in FIG1 .
[0038] The memory 104 can be configured to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the load resource allocation method 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, implementing 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 include a memory remotely located relative to the processor 102, and these remote memories may be connected to the computer terminal 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.
[0039] The transmission device 106 is configured to receive or transmit data via a network. The network may include a wireless network provided by the computer terminal's communications provider. In one embodiment, the transmission device 106 includes a network interface controller (NIC) that can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 106 may be a radio frequency (RF) module configured to communicate with the Internet wirelessly.
[0040] FIG2 is a flow chart of a method for removing a hard disk according to an embodiment of the present application. As shown in FIG2 , the flow includes the following steps:
[0041] Step S202, determining the first response time corresponding to the target operation instruction;
[0042] Step S204: When the first response time is longer than the first preset time, a first detection instruction for determining whether the target hard disk is a slow disk is sent to the target hard disk corresponding to the target operation instruction;
[0043] Step S206 , when the first detection result corresponding to the first detection instruction indicates that the latency indicator of the target hard disk meets the slow disk standard, sending a second detection instruction for determining the hard disk slowness level to the target hard disk;
[0044] Step S208 : determining whether to remove the target hard disk according to the second detection result corresponding to the second detection instruction.
[0045] Through the above steps, the first response duration corresponding to the target operation instruction is determined; when the first response duration is greater than the first preset duration, a first detection instruction for determining whether the target hard disk is a slow disk is initiated to the target hard disk corresponding to the target operation instruction; when the first detection result corresponding to the first detection instruction indicates that the latency index of the target hard disk meets the slow disk standard, a second detection instruction for determining the slowness level of the hard disk is sent to the target hard disk; and whether to remove the target hard disk is determined based on the second detection result corresponding to the second detection instruction. Therefore, it can be solved that in the related field, the operation duration within a preset period is often compared with the preset value to determine whether the hard disk is a slow disk. In order to avoid misjudgment, the preset value is often set too large, which makes the slow disk detection result prone to errors and cannot determine whether the hard disk needs to be removed. The effect of determining whether a hard disk needs to be removed by determining the slowness level of the hard disk is achieved.
[0046] In an optional embodiment, the above method can be applied to optimize the slow disk detection logic and detection standards in an MCS (Management Control System) system.
[0047] In an exemplary embodiment, when it is determined that there are multiple data blocks in the target hard disk, the second response duration corresponding to the operation instruction in each data block is obtained; when the instruction attribute corresponding to the target operation instruction is determined, the first preset duration corresponding to the target operation instruction is determined according to the instruction attribute, wherein the instruction attribute includes at least one of the following: a read instruction, a write instruction, and the first preset duration includes at least one of the following: a preset read duration, a preset write duration; and whether to send the first detection instruction is determined according to the second response duration and the first preset duration.
[0048] That is to say, each target hard disk corresponds to multiple data blocks, and different operation instructions are stored in different data blocks. When testing the slow disk, by determining the response time of different operation instructions in each data block, the operation instructions with a response time longer than the first preset time are screened out. Among them, the operation instructions include read instructions and write instructions, and the read instructions and write instructions correspond to different preset time lengths. In the case that the operation instruction is a read instruction, it is determined whether to send the first detection instruction based on the preset read time length and the second response time length. If the second response time length is longer than the preset read time length, the first detection instruction is sent, otherwise it is not sent. In the case that the operation instruction is a write instruction, it is determined whether to send the first detection instruction based on the preset write time length and the second response time length. If the second response time length is longer than the preset write time length, the first detection instruction is sent, otherwise it is not sent.
[0049] In summary, by storing different operating instructions in different data blocks, the hard drive area that needs to be tested can be quickly located, effectively improving detection efficiency. By screening the response time of different operating instructions in each data block, hard drive performance issues can be more accurately judged, reducing false positives and missed reports. Based on the preset durations corresponding to read and write instructions, targeted optimization can be performed to improve the hard drive's read and write performance. By regularly testing and maintaining slow drives, hard drive performance issues can be discovered and resolved in a timely manner, reducing maintenance costs caused by hard drive failures. By testing and maintaining slow drives, the stability of the entire system can be improved, avoiding system crashes or data loss caused by hard drive performance issues.
[0050] In an exemplary embodiment, a first detection instruction for determining whether the target hard disk is a slow disk is initiated to the target hard disk corresponding to the target operation instruction, including: copying the first operation data corresponding to the target operation instruction to the verification block corresponding to the target hard disk; sending the first detection instruction to the verification block to determine whether the target hard disk is a slow disk.
[0051] It should be noted that, in order to prevent the execution of the first test instruction from affecting the normal operation of the operating instruction on the target hard drive, data isolation can be used to move the data to be tested to an isolated area for testing, thereby ensuring the normal operation of the operating instruction. Therefore, the first operating data is copied to the corresponding check block on the target hard drive. The check block is equivalent to the isolation area, which is used to isolate the first operating data to be tested from other operating data running on the target hard drive, while ensuring that the first operating data can still run normally on the target hard drive.
[0052] In an exemplary embodiment, after sending a first detection instruction to the check block to determine whether the target hard disk is a slow disk, the method further includes: obtaining the execution result of the check block on the first detection instruction; determining whether the target hard disk is a slow disk based on the execution result, wherein the first detection instruction is used to detect the response efficiency of the first operation data in the check block.
[0053] That is to say, after the first detection instruction is executed, it can be determined whether the target hard disk is a slow disk based on the execution result of the first detection instruction. Optionally, when the instruction result indicates that the response efficiency of the first operation data in the verification block meets the preset requirements, it is determined that the target hard disk is not a slow disk. When the execution result indicates that the response efficiency of the first operation data in the verification block does not meet the preset requirements, the target hard disk may be a slow disk.
[0054] In an exemplary embodiment, a first detection time period corresponding to a first detection instruction is obtained; if a first execution result indicating that the first detection instruction has passed the detection is not received within the first detection time period, a target execution result corresponding to the first detection instruction that appears within a second detection time period is determined; if the target execution result is the same as the first execution result, the set first detection time period corresponding to the first detection instruction is canceled.
[0055] That is to say, the target hard disk is tested according to the preset test cycle. Even if the first test fails or the first test instruction indicates that the target hard disk is not a slow disk, the target hard disk will continue to be tested according to the preset test cycle until the second test instruction is triggered and the test result corresponding to the second test instruction clearly indicates that there is no slow disk, or that there is a slow disk, then the test of the target hard disk will be stopped. If the test result corresponding to the second test instruction does not clearly indicate that there is no slow disk, or that there is a slow disk, the target hard disk will continue to be tested according to the preset test cycle. In an exemplary embodiment, a 30s timer will start after the slow disk test starts. If the slow disk test fails (normal_slow), the 30s timer will not be canceled, and the slow disk test process of the next cycle will continue. From the second cycle, only Phase (cycle) 2 test will be performed; the CSM (cluster) will cancel the timer only after the check passes (no_slow).
[0056] In an exemplary embodiment, after initiating a first detection instruction for determining whether the target hard disk is a slow disk to the target operation instruction, the method further includes: determining a detection duration of the first detection instruction; when initiating the first detection instruction to the target hard disk, determining all first operation instructions running on the target hard disk; and determining a first detection result corresponding to the first detection instruction based on the first running duration and detection duration corresponding to all the first operation instructions.
[0057] That is, after issuing a first test command to the target hard drive, the first test result is determined based on the test duration of the first test command on the target hard drive and the runtime of all operation commands executed on the target hard drive. It should be noted that the test duration refers to the duration during which the first test command executes the test operation on the target hard drive, which is also equivalent to the duration during which the first test command executes on the target hard drive.
[0058] In an exemplary embodiment, before determining the detection result corresponding to the first detection instruction based on the first running time and detection time corresponding to all the first operating instructions, the method also includes: determining the number of instructions of all the first operating instructions; when the number of instructions is greater than a first preset value, allowing the detection result corresponding to the first detection instruction to be determined based on the first running time and detection time, and determining whether the target hard disk is a slow disk based on the detection result; when the number of instructions is less than or equal to the first preset value, prohibiting the determination of the detection result corresponding to the first detection instruction based on the first running time and detection time, and identifying the target hard disk as a slow disk.
[0059] Optionally, the first preset value can be 0. It should be noted that the first detection instruction will only be triggered when the first response duration is greater than the first preset duration. When the first detection instruction is triggered, it means that a problem has been detected in the target hard disk. If the number of instructions of all first operation instructions is detected to be 0 or less than 0, it means that there are currently no operation instructions running on the target hard disk, that is, the first response duration is greater than the first preset duration and not due to an overload of the target hard disk. Therefore, there is no need to determine the test result corresponding to the first detection instruction based on the first running time and the detection time, and the target hard disk can be directly determined to be a slow disk.
[0060] Optionally, the first preset value may be Z, where Z is an integer not equal to 0. The number of sub-detection instructions carried by the first detection instruction is equal to Z.
[0061] In an exemplary embodiment, a detection result corresponding to the first detection instruction is determined based on the first operating time and detection time corresponding to all the first operating instructions, including: determining the first average operating time corresponding to all the first operating instructions within a first preset time period; if the target conditions are met, determining that the target hard disk is a slow disk, wherein the target conditions are at least one of the following: the detection time is greater than a first preset multiple of the first average operating time; the detection time is greater than a second preset value; the first operating time is greater than a second preset multiple of the first average operating time; the first operating time is greater than a third preset value; if the target conditions are not met, determining that the target hard disk is not a slow disk.
[0062] In an optional embodiment, the above steps are implemented in the following manner:
[0063] Step 1: Send an OTUR (Ordered Test Unit Ready) command (equivalent to the first detection command); count the time it takes for the command to be processed on the disk.
[0064] Step 2: Find the longest I / O in the MCS I / O queue (including all queues, including those sent to the disk, those undergoing rate limiting, and those undergoing error handling). Wait and calculate the duration of this longest I / O. This duration includes the MCS I / O scheduling time (VL (virtual layer) processing time) and the disk processing time.
[0065] After executing steps 1 and 2 above, it is determined whether the target hard disk is a slow disk according to a first target condition, wherein the first target condition includes at least one of the following:
[0066] 1. The OTUR time is more than twice the average processing time in the last 5-10 minutes (the average time for disk processing);
[0067] 2. The longest I / O duration is greater than twice the average processing time in the last 5-10 minutes (MCS I / O scheduling time + total average disk processing time);
[0068] 3. The OTUR time is greater than 500ms;
[0069] 4. The longest I / O duration is greater than 1200ms.
[0070] It should be noted that the above steps are to preliminarily confirm whether the disk is really taking a long time at the current moment from the perspective of business use (without paying attention to the impact of the disk's own load on the result).
[0071] The principle of OTUR is to wait until all I / Os in the disk queue are processed before processing the instruction. Therefore, OTUR is used to confirm the current pressure situation of the disk, that is, to estimate the maximum possible time required for a new I / O to be sent to the disk at the current moment.
[0072] The longest I / O duration statistics, including the MCS I / O scheduling time and disk processing time, are used to determine I / O pressure on the MCS. Specifically, they estimate the maximum possible duration of an I / O operation issued by the current RAID (Redundant Array of Independent Disks). In other words, the target drive's performance is measured based on the completion status of the longest and most recent instructions executed on the target drive.
[0073] The judgment criteria take into account both the business I / O load statistical time and the fixed time threshold. Twice the 5-10 minute average statistical time is highly consistent with the business load, and the latency meets the current detection standard. The longest I / O fixed threshold of 1200ms is derived from the raid I / O timeout standard. In extreme cases, a timeout of 600ms may occur, leaving a 1x fluctuation space.
[0074] In an exemplary embodiment, before sending a second detection instruction for determining the slowness level of the hard disk to the target hard disk, the method also includes: determining a check block corresponding to the second detection instruction; when performing an initialization operation on the check block to obtain an initial check block, determining all second operation instructions running on the target hard disk, and determining the second running time corresponding to each second operation instruction; sorting the second running times in descending order to obtain a sorting result; determining the second detection instruction based on the target second operation instructions corresponding to the first M second running times in the sorting result, where M is an integer and M>1.
[0075] In other words, the second detection instruction is an operation instruction set including multiple sub-detection instructions. By sorting the execution time of the operation instructions running on the target hard disk, the operation instructions with the first M execution time are selected as the sub-operation instructions constituting the second detection instruction. In other words, the M "longest" operation instructions are selected from the target hard disk as the sub-operation instructions constituting the second detection instruction.
[0076] In an exemplary embodiment, the second detection instruction may be obtained by matching the target hard drive's attributes from a preset instruction database. Optionally, a preset database is established, containing various hard drive attributes and corresponding test instructions. This database may be a table or a dictionary, in which each hard drive attribute corresponds to a set of test instructions.
[0077] When the response efficiency of a target hard disk needs to be tested, the attribute information of the hard disk is first obtained, including the brand, model, capacity, rotation speed, etc.
[0078] We then match these attributes against a pre-defined database to find the best matching set of test instructions. The matching method can be string matching, fuzzy matching, etc., depending on the actual application requirements.
[0079] Finally, execute this set of test commands to test the hard drive's response efficiency. The test results can be used to evaluate the hard drive's performance and determine whether it needs to be optimized or replaced.
[0080] It should be noted that in actual applications, hard drive attribute information can be very complex, and there are significant differences between different brands and models of hard drives. Therefore, to improve matching accuracy and efficiency, other technical methods can be used, such as machine learning algorithms and neural networks. These technologies allow the system to automatically learn and identify various hard drive attribute characteristics, thereby more accurately matching the most suitable test instructions.
[0081] In an exemplary embodiment, the second detection instruction is determined based on the target second operation instructions corresponding to the first M second running times in the sorting result, including: determining the second detection sub-instruction corresponding to each target second operation instruction to obtain M second detection sub-instructions; and combining the M second detection sub-instructions to obtain the second detection instruction.
[0082] In an exemplary embodiment, before sending a second detection instruction for determining the slowness level of the hard disk to the target hard disk, the method also includes: determining a check block corresponding to the second detection instruction; when performing an initialization operation on the check block to obtain an initial check block, determining an operation set carrying M sub-operation instructions randomly determined from a preset operation instruction library; and determining the second detection instruction based on the operation set.
[0083] In other words, before sending the second detection instruction, the corresponding check block (i.e., the isolation zone) must be determined. To ensure that the check block does not include residual instructions from the first detection instruction during the verification process, it is necessary to initialize the check block to ensure that it is not affected by other instructions during the current verification process. Once the check block is initialized, the second detection instruction is determined based on the operation set.
[0084] In an exemplary embodiment, after sending a second detection instruction for determining the hard disk slowness level to the target hard disk, the method also includes: determining a second average running time of the second detection instruction running on the check block; determining a third average running time corresponding to all first operation instructions within a third preset time period; if the second target condition is met, determining the target hard disk as level one slow, wherein the second target condition includes at least one of the following: the second average running time is greater than the third preset multiple of the third average running time, the second average running time is greater than the fourth preset value, and the third average running time is greater than the fifth preset value; if the second target condition is not met, determining the target hard disk as an alternative level two slow, wherein the hard disk response efficiency corresponding to the level one slow is less than the hard disk response efficiency corresponding to the alternative level two slow.
[0085] In an optional embodiment, the above steps are implemented in the following manner:
[0086] Disk initialization process. If initialization is currently in progress, retry initialization after 2 seconds. After initialization is completed, check up to 10 longest I / O commands from the receive Q queue, then clear the remaining receive Qs, wait and count the time taken for these I / Os. Send the OTUR (Ordered Test Unit Ready) command. Send a read command to read the last block of the disk capacity, with a length of 1 block size (data block size). Count the disk processing time for this command. Send a write command to write the last block of the disk capacity, with a length of 1 block size. Count the disk processing time for this command. Send the Send diagnostic command.
[0087] The number of read and write operations (a read and a write operation are counted as one, and read and write operations are sent in pairs) is fixed at 10. If the number of I / O operations on receive Q is less than 10, 10 read / write pairs are fixedly sent.
[0088] The second target condition includes at least one of the following:
[0089] The average disk processing time for read and write command internal tests (referring to the target hard disk) is greater than five times the average disk processing time in the last 5-10 minutes and exceeds 50ms.
[0090] The average disk I / O processing time in the second detection instruction is greater than 5 times the average disk processing time in the last 5-10 minutes and exceeds 200ms;
[0091] The average disk processing time of the internal test (referring to the target hard disk) for read and write instructions exceeds 200ms;
[0092] The average disk processing time of I / O in the second detection instruction exceeds 500ms;
[0093] The average disk processing time in the last 5-10 minutes exceeds 500ms.
[0094] In an exemplary embodiment, after determining that the target hard disk is an alternative secondary slowness, the method also includes: determining the alternative secondary slowness as the target secondary slowness when a third target condition is met, wherein the third target condition includes at least one of the following: the third average operating length is greater than a sixth preset value, the second average operating length is greater than a fourth preset multiple of the third average operating length, and the third average operating length is greater than a seventh preset value.
[0095] In an optional embodiment, the third target condition includes at least one of the following:
[0096] The average disk processing time for read and write internal test I / O is greater than 10ms;
[0097] The average disk processing time for I / O in receive Q (second detection instruction) is greater than twice the average disk processing time in the last 5-10 minutes;
[0098] The average disk processing time is 5-10 minutes, which exceeds 110ms.
[0099] In an exemplary embodiment, after determining whether to remove the target hard disk based on the second detection result corresponding to the second detection instruction, the method also includes: in the case of determining to remove the target hard disk, obtaining hard disk information corresponding to the target hard disk, wherein the hard disk information includes at least one of the following: hard disk model, hard disk location; sending a prompt message carrying the hard disk information to the target object, wherein the prompt message is used to indicate that the target object has determined the hard disk to be removed.
[0100] It should be noted that, if it is determined that the target hard disk needs to be removed, a prompt message can be sent to the target object so that the target object can more quickly determine the target hard disk to be removed based on the hard disk information. The hard disk location can be the location of the target hard disk in the system, or the terminal to which the target hard disk corresponds or the location where the target hard disk is installed in the terminal.
[0101] It should be noted that all of the aforementioned preset values and multiples can be determined through the use of a benchmark, a measurement or evaluation standard that uses a standardized dataset, conducts experiments in a prescribed manner, and measures the results using specific metrics. Such benchmarks can clearly demonstrate the performance strengths and weaknesses of different computer systems or software, allowing for appropriate optimization or trade-offs.
[0102] In an exemplary embodiment, the above steps may also be implemented in the following manner, which is described below in conjunction with FIG3 , which is a schematic diagram of the execution process of the hard disk removal method according to an embodiment of the present application. Optionally:
[0103] First, it's important to note that the above method can be applied to optimize the slow disk detection logic and criteria within the MCS system. This optimization focuses on performance statistics, aligning latency statistics with load variations and making them more reasonable. It also eliminates detection bias caused by the background task "send diag" (a command used for testing and diagnostics) impacting foreground I / O. Furthermore, it eliminates time-consuming operations such as disk reads during the write I / O statistics cycle, improving the accuracy of the judgment criteria.
[0104] The slow disk detection function is divided into two parts: timeout trigger (the first response duration is longer than the first preset duration) and detection process (equivalent to issuing the first detection instruction and the second detection instruction). After the RAID (combining multiple independent hard disks to form a large disk system) module service I / O timeout, the slow disk service is isolated and the VL module is notified. After receiving the detection request, the VL module executes the phase 1 / phase 2 two-stage detection process. If the detection passes, the disk service is restored; otherwise, the problem disk is kicked out.
[0105] The I / O timeout judgment standard, slow disk detection standard, and hard disk latency requirements are interrelated. If the disk latency performance is inconsistent with the software standard, the detection will be triggered, the detection will fail, or it will be misjudged.
[0106] MCS slow disk detection is triggered by RAID service I / O timeout. When the RAID read I / O exceeds the 512ms or write I / O exceeds the 5s threshold, the VL will be notified. During the subsequent detection window, all service I / O access to the disk will be suspended and two phases of slow disk detection will be performed.
[0107] The VL disk management layer adds debug information to each I / O to capture and analyze the actual execution behavior of the I / O.
[0108] Debug information (check and modify information) includes:
[0109] Disk information (ID, slow disk flag);
[0110] I / O attributes (operation type, LBA (Logical Block Addressing, a common data block description mechanism for computer storage devices), length, status, number of retransmissions, and number of retries);
[0111] Receiving information (number, receiving time);
[0112] Write secondary queue information (queue number, write I / O quantity, queue time);
[0113] First-level queue information (queue number, queue I / O quantity, queue time);
[0114] Execution information (execution number, execution I / O quantity, execution time);
[0115] Completion information (number);
[0116] There are two types of RD (Route Distinguisher) slow disk detection: one is for slow disk caused by read I / O timeout, and the other is for CID slow disk caused by write I / O timeout:
[0117] Slow disk is a RAID feature designed to optimize RD read performance. If a block in a read I / O is processed slowly, RAID will mark the disk as a slow disk and directly reconstruct the data block through reconstruction read and return it to the user, preventing slow I / O processing caused by reading the disk.
[0118] CID stands for Component in Doubt. This is a RD feature designed to optimize write I / O performance. If a block in a write I / O is processing very slowly, RD will not wait for the block to complete. Instead, it will mark the disk as CID. Once VL detects that the disk is no longer slow, it will use the checksum data to reconstruct the block.
[0119] Conditions for RD to trigger slow disk detection:
[0120] Slow disk detection is triggered by Raid I / O timeouts. Read I / O timeouts of 512ms and write I / O timeouts of 5s will trigger the detection.
[0121] RD read I / O triggers slow disk detection:
[0122] During the read process, the RD (Route Identifier) divides the read I / O data length into multiple stripes, and each stripe is divided into multiple blocks. After the RD initiates a read I / O operation for a stripe or block, it records the response time for each disk's read CID. If the read times out, the block's status is set to BADSTRIP_SLOW. Whether to report a slow disk requires the following conditions to be met:
[0123] This drive is a SLOW / CID disk, or there is no other SLOW / CID disk in the system.
[0124] The read response time of the current block is 600ms longer than that of other blocks;
[0125] After reporting the slow disk, the I / O time is checked, the READ ERP process is initiated, and the I / O process continues. The agent notifies the CSM of the member change through the UTAR (Universal Asynchronous Receiver / Transmitter). The CSM modifies the UTOD (Universal Timed Observational Deterministic) state machine to notify the VL to initiate slow disk detection.
[0126] 1. RD (Raid layer) does not have Q (Queue), and it is directly sent to VL when it arrives.
[0127] 2. Only when LBA+length overlaps will the packet wait for the previous I / O to return from the VL before sending it down.
[0128] For read timeouts: you can wait for the I / O to return, and calculate by reading data on other disks to calculate the content of the read I / O, reply to the upper layer, and pass it to the cache.
[0129] The following description is made in conjunction with FIG4 , which is a schematic diagram of a write instruction triggering slow disk detection in a hard disk removal method according to an embodiment of the present application. Optionally:
[0130] The write process includes full write, uppercase write, and lowercase write. The mechanism for triggering a slow disk is the same. Here, the lowercase write process is used as an example.
[0131] The IPK (Identity-based Public Key) for the data and checksum (P, Q) blocks is added to the linked list Ipk->IPK_Timeout. At this point, the write operation has not yet been initiated, and all components are likely slow, so the IPK status is updated to R6_CID_Candidate. Then, the write operation for the data and checksum blocks is initiated. After the write is complete, the CID status of the blocks is set to R6_CID_Done and removed from the Ipk->IPK_Timeout chain. Check if there is a last remaining IPK that has not been completed.
[0132] If the last LastIpk is unfinished, the CID status of the ipk is set to R6_CID_Timing (time), and a timer is started. The timeout threshold is the remaining time (i.e., 5 seconds minus the elapsed Ipk time). If the LastIpk times out, the CID status of the LastIpk is changed to R6_CID_Committing (committing), and an asynchronous task is initiated to report the CID slow disk. Initiating a CID slow disk requires the following conditions to be met simultaneously. Otherwise, the CID disk is temporarily blocked through Rd6_CID_Block (block).
[0133] If the disk is set to SLOW, the corresponding block in SDE is set to R6_BADSTRIP_SLOW. In the write process, the CID state is changed from R6_CID_Candidate to R6_CID_PredictSlow through Rd6_CID_PredictSlow (predict slow).
[0134] When the CID status of LastIpk is R6_CID_PredictSlow, since the strict read timeout condition of 600ms has already occurred, the asynchronous task is directly set to start to report the CID slow disk without waiting for the 5-second timeout.
[0135] Through the above methods, we focused on optimizing performance statistics, making latency statistics more reasonable and consistent with load variations. We also eliminated detection bias caused by the background task of sending diags to disks affecting foreground I / O, eliminating detection bias caused by the background task of detecting slow disks. Furthermore, we eliminated time-consuming operations such as disk reads from the write I / O statistics cycle, improving the accuracy of the judgment criteria.
[0136] This embodiment also provides a hard drive removal device configured to implement the aforementioned embodiments and alternative implementations. Details already described will not be repeated. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.
[0137] FIG5 is a block diagram of a hard disk removal device according to an embodiment of the present application. As shown in FIG5 , the device includes:
[0138] A determination module 52 is configured to determine a first response time corresponding to a target operation instruction;
[0139] The first detection module 54 is configured to initiate a first detection instruction to the target hard disk corresponding to the target operation instruction to determine whether the target hard disk is a slow disk when the first response time is longer than a first preset time;
[0140] The second detection module 56 is configured to send a second detection instruction for determining a hard disk slowness level to the target hard disk when the first detection result corresponding to the first detection instruction indicates that the latency indicator of the target hard disk meets the slow disk standard;
[0141] The removal module 58 is configured to determine whether to remove the target hard disk according to a second detection result corresponding to the second detection instruction.
[0142] Through the above-mentioned device, the first response duration corresponding to the target operation instruction is determined; when the first response duration is greater than the first preset duration, a first detection instruction for determining whether the target hard disk is a slow disk is initiated to the target hard disk corresponding to the target operation instruction; when the first detection result corresponding to the first detection instruction indicates that the latency index of the target hard disk meets the slow disk standard, a second detection instruction for determining the slowness level of the hard disk is sent to the target hard disk; and whether to remove the target hard disk is determined based on the second detection result corresponding to the second detection instruction. Therefore, it can be solved that in the related field, the operation duration within a preset period is often compared with the preset value to determine whether the hard disk is a slow disk. In order to avoid misjudgment, the preset value is often set too large, which makes the slow disk detection result prone to errors and cannot determine whether the hard disk needs to be removed. The effect of determining whether a hard disk needs to be removed by determining the slowness level of the hard disk is achieved.
[0143] In an exemplary embodiment, the first detection module 54 is also configured to: when it is determined that there are multiple data blocks in the target hard disk, obtain the second response duration corresponding to the operation instruction in each data block; when it is determined that the instruction attribute corresponding to the target operation instruction is determined, determine the first preset duration corresponding to the target operation instruction according to the instruction attribute, wherein the instruction attribute includes at least one of the following: a read instruction, a write instruction, and the first preset duration includes at least one of the following: a preset read duration, a preset write duration; determine whether to send the first detection instruction based on the second response duration and the first preset duration.
[0144] In an exemplary embodiment, the first detection module 54 is further configured to copy the first operation data corresponding to the target operation instruction to a check block corresponding to the target hard disk; and send a first detection instruction to the check block to determine whether the target hard disk is a slow disk.
[0145] In an exemplary embodiment, the first detection module 54 is also configured to obtain the execution result of the check block on the first detection instruction; determine whether the target hard disk is a slow disk based on the execution result, wherein the first detection instruction is used to detect the response efficiency of the first operation data in the check block.
[0146] In an exemplary embodiment, the first detection module 54 is also configured to obtain a first detection time period corresponding to the first detection instruction; if the first execution result corresponding to the first detection instruction is not received within the first detection time period, the target execution result corresponding to the first detection instruction that appears within the second detection time period is determined; if the target execution result is the same as the first execution result, the first detection time period corresponding to the set first detection instruction is canceled.
[0147] In an exemplary embodiment, the first detection module 54 is also configured to determine the detection duration of the first detection instruction; when the first detection instruction is initiated to the target hard disk, all first operation instructions running on the target hard disk are determined; and the first detection result corresponding to the first detection instruction is determined based on the first running duration and detection duration corresponding to all the first operation instructions.
[0148] In an exemplary embodiment, the first detection module 54 is also configured to determine the number of instructions of all first operation instructions; when the number of instructions is greater than a first preset value, it is allowed to determine the detection result corresponding to the first detection instruction based on the first running time and the detection time, and determine whether the target hard disk is a slow disk based on the detection result; when the number of instructions is less than or equal to the first preset value, it is prohibited to determine the detection result corresponding to the first detection instruction based on the first running time and the detection time, and the target hard disk is identified as a slow disk.
[0149] In an exemplary embodiment, the first detection module 54 is also configured to determine a first average operating time corresponding to all first operation instructions within a first preset time period; if the first target condition is met, the target hard disk is determined to be a slow disk, wherein the first target condition includes at least one of the following: the detection time is greater than a first preset multiple of the first average operating time, the detection time is greater than a second preset value, the first operating time is greater than a second preset multiple of the first average operating time, and the first operating time is greater than a third preset value; if the first target condition is not met, the target hard disk is determined not to be a slow disk.
[0150] In an exemplary embodiment, the second detection module 56 is further configured to determine a check block corresponding to the second detection instruction; when the check block is initialized to obtain an initial check block, all second operation instructions running on the target hard disk are determined, and the second running time corresponding to each second operation instruction is determined; the second running times are sorted in descending order to obtain a sorting result; and the second detection instruction is determined based on the target second operation instructions corresponding to the first M second running times in the sorting result, where M is an integer and M>1.
[0151] In an exemplary embodiment, the second detection module 56 is further configured to determine a second detection sub-instruction corresponding to each target second operation instruction to obtain M second detection sub-instructions; and combine the M second detection sub-instructions to obtain a second detection instruction.
[0152] In an exemplary embodiment, the second detection module 56 is also configured to determine a check block corresponding to the second detection instruction; when an initial check block is initialized to obtain an initial check block, an operation set carrying M sub-operation instructions randomly determined from a preset operation instruction library is determined; and the second detection instruction is determined based on the operation set.
[0153] In an exemplary embodiment, the second detection module 56 is also configured to determine the second average running time of the second detection instruction running on the verification block; determine the third average running time corresponding to all the first operation instructions within a third preset time period; and determine the target hard disk as level one slow when the second target condition is met, wherein the second target condition includes at least one of the following: the second average running time is greater than the third preset multiple of the third average running time, the second average running time is greater than the fourth preset value, and the third average running time is greater than the fifth preset value; and determine the target hard disk as an alternative level two slow when the second target condition is not met, wherein the hard disk response efficiency corresponding to the level one slowness is less than the hard disk response efficiency corresponding to the alternative level two slowness.
[0154] In an exemplary embodiment, the second detection module 56 is further configured to determine the alternative secondary slowness as the target secondary slowness when a third target condition is met, wherein the third target condition includes at least one of the following: the third average operating time is greater than a sixth preset value, the second average operating time is greater than a fourth preset multiple of the third average operating time, and the third average operating time is greater than a seventh preset value.
[0155] In an exemplary embodiment, the removal module 58 is also configured to obtain hard disk information corresponding to the target hard disk when it is determined to remove the target hard disk, wherein the hard disk information includes at least one of the following: hard disk model, hard disk location; and send a prompt message carrying the hard disk information to the target object, wherein the prompt message is used to indicate that the target object has determined the hard disk to be removed.
[0156] In an exemplary embodiment, the non-volatile readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0157] An embodiment of the present application further provides an electronic device, comprising 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.
[0158] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0159] For optional examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementations, and this embodiment will not be described in detail here.
[0160] Obviously, those skilled in the art should understand that the modules or steps of the present application described above can be implemented using a general-purpose computing device, they can be concentrated on a single computing device, or distributed across a network composed of multiple computing devices, they can be implemented using program code executable by the computing device, and thus, they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be performed in a different order than herein, or they can be fabricated into separate integrated circuit modules, or multiple modules or steps can be fabricated into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0161] The above are merely optional embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may be subject to various modifications and variations. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A method for removing a hard disk, characterized in that, Including: Determine a first response duration corresponding to a target operation instruction; When the first response duration is greater than a first preset duration, send a first detection instruction for determining whether the target hard disk is a slow hard disk to the target hard disk corresponding to the target operation instruction; When a first detection result corresponding to the first detection instruction indicates that a latency index of the target hard disk meets the slow hard disk standard, send a second detection instruction for determining a hard disk slow level to the target hard disk; Determine whether to remove the target hard disk according to a second detection result corresponding to the second detection instruction.
2. The method according to claim 1, wherein Before determining the first response duration corresponding to the target operation instruction, the method further includes: When it is determined that there are multiple data blocks in the target hard disk, obtain a second response duration corresponding to the target operation instruction in each data block; When determining an instruction attribute of the target operation instruction, determine a first preset duration corresponding to the target operation instruction according to the instruction attribute, where the instruction attribute includes at least one of the following at least: read instruction, write instruction, and the first preset duration includes at least one of the following: preset read duration, preset write duration; Determine whether to send the first detection instruction according to the second response duration and the first preset duration.
3. The method according to claim 1, wherein Sending a first detection instruction for determining whether the target hard disk is a slow hard disk to the target hard disk corresponding to the target operation instruction includes: Copy first operation data corresponding to the target operation instruction to a check block corresponding to the target hard disk; Send the first detection instruction for determining whether the target hard disk is a slow hard disk to the check block.
4. The method according to claim 3, wherein After sending the first detection instruction for determining whether the target hard disk is a slow hard disk to the check block, the method further includes: Obtain an execution result of the check block for the first detection instruction; Determine whether the target hard disk is a slow hard disk according to the execution result, where the first detection instruction is used to detect a response efficiency of the first operation data in the check block.
5. The method according to claim 4, wherein The method further includes: Obtain a first detection time period corresponding to the first detection instruction; When a first execution result indicating that the first detection instruction passes the detection is not received within the first detection time period, determine a target execution result corresponding to the first detection instruction that appears within a second detection time period; When the target execution result is the same as the first execution result, cancel the first detection time period set for the first detection instruction.
6. The method according to claim 1, characterized in that, After sending a first detection instruction for determining whether the target hard disk is a slow hard disk to the target hard disk corresponding to the target operation instruction, the method further includes: Determine a detection duration of the first detection instruction; When sending the first detection instruction to the target hard disk, determine all first operation instructions running on the target hard disk; Determine a first detection result corresponding to the first detection instruction according to a first running duration corresponding to all the first operation instructions and the detection duration.
7. The method according to claim 6, characterized in that, Before determining the first detection result corresponding to the first detection instruction according to the first running duration corresponding to all the first operation instructions and the detection duration, the method further includes: Determine the number of instructions of all the first operation instructions; When the number of instructions is greater than a first preset value, allow determining the first detection result corresponding to the first detection instruction according to the first running duration and the detection duration, and determine whether the target hard disk is a slow disk according to the first detection result; When the number of instructions is less than or equal to the first preset value, prohibit determining the first detection result corresponding to the first detection instruction according to the first running duration and the detection duration, and mark the target hard disk as a slow disk.
8. The method according to claim 6, characterized in that, Determining the first detection result corresponding to the first detection instruction according to the first running duration corresponding to all the first operation instructions and the detection duration includes: Determine the first average running duration corresponding to all the first operation instructions within a first preset time period; When meeting a first target condition, determine the target hard disk as a slow disk, where the first target condition includes at least one of the following: the detection duration is greater than a first preset multiple of the first average running duration, the detection duration is greater than a second preset value, the first running duration is greater than a second preset multiple of the first average running duration, the first running duration is greater than a third preset value; When not meeting the first target condition, determine that the target hard disk is not a slow disk.
9. The method according to claim 8, wherein The method further includes: Find the input / output queue with the longest time in the input / output queue of the target hard disk, where the input / output queue includes the queue that has been sent to the target hard disk, the rate-limiting queue, and the error handling queue; Wait for and count the time consumption of the input / output queue with the longest time as the first running duration, where the time consumption includes the sum of the input / output scheduling time and the target hard disk processing time.
10. The method according to claim 1, wherein Before sending a second detection instruction for determining the hard disk slow level to the target hard disk, the method further includes: Determine the check block corresponding to the second detection instruction; When performing an initialization operation on the check block to obtain an initial check block, determine all the second operation instructions running on the target hard disk, and determine the second running duration corresponding to each second operation instruction; Sort the second running durations in descending order to obtain a sorting result; Determine the second detection instruction according to the target second operation instructions corresponding to the first M second running durations in the sorting result, where M is an integer and M>1.
11. The method according to claim 10, wherein Determining the second detection instruction according to the target second operation instructions corresponding to the first M second running durations in the sorting result includes: Determine the second detection sub-instructions corresponding to each of the target second operation instructions to obtain M second detection sub-instructions; Combine the M second detection sub-instructions to obtain the second detection instruction.
12. The method according to claim 1, wherein Before sending a second detection instruction for determining the hard disk slow level to the target hard disk, the method further includes: Determine the check block corresponding to the second detection instruction; When initializing the verification block to obtain an initial verification block, determine an operation set carrying M sub-operation instructions randomly determined from a preset operation instruction library; Determine the second detection instruction according to the operation set.
13. The method according to claim 10 or 12, characterized in that, After sending the second detection instruction for determining the hard disk slow level to the target hard disk, the method further includes: Determine the second average running duration of the second detection instruction running on the verification block; Determine the third average running duration corresponding to all the first operation instructions within a third preset time period; When meeting the second target condition, determine that the target hard disk is at the first level of slowness, where the second target condition includes at least one of the following: the second average running duration is greater than a third preset multiple of the third average running duration, the second average running duration is greater than a fourth preset value, and the third average running duration is greater than a fifth preset value; When not meeting the second target condition, determine that the target hard disk is an alternative second-level slow, where the hard disk response efficiency corresponding to the first-level slow is less than the hard disk response efficiency corresponding to the alternative second-level slow.
14. The method according to claim 13, characterized in that, Determining the second average running duration of the second detection instruction running on the verification block includes: Search for the oldest input / output command from the second detection instruction queue and clear the remaining second detection instructions, where the number of the oldest input / output commands is less than or equal to 10; Wait and count the average time consumption of the oldest input / output command as the second average running duration.
15. The method according to claim 13, wherein Determining the third average running duration corresponding to all the first operation instructions within a third preset time period includes: Send 10 first detection instructions in sequence and detect the average processing time of the target hard disk for processing the 10 first detection instructions as the third average running duration, where the first detection instruction includes a paired read command and write command, the read command is used to read the last block of the disk capacity, and the write command is used to write the last block of the disk capacity.
16. The method according to claim 13, wherein After determining that the target hard disk is an alternative second-level slow, the method further includes: When meeting the third target condition, determine the alternative second-level slow as the target second-level slow, where the third target condition includes at least one of the following: the third average running duration is greater than a sixth preset value, the second average running duration is greater than a fourth preset multiple of the third average running duration, and the third average running duration is greater than a seventh preset value.
17. The method according to claim 1, wherein After determining whether to remove the target hard disk according to the second detection result corresponding to the second detection instruction, the method further includes: When determining to remove the target hard disk, obtain the hard disk information corresponding to the target hard disk, where the hard disk information includes at least one of the following: hard disk model, hard disk location; Send a prompt message carrying the hard disk information to the target object, where the prompt message is used to instruct the target object to determine the hard disk to be removed.
18. A removal device for a hard disk, characterized in that, Includes: A determination module, configured to determine the first response duration corresponding to the target operation instruction; The first detection module is configured to, when the first response duration is greater than the first preset duration, send a first detection instruction for determining whether the target hard disk is a slow hard disk to the target hard disk corresponding to the target operation instruction; The second detection module is configured to, when the first detection result corresponding to the first detection instruction indicates that the latency index of the target hard disk meets the slow hard disk standard, send a second detection instruction for determining the slow level of the hard disk to the target hard disk; The removal module is configured to determine whether to remove the target hard disk according to the second detection result corresponding to the second detection instruction.
19. A non-volatile readable storage medium, characterized in that, The non-volatile readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 17 are implemented.
20. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, the steps of the method described in any one of claims 1 to 17 are implemented.
Citation Information
Patent Citations
Slow disk detection method, device and equipment and storage medium
CN112416639A
Slow disk detection method and device, electronic equipment and storage medium
CN114415973A
Hard disk removal method and device, storage medium and electronic equipment
CN117573483A
Method and system for reducing program code size
US20060206886A1