System interface stress testing methods, devices and storage media
By adaptively adjusting test configuration parameters and automatically conducting the next round of testing based on the test results, the problem of high human intervention in existing technologies is solved, realizing automated stress testing of system interfaces, reducing costs and improving accuracy.
Patent Information
- Application Number
- CN202611172864.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-04
- Publication Date
- 2026-11-10
- Estimated Expiration
- 2046-08-04
AI Technical Summary
The existing system interface stress testing process requires manual intervention, resulting in high labor costs and making automation impossible.
By adaptively adjusting test configuration parameters and automatically performing the next round of testing based on the test results, automated load testing can be achieved, replacing manual modifications.
It reduces human intervention, lowers labor costs, and improves the automation and accuracy of stress testing.
Smart Images

Figure CN122691966B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of software performance testing technology, and in particular relates to a system interface stress testing method, apparatus and storage medium. Background Technology
[0002] In microservice architectures, interfaces such as HTTP (Hypertext Transfer Protocol) and gRPC (Google Remote Procedure Call) are widely used. When these interfaces receive high concurrency requests, they may affect system stability. Therefore, interface stress testing is a critical step in ensuring system stability.
[0003] Currently, testers typically set test parameters, such as the number of concurrent threads, stress test time, and test duration. They then test the interface according to these parameters to obtain sampling results. Based on these results, the testers manually modify the test parameters and test the interface again. After multiple rounds of modifying the test parameters and rerunning the test, the stress test on the interface is completed.
[0004] However, this testing method requires manual intervention throughout the entire testing process, resulting in high labor costs. Summary of the Invention
[0005] This application provides a system interface stress testing method, apparatus, and storage medium that can adaptively modify test parameters, reduce manual intervention, lower labor costs, and achieve automated stress testing.
[0006] In a first aspect, embodiments of this application provide a system interface stress testing method, the method comprising: Retrieve the test configuration parameters for the current testing phase; Based on the test configuration parameters, the driver thread sends a target request to the target interface to perform stress testing on the target interface, and records the sampled data generated by each request to a preset file. The target interface is the interface to be tested in the system interface. Obtain all the sampled data of the current testing phase from the preset file, and determine the test result of the target interface based on the sampled data; Based on the test results, the test configuration parameters for the next test phase are determined. If the current test phase has not reached the preset test convergence state, the next test phase is updated to the current test phase, and the process returns to the step of obtaining the test configuration parameters for the current test phase and subsequent steps.
[0007] In this way, during the testing process, based on all the sampled data of the current testing phase, the test results of the target interface are determined according to the sampled data. By analyzing the test results, the test configuration parameters for the next testing phase are determined based on the test results. If the current testing phase has not reached the preset test convergence state, the next testing phase is updated to the current testing phase, and a new round of testing is started. The test results based on the current testing phase are set as feedback to adaptively adjust the test configuration parameters. Then, the next round of testing is automatically carried out based on the adjusted test configuration parameters, replacing manual modification of test configuration parameters and realizing automated load testing.
[0008] In one optional implementation of the first aspect, the test results include the response error rate of the target interface to the target request and the identification results of the latency inflection point, and the test configuration parameters include the number of threads and the ramp-up time; The step of determining the test configuration parameters for the next testing phase based on the test results includes: When the response error rate is greater than or equal to a first error rate threshold, or when there is a latency inflection point in the current test phase, the number of threads in the next test phase is reduced and / or the ramp-up time is increased. The latency inflection point represents a sudden change in the response time of the target interface to all target requests.
[0009] In an optional implementation of the first aspect, determining the test configuration parameters for the next test phase based on the test results further includes: When the response error rate is less than the first error rate threshold and there is no latency inflection point in the current test phase, the test configuration parameters remain unchanged; The trigger count is incremented by 1. When the count is greater than or equal to a preset number of times, the current test phase reaches a preset test convergence state.
[0010] In an optional implementation of the first aspect, determining the test configuration parameters for the next test phase based on the test results further includes: When the response error rate is less than the first error rate threshold and there is no latency inflection point in the current test phase, it is determined whether the response error rate is less than the second error rate threshold. The first error rate threshold is greater than the second error rate threshold, and the second error rate threshold represents the maximum error rate allowed when applying pressure to the target interface. If the response error rate is less than the second error rate threshold, then the number of threads in the next test phase is increased; If the response error rate is not less than the second error rate threshold, the test configuration parameters remain unchanged, and the count value is incremented by 1. When the count value is greater than or equal to the preset number of times, the current test phase reaches the preset test convergence state.
[0011] In one alternative implementation of the first aspect, it also includes: When the number of threads is greater than or equal to the maximum number of concurrent threads, or when the count value is greater than or equal to a preset number of times, it is determined that the current test phase has reached a preset test convergence state.
[0012] In one optional implementation of the first aspect, the sampling data includes the response time of the target interface to the target request, and determining the test result of the target interface based on the sampling data includes: The sampled data is sliced at preset intervals to obtain multiple data intervals; Determine the target feature value corresponding to the response time of the target request within the valid data interval. The target feature value represents the average distribution trend of the response time of the target request within the valid data interval. The valid data interval is the data interval corresponding to the non-working thread startup time. The reference response time is determined based on the target feature values of the multiple valid data intervals. Based on the reference response time and preset coefficient, the delay inflection point within each of the data intervals is identified.
[0013] In one optional implementation of the first aspect, determining the target feature value corresponding to the response time of the target request within the valid data interval includes: Obtain the average response time of the target request within the effective data interval, and determine the average value as the target feature value; Alternatively, the response times of the target request within the effective data range can be sorted from smallest to largest, and the 95th percentile response time can be determined as the target feature value.
[0014] In one optional implementation of the first aspect, identifying the delay inflection point within each of the data intervals based on the reference response time and a preset coefficient includes: The reference response time is corrected based on a preset coefficient; If the target feature value corresponding to the data interval is greater than or equal to the corrected reference response time, then a delay inflection point is determined to exist within the data interval.
[0015] Secondly, embodiments of this application provide a system interface stress testing device, comprising: The acquisition unit is used to acquire the test configuration parameters for the current test phase. The load testing execution unit is used to drive the worker thread to send a target request to the target interface based on the test configuration parameters, so as to perform load testing on the target interface, and record the sampled data generated by each request to a preset file. The target interface is the interface to be tested in the system interface. An analysis unit is configured to obtain all the sampled data of the current testing phase from the preset file, and determine the test result of the target interface based on the sampled data; The parameter adaptive adjustment unit is used to determine the test configuration parameters for the next test stage based on the test results, and to update the next test stage to the current test stage and trigger the acquisition unit when the current test stage has not reached the preset test convergence state.
[0016] Thirdly, embodiments of this application provide an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the system interface stress testing method as described in any one of the first aspects above.
[0017] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the system interface stress testing method as described in any one of the first aspects above.
[0018] Fifthly, embodiments of this application provide a computer program product that, when run on a terminal device, causes the terminal device to execute the system interface stress testing method described in any one of the first aspects.
[0019] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a schematic diagram of a system interface stress testing system provided in an embodiment of this application; Figure 2 This is a flowchart illustrating a system interface stress testing method provided in an embodiment of this application; Figure 3This is a flowchart illustrating a system interface stress testing method according to another embodiment of this application; Figure 4 This is a flowchart illustrating a system interface stress testing method provided in another embodiment of this application; Figure 5 This is a structural block diagram of the system interface stress testing device provided in the embodiments of this application; Figure 6 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0022] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0023] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0024] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0025] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."
[0026] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0027] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0028] In microservice architectures, interfaces such as HTTP (Hypertext Transfer Protocol) and gRPC (Google Remote Procedure Call) are widely used. When these interfaces receive high concurrency requests, they may affect system stability. Therefore, interface stress testing is a critical step in ensuring system stability.
[0029] In relevant interface stress testing solutions, an open-loop testing system is typically used. Testers set test parameters, such as the number of concurrent threads, stress time, and test duration. The interface is tested according to the set test parameters to obtain sampling results. Then, the testers manually modify the test parameters based on the sampling results and test the interface again based on the modified test parameters. After multiple rounds of modifying test parameters and rerunning the test, the test results are finally statistically analyzed to complete the stress test of the interface.
[0030] However, this testing method requires manual intervention throughout the entire testing process, resulting in high labor costs.
[0031] Based on this, this application provides a system interface load testing method. During the testing process, the method analyzes the test results (referring to test performance results) and then adaptively adjusts the test configuration parameters based on these results. The next round of testing is then automatically performed based on the adjusted test configuration parameters, replacing manual modification of the test configuration parameters and achieving automated load testing. This application's ability to adaptively adjust test configuration parameters is based on its test result identification and analysis capabilities, as well as a mechanism that maps test results back to and adjusts test configuration parameters. The following detailed description, in conjunction with the accompanying drawings and embodiments, provides further details.
[0032] Figure 1 Please refer to the schematic diagram of the system interface stress testing system provided in one embodiment of this application. Figure 1The system interface stress testing system is used to stress test the interfaces of the system under test. The system interface stress testing system includes a stress testing control layer and a stress testing machine cluster. The stress testing control layer is connected to the stress testing machine cluster, and the stress testing machine cluster is connected to the system under test (such as to the various interfaces of the system under test).
[0033] The load testing control layer provides a user interface. Users input initial test configuration parameters and load testing commands through this interface. The load testing control layer executes the load testing process (such as executing worker threads) according to the commands. Based on the initial test configuration parameters, it controls the load testing machine cluster to simulate requests and send them to the system under test. Upon receiving the request, the system under test responds.
[0034] The load testing control layer is also connected to the system under test (SUT). During load testing, it synchronously records the sampled data generated each time a request is sent. Based on this sampled data, it determines the test results of the target interface and decides whether to update the test configuration parameters. If updating the test configuration parameters is permitted, it automatically adjusts them and re-executes the load testing process for a new round. If updating the test configuration parameters is not permitted (e.g., the SUT does not meet the conditions for increasing or decreasing load), it further determines whether to terminate the test or continue testing while maintaining the current test configuration parameters.
[0035] In this embodiment, the system interface stress testing system can be deployed on a server or a computer; that is, the system interface stress testing method provided in this embodiment can be applied to terminal devices such as servers or computers. This embodiment does not impose any restrictions on the specific type of terminal device.
[0036] Figure 2 This illustration shows a flowchart of a system interface stress testing method provided in an embodiment of this application, which is applied to the aforementioned system interface stress testing system, such as... Figure 2 As shown, the system interface stress testing method includes: S210, retrieve the test configuration parameters for the current testing phase.
[0037] The system interface stress testing process requires multiple rounds of testing to obtain the performance of the system interface. These multiple rounds of testing can be conducted on the system interface based on different test configuration parameters to obtain more accurate test results.
[0038] In this embodiment, during the first round of testing, the tester sets the test configuration parameters, i.e., the initial test configuration parameters, based on the operation interface of the load testing system. Subsequent test configuration parameters are automatically updated based on the test results. In this step, the current test phase refers to the load testing phase currently being executed by the load testing system. The current test phase can be the first round of testing or a subsequent round.
[0039] The test configuration parameters include the number of threads (concurrent threads), ramp-up time, and the duration of each test phase, etc. These parameters are obtained through the parameter initialization unit.
[0040] S220, based on test configuration parameters, drives worker threads to send target requests to the target interface to perform load testing on the target interface, and records the sampled data generated by each request to a preset file.
[0041] The target interface is the interface to be tested in the system interface. There can be one or more target interfaces. This embodiment will use one target interface as an example for explanation.
[0042] In step S220, based on the test configuration parameters, load testing for the current test phase is performed on the target interface, and a preset file recording the sampled data is output. The preset file adopts the JTL file format (JMeter Text Log). As an example, the load testing process includes the following steps: First, the load testing system initializes the runtime environment for the current test phase, configures the number of threads, ramp-up time, and duration of the current test phase, creates a load testing session, and executes the load testing process based on the session. Here, "thread" refers to worker threads, and the number of threads reflects the number of concurrent worker threads; "ramp-up time" refers to the total startup time of concurrent threads.
[0043] Then, based on the ramp-up time and the number of threads, the startup interval for each worker thread is calculated. Worker threads are then started gradually according to these intervals to simulate real traffic growth, while avoiding a sudden surge of target requests to the target interface that could disrupt system startup. For example, if the number of threads is 10 and the ramp-up time is 10 seconds, the startup interval for the worker threads is (10 seconds × 1000) / 10 = 1000 milliseconds. That is, one worker thread is started every 1000 milliseconds, and all worker threads are started within 10 seconds.
[0044] After each worker thread starts, it executes the sequence of steps in the test process in a loop within the duration of the current test phase to perform load testing on the interface and complete the load test. For example, if the duration is 60 seconds, each worker thread will continuously send multiple target requests to the target interface within 60 seconds according to the test process to test the response performance of the target interface to the target requests.
[0045] During the execution of the test step sequence by the worker thread, multiple target requests are sent to the target interface. The sampled data generated each time a target request is sent is recorded in a preset file. These multiple target requests can be concurrent requests. The sampled data includes the request initiation timestamp, the request response time, the request tag (indicating the target interface), the response success or failure flag, the response bytes, etc.
[0046] S230: Obtain all sampled data for the current testing phase from the preset file, and determine the test results of the target interface based on the sampled data.
[0047] When the test duration is reached, all sampled data is retrieved from a preset file. The test results for the target interface are then analyzed based on this data, and these results are expressed through performance metrics of the target interface. For example, test results may include response error rate, throughput, and the presence of latency inflection points.
[0048] As an example, the response error rate is calculated based on the response success flag and / or response failure flag. The throughput of the target interface is calculated based on the response time and the request initiation timestamp. The latency inflection point is identified based on the response time or the response latency level. The specific identification process of the latency inflection point can be referred to the following embodiment.
[0049] S240 determines whether the test configuration parameters for the next testing phase can be updated based on the test results.
[0050] If it is determined that the test configuration parameters for the next test phase can be updated, then execute S250 to determine the configuration parameters for the next test phase, update the next test phase to the current test phase, and return to execute steps S210 to S250.
[0051] The next testing phase refers to the next round of load testing that needs to be conducted after the current testing phase is completed. In this embodiment, the test results determine whether the test configuration parameters can be adjusted to trigger the next round of load testing on the target interface. This achieves adaptive adjustment of test configuration parameters and automatic triggering of the next round of load testing based on the test results of the system interface, without manual intervention.
[0052] Among them, based on the system interface's ability to process response requests or the system interface's performance, it is determined whether the test configuration parameters for the next testing phase can be updated and the load test can continue.
[0053] In one embodiment, when the response error rate is greater than or equal to a first error rate threshold, or when a latency inflection point exists in the current test phase, it is determined that the test configuration parameters for the next test phase need to be updated. The first error rate threshold represents the maximum response error under normal operating conditions of the target interface. When the response error rate is greater than or equal to the first error rate threshold, it is determined that the target interface is under excessive load and is in an abnormal operating state. Therefore, when the response error rate is greater than or equal to the first error rate threshold, the test configuration parameters need to be adjusted, and the next round of testing needs to be conducted to detect the performance indicators of the target interface under normal operating conditions. A latency inflection point represents a sudden change in the response time of the target interface for all target requests. The existence of a latency inflection point in the current test phase indicates that the target interface is experiencing timeout responses when processing requests, meaning that the target interface is under excessive load and is in an abnormal operating state in the current test phase. Therefore, when a latency inflection point exists in the current test phase, the test configuration parameters need to be adjusted, and the next round of testing needs to be conducted to detect the performance indicators of the target interface under normal operating conditions.
[0054] In other words, when the response error rate is greater than or equal to the first error rate threshold, or when there is a latency inflection point in the current testing phase, it is necessary to de-stress the target interface. This can be achieved by reducing the number of threads in the next testing phase and / or increasing the ramp-up time, in order to determine the test configuration parameters for the next testing phase. Fewer threads and / or longer thread start intervals, resulting in slower thread startup, reduce the pressure on the target interface to respond to target requests.
[0055] In some embodiments, the test configuration parameters also include a single-thread decay amount and / or a single-climb time increment. The target thread count is obtained based on the difference between the current test phase's thread count and the single-thread decay amount. This target thread count is the thread count for the next test phase. The target climbing time is determined based on the current test phase's climbing time and the single-climb time increment. This target climbing time is the climbing time for the next test phase. Alternatively, in some embodiments, the test configuration parameters also include a single-thread decay coefficient and / or a single-climb time growth coefficient. The target thread count, i.e., the thread count for the next test phase, is obtained by multiplying the current test phase's thread count and the decay coefficient. The target climbing time, i.e., the climbing time for the next test phase, is obtained by multiplying the current test phase's climbing time and the growth coefficient.
[0056] Furthermore, the test configuration parameters also include the minimum number of threads. When reducing the number of threads in the next test phase, the number of threads in the next test phase is determined based on the target number of threads and the minimum number of threads. For example, if the target number of threads is greater than the minimum number of threads, then the target number of threads is determined as the number of threads in the next test phase; if the target number of threads is less than the minimum number of threads, then the minimum number of threads is determined as the number of threads in the next test phase, to avoid reducing the number of threads to 0 or below the allowed lower limit.
[0057] Furthermore, the configuration parameters also include an upper limit and a lower limit for ramp time growth. After determining the target ramp time, it is determined whether the target ramp time is between the upper limit and the lower limit. If the target ramp time is between the upper limit and the lower limit, the target ramp time is set as the ramp time for the next test phase. If the target ramp time is greater than the upper limit, the upper limit is set as the ramp time for the next test phase. If the target ramp time is less than the lower limit, the lower limit is set as the ramp time for the next test phase.
[0058] When it is determined that de-stressing is necessary, not only is the number of threads reduced, but the ramp-up time is also extended. After de-stressing, the next test phase runs with fewer threads and a slower startup rate, avoiding secondary overload caused by a sudden surge of requests after de-stressing.
[0059] Alternatively, in other embodiments, the test configuration parameters for the next test phase can be determined in other ways, such as based on the magnitude of the response error rate, or based on the difference between the response time corresponding to the latency inflection point and the target response time, etc.
[0060] In one embodiment, when the response error rate is less than a first error rate threshold and there is no latency inflection point in the current test phase, it is determined that the system interface can normally process the currently initiated request, the system interface is in a normal working state, and the test configuration parameters can remain unchanged, that is, the test configuration parameters for the next test phase are not updated. Alternatively, the system interface can be boosted, for example, by increasing the number of threads in the next test phase, wherein the method of increasing the number of threads in the next test phase is the same as the method of determination in the aforementioned deboosting process.
[0061] When it is determined that the test configuration parameters for the next test phase cannot be updated, two scenarios may occur. In one scenario, the test results meet the test requirements, and no further adjustment of the test configuration parameters is needed. Testing continues based on the current test configuration parameters to stabilize the test results. In the other scenario, the test has reached the maximum number of concurrent threads, and further adjustments are not possible, or the test results have stabilized, requiring the test to end. Therefore, in this embodiment, when it is determined that the test configuration parameters for the next test phase cannot be updated, step S260 is executed to determine whether the current test phase has reached a preset test convergence state. If the current test phase has reached the preset test convergence state, step S270 is executed to end the test. If the current test phase has not reached the preset test convergence state, step S280 is executed, keeping the test configuration parameters unchanged, and returning to steps S210 to S250 to continue testing based on the current test configuration parameters, allowing the test process to stabilize.
[0062] In one embodiment, if the number of threads is greater than or equal to the maximum concurrent thread count, the current test phase is determined to have reached a preset test convergence state. The test configuration parameters also include the maximum concurrent thread count of the target interface. For example, if the current test phase has 10 threads and the maximum concurrent thread count is 60, then the current thread count is less than the maximum concurrent thread count. If the current test phase has 60 or more threads, then the current thread count is greater than or equal to the maximum concurrent thread count.
[0063] In one embodiment, the load testing system also includes a counter that records the number of consecutive times the test configuration parameters remain unchanged, automatically terminating the test. For example, when the response error rate is less than a first error rate threshold and there is no latency inflection point in the current test phase, the counter is incremented by 1. If the counter is greater than or equal to a preset number of times, the current test phase is considered to have reached a preset test convergence state, and the next test phase is not initiated. If the counter is less than the preset number of times, the next test phase is initiated with the current test configuration parameters. Additionally, if the response error rate is greater than or equal to the first error rate threshold, or there is a latency inflection point in the current test phase, or the number of threads is greater than or equal to the maximum concurrent thread count, the counter is reset to zero. This ensures that the test automatically terminates only when the response error rate is consistently below the first error rate threshold and there is no latency inflection point in the current test phase, preventing premature termination of the test before it reaches stability and reducing the accuracy of automated testing.
[0064] The following example illustrates the system interface stress testing process in this application embodiment: Assume the initial test configuration parameters are configured as follows: 10 threads, 50 maximum concurrent threads, 10 threads per increment, 0.7 decay coefficient per thread, 10 seconds ramp time, 2 increment coefficient per ramp time, and 60 seconds duration of the current test phase.
[0065] A worker thread is started every 1000ms. After the worker thread starts, it executes the test step sequence in a loop for 60 seconds, sends requests to the target interface, and analyzes the test results based on the sampled data generated when sending requests.
[0066] If the test results determine that the response error rate is greater than or equal to the first error rate threshold, or if there is a latency inflection point in the current test phase, then the number of threads in the next test phase is determined to be 7, and / or the ramp-up time in the next test phase is determined to be 20 seconds. In the next test phase, a worker thread is started every 2850ms to reduce the impact of requests and further test the response performance of the target interface after de-stressing.
[0067] If the test results determine that the response error rate is less than the first error rate threshold, and there is no latency inflection point in the current test phase, then maintain the current test configuration parameters, or perform a boost test. For example, perform a boost test on the target interface, determine that the number of threads in the next test phase is 20, and in the next test phase, start a worker thread every 500ms to rapidly increase requests to the target interface, further testing the response performance of the target interface after boosting.
[0068] After the test is completed, a test report is generated based on the test results and then output.
[0069] In this embodiment, during the testing process, based on all the sampled data of the current testing phase, the test results of the target interface are determined according to the sampled data. By analyzing the test results, the test configuration parameters for the next testing phase are determined. If the current testing phase has not reached the preset test convergence state, the next testing phase is updated to the current testing phase, and a new round of testing is started. The test results of the current testing phase are used as feedback to adaptively adjust the test configuration parameters. Then, the next round of testing is automatically performed based on the adjusted test configuration parameters, replacing manual modification of the test configuration parameters and achieving automated load testing. Furthermore, the response error rate and latency inflection point directly reflect the performance of the target interface. Based on the response error rate and latency inflection point, the next test configuration parameters can be accurately adjusted, improving the efficiency and accuracy of automated load testing.
[0070] Figure 3 This illustration shows a flowchart of a system interface stress testing method according to another embodiment of this application, applied to the aforementioned system interface stress testing system. Figure 2 Based on the previous embodiment, this embodiment determines the test configuration parameters for the next stage and the test convergence status of the system according to the priority of each test result from high to low, as follows: Figure 3 As shown, the method includes: S310: Obtain the test configuration parameters for the current testing phase.
[0071] The S320, based on test configuration parameters, drives worker threads to send target requests to the target interface to perform load testing on the target interface, and records the sampled data generated by each request to a preset file.
[0072] S330 retrieves all sampled data from the preset file for the current testing phase and determines the response error rate and latency inflection point of the target interface based on the sampled data.
[0073] The specific implementation process and implementation principle of steps S310 to S330 are the same as those described above. Figure 2S210 to S230 in the embodiments are the same, and the specific details can be found in the foregoing embodiments, which will not be repeated here.
[0074] Unlike the previous embodiments, the test results in this embodiment include the response error rate, the identification result of the latency inflection point, whether the maximum number of concurrent threads has been reached, and whether the maximum allowable error rate has been reached when applying pressure to the target interface. Based on one or more of the above test results, this embodiment decides the next target operation after the current test phase is completed. For example, the next target operation includes starting the next test phase after updating the test configuration parameters, starting the next test phase while maintaining the current test configuration parameters, or ending the test.
[0075] It is understandable that different performance requirements for the target interface lead to different decision results from the load testing system, resulting in different test processes. For example, in one embodiment, a high response success rate for the target interface is required, meaning a reduction in the response error rate. Secondly, it is necessary to minimize latency. To achieve these performance requirements for the target interface, this embodiment prioritizes test results such as response error rate, the presence of a latency inflection point, and whether the maximum concurrent threads have been reached. The response error rate has the highest priority, while the maximum concurrent threads have the lowest priority. Therefore, after obtaining the test results, the load testing system decides, in descending order of priority, whether to update the test configuration parameters for the next test phase and adjust the test configuration parameters accordingly. The specific implementation process is as follows: steps S340 to S393.
[0076] Alternatively, in other embodiments, where there are high requirements for the response time of the target interface processing requests, the configuration of whether a latency inflection point exists has the highest priority, while whether the maximum concurrent threads are reached has the lowest priority. Correspondingly, during the testing process, the presence of a latency inflection point in the current testing phase is determined first. If no latency inflection point exists, the response error rate is then assessed. The method for deciding the next target operation based on the test results is the same (as in each step from S340 to S393). The difference between this embodiment and the above embodiments lies in the different priorities of the various test results.
[0077] S340, determine whether the response error rate is greater than or equal to the first error rate threshold; If the response error rate is greater than or equal to the first error rate threshold, then execute S350 to reduce the number of threads in the next test phase and / or increase the ramp-up time.
[0078] The first error rate threshold refers to the pre-configured maximum error rate allowed for the target interface to respond with errors. The first error rate threshold is determined based on the performance requirements of the target interface.
[0079] First, determine if the response error rate meets the requirements. If the response error rate is greater than or equal to the first error rate threshold, it is determined that the response error rate does not meet the requirements, meaning the success rate of the target interface in responding to requests is low. In this case, the test configuration parameters for the next testing phase need to be updated. For example, the number of threads in the next testing phase may be reduced and / or the ramp-up time may be increased. The test should specify the number of concurrent threads and / or the corresponding ramp-up time that the target interface can handle while meeting the response success rate requirements. For details on how to reduce the number of threads and / or increase the ramp-up time in the next testing phase, please refer to the aforementioned methods. Figure 2 Example.
[0080] If the response error rate is less than the first error rate threshold, then execute S360 to determine whether there is a delay inflection point in the current test phase.
[0081] If a delay inflection point exists during the current testing phase, proceed to step S350.
[0082] The latency inflection point is determined based on the response time of each request by the stress testing system. When a latency inflection point exists in the current test phase, it means that the target interface's processing speed for the corresponding request drops rapidly from that latency inflection point (response capability decreases), which means that the target interface is overloaded (excessive pressure). At this time, it is necessary to de-stress the target interface, for example, by reducing the number of threads in the next test phase and / or increasing the ramp-up time. The implementation of reducing the number of threads in the next test phase and / or increasing the ramp-up time can be the same as the specific implementation of S350, or it can be different, for example, by reducing the number of threads or increasing the ramp-up time.
[0083] The absence of latency inflection points in the current testing phase indicates that the response times of the target interface to requests are all within acceptable timeframes (or within the required timeframes for the target interface). For example, if the performance requirement for the target interface is that the response time for all requests is within 50 seconds, and if there are no latency inflection points in the current testing phase, meaning no response times exceeding 50 seconds, then the performance test of the target interface has passed, and no underload testing is required.
[0084] If there is no latency inflection point in the current testing phase, execute S370 to determine whether the number of threads is greater than or equal to the maximum number of concurrent threads.
[0085] If there is no latency inflection point in the current test phase and the response error rate is less than the first error rate threshold, and the target interface's response to the request corresponding to the current test phase meets the test requirements, then it is necessary to first determine whether the current test phase has reached the preset test convergence state in order to determine whether to end the test or continue with stress testing.
[0086] For example, this embodiment determines whether the current test phase has reached the preset test convergence state based on the comparison result between the number of threads and the maximum concurrent thread count. The comparison result includes whether the number of threads is greater than or equal to the maximum concurrent thread count and whether the number of threads is less than the maximum concurrent thread count. If the comparison result is that the number of threads is greater than or equal to the maximum concurrent thread count, it is determined that the current test phase has reached the preset test convergence state, and the number of threads cannot be increased to test the target interface. Therefore, step S380 is executed to end the test.
[0087] The number of threads refers to the actual number of threads started in the current test phase. Under normal circumstances, the actual number of threads started is the same as the number of threads in the test configuration parameters. However, in some special scenarios, the actual number of threads may differ from the number of threads in the test configuration parameters, such as when some threads fail to start.
[0088] If the comparison result shows that the number of threads is less than the maximum concurrent thread count, it indicates that the currently started number of threads has not saturated the target interface. In other words, the number of threads in the current test phase is relatively small, the pressure on the target interface is low, and there is usually no latency inflection point and a low response error rate in the current test phase. In this scenario, it is necessary to further test the actual load-bearing capacity of the target interface, such as increasing the load on the target interface to test its maximum load-bearing capacity. For example, when the number of threads is less than the maximum concurrent thread count, increase the number of threads in the next test phase and start the load test in the next phase. The specific implementation method for increasing the number of threads in the next test phase can be found in the aforementioned... Figure 2 Example.
[0089] In one embodiment, to prevent a sudden increase in the target interface's response error rate when applying pressure, a maximum allowed error rate, i.e., a second error rate threshold, is preset when applying pressure to the target interface. This second error rate threshold is lower than the first error rate threshold. When the target interface's response error rate is below the second error rate threshold, applying pressure to the target interface will not cause a sudden increase in its response error rate, thus reducing the execution of meaningless testing processes.
[0090] That is, when the number of threads is less than the maximum number of concurrent threads, S390 is executed first to determine whether the response error rate is less than the second error rate threshold.
[0091] If the response error rate is less than the second error rate threshold, meaning the target interface can actually handle a larger number of requests and can guarantee a successful response rate, then execute S391 to increase the number of threads in the next test phase to test the actual performance of the target interface.
[0092] In scenarios where pressure can be applied to the target interface, the number of threads in the next testing phase can be adjusted while keeping the startup method unchanged, i.e., keeping the ramp-up time constant.
[0093] The number of threads can be increased in two ways: either by adding a fixed number of threads to the current number of threads in the test phase, or by calculating the number of threads for the next test phase based on a growth factor.
[0094] If the response error rate is not less than the second error rate threshold, then execute S392, keep the test configuration parameters unchanged, and trigger the counter value to increment by 1.
[0095] S393, determine whether the count value is greater than or equal to the preset number; If the count value is greater than or equal to the preset number of times, the current test phase has reached the preset test convergence state, then execute S380.
[0096] If the count value is less than the preset number of times, the current test phase has not reached the preset test convergence state. Keep the test configuration parameters unchanged and return to execute the above steps.
[0097] If the response error rate is greater than or equal to the second error rate threshold, pressure should not be applied to the target interface. In this case, the test can be terminated. Alternatively, to obtain stable test results, the test configuration parameters can be kept unchanged, and the next test phase can be started to continue testing and re-determine whether the test results of the target interface meet the requirements. Simultaneously, the number of test phases executed with the same test configuration parameters should be recorded. When the preset number of times is reached, the test should be terminated to avoid infinite loops.
[0098] In this embodiment, the load testing system is equipped with a counter that records the number of consecutive times the test configuration parameters remain unchanged, thus automatically ending the test. For example, when the response error rate is less than a first error rate threshold, there is no latency inflection point in the current test phase, and the response error rate is greater than or equal to a second error rate threshold, the counter value is incremented by 1. If the counter value is greater than or equal to a preset number of times, it is determined that the current test phase has reached a preset test convergence state, and the next test phase is not started. If the counter value is less than the preset number of times, the next test phase is started with the current test configuration parameters. Additionally, if the response error rate is less than the first error rate threshold, or there is a latency inflection point in the current test phase, the counter value is reset to zero. This ensures that the test automatically ends only when the response error rate is detected to be less than the first error rate threshold in multiple consecutive test phases, and there is no latency inflection point in the current test phase. This avoids prematurely ending the test before it has stabilized, thus preventing a reduction in the accuracy of automated testing.
[0099] In this embodiment, multiple test results are used as feedback to determine the test configuration parameters for the next testing phase. Different test results reflect different performance characteristics, and the priority of different test results can be configured according to the testing requirements of the target interface. The test configuration parameters for the next testing phase are determined based on the test results with higher priority, ensuring that the target interface is tested according to the requirements. Simultaneously, the use of multiple test results as feedback automates the entire load testing process. Error rate is prioritized over latency inflection point; overload protection is implemented first, and pressure is stopped when the capacity limit is reached. Pressure is increased when the system is in a stable state to explore capacity boundaries. The entire load testing process is stable and orderly, improving the testing effectiveness of automated load testing.
[0100] Figure 4 This illustration shows a flowchart of a system interface stress testing method according to another embodiment of this application, applied to the aforementioned system interface stress testing system. Based on the previous embodiments, this embodiment proposes a method for identifying delay inflection points. Specifically, as... Figure 4 As shown, the test results for the target interface, determined based on the sampled data, include: S410 slices the sampled data at preset intervals to obtain multiple data ranges.
[0101] For example, obtain the global time range of the sampled data as a slicing baseline. Determine the global time interval of the sampled data using the maximum and minimum timestamps in the sampled data (e.g., t0 = 1716254400000, t...). N =1716254460000, global time interval 60s). The sampled data is sliced according to the preset duration and width, dividing the sampled data into corresponding data intervals. For example, if the preset duration is 15s and the global time interval is 60s, the sampled data will be divided into 4 data intervals, based on the timestamp of the sampled data.
[0102] S420, determine the target feature value corresponding to the response time of the target request within the valid data interval. The target feature value represents the average distribution trend of the response time of the target request within the valid data interval. The valid data interval is the data interval corresponding to the non-working thread startup time.
[0103] In this embodiment, the delay inflection point is identified by the sampled data generated by the target interface in response to the target request after all threads have been driven. The data interval during the thread startup phase is skipped to avoid data interference during the thread startup phase affecting the accuracy of delay inflection point identification.
[0104] For example, in step S410, the sampled data is divided into four data intervals. If all threads start and complete within the first data interval, the valid data intervals include the second, third, and fourth data intervals. If all threads start and complete within the first and second data intervals, the valid data intervals are the third and fourth data intervals.
[0105] As an example, the method for determining the valid data range is as follows: First, determine the data range corresponding to the worker thread startup phase, such as by the ramp-up time and the time span (preset duration) corresponding to each data range. If the ramp-up time is less than the preset duration, then the worker thread startup phase is determined to be in the first data range. If the ramp-up time is greater than the preset duration but less than twice the preset duration, then the worker thread startup time is determined to be within the first and second data ranges. The other data ranges besides the data range where the worker thread startup phase is located are the valid data ranges.
[0106] Alternatively, in some embodiments, a predetermined number of data intervals following the data interval where the worker thread startup phase occurs are considered valid data intervals, or steady-state initial data intervals. For example, suppose the sampled data is divided into 10 data intervals, where the worker thread startup phase occurs in the first data interval. Then, the second to tenth data intervals are all data intervals other than the one where the worker thread startup phase occurs. In this embodiment, the second to fourth data intervals are considered valid data intervals. The target feature value is determined based on the data in the second to fourth data intervals, and then all data intervals are traversed according to the target feature value to identify the delay inflection point.
[0107] Specifically, the latency inflection point is identified by the response time of the target interface to the target request. In particular, the latency inflection point is identified by the target feature value that characterizes the average distribution trend of the response time.
[0108] In one embodiment, the target feature value corresponding to the response time of the target request within the valid data interval can be determined in the following way: for example, by obtaining the average response time of the target request within the valid data interval and determining the average value as the target feature value. It can be understood that there are multiple target requests within each valid data interval, and the average response time of the target request within each data interval is calculated; this average value is then the target feature value within the valid data interval.
[0109] In one embodiment, the target feature value corresponding to the response time of the target request within the valid data range can be determined in the following way: for example, the response time of the target request within the valid data range is sorted from smallest to largest, and the response time located at the 95th percentile is determined as the target feature value.
[0110] It is understood that there are multiple target requests within each valid data interval. The response time of the target interface to each target request may be the same or different. When 95% of the response times within the valid data interval are less than this response time, then this response time is the target characteristic value. For example, if the valid data interval includes 1000 requests, and the target interface processes 1000 requests, and the response time of 950 requests is less than 50ms, then 50ms is the target characteristic value for this valid data interval.
[0111] In this embodiment, the response time at the 95th percentile (P95) is used as the target feature value. When the system is close to saturation, the tail delay increases first, and P95 can capture the inflection point signal earliest. Therefore, the response time at the 95th percentile (P95) is used as the target feature value, which is sensitive to performance degradation.
[0112] S430 determines the reference response time based on the target characteristic values of multiple valid data intervals.
[0113] In one embodiment, the average of the target feature values across multiple valid data intervals is used as a reference response time.
[0114] For example, the effective data intervals include a first data interval, a second data interval, and a third data interval. Assuming that the target feature values corresponding to the three data intervals are [45ms, 48ms, 47ms], the reference response time is 46.7ms.
[0115] S440 identifies the latency inflection point within each data interval based on the reference response time and preset coefficients.
[0116] In one embodiment, the reference response time is corrected based on a preset coefficient. For example, the product of the preset coefficient and the reference response time is used as the corrected reference response time, where the preset coefficient is greater than or equal to 1. Correcting the reference response time by using a preset coefficient can avoid errors caused by using the average value or delay percentile value within the valid data range, thus reducing the accuracy of delay inflection point determination.
[0117] If the target feature value corresponding to the data interval is greater than or equal to the corrected reference response time, it indicates that the response time of the data interval has a sudden change (delay anomaly), that is, there is a delay inflection point in the data interval.
[0118] For example, if the valid data interval includes a first data interval, a second data interval, and a third data interval, and assuming the target characteristic values corresponding to the three data intervals are [45ms, 48ms, 47ms], then the reference response time is 46.7ms. If the preset coefficient is 1.75, the corrected reference response time is 81.7ms. Since the target characteristic values of 45ms, 48ms, and 47ms in the valid data interval are all less than 81.7ms, it is determined that there is no latency inflection point within the valid data interval. If there is a target characteristic value of 90 for a valid data interval, then it is determined that there is a latency inflection point in that valid data interval, i.e., there is a latency inflection point in the current testing phase. The preset coefficient is a verified coefficient that can effectively distinguish between normal fluctuations in response time and abrupt changes in response time when performance is saturated.
[0119] After the test, a test report is generated and output based on the test results. For example, sampled data from each stage are merged to generate an adaptive control report and a performance analysis report. The merging rule retains the header row of the first file and concatenates the data rows of all files (skipping the headers of subsequent files). Simultaneously, the decision-making process for each stage is recorded, providing a complete closed-loop control audit trajectory and generating an adaptive control report. The merged sampled data is then automatically analyzed, outputting delay quantiles, delay inflection point indicators, interface statistics, and optimization suggestions, generating a performance analysis report.
[0120] The analytical dimensions include: Global statistics: total number of requests, success rate, latency percentile (min minimum latency / max maximum latency / avg average latency / P50 / P90 / P95 / P99), throughput.
[0121] Delayed inflection point hint: Reuse the same inflection point identification results as the control link.
[0122] Analyze by interface: Aggregate the number of samples, success rate, and P95 latency of each interface to pinpoint the bottleneck interface.
[0123] Heuristic optimization suggestions: Based on error rate, P95 latency, inflection point identification results, etc., actionable suggestions are automatically generated. For example, if the error rate is too high (e.g., greater than 5%), it is recommended to check the server logs and investigate the cause of the anomaly; if the latency is too high, such as the P95 latency score being more than twice the target value, it is recommended to optimize slow queries, increase caching, or expand capacity; if an inflection point is detected, i.e., performance saturation, it is recommended to run below the number of threads at the inflection point, or optimize the bottleneck interface; if a bottleneck interface is detected, such as a certain interface P95 being more than twice the global P95, it is recommended to focus on optimizing the implementation logic of that interface.
[0124] Understandably, if the analysis methods or parameters used for the sampled data when generating the test report differ from those used during the load testing process, two different conclusions may be drawn from the same sampled data. For example, if the methods or parameters for identifying the latency inflection point differ between the two stages, the performance summary in the test report may indicate that no obvious latency inflection point was found, while the load testing process may have identified a latency inflection point and performed a buck test. These two different or contradictory conclusions weaken the credibility and auditability of the automated load testing conclusions. Therefore, it is necessary to ensure that the analysis methods and parameters used for the sampled data during the test report generation process are consistent with those used during the load testing process to avoid two different analytical conclusions based on the same sampled data.
[0125] By employing the same delay inflection point identification process (or procedure), inconsistencies in delay inflection point identification methods can be avoided. For example, a single entry point for inflection point analysis can be set up in the algorithm and architecture, centrally implemented by the delay inflection point identification module (program); the identification results are output in a structured form, including at least: whether a delay inflection point was detected, etc., as a textual description for use in the testing process and performance summary.
[0126] The time window width (preset duration), preset coefficients, and test configuration parameters of the data range are placed in the same object. Before the load test starts, all parameters are loaded from the configuration file or command line at once. The load test process and the report generation process both reference the same set of parameters and do not maintain their own copies or default values.
[0127] During the load testing process and test report generation, both ends use the same parameters. For example, during the load testing process, after each test phase, a unified latency inflection point identification process is invoked, using the same ramp-up time, time window width (windowWidthMs), preset coefficients, and test configuration parameters as the current phase. During the performance analysis report generation process, the same parameters as the test phases in the load testing process are used to generate the corresponding test analysis report.
[0128] This embodiment has a delay inflection point identification function, which provides a basis for adjusting the test configuration parameters in the next testing phase and realizes the automation of system interface stress testing.
[0129] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0130] Corresponding to the system interface stress testing method in the above embodiment, Figure 5 A structural block diagram of the system interface stress testing device provided in an embodiment of this application is shown. For ease of explanation, only the parts relevant to the embodiments of this application are shown.
[0131] Reference Figure 5 The system interface pressure testing device 500 includes: Unit 510 is used to obtain the test configuration parameters for the current test phase; The load testing execution unit 520 is used to drive the worker thread to send a target request to the target interface based on the test configuration parameters, so as to perform load testing on the target interface, and record the sampled data generated by each request to a preset file. The target interface is the interface to be tested in the system interface. Analysis unit 530 is used to obtain all the sampling data of the current test phase from the preset file, and determine the test result of the target interface based on the sampling data; The parameter adaptive adjustment unit 540 is used to determine the test configuration parameters for the next test stage based on the test results, and to update the next test stage to the current test stage and trigger the acquisition unit when the current test stage has not reached the preset test convergence state.
[0132] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.
[0133] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0134] To implement the above embodiments, this application also proposes an electronic device. Figure 6 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application.
[0135] like Figure 6 As shown, the above-mentioned electronic device 600 includes: The system interface stress testing method of this application embodiment is implemented when the processor 620 executes the computer program stored in the memory 610 and at least one processor 620.
[0136] Bus 630 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0137] Electronic device 600 typically includes a variety of electronic device readable media. These media can be any available media that can be accessed by electronic device 600, including volatile and non-volatile media, removable and non-removable media.
[0138] A program / utility having a set (at least one) of program modules 640 may be stored, for example, in memory 610. Such program modules 640 include—but are not limited to—an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 640 typically perform the functions and / or methods described in the embodiments of this application.
[0139] The processor 620 executes various functional applications and data processing by running programs stored in the memory 610.
[0140] It should be noted that the implementation process and technical principles of the electronic device in this embodiment are explained in the foregoing description of the system interface stress testing method of this application embodiment, and will not be repeated here.
[0141] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps described in the various method embodiments above.
[0142] This application provides a computer program product that, when run on a mobile terminal, enables the mobile terminal to implement the steps described in the above-described method embodiments.
[0143] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0144] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0145] In the embodiments provided in this application, it should be understood that the disclosed apparatus / network devices and methods can be implemented in other ways. For example, the apparatus / network device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0146] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0147] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A system interface stress testing method, characterized in that, The method includes: Retrieve the test configuration parameters for the current testing phase; Based on the test configuration parameters, the driver thread sends a target request to the target interface to perform load testing on the target interface, and records the sampled data generated by each request to a preset file. The target interface is the interface to be tested in the system interface. All the sampled data of the current test phase are obtained from the preset file, and the test result of the target interface is determined based on the sampled data. The sampled data includes the response time of the target interface to the target request, and the test result includes whether there is a delay inflection point in the response of the target interface to the target request. Based on the test results, the test configuration parameters for the next test phase are determined. If the current test phase has not reached the preset test convergence state, the next test phase is updated to the current test phase, and the process returns to the step of obtaining the test configuration parameters for the current test phase and the subsequent steps. The following steps are used to determine whether the test results show the delay inflection point: The sampled data is sliced at preset intervals to obtain multiple data intervals; Determine the target feature value corresponding to the response time of the target request within the valid data interval. The target feature value represents the average distribution trend of the response time of the target request within the valid data interval. The valid data interval is the data interval corresponding to the non-working thread startup time. The reference response time is determined based on the target feature values of the multiple valid data intervals. Based on the reference response time and preset coefficient, the delay inflection point within each of the data intervals is identified.
2. The method according to claim 1, characterized in that, The test results also include the error rate of the target interface in response to the target request, and the test configuration parameters include the number of threads and the ramp-up time; The step of determining the test configuration parameters for the next testing phase based on the test results includes: When the response error rate is greater than or equal to a first error rate threshold, or when there is a latency inflection point in the current test phase, the number of threads in the next test phase is reduced and / or the ramp-up time is increased. The latency inflection point represents a sudden change in the response time of the target interface to all target requests.
3. The method according to claim 2, characterized in that, The step of determining the test configuration parameters for the next testing phase based on the test results further includes: When the response error rate is less than the first error rate threshold and there is no latency inflection point in the current test phase, the test configuration parameters remain unchanged; The trigger count is incremented by 1. When the count is greater than or equal to a preset number of times, the current test phase reaches a preset test convergence state.
4. The method according to claim 2, characterized in that, The step of determining the test configuration parameters for the next testing phase based on the test results further includes: When the response error rate is less than the first error rate threshold and there is no latency inflection point in the current test phase, it is determined whether the response error rate is less than the second error rate threshold. The first error rate threshold is greater than the second error rate threshold, and the second error rate threshold represents the maximum error rate allowed when applying pressure to the target interface. If the response error rate is less than the second error rate threshold, then the number of threads in the next test phase is increased; If the response error rate is not less than the second error rate threshold, the test configuration parameters remain unchanged, and the count value is incremented by 1. When the count value is greater than or equal to the preset number of times, the current test phase reaches the preset test convergence state.
5. The method according to claim 3 or 4, characterized in that, Also includes: When the number of threads is greater than or equal to the maximum number of concurrent threads, or when the count value is greater than or equal to a preset number of times, it is determined that the current test phase has reached a preset test convergence state.
6. The method according to claim 1, characterized in that, The determination of the target feature value corresponding to the response time of the target request within the valid data range includes: Obtain the average response time of the target request within the effective data interval, and determine the average value as the target feature value; Alternatively, the response times of the target requests within the effective data range can be sorted from smallest to largest, and the response time located at the 95th percentile can be determined as the target feature value.
7. The method according to claim 1, characterized in that, The step of identifying the delay inflection point within each of the data intervals based on the reference response time and a preset coefficient includes: The reference response time is corrected based on a preset coefficient; If the target feature value corresponding to the data interval is greater than or equal to the corrected reference response time, then a delay inflection point is determined to exist within the data interval.
8. A system interface stress testing device, characterized in that, include: The acquisition unit is used to acquire the test configuration parameters for the current test phase. The load testing execution unit is used to drive the worker thread to send a target request to the target interface based on the test configuration parameters, so as to perform load testing on the target interface, and record the sampled data generated by each request to a preset file. The target interface is the interface to be tested in the system interface. An analysis unit is used to obtain all the sampled data of the current test phase from the preset file, and determine the test result of the target interface based on the sampled data. The sampled data includes the response time of the target interface to the target request, and the test result includes the response error rate of the target interface to the target request and whether there is a latency inflection point. The parameter adaptive adjustment unit is used to determine the test configuration parameters for the next test phase based on the test results, and to update the next test phase to the current test phase and trigger the acquisition unit when the current test phase has not reached the preset test convergence state. The analysis unit is further configured to identify whether the test results have a latency inflection point by: slicing the sampled data at preset intervals to obtain multiple data intervals; determining the target feature value corresponding to the response time of the target request within the valid data interval, wherein the target feature value characterizes the average distribution trend of the response time of the target request within the valid data interval, and the valid data interval is the data interval corresponding to the non-working thread startup time; determining a reference response time based on the target feature values of the multiple valid data intervals; and identifying the latency inflection point within each of the data intervals based on the reference response time and a preset coefficient.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Dynamic pressure self-adaptive interface performance automatic test method, device and equipment
CN121636315A
