Hard disk test method and device, electronic equipment and storage medium
The hard disk performance value is fitted through the least squares fitting method, which solves the problem of insufficient accuracy of hard disk consistency testing, realizes consistency evaluation of hard disk performance, and improves the stability and accuracy of the test.
Patent Information
- Application Number
- CN202411311436.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2024-12-27
AI Technical Summary
The existing hard disk consistency testing methods cannot accurately reflect the performance consistency of the hard disk at the time when the performance value is not collected, resulting in poor test accuracy.
The least squares fitting method is used to fit the read and write performance values of the hard disk, draw the fitting curve, and determine the consistency test results of the hard disk by comparing the standard performance values with the fitting curve to determine whether the hard disk passes the consistency test.
It improves the accuracy of hard disk consistency tests, can reflect the performance values at any point in time, and enhances the stability and reliability of the test.
Smart Images

Figure CN119201573A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and more specifically, to a hard disk testing method, device, electronic device, and storage medium. Background Art
[0002] With the increase in server computing power, the widespread use of storage servers and big data servers, the demand for hard disks is also increasing, and the capacity and number of hard disks in servers are increasing. The number of hard disks in a server has reached dozens. At present, solid-state SSD (Solid State Drive) and NVME (Non-Volatile Memory Express) are gradually replacing HDD (Hard Disk Drive) because of their ultra-high read and write speeds. The consistency of these hard disks, that is, the stability of the read and write rates, is the focus of attention.
[0003] In the related art, the hard disk is read and written continuously for a predetermined time to obtain the performance values corresponding to multiple time points, and then the performance average is calculated. The floating range is calculated based on the performance average, and the consistency test result of the hard disk is determined by comparing the ratio of the amount of data in the floating range to the total amount of data with the preset value. The above scheme reflects the performance consistency of the time point when the performance value is collected, and cannot test the performance consistency of the time point when the performance value is not collected, resulting in poor accuracy of the hard disk consistency test.
[0004] Therefore, how to improve the accuracy of hard disk consistency testing is a technical problem that those skilled in the art need to solve. Summary of the invention
[0005] The purpose of the present application is to provide a hard disk testing method, device, electronic device and storage medium, which improve the accuracy of hard disk consistency testing.
[0006] To achieve the above purpose, the present application provides a hard disk testing method, comprising:
[0007] Get the standard performance value of the hard disk;
[0008] Performing a read and write test on the hard disk to obtain a test performance value of the hard disk;
[0009] Plotting the test performance value in a coordinate system; wherein the horizontal axis of the coordinate system corresponds to time, and the vertical axis corresponds to the test performance value;
[0010] The test performance values in the coordinate system are fitted by a least square fitting method to obtain a fitting curve;
[0011] The standard performance value is compared with the fitting curve to obtain the consistency test result of the hard disk.
[0012] The method of fitting the test performance values in the coordinate system by the least square fitting method to obtain a fitting curve includes:
[0013] The test performance values in the coordinate system are fitted using a nonlinear fitting method to obtain a fitting curve.
[0014] The method of fitting the test performance values in the coordinate system by the least square fitting method to obtain a fitting curve includes:
[0015] Determine multiple candidate initial solutions for least squares fitting, and determine multiple test performance value groups to be fitted; wherein the test performance value groups to be fitted contain multiple test performance values to be fitted, and different test performance value groups to be fitted contain different numbers of test performance values to be fitted;
[0016] Using a least square fitting method to fit the test performance values to be fitted in the plurality of test performance value groups to be fitted based on the plurality of candidate initial solutions, to obtain a plurality of candidate fitting curves;
[0017] The candidate fitting curve with the highest fitting accuracy is selected as the fitting curve.
[0018] Wherein, after fitting the test performance values in the coordinate system by the least square fitting method to obtain the fitting curve, the method further includes:
[0019] A target test performance value is determined in the fitting curve, and a window around the target test performance value is determined, and local fitting is performed on the test performance values within the window to optimize the fitting curve.
[0020] Wherein, the step of comparing the standard performance value with the fitting curve to obtain the consistency test result of the hard disk includes:
[0021] The normal performance value range is determined according to the standard performance value; wherein the lower limit of the normal performance value range is the product of the standard performance value and a first preset ratio, and the upper limit of the normal performance value range is the product of the standard performance value and a second preset ratio, the first preset ratio is 1-N, the second preset ratio is 1+N, N is a preset fluctuation ratio, 0 <N<1;
[0022] Determining a target time span within the normal performance value range according to the fitting curve;
[0023] Determine whether the ratio between the target time span and the total time span of the fitting curve is greater than a preset value;
[0024] If yes, it is determined that the hard disk passes the consistency test;
[0025] If not, it is determined that the hard disk fails the consistency test.
[0026] Wherein, obtaining the standard performance value of the hard disk includes:
[0027] Obtain the first standard bandwidth value of sequential reading, the second standard bandwidth value of sequential writing, the first standard IOPS value of random reading, and the second standard IOPS value of random writing of the hard disk;
[0028] Accordingly, performing a read and write test on the hard disk to obtain a test performance value of the hard disk includes:
[0029] Performing sequential read, sequential write, random read, and random write tests on the hard disk respectively to obtain a first test bandwidth value for sequential read, a second test bandwidth value for sequential write, a first test IOPS value for random read, and a second test IOPS value for random write of the hard disk;
[0030] Accordingly, determining the normal performance value range according to the standard performance value includes:
[0031] Determine a first normal bandwidth range according to the first standard bandwidth value, determine a second normal bandwidth range according to the second standard bandwidth value, determine a first normal IOPS range according to the first standard IOPS value, and determine a first normal IOPS range according to the first standard IOPS value;
[0032] Accordingly, determining the target time span within the normal performance value range according to the fitting curve includes:
[0033] Determining a first fitting curve segment corresponding to the sequential reading in the fitting curve, and determining a first time span in the first normal bandwidth range according to the first fitting curve segment;
[0034] Determine a second fitting curve segment corresponding to the sequence in the fitting curve, and determine a second time span in the second normal bandwidth range according to the second fitting curve segment;
[0035] Determine a third fitting curve segment corresponding to random read in the fitting curve, and determine a third time span within the first normal IOPS range according to the third fitting curve segment;
[0036] Determining a fourth fitting curve segment corresponding to random read in the fitting curve, and determining a fourth time span within the second normal IOPS range according to the fourth fitting curve segment;
[0037] The sum of the first time span, the second time span, the third time span, and the fourth time span is determined as a target time span.
[0038] The step of performing sequential read, sequential write, random read and random write tests on the hard disk respectively includes:
[0039] A unit test time is set, and a sequential read test of the unit test time, a sequential write test of the unit test time, a random read test of the unit test time, and a random write test of the unit test time are sequentially performed on the hard disk.
[0040] To achieve the above object, the present application provides a hard disk testing device, comprising:
[0041] An acquisition module is used to obtain the standard performance value of the hard disk;
[0042] A test module, used for performing a read and write test on the hard disk to obtain a test performance value of the hard disk;
[0043] A drawing module, used for drawing the test performance value in a coordinate system; wherein the horizontal axis of the coordinate system corresponds to time, and the vertical axis corresponds to the test performance value;
[0044] A fitting module, used for fitting the test performance values in the coordinate system by using a least square fitting method to obtain a fitting curve;
[0045] A comparison module is used to compare the standard performance value with the fitting curve to obtain a consistency test result of the hard disk.
[0046] To achieve the above objectives, the present application provides an electronic device, including:
[0047] Memory for storing computer programs;
[0048] A processor is used to implement the steps of the hard disk testing method as described above when executing the computer program.
[0049] To achieve the above-mentioned purpose, the present application provides a non-volatile storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the hard disk testing method as described above are implemented.
[0050] To achieve the above objectives, the present application provides a computer program product, including a computer program, which implements the steps of the above hard disk testing method when executed by a processor.
[0051] It can be seen from the above scheme that a hard disk testing method provided by the present application includes: obtaining a standard performance value of a hard disk; performing a read and write test on the hard disk to obtain a test performance value of the hard disk; plotting the test performance value in a coordinate system; wherein the horizontal axis of the coordinate system corresponds to time, and the vertical axis corresponds to the test performance value; using a least squares fitting method to fit the test performance value in the coordinate system to obtain a fitting curve; and comparing the standard performance value with the fitting curve to obtain a consistency test result of the hard disk.
[0052] The hard disk test method provided by the present application plots the collected test performance values in a coordinate system and then fits them using the least squares fitting method, which can not only reflect the performance consistency of the time point when the performance values are collected, but also calculate the performance values at any time through the fitting curve, thereby improving the accuracy of the hard disk consistency test. The present application also discloses a hard disk test device, an electronic device, a non-volatile storage medium and a computer program product, which can also achieve the above technical effects.
[0053] It should be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. The drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific implementation methods, they are used to explain the present disclosure, but do not constitute a limitation to the present disclosure. In the drawings:
[0055] Figure 1 is a flow chart of a hard disk testing method according to an exemplary embodiment;
[0056] Figure 2 is a schematic diagram of local tuning according to an exemplary embodiment;
[0057] Figure 3 is a flow chart showing another hard disk testing method according to an exemplary embodiment;
[0058] Figure 4 is a structural diagram of a hard disk testing device according to an exemplary embodiment;
[0059] Figure 5 The figure is a structural diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0060] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. In addition, in the embodiments of the present application, "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0061] The embodiment of the present application discloses a hard disk testing method, which improves the accuracy of hard disk consistency testing.
[0062] See also Figure 1 , according to an exemplary embodiment, a flowchart of a hard disk testing method is shown, such as Figure 1 As shown, including:
[0063] S101: Obtaining a standard performance value of a hard disk;
[0064] In this embodiment, an automated script is used to perform a hard disk consistency test. The tester only needs to run the automated script to automatically execute the steps of this embodiment to perform a hard disk consistency test without the need for manual operations.
[0065] In this step, the automated script can use the smartctl command to view the standard performance values of the hard disk. It can retrieve the hard disk specification by searching the hard disk name, manufacturer, capacity, etc., and obtain the standard performance values of the hard disk in the specification, such as bandwidth value, IOPS (Input / Output Operations Per Second) value, etc. The obtained standard performance values can be stored in the memory or database, and can be directly obtained in the memory or database the next time it is retrieved.
[0066] It should be noted that different read and write modes can obtain the same type of standard performance values, for example, sequential read, sequential write, random read, and random write all obtain standard bandwidth values. Different read and write modes can also obtain different types of standard performance values, for example, sequential read and sequential write obtain bandwidth values, and random read and random write obtain standard IOPS values. Different read and write modes can obtain standard performance values of the same block size, for example, sequential read, sequential write, random read, and random write all obtain a standard performance value of 128K. Different read and write modes can also obtain standard performance values of different block sizes, for example, sequential read and sequential write obtain a standard performance value of 128K, and random read and random write obtain a standard performance value of 4K.
[0067] For example, the standard bandwidth value for 128K sequential read is 540, the standard bandwidth value for 128K sequential write is 520, the standard IOPS value for 4K random read is 95K, and the standard IOPS value for 4K random write is 37K.
[0068] S102: performing a read and write test on the hard disk to obtain a test performance value of the hard disk;
[0069] In the specific implementation, the automated script uses fio (Flexible I / O Tester, a testing tool) for performance testing and libaio (Linux Asynchronous I / O library) engine for read and write testing. First, the hard disk is formatted according to the normal test steps, and fio is used to fill the hard disk. Then, sequential read, sequential write, random read, and random write tests are performed to obtain the test performance values.
[0070] For example, one thread is used to perform sequential read and sequential write tests on a hard disk with a block size of 128K and a queue depth of 32. Four threads are used to perform random read and random write tests on a hard disk with a block size of 4K to obtain the test performance values corresponding to sequential read, sequential write, random read, and random write respectively.
[0071] It can be seen that in this embodiment, the read and write modes can be switched arbitrarily, which more realistically simulates the actual application scenario of the hard disk. Compared with the related technology that can only test a single read and write mode at a time, this embodiment improves the applicability of the hard disk consistency test.
[0072] S103: Plotting the test performance value in a coordinate system; wherein the horizontal axis of the coordinate system corresponds to time, and the vertical axis corresponds to the test performance value;
[0073] In a specific implementation, the collected test performance values are plotted in a coordinate system with time as the X-axis and the test performance value as the Y-axis. It is understandable that, since the test performance values will be fitted in subsequent steps of this embodiment, even if different types of test performance values are collected in the previous step, they can be plotted in the same coordinate system, and the fitting curve is divided into multiple fitting curve segments, and the same fitting curve segment corresponds to the same type of test performance value.
[0074] S104: fitting the test performance values in the coordinate system using a least square fitting method to obtain a fitting curve;
[0075] In a specific implementation, the least squares fitting method is used to fit the test performance value. Least squares fitting is a mathematical optimization technique that finds the best function match for the data by minimizing the sum of squares of errors. This embodiment can use a linear fitting method, and the fitting function type can include a linear equation, a cosine function equation, a sine function equation, etc., or a nonlinear fitting method can be used.
[0076] For example, set the fitting curve to y=kx+b, and let L=∑(y i −kx i −b)^2, we need to find k and b that minimize L. To simplify the calculation, the automation script can directly call the MATLAB library in Python and use the LSQNONLIN function (Solve nonlinear least-squares problem) in MATLAB for calculation. Set a set of initial solutions x0, for example, when using y=2x+3, x0=[2,3], use the LSQNONLIN function A= lsqnonlin(fun fitting function, x0, lb, ub, options), x0 is the initial solution, lb and ub are the lower and upper bounds of the solution vector lb≤x≤ub, if no bounds are specified, lb=[ ], ub=[ ]; options are the specified optimization parameters; lsqnonlin solves nonlinear least squares problems, including nonlinear data fitting problems, where x0 is not empty, lb, ub, and option can be empty. The array A solved in this way is the parameter of the least squares fitting function. After obtaining these parameters, the fitting curve is obtained. The scatter plot and fitting curve can be drawn using the plot function provided by Matlab.
[0077] It should be noted that after the hard disk performance value enters the steady state, the data is generally within the allowable fluctuation range. In order to improve the fitting effect, the cosine function can be used for fitting, or the nonlinear fitting curve lsqcurvefit can be used directly for fitting, both of which can be calculated using Matlab.
[0078] As a preferred implementation, the least squares fitting method is used to fit the test performance values in the coordinate system to obtain a fitting curve, including: determining multiple candidate initial solutions for the least squares fitting, and determining multiple test performance value groups to be fitted; wherein the test performance value groups to be fitted contain multiple test performance values to be fitted, and different test performance value groups to be fitted contain different numbers of test performance values to be fitted; the least squares fitting method is used to fit the test performance values to be fitted in the multiple test performance value groups to be fitted based on the multiple candidate initial solutions, respectively, to obtain multiple candidate fitting curves; and the candidate fitting curve with the highest fitting accuracy is selected as the fitting curve.
[0079] In the specific implementation, in order to prevent underfitting, that is, the fitting curve is too different from the actual data, and to prevent overfitting, that is, the fitting is very close to the training sample part, but the accuracy is too low in the actual prediction, the number of test performance values to be fitted can be appropriately increased, and multiple groups of candidate initial solutions can be set. Multiple fittings are performed to obtain multiple candidate fitting curves, and the candidate fitting curve with the highest fitting accuracy is selected as the fitting curve to achieve fitting tuning and prevent underfitting and overfitting.
[0080] As a feasible implementation method, the standard deviation can be used to measure the fitting accuracy of the candidate fitting curve, that is, the standard deviation between the test performance value actually collected at each time point and the corresponding performance value in the fitting curve is calculated, and the sum of the standard deviations of all time points is calculated. The smaller the sum of the standard deviations, the higher the fitting accuracy. The candidate fitting curve with the smallest sum of standard deviations is used as the fitting curve. It can be seen that the use of standard deviation can accurately measure the fitting accuracy of the candidate fitting curve, improve the fitting effect of the test performance value, and thus improve the accuracy of subsequent hard disk consistency tests.
[0081] As a preferred implementation, after fitting the test performance values in the coordinate system by the least squares fitting method to obtain the fitting curve, it also includes: determining the target test performance value in the fitting curve, and determining a window around the target test performance value, and performing local fitting on the test performance values within the window to optimize the fitting curve.
[0082] In specific implementations, the fitting curve can be further tuned by local fitting. Figure 2 As shown, the SG (Savitzky-Golay filter) filtering algorithm is used for processing, which works by looping through each individual data point in the measured data array and generating the corresponding filtered output data point. For a data point (i=0) in the fitting curve, which is also the target test performance value, a window is selected around it, and the fit is performed within this window. The best fitting polynomial is evaluated to perform a local fit on the data within the window. Then, this process is repeated for all other data points.
[0083] S105: Compare the standard performance value with the fitting curve to obtain a consistency test result of the hard disk.
[0084] In this step, the standard performance value is compared with the fitting curve to determine the stability of the read and write speed, that is, the consistency test result of the hard disk. Since the standard performance value is obtained by querying the specification, compared with the average value of the actual test performance value as the standard performance value in the related art, the consistency test result obtained by comparison is more accurate.
[0085] As a feasible implementation manner, comparing the standard performance value with the fitting curve to obtain the consistency test result of the hard disk includes: determining a normal performance value range according to the standard performance value; wherein, the lower limit of the normal performance value range is the product of the standard performance value and a first preset ratio, the upper limit of the normal performance value range is the product of the standard performance value and a second preset ratio, the first preset ratio is 1 - N, the second preset ratio is 1 + N, N is a preset fluctuation ratio, and 0 < N < 1; determining a target time span within the normal performance value range according to the fitting curve; judging whether the ratio between the target time span and the total time span of the fitting curve is greater than a preset value; if so, determining that the hard disk passes the consistency test; if not, determining that the hard disk fails the consistency test.
[0086] In a specific implementation, the normal performance value range is determined according to the standard performance value and the preset fluctuation ratio. For example, if the standard performance value is M and the preset fluctuation ratio is N, then the lower limit of the normal performance value range is (1 - N)M, and the upper limit of the normal performance value range is (1 + N)M. Then, the target time span during which the test performance value in the fitting curve is within the normal performance value range is counted, and the ratio between the target time span and the total time span of the fitting curve is calculated. If this ratio is greater than the preset value, it indicates that the read and write speeds are relatively stable, and the hard disk passes the consistency test; otherwise, it indicates that the write speed is relatively unstable, and the hard disk fails the consistency test.
[0087] The hard disk test method provided by the embodiments of the present application plots the collected test performance values in a coordinate system, and then uses the least squares fitting method to fit them, which can not only reflect the performance consistency at the time points of the collected performance values, but also calculate the performance values at any time through the fitting curve, improving the accuracy of the hard disk consistency test.
[0088] The embodiments of the present application disclose a hard disk test method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution. Specifically:
[0089] See Figure 3 , according to the flowchart of another hard disk test method shown in an exemplary embodiment, as Figure 3 shown, includes:
[0090] S201: Obtain the standard performance value of the hard disk; wherein, the standard performance value includes a first standard bandwidth value for sequential reading, a second standard bandwidth value for sequential writing, a first standard IOPS value for random reading, and a second standard IOPS value for random writing;
[0091] In a specific implementation, the specification sheet of the hard disk is queried to obtain the standard performance values of the hard disk, including the first standard bandwidth value of sequential read operations, the second standard bandwidth value of sequential write operations, the first standard IOPS value of random read operations, and the second standard IOPS value of random write operations.
[0092] S202: performing sequential read, sequential write, random read, and random write tests on the hard disk respectively to obtain a test performance value of the hard disk; wherein the test performance value includes a first test bandwidth value for sequential read, a second test bandwidth value for sequential write, a first test IOPS value for random read, and a second test IOPS value for random write;
[0093] In the specific implementation, the actual performance test of the hard disk is carried out, including four tests: sequential read, sequential write, random read and random write. Through these tests, the performance of the hard disk in actual use, that is, the test performance value, can be obtained. These test performance values correspond to the standard performance values obtained previously, including the first test bandwidth value of sequential read, the second test bandwidth value of sequential write, the first test IOPS value of random read and the second test IOPS value of random write.
[0094] As a feasible implementation, the sequential read, sequential write, random read, and random write tests are respectively performed on the hard disk, including: setting a unit test time, and sequentially performing a sequential read test for the unit test time, a sequential write test for the unit test time, a random read test for the unit test time, and a random write test for the unit test time on the hard disk. In a specific implementation, the unit test time can be set, for example, 30s, and then sequential read for 30s, sequential write for 30s, random read for 30s, and random write for 30s are performed in sequence.
[0095] S203: Plotting the test performance value in a coordinate system; wherein the horizontal axis of the coordinate system corresponds to time, and the vertical axis corresponds to the test performance value;
[0096] S204: fitting the test performance values in the coordinate system using a least square fitting method to obtain a fitting curve;
[0097] S205: Determine a first normal bandwidth range according to the first standard bandwidth value, determine a second normal bandwidth range according to the second standard bandwidth value, determine a first normal IOPS range according to the first standard IOPS value, and determine a first normal IOPS range according to the first standard IOPS value;
[0098] In a specific implementation, the normal range of hard disk performance can be determined using the previously obtained standard performance values. Specifically, the normal bandwidth range is determined based on the standard bandwidth values of sequential read and write operations, and the normal IOPS range is determined based on the standard IOPS values of random read and write operations.
[0099] S206: determining a first fitting curve segment corresponding to sequential read in the fitting curve, and determining a first time span in the first normal bandwidth range according to the first fitting curve segment; determining a second fitting curve segment corresponding to sequential write in the fitting curve, and determining a second time span in the second normal bandwidth range according to the second fitting curve segment; determining a third fitting curve segment corresponding to random read in the fitting curve, and determining a third time span in the first normal IOPS range according to the third fitting curve segment; determining a fourth fitting curve segment corresponding to random read in the fitting curve, and determining a fourth time span in the second normal IOPS range according to the fourth fitting curve segment; determining the sum of the first time span, the second time span, the third time span, and the fourth time span as the target time span;
[0100] In a specific implementation, on the fitting curve, the curve segments corresponding to the sequential read, sequential write, random read and random write operations are determined respectively. Then, based on these curve segments, the time spans in which the hard disk performance is within the normal range are determined. These time spans include a first time span for sequential read, a second time span for sequential write, a third time span for random read and a fourth time span for random write. These time spans are added together to obtain the target time span.
[0101] S207: Determine whether the ratio between the target time span and the total time span of the fitting curve is greater than a preset value; if so, determine that the hard disk passes the consistency test; if not, determine that the hard disk fails the consistency test.
[0102] It can be seen that this embodiment realizes consistency testing of multiple read and write modes through one-time curve fitting, that is, it realizes consistency testing of sequential read, sequential write, random read and random write at the same time, thereby improving the efficiency of hard disk consistency testing.
[0103] A hard disk testing device provided in an embodiment of the present application is introduced below. The hard disk testing device described below and the hard disk testing method described above can be referenced to each other.
[0104] See also Figure 4 , a structural diagram of a hard disk testing device according to an exemplary embodiment is shown, such as Figure 4 As shown, including:
[0105] An acquisition module 401 is used to acquire a standard performance value of a hard disk;
[0106] The test module 402 is used to perform a read and write test on the hard disk to obtain a test performance value of the hard disk;
[0107] A drawing module 403 is used to draw the test performance value in a coordinate system; wherein the horizontal axis of the coordinate system corresponds to time, and the vertical axis corresponds to the test performance value;
[0108] A fitting module 404 is used to fit the test performance values in the coordinate system using a least square fitting method to obtain a fitting curve;
[0109] The comparison module 405 is used to compare the standard performance value with the fitting curve to obtain the consistency test result of the hard disk.
[0110] The hard disk testing device provided in the embodiment of the present application plots the collected test performance values in a coordinate system, and then fits them using the least squares fitting method. This can not only reflect the performance consistency of the time point when the performance value is collected, but also calculate the performance value at any time through the fitting curve, thereby improving the accuracy of the hard disk consistency test.
[0111] Based on the above embodiment, as a preferred implementation, the fitting module 404 is specifically used to: use a nonlinear fitting method to fit the test performance values in the coordinate system to obtain a fitting curve.
[0112] On the basis of the above embodiments, as a preferred implementation mode, the fitting module 404 is specifically used to: determine multiple candidate initial solutions for least squares fitting, and determine multiple test performance value groups to be fitted; wherein the test performance value groups to be fitted contain multiple test performance values to be fitted, and different test performance value groups to be fitted contain different numbers of test performance values to be fitted; using the least squares fitting method to fit the test performance values to be fitted in the multiple test performance value groups to be fitted based on the multiple candidate initial solutions, respectively, to obtain multiple candidate fitting curves; and selecting the candidate fitting curve with the highest fitting accuracy as the fitting curve.
[0113] Based on the above embodiment, as a preferred implementation, it also includes:
[0114] The fitting and tuning module is used to determine the target test performance value in the fitting curve, determine the window around the target test performance value, and perform local fitting on the test performance value in the window to optimize the fitting curve.
[0115] Based on the above embodiments, as a preferred embodiment, the comparison module 405 is specifically configured to: determine a normal performance value range according to the standard performance value; wherein, the lower limit of the normal performance value range is the product of the standard performance value and a first preset ratio, the upper limit of the normal performance value range is the product of the standard performance value and a second preset ratio, the first preset ratio is 1 - N, the second preset ratio is 1 + N, N is a preset fluctuation ratio, and 0 < N < 1; determine a target time span within the normal performance value range according to the fitting curve; determine whether the ratio between the target time span and the total time span of the fitting curve is greater than a preset value; if so, determine that the hard disk passes the consistency test; if not, determine that the hard disk fails the consistency test.
[0116] Based on the above embodiments, as a preferred embodiment, the acquisition module 401 is specifically configured to: acquire a first standard bandwidth value for sequential read of the hard disk, a second standard bandwidth value for sequential write, a first standard IOPS value for random read, and a second standard IOPS value for random write.
[0117] Correspondingly, the test module 402 is specifically configured to: perform sequential read, sequential write, random read, and random write tests on the hard disk respectively to acquire a first test bandwidth value for sequential read of the hard disk, a second test bandwidth value for sequential write, a first test IOPS value for random read, and a second test IOPS value for random write.
[0118] Correspondingly, the comparison module 405 is specifically configured to: determine a first normal bandwidth range according to the first standard bandwidth value, determine a second normal bandwidth range according to the second standard bandwidth value, determine a first normal IOPS range according to the first standard IOPS value, and determine a first normal IOPS range according to the first standard IOPS value; determine a first fitting curve segment corresponding to sequential read in the fitting curve, and determine a first time span within the first normal bandwidth range according to the first fitting curve segment; determine a second fitting curve segment corresponding to sequential write in the fitting curve, and determine a second time span within the second normal bandwidth range according to the second fitting curve segment; determine a third fitting curve segment corresponding to random read in the fitting curve, and determine a third time span within the first normal IOPS range according to the third fitting curve segment; determine a fourth fitting curve segment corresponding to random write in the fitting curve, and determine a fourth time span within the second normal IOPS range according to the fourth fitting curve segment; determine the sum of the first time span, the second time span, the third time span, and the fourth time span as the target time span.
[0119] Based on the above embodiments, as a preferred implementation mode, the test module 402 is specifically used to: set a unit test time, and perform a sequential read test of the unit test time, a sequential write test of the unit test time, a random read test of the unit test time, and a random write test of the unit test time on the hard disk in sequence.
[0120] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0121] Based on the hardware implementation of the above program modules, and in order to implement the method of the embodiment of the present application, the embodiment of the present application further provides an electronic device, Figure 5 FIG. 1 is a structural diagram of an electronic device according to an exemplary embodiment. Figure 5 As shown, the electronic equipment includes:
[0122] Communication interface 1, capable of exchanging information with other devices such as network devices;
[0123] The processor 2 is connected to the communication interface 1 to realize information exchange with other devices, and is used to execute the hard disk testing method provided by one or more technical solutions when running a computer program. The computer program is stored in the memory 3.
[0124] Of course, in actual application, the various components in the electronic device are coupled together through the bus system 4. It can be understood that the bus system 4 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 4 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, Figure 5 Various buses are labeled as bus system 4 .
[0125] The memory 3 in the embodiment of the present application is used to store various types of data to support the operation of the electronic device. Examples of such data include: any computer program used to operate on the electronic device.
[0126] It can be understood that the memory 3 can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM, SyncLink Dynamic Random Access Memory), and direct RAMbus random access memory (DRRAM, Direct Rambus Random Access Memory).The memory 3 described in the embodiments of the present application is intended to include but is not limited to these and any other suitable types of memories.
[0127] The method disclosed in the above embodiment of the present application can be applied to the processor 2, or implemented by the processor 2. The processor 2 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 2 or the instruction in the form of software. The above processor 2 may be a general-purpose processor, a DSP, or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 2 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiment of the present application, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium, which is located in the memory 3, and the processor 2 reads the program in the memory 3 and completes the steps of the above method in combination with its hardware.
[0128] When the processor 2 executes the program, the corresponding processes in the various methods of the embodiments of the present application are implemented, which will not be repeated here for the sake of brevity.
[0129] In an exemplary embodiment, the embodiment of the present application further provides a non-volatile storage medium storing a computer program, which can be executed by the processor 2 to complete the steps of the aforementioned method.
[0130] In an exemplary embodiment, the present application also provides a computer program product, including a computer program, which is executed by the processor 2 to complete the steps of the aforementioned method.
[0131] A person of ordinary skill in the art can understand that all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to computer program instructions, and the aforementioned computer program can be stored in a non-volatile storage medium. When the computer program is executed, it executes the steps of the above-mentioned method embodiment. Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a non-volatile storage medium. Based on this understanding, the technical solution of the embodiment of the present application can be essentially or partly embodied in the form of a software product, which is stored in a non-volatile storage medium and includes a number of instructions for an electronic device (which can be a personal computer, a server, a network device, etc.) to execute all or part of the methods described in each embodiment of the present application.
[0132] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. A hard disk testing method, characterized in that: include: Get the standard performance value of the hard disk; Performing a read and write test on the hard disk to obtain a test performance value of the hard disk; Plotting the test performance value in a coordinate system; wherein the horizontal axis of the coordinate system corresponds to time, and the vertical axis corresponds to the test performance value; The test performance values in the coordinate system are fitted by a least square fitting method to obtain a fitting curve; The standard performance value is compared with the fitting curve to obtain the consistency test result of the hard disk.
2. The hard disk testing method according to claim 1, characterized in that: The step of fitting the test performance values in the coordinate system by the least square fitting method to obtain a fitting curve includes: The test performance values in the coordinate system are fitted using a nonlinear fitting method to obtain a fitting curve.
3. The hard disk testing method according to claim 1, characterized in that: The step of fitting the test performance values in the coordinate system by the least square fitting method to obtain a fitting curve includes: Determine multiple candidate initial solutions for least squares fitting, and determine multiple test performance value groups to be fitted; wherein the test performance value groups to be fitted contain multiple test performance values to be fitted, and different test performance value groups to be fitted contain different numbers of test performance values to be fitted; Using a least square fitting method to fit the test performance values to be fitted in the plurality of test performance value groups to be fitted based on the plurality of candidate initial solutions, to obtain a plurality of candidate fitting curves; The candidate fitting curve with the highest fitting accuracy is selected as the fitting curve.
4. The hard disk testing method according to claim 1, characterized in that: After fitting the test performance values in the coordinate system by the least square fitting method to obtain a fitting curve, the method further includes: A target test performance value is determined in the fitting curve, and a window around the target test performance value is determined, and local fitting is performed on the test performance values within the window to optimize the fitting curve.
5. The hard disk testing method according to claim 1, characterized in that: The comparing the standard performance value with the fitting curve to obtain the consistency test result of the hard disk includes: The normal performance value range is determined according to the standard performance value; wherein the lower limit of the normal performance value range is the product of the standard performance value and a first preset ratio, and the upper limit of the normal performance value range is the product of the standard performance value and a second preset ratio, the first preset ratio is 1-N, the second preset ratio is 1+N, N is a preset fluctuation ratio, 0 <N<1; Determining a target time span within the normal performance value range according to the fitting curve; Determine whether the ratio between the target time span and the total time span of the fitting curve is greater than a preset value; If yes, it is determined that the hard disk passes the consistency test; If not, it is determined that the hard disk fails the consistency test.
6. The hard disk testing method according to claim 5, characterized in that: The obtaining of the standard performance value of the hard disk includes: Obtain the first standard bandwidth value of sequential reading, the second standard bandwidth value of sequential writing, the first standard IOPS value of random reading, and the second standard IOPS value of random writing of the hard disk; Accordingly, performing a read and write test on the hard disk to obtain a test performance value of the hard disk includes: Performing sequential read, sequential write, random read, and random write tests on the hard disk respectively to obtain a first test bandwidth value for sequential read, a second test bandwidth value for sequential write, a first test IOPS value for random read, and a second test IOPS value for random write of the hard disk; Accordingly, determining the normal performance value range according to the standard performance value includes: Determine a first normal bandwidth range according to the first standard bandwidth value, determine a second normal bandwidth range according to the second standard bandwidth value, determine a first normal IOPS range according to the first standard IOPS value, and determine a first normal IOPS range according to the first standard IOPS value; Accordingly, determining the target time span within the normal performance value range according to the fitting curve includes: Determining a first fitting curve segment corresponding to the sequential reading in the fitting curve, and determining a first time span in the first normal bandwidth range according to the first fitting curve segment; Determine a second fitting curve segment corresponding to the sequence in the fitting curve, and determine a second time span in the second normal bandwidth range according to the second fitting curve segment; Determine a third fitting curve segment corresponding to random read in the fitting curve, and determine a third time span within the first normal IOPS range according to the third fitting curve segment; Determining a fourth fitting curve segment corresponding to random read in the fitting curve, and determining a fourth time span within the second normal IOPS range according to the fourth fitting curve segment; The sum of the first time span, the second time span, the third time span, and the fourth time span is determined as a target time span.
7. The hard disk testing method according to claim 6, characterized in that: The sequential reading, sequential writing, random reading and random writing tests are respectively performed on the hard disk, including: A unit test time is set, and a sequential read test of the unit test time, a sequential write test of the unit test time, a random read test of the unit test time, and a random write test of the unit test time are sequentially performed on the hard disk.
8. A hard disk testing device, characterized in that: include: An acquisition module is used to obtain the standard performance value of the hard disk; A test module, used for performing a read and write test on the hard disk to obtain a test performance value of the hard disk; A drawing module, used for drawing the test performance value in a coordinate system; wherein the horizontal axis of the coordinate system corresponds to time, and the vertical axis corresponds to the test performance value; A fitting module, used for fitting the test performance values in the coordinate system by using a least square fitting method to obtain a fitting curve; A comparison module is used to compare the standard performance value with the fitting curve to obtain a consistency test result of the hard disk.
9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the hard disk testing method according to any one of claims 1 to 7 when executing the computer program.
10. A non-volatile storage medium, characterized in that: The non-volatile storage medium stores a computer program, and when the computer program is executed, the steps of the hard disk testing method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Memory testing method, system and device and storage medium
CN119580816A
A memory testing method, system, device and storage medium
CN119580816B
