Pressure test log processing method and device, equipment and storage medium
By building a strategy engine to automatically analyze the stress detection log information, the problems of large resource overhead and lack of classification analysis in the existing technology are solved, efficient abnormal event detection and alarm are achieved, and the stability and accuracy of performance testing are improved.
Patent Information
- Application Number
- CN202411963880.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-15
AI Technical Summary
The analysis method of stress test logs in existing performance tests has problems such as high resource overhead, lack of data classification and advanced analysis functions, which affects the stability of the test and the accuracy of the results.
Provide a method for processing pressure measurement logs. By obtaining pressure measurement log information and building a policy engine, it automatically analyzes the log information, determines abnormal events, and sends alarm information.
It realizes automated stress test log analysis, timely discovers abnormal events, improves testing efficiency and accuracy, and effectively prevents production problems.
Smart Images

Figure CN119830185A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of performance testing, and in particular, designs a method and device for processing stress testing logs, equipment and storage medium. Background Art
[0002] Currently, the stress test log and analysis in the performance test process are all performed using the View Result Tree method. This method has three disadvantages when used in the performance test process: First, the performance resource overhead is large: the View Result Tree component will save a large amount of data when the test is running, increasing memory usage and disk consumption, affecting test stability and result accuracy. Second, lack of data classification: although the View Result Tree component records the stress test log, it cannot classify the log and cannot quickly find the key performance bottleneck. Third, lack of advanced analysis functions: The View Result Tree component mainly displays the results in text form, and cannot use graphical tools to display data classification and trends.
[0003] During the performance testing process, monitoring stress test logs, as well as collecting, analyzing and warning their information is a necessary process. Improving timeliness, log analysis and classification, performance analysis and warning are the current pain points. Summary of the invention
[0004] The present invention provides a method and apparatus for processing stress testing logs, equipment and storage medium, which can automatically analyze stress testing logs and identify abnormal events in a timely manner.
[0005] On the one hand, a method for processing stress testing logs is provided, including: Get stress testing log information; Build a policy engine, analyze stress testing log information based on the policy engine, and identify abnormal events; Send alarm information based on the analysis results of the policy engine.
[0006] Optionally, obtain stress testing log information, including: Collect stress testing log information according to the log collection cycle, and the stress testing log information includes task name, start time, time consumption, transaction keywords, and response code; Store stress testing log information in the database; Clean up the stress testing log information in the database according to the data cleanup cycle.
[0007] Optionally, build a policy engine to analyze stress testing log information based on the policy engine to determine abnormal events, including: Differentiate priorities according to the event sequence of the stress testing log, and classify the stress testing log information according to the priorities, wherein the priorities are the order in which the stress testing log information is processed; The event log records sort the obtained stress test log information by start time; the number of logs recorded within 1 second is used as the TPS of the event; the number of stress test log information recorded in the statistical period is determined by the statistical period and TPS, which is recorded as TPS10sec; The fluctuation algorithm is used to analyze TPS10sec. If the TPS10sec of adjacent statistical periods exceeds the threshold, the current event is marked as a suspicious event. When the number of occurrences of the suspicious event exceeds a number threshold, the current event is determined to be an abnormal event.
[0008] Optionally, a policy engine is constructed to analyze stress testing log information according to the policy engine to determine abnormal events, which also includes: The event log records sort the obtained stress test log information by response time; the number of log records within 1 second is used as the TPS of the event; the number of stress test log information recorded in the statistical period is determined by the statistical period and TPS, which is recorded as TPS10sec; The fluctuation algorithm is used to analyze TPS10sec. If the TPS10sec of adjacent statistical periods exceeds the threshold, the current event is marked as a suspicious event. When the number of occurrences of the suspicious event exceeds a number threshold, the current event is determined to be an abnormal event.
[0009] Optionally, a policy engine is constructed to analyze stress testing log information according to the policy engine to determine abnormal events, which also includes: Determine the error rate of stress test log information within the statistical period; If the error rate during the statistical period exceeds the error rate threshold, the current event is considered an abnormal event.
[0010] Optionally, a policy engine is constructed to analyze stress testing log information according to the policy engine to determine abnormal events, which also includes: Determine the number of errors reported in the stress test log information within the evaluation period; If the number of errors in the stress test log information exceeds the error threshold during the evaluation period, the current event is considered an abnormal event.
[0011] Optionally, the policy engine is also used to: Generate a log query interface, which is used to display information about abnormal events counted by the policy engine.
[0012] On the other hand, a device for processing a stress testing log is provided, including: Acquisition module, used to obtain stress testing log information; The analysis module is used to build a policy engine, analyze the stress testing log information according to the policy engine, and identify abnormal events; The output module is used to send alarm information based on the analysis results of the policy engine.
[0013] On the other hand, an electronic device is provided, characterized by comprising the apparatus for processing stress testing logs as described above.
[0014] On the other hand, a computer-readable storage medium is provided, in which at least one program code is stored, and the program code is executed by a processor to implement the method for processing a stress testing log as described in any one of the above items.
[0015] The beneficial effects brought by the technical solution provided by the present invention are: In the present invention, a method for processing stress testing logs is provided. By automatically obtaining stress testing log information and automatically analyzing the stress testing log information through a policy engine, abnormal events can be determined, so that relevant personnel can be notified in time to repair or optimize the abnormal events, effectively preventing production problems. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 A flow chart of a method for processing stress testing logs provided by the present invention; Figure 2 A structural block diagram of a stress testing log processing device provided by the present invention; Figure 3 This is a structural block diagram of an electronic device provided by the present invention.
[0018] The reference numerals are as follows: 21: Acquisition module; 22: Processing module; 23: Output module.
[0019] 31: processor; 32: memory. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. 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 ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0021] Figure 1 This is a flow chart of a method for processing stress testing logs provided by the present invention. Figure 1 ,include: S11. Obtain stress testing log information.
[0022] In one example, S11 includes: Step S111: Collect stress testing log information according to the log collection cycle, wherein the stress testing log information includes task name, start time, time consumption, transaction keyword, and response code.
[0023] Step S112: Store the stress testing log information in the database.
[0024] Step S113: clean up the stress testing log information in the database according to the data cleanup cycle.
[0025] In this embodiment, by storing the stress testing log information in a database and periodically cleaning the stress testing log information in the database according to a data cleaning cycle, it is possible to ensure that the resource occupancy rate of the stress testing log information is low.
[0026] Exemplarily, step S11 may include: Step 1.1: Log in to the server where the stress test machine is located, enable the stress test log collection device, and start the stress test script.
[0027] Step 1.2: The log collection device collects stress test log information including: task name, start time, duration, server IP, port number, protocol type, request type, URL path, transaction keyword, response code, response code annotation, request message, response message, etc. The log collection cycle is once per second.
[0028] Step 1.3: The storage medium of the acquisition device uses a database, and the name of the storage data table is designed to be: performancelog_information. The fields include: task name, start time, time consumption, server IP, port number, protocol type, request type, URL path, transaction keyword, response code, response code annotation, request message, response message, etc. In order to improve the query performance, a field index is established: task name + transaction keyword; Step 1.4: The data collected by the collection device is transmitted to the storage medium of the analysis device through the communication protocol and stored in the database table, including: task name, start time, duration, server IP, port number, protocol type, request type, URL path, transaction keyword, response code, response code annotation, request message, response message, etc.; Step 1.5: Data cleaning and maintenance of storage media. Regularly clean up historical data of stress testing logs to maintain the availability and performance of data storage. The retention policy is: retain data for the past 90 days (data cleaning cycle) and delete data older than 90 days.
[0029] S12. Build a policy engine, analyze the stress testing log information according to the policy engine, and determine abnormal information in the stress testing log information.
[0030] In one example, step S12 includes: S121, distinguishing priorities according to the event sequence of the stress testing log, and classifying the stress testing log information according to the priorities, wherein the priorities are the processing order of the stress testing log information; S122, event log records sort the obtained stress testing log information by start time; the number of log entries recorded within 1 second is used as the TPS of the event; the number of stress testing log information recorded within the statistical period is determined by the statistical period and TPS, recorded as TPS10sec.
[0031] Event log records are sorted by time, and the number of log records within 1 second is taken as the TPS of this event; the number of log records is counted with 10 seconds as a statistical period, recorded as TPS10sec.
[0032] S123. The TPS10sec is analyzed using a fluctuation algorithm. If the TPS10sec of adjacent statistical periods exceeds a threshold, the current event is marked as a suspicious event.
[0033] Using the fluctuation algorithm for analysis, if the TPS10sec of the subsequent cycle is within 20% of the TPS10sec of the previous cycle, the fluctuation is considered to be normal. If it exceeds the 20% range, it is marked as a suspicious anomaly, thus identifying the current event as a suspicious event.
[0034] S124: When the number of occurrences of the suspicious event exceeds a number threshold, determine that the current event is an abnormal event.
[0035] In this embodiment, the stress test log information is analyzed by the start time, and by the difference in the number of stress test log information in adjacent statistical periods, if the difference in the number of stress test log information in adjacent statistical periods is too large, the current event can be determined to be a suspicious event. If the current event is determined to be a suspicious event multiple times, the current event can be determined to be an abnormal event.
[0036] In this embodiment, step S12 further includes: Step S125, event log records sort the obtained stress testing log information by response time; the number of log entries recorded within 1 second is used as the TPS of the event; the number of stress testing log information recorded within the statistical period is determined by the statistical period and TPS, recorded as TPS10sec.
[0037] Step S126: Use a fluctuation algorithm to analyze TPS10sec. If the TPS10sec of adjacent statistical periods exceeds a threshold, mark the current event as a suspicious event.
[0038] Using the fluctuation algorithm for analysis, if the average value of TPS10sec in the subsequent period is within 20% of the average value of TPS10sec in the previous period, the fluctuation is considered to be normal. If it exceeds the 20% range, it is marked as a suspicious anomaly, thus identifying the current event as a suspicious event.
[0039] Step S127: When the number of occurrences of the suspicious event exceeds a threshold number, determine that the current event is an abnormal event.
[0040] In this embodiment, the stress testing log is also analyzed by response time to further analyze whether the current event is an abnormal event, thereby improving the accuracy of the analysis.
[0041] In this embodiment, step S12 further includes: Step S128: Determine the error rate of the stress testing log information within the statistical period.
[0042] Step S129: If the error rate within the statistical period exceeds the error rate threshold, the current event is considered to be an abnormal event.
[0043] Among them, the error rate threshold can be 0.03%.
[0044] In this embodiment, it is further determined whether the current event is a suspicious event by counting the error rate of the stress testing log information to ensure the accuracy of the analysis.
[0045] As an alternative to step S128 and step S129, step S12 further includes: Step S128, determining the number of errors reported in the stress testing log information within the evaluation period.
[0046] The evaluation period may be 30 seconds.
[0047] Step S129: If the number of error reports in the stress test log information during the evaluation period exceeds the error report number threshold, the current event is considered an abnormal event.
[0048] The error reporting threshold may be 10 times.
[0049] In this embodiment, by determining the number of error reports within the evaluation period, it is also possible to determine whether the current event is an abnormal event.
[0050] In this embodiment, the policy engine is also used to: Generate a log query interface, which is used to display information about abnormal events counted by the policy engine.
[0051] In this embodiment, a log query interface is generated, which can facilitate displaying the statistical results of the policy engine in the form of images.
[0052] Exemplarily, the query conditions of the log query interface include: task name / transaction keyword / start time / end time; the number of summary records of the stress test log results is counted in two dimensions: 1. Success / failure (error response code classification), 2. Time consumption (transaction category / query classification). And they are displayed separately in the log query interface. By clicking on the number of summary records, you can jump to the corresponding detailed interface, which displays the task name, start time, time consumption, server IP, port number, protocol type, request type, URL path, transaction keyword, response code, response code annotation, request message, response message, etc.: S13. Send an alarm message based on the analysis result of the policy engine.
[0053] In one example, step S13 includes: Step S131: After the early warning device detects abnormal results according to the policy engine, the early warning device notifies the corresponding persons in charge through WeChat, including: the person in charge of the R&D system, the person in charge of performance testing, and R&D and performance testing personnel.
[0054] Step S132, the early warning device detects anomalies based on the policy engine, triggers a script task to collect message information, and sends it to the person in charge of the R&D system, the person in charge of performance testing, and R&D and performance testing personnel via email, so that the R&D personnel can analyze the problem through logs and optimize the solution.
[0055] In the present invention, a method for processing stress testing logs is provided. By automatically obtaining stress testing log information and automatically analyzing the stress testing log information through a policy engine, abnormal events can be determined, so that relevant personnel can be notified in time to repair or optimize the abnormal events, effectively preventing production problems.
[0056] Figure 2 This is a structural block diagram of a stress test log processing device provided by the present invention. Figure 2 ,include: The acquisition module 21 is used to obtain stress testing log information.
[0057] The analysis module 22 is used to build a policy engine, analyze the stress testing log information according to the policy engine, and determine abnormal events.
[0058] The output module 23 is used to send alarm information according to the analysis result of the policy engine.
[0059] Figure 3 This is a structural block diagram of an electronic device provided in this embodiment. Figure 3 , electronic devices may include Figure 2 The stress test log processing device generally includes a processor 31 and a memory 32 .
[0060] The processor 31 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 31 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 31 may also include a main processor and a coprocessor, the main processor is a processor for processing data in the wake-up state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. The memory 32 may include one or more computer-readable storage media, which may be non-transitory. The memory 32 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 32 is used to store at least one instruction, which is used to be executed by the processor 31 to implement the method for processing stress test logs performed by an electronic device provided in the method embodiment of the present application.
[0061] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for processing stress testing logs, characterized in that: include: Get stress testing log information; Build a policy engine, analyze stress testing log information based on the policy engine, and identify abnormal events; Send alarm information based on the analysis results of the policy engine.
2. The method for processing stress testing logs according to claim 1, characterized in that: Obtain stress testing log information, including: Collect stress testing log information according to the log collection cycle, and the stress testing log information includes task name, start time, time consumption, transaction keywords, and response code; Store stress testing log information in the database; Clean up the stress testing log information in the database according to the data cleanup cycle.
3. The method for processing stress testing logs according to claim 2, characterized in that: Build a policy engine, analyze the stress test log information based on the policy engine, and identify abnormal events, including: Differentiate priorities according to the event sequence of the stress testing log, and classify the stress testing log information according to the priorities, wherein the priorities are the order in which the stress testing log information is processed; The event log records sort the obtained stress test log information by start time; the number of logs recorded within 1 second is used as the TPS of the event; the number of stress test log information recorded in the statistical period is determined by the statistical period and TPS, which is recorded as TPS10sec; The fluctuation algorithm is used to analyze TPS10sec. If the TPS10sec of adjacent statistical periods exceeds the threshold, the current event is marked as a suspicious event. When the number of occurrences of the suspicious event exceeds a number threshold, the current event is determined to be an abnormal event.
4. The method for processing stress testing logs according to claim 3, characterized in that: Build a policy engine, analyze the stress test log information based on the policy engine, identify abnormal events, and also include: The event log records sort the obtained stress test log information by response time; the number of log records within 1 second is used as the TPS of the event; the number of stress test log information recorded in the statistical period is determined by the statistical period and TPS, which is recorded as TPS10sec; The fluctuation algorithm is used to analyze TPS10sec. If the TPS10sec of adjacent statistical periods exceeds the threshold, the current event is marked as a suspicious event. When the number of occurrences of the suspicious event exceeds a number threshold, the current event is determined to be an abnormal event.
5. The method for processing stress testing logs according to claim 4, characterized in that: Build a policy engine, analyze the stress test log information based on the policy engine, identify abnormal events, and also include: Determine the error rate of stress test log information within the statistical period; If the error rate during the statistical period exceeds the error rate threshold, the current event is considered an abnormal event.
6. The method for processing stress testing logs according to claim 4, characterized in that: Build a policy engine, analyze the stress test log information based on the policy engine, identify abnormal events, and also include: Determine the number of errors reported in the stress test log information within the evaluation period; If the number of errors in the stress test log information exceeds the error threshold during the evaluation period, the current event is considered an abnormal event.
7. The method for processing stress testing logs according to any one of claims 1 to 6, characterized in that: The policy engine is also used to: Generate a log query interface, which is used to display information about abnormal events counted by the policy engine.
8. A stress test log processing device, characterized in that: include: Acquisition module, used to obtain stress testing log information; The analysis module is used to build a policy engine, analyze the stress testing log information according to the policy engine, and identify abnormal events; The output module is used to send alarm information based on the analysis results of the policy engine.
9. An electronic device, characterized in that: A processing device for stress testing logs comprising the device as claimed in claim 8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one program code, and the program code is executed by a processor to implement the method for processing stress testing logs according to any one of claims 1 to 7.