Phython-based solid state disk test method and device, electronic equipment and storage medium
A Python-based method processes and visualizes solid-state drive test results using getopt and pyecharts modules, addressing the complexity of existing data analysis by generating intuitive waveform files for performance analysis.
Patent Information
- Application Number
- CN202411242951.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2024-12-27
AI Technical Summary
Existing solid-state drive testing methods using Vdbench and Fio produce large volumes of complex data that are difficult to intuitively display and analyze.
A Python-based method utilizing the getopt and pyecharts modules to process and visualize test results from Vdbench and Fio, generating visual waveform files that include IOPS, bandwidth, and latency data.
Enables intuitive visualization of solid-state drive performance fluctuations, facilitating easier analysis and comparison of test results.
Smart Images

Figure CN119207537A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of testing technology, and in particular to a solid-state hard disk testing method, device, electronic equipment, and storage medium based on phython. Background Art
[0002] When testing the performance of solid-state drives, Vdbench and Fio are used very frequently. However, the test results of these tools are usually in text form. Vdbench outputs an HTML file, which contains data information such as IOPS, bandwidth, latency and other key indicators. Fio outputs a log file, and the IOPS, bandwidth and latency data are in different log files.
[0003] However, the data file processing volume is large and complicated, and it is not possible to intuitively display the test results and the performance changes of the solid-state drive. Summary of the invention
[0004] In view of this, the object of the present invention is to provide a solid state hard disk testing method, device, electronic device, and storage medium based on phython.
[0005] In a first aspect, an embodiment of the present invention provides a solid state drive testing method based on phython, the method comprising:
[0006] Run the automation script written by phython, which includes the getopt module and the pyecharts module;
[0007] Read Vdbench and / or Fio test result files through the getopt module;
[0008] Process the test result file based on the target processing rule to obtain a test data list of the solid-state drive, where the test data list at least includes IOPS, bandwidth, and latency of the solid-state drive;
[0009] Use the pyecharts module to process and render the test data list and generate a visual waveform file.
[0010] In combination with the first aspect, after the step of the getopt module reading the test result file of Vdbench and / or Fio, the method further includes:
[0011] The preconfiguration information is obtained and the preconfiguration information is determined as a target processing rule.
[0012] In combination with the first aspect, the step of obtaining pre-configuration information and determining the type of waveform graph, the name of the waveform graph and the coordinate information includes:
[0013] Editing the automation script to identify at least one target test result file;
[0014] For each target test result file, edit the waveform coordinate parameters of the target test result file in the automation script;
[0015] Determine target configuration information according to the target test result file and the waveform coordinate parameters corresponding to each target test result file;
[0016] The target configuration information is determined as a target processing rule.
[0017] In combination with the first aspect, after the step of determining the target configuration information as a target processing rule, the method further includes:
[0018] Edit the name of the waveform in the automation script to update the target processing rule.
[0019] In combination with the first aspect, after the step of editing the automation script to determine at least one target test result file, the method further includes:
[0020] Edit the target parameters in the automation script to associate the target waveform graph with multiple target test result files.
[0021] In combination with the first aspect, the step of the getopt module reading the test result file of Vdbench and / or Fio includes:
[0022] Get the reading type and target test tool of the test result file defined in the automation script;
[0023] The getopt module reads data from the database and Excel according to the read type and target test tool to obtain the test result file.
[0024] Combined with the first aspect, before running the automated script written by phython, it also includes:
[0025] Test the SSD using Vdbench and / or Fio to obtain the test result file;
[0026] Store test result files in database and excel.
[0027] In a second aspect, the present application provides a solid state drive testing device based on phython, the device comprising:
[0028] The run module is used to run the automation script written by phython. The automation script includes the getopt module and the pyecharts module.
[0029] The reading module is used to read the test result files of Vdbench and / or Fio through the getopt module;
[0030] A processing module, used to process the test result file based on the target processing rule and the target configuration parameter to obtain a test data list of the solid-state drive, wherein the test data list at least includes IOPS, bandwidth, and latency of the solid-state drive;
[0031] Image conversion module, used to process and render the test data list using the pyecharts module to generate a visual waveform file.
[0032] In a third aspect, the present application provides an electronic device, which includes a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the above method.
[0033] In a fourth aspect, the present application provides a readable storage medium, in which computer program instructions are stored. When the computer program instructions are read and executed by a processor, the above method is executed.
[0034] The embodiment of the present invention brings the following beneficial effects: the present application provides a solid-state hard disk test method, device, electronic device, and storage medium based on phython, the method comprising: running an automated script written by phython, the automated script comprising a getopt module and a pyecharts module; reading the test result file of Vdbench and / or Fio through the getopt module; processing the test result file based on the target processing rule to obtain a test data list of the solid-state hard disk, the test data list at least including the IOPS, bandwidth, and latency of the solid-state hard disk; using the pyecharts module to process and render the test data list, and generate a visual waveform file. In the present application, a scripting language is generally used to process these test results, and a visual display is realized to facilitate subsequent analysis.
[0035] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0036] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0038] Figure 1 A flow chart of a solid state drive testing method based on phython provided in an embodiment of the present application;
[0039] Figure 2 A schematic diagram of a solid state drive testing device based on phython provided in an embodiment of the present application;
[0040] Figure 3 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention.
[0041] Reference numerals:
[0042] 10 - operation module, 20 - reading module, 30 - processing module, 40 - graphic conversion module; 130 - processor, 131 - memory, 132 - bus, 133 - communication interface. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0044] In order to facilitate the understanding of this embodiment, the technical terms designed in this application are briefly introduced below.
[0045] Vdbench is an I / O workload generator that is often used to verify data integrity and measure direct-attached (or network-attached) storage performance. It can run in Windows and Linux environments and can be used to test file system or block device benchmark performance.
[0046] Fio is a tool for testing IOPS. It is used to stress test and verify the disk. Disk I / O is an important indicator for checking disk performance. It can be divided into two categories according to the load: sequential reading and writing and random reading and writing. FIO can generate many threads and perform specific types of I / O operations specified by the user. Its typical use is to write and simulate job texts that match the I / O load. In other words, FIO is a multi-threaded I / O generation tool that can generate multiple I / O modes to test the performance of disk devices.
[0047] After introducing the technical terms involved in this application, the application scenarios and design concepts of the embodiments of this application are briefly introduced.
[0048] Traditional solid-state drive testing using Vdbench and Fio results in a large number of test result files and complex data analysis, making it difficult to intuitively characterize the performance of the solid-state drive.
[0049] Based on this, the embodiments of the present application provide a solid-state hard disk testing method, device, electronic device, and storage medium based on Phython.
[0050] Example 1
[0051] This application provides a solid state drive testing method based on phython, combined with Figure 1 As shown, the method includes:
[0052] S110, runs the automation script written in phython, which includes the getopt module and the pyecharts module.
[0053] S120, read the test result file of Vdbench and / or Fio through the getopt module.
[0054] S130, processing the test result file based on the target processing rule to obtain a test data list of the solid state drive, the test data list at least including the IOPS, bandwidth, and latency of the solid state drive.
[0055] S140, use the pyecharts module to process and render the test data list and generate a visual waveform file.
[0056] In the present embodiment, by running the automation script written by phython, the getopt module reads the test result file obtained by Vdbench and / or Fio for the solid-state drive test based on the pre-edited parameters, and processes it to obtain a test data list of the solid-state drive containing multiple indicators, and then converts the test data list into a visual waveform file under the effect of the pyecharts module. In this way, the test result file is converted into a visual waveform file, so that the fluctuation of the solid-state drive performance can be observed intuitively through graphics.
[0057] In combination with the first aspect, after step S120, the method further includes:
[0058] S121, obtaining pre-configuration information, and determining the pre-configuration information as a target processing rule.
[0059] In this application, after obtaining the test result file of Vdbench and / or Fio for the solid-state drive test, the pre-configuration information is obtained so that the pyecharts module further processes the test result file according to the pre-configuration information and generates a waveform file that meets the pre-configuration information.
[0060] In combination with the first aspect, after step S120, the method further includes:
[0061] S1211, edit the automation script to determine at least one target test result file.
[0062] S1212, for each target test result file, editing the waveform coordinate parameters of the target test result file in the automation script;
[0063] S1213, determining target configuration information according to the target test result file and the waveform coordinate parameters corresponding to each target test result file;
[0064] S1214, determining the target configuration information as a target processing rule.
[0065] Combined with the target configuration information of the getopt module above, the selected target test file results are processed and then passed to the pyecharts module. By running the python script file, a test result waveform that meets the requirements is obtained.
[0066] In this embodiment, the target test result file that the user needs to perform graphic conversion is first selected through S1211, that is, the source of the test result file obtained based on S120 is a plurality of test result files obtained by testing the solid-state drive by Vdbench and / or Fio. In the actual application process, it is not necessary to analyze all the test results, so only a part of the test result files need to be selected. In step S1211, the data type parameters of the automation script are edited (for example, -i (iops), -b (bw), -l (lat) distribution corresponding to IOPS, bandwidth, and latency) to customize the selected target test result file.
[0067] Afterwards, for each target test result file, it needs to be converted into a waveform graph, but the waveform graphs corresponding to each target test result file can express different meanings, that is, the coordinates in each waveform graph may be different. Therefore, in step S1212, by editing the coordinate information of the waveform graph corresponding to each target test result file, the information of the conversion graph is configured for each target test result file to be converted. For example, -x (xaxis) is used to select the horizontal coordinate of the waveform graph, and the horizontal coordinate can be time (time) or size (capacity). The time data comes from the test file, and the capacity can be calculated based on time and bandwidth.
[0068] Therefore, in step S1213, multiple target test result files and the configuration of the graphic coordinates corresponding to each target test result file are integrated to obtain the target configuration information of this operation.
[0069] In combination with the first aspect, after step S1214, the method further includes:
[0070] S1215, edit the name of the waveform diagram in the automation script to update the target configuration information.
[0071] In this embodiment, the name of the waveform graph is customized, and the waveform graph with the customized name is output after the obtained test result file is converted into text and images by running the phython script. It can be understood that the waveform graph includes the waveform graph corresponding to the target test result file determined in step S1211, and each waveform graph has the waveform graph coordinate parameters determined in step S1212.
[0072] For example, define parameters such as -n(name) to customize the name of the output waveform file. For example, you can customize the name such as draw.py, and finally run draw.py to get the target waveform named draw.py.
[0073] It is understandable that if the name of the waveform graph is not set, the name of the output waveform graph may be a random name or a name configured according to a preset rule, for example, a name determined by the file name plus the data type.
[0074] In combination with the first aspect, after step S1211, the method further includes:
[0075] S1216, editing the target parameters in the automation script to establish an association relationship between the target waveform graph and multiple target test result files.
[0076] In this embodiment, the target parameter (eg -m (multiple)) outputs a waveform graph after executing the script with the configuration, which includes waveforms corresponding to multiple target test result files in the same coordinate system for easy comparison.
[0077] In combination with the first aspect, step S120 specifically includes:
[0078] S1201, obtaining the reading type and target testing tool of the test result file defined in the automation script.
[0079] S1202, the getopt module reads the data in the database and Excel according to the read type and the target test tool to obtain the test result file.
[0080] In this embodiment, a test result file of Vdbench and / or Fio is selected through a custom parameter (e.g., -f (file)), wherein the number of test result files may be multiple. Then, based on a custom parameter (e.g., -t (tool)), the test tool is selected to be Vdbench / Fio, and finally the test result file is obtained.
[0081] In combination with the first aspect, before step S110, the method further includes:
[0082] Use Vdbench and / or Fio to test the SSD and obtain the test result file;
[0083] Store test result files in database and excel.
[0084] Before actual application, use Vdbench and / or Fio to perform performance tests on the solid-state drive, and store the test result files in the database and Excel. Then, under the action of the running phython script, run it directly through a command line. By configuring different parameters according to different needs, you can directly draw test result curves of multiple files, and observe the fluctuation of disk performance more intuitively.
[0085] In this embodiment, for example, there are two files a.html and b.html, which are Vdbench test result files of two solid state drives a and b respectively. To draw the bandwidth graphs of the two solid state drives together for comparison, the output waveform graph file is ab, and the configuration information in the running script is: python draw.py-fa.html,b.html-t Vdbench-bmn ab.
[0086] You can get a waveform file ab.html, which has the bandwidth waveforms of two solid state drives a and b drawn on one coordinate.
[0087] If you want to draw the bandwidth graph, iops graph and latency graph of two solid-state drives a and b, run the command:
[0088] python draw.py -f a.html,b.html -t Vdbench -bil. You can get 6 waveform files, namely the bandwidth graph a_bw.html, iops graph a_iops.html and latency graph a_lat.html of SSD a and the bandwidth graph b_bw.html, iops graph b_iops.html and latency graph b_lat.html of SSD b.
[0089] By running the automated script written by phython, the solid-state drive test result file is converted into a waveform chart, so that the test result file of Vdbench and / or Fio can be visualized and observed easily, so that the test results of different dimensions can be presented based on different configuration information.
[0090] In the second aspect, the present application provides a solid state drive testing device based on phython, combined with Figure 2 As shown, the device includes: an operating module 10, a reading module 20, a processing module 30 and a graphic conversion module 40.
[0091] The running module 10 is used to run the automation script written by phython, and the automation script includes the getopt module and the pyecharts module.
[0092] The reading module 20 is used to read the test result file of Vdbench and / or Fio through the getopt module.
[0093] The processing module 30 is used to process the test result file based on the target processing rule to obtain a test data list of the solid state drive. The test data list at least includes the IOPS, bandwidth, and latency of the solid state drive.
[0094] The graphics conversion module 40 is used to process and render the test data list using the pyecharts module to generate a visual waveform graph file.
[0095] In a third aspect, the present application provides an electronic device, Figure 3 As shown, the electronic device includes a memory 131 and a processor 130. The memory 131 is used to store computer programs, and the processor 130 runs the computer programs to enable the electronic device to perform the above method.
[0096] Furthermore, combined with Figure 3 The electronic device shown further includes a bus 132 and a communication interface 133 , and the processor 130 , the communication interface 133 and the memory 131 are connected via the bus 132 .
[0097] The memory 131 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 133 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 132 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0098] The processor 130 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 or software instructions in the processor 130. The above processor 130 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 131, and the processor 130 reads the information in the memory 131 and completes the steps of the method of the above embodiment in combination with its hardware.
[0099] In a fourth aspect, an embodiment of the present application provides a readable storage medium, in which computer program instructions are stored. When the computer program instructions are read and executed by a processor, the above method is executed.
[0100] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0101] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0102] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0103] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0104] Finally, it should be noted that the above embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A solid state drive testing method based on phython, characterized in that: The method comprises: Run the automation script written by phython, which includes the getopt module and the pyecharts module; Read the test result file of Vdbench and / or Fio through the getopt module; Processing the test result file based on the target processing rule to obtain a test data list of the solid state drive, wherein the test data list includes at least IOPS, bandwidth, and latency of the solid state drive; Use the pyecharts module to process and render the test data list to generate a visual waveform file.
2. The method according to claim 1, characterized in that: After the step of the getopt module reading the test result file of Vdbench and / or Fio, the method further includes: Preconfiguration information is acquired, and the preconfiguration information is determined as the target processing rule.
3. The method according to claim 2, characterized in that The steps of obtaining pre-configuration information and determining the type of waveform graph, the name of the waveform graph and coordinate information include: Editing the automation script to determine at least one target test result file; For each of the target test result files, editing the waveform coordinate parameters of the target test result file in the automation script; Determine target configuration information according to the target test result file and the waveform coordinate parameters corresponding to each of the target test result files; The target configuration information is determined as the target processing rule.
4. The method according to claim 3, characterized in that After the step of determining the target configuration information as the target processing rule, the method further includes: The name of the waveform diagram in the automation script is edited to update the target processing rule.
5. The method according to claim 1, characterized in that After the step of editing the automation script to determine at least one target test result file, the method further includes: The target parameters in the automation script are edited to establish an association relationship between the target waveform diagram and a plurality of target test result files.
6. The method according to claim 1, characterized in that The step of the getopt module reading the test result file of Vdbench and / or Fio comprises: Obtain the reading type and target test tool of the test result file defined in the automation script; The getopt module reads the data in the database and the excel according to the read type and the target test tool to obtain the test result file.
7. The method according to claim 6, characterized in that Before running the steps of the automated script written by phython, it also includes: Test the SSD using Vdbench and / or Fio to obtain the test result file; The test result file is stored in the database and the Excel.
8. A solid state drive testing device based on phython, characterized in that: The device comprises: The run module is used to run the automation script written by phython, and the automation script includes the getopt module and the pyecharts module; A reading module, used for reading the test result file of Vdbench and / or Fio through the getopt module; A processing module, configured to process the test result file based on a target processing rule to obtain a test data list of the solid state drive, wherein the test data list includes at least IOPS, bandwidth, and latency of the solid state drive; An image conversion module is used to process and render the test data list using the pyecharts module to generate a visual waveform file.
9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to perform the method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium stores computer program instructions, and when the computer program instructions are read and executed by a processor, the method according to any one of claims 1 to 7 is executed.
