Pressure measurement method and device, electronic equipment and storage medium

By generating target load test traffic through dynamic sampling and user behavior model-driven traffic mixing, the problem of business logic distortion in traditional load testing methods is solved, and accurate load verification of critical paths and safe and reliable testing of system performance are achieved.

CN120929371APending Publication Date: 2025-11-11BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511012341.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-22
Publication Date
2025-11-11

AI Technical Summary

Technical Problem

Traditional stress testing methods struggle to simulate complex user behaviors in real-world business scenarios, resulting in a fundamental difference between test traffic and real-world business traffic. This makes it impossible to accurately reflect the stress levels of critical business paths and to conduct targeted stress testing.

Method used

By dynamically sampling online business traffic, a user behavior model is constructed, and real replay traffic and simulated enhanced traffic are dynamically mixed to generate target stress test traffic. Stress tests are then performed in the test system, including real-time monitoring and tiered circuit breaker mechanisms.

Benefits of technology

It ensures the authenticity of business logic, accurately reproduces the characteristics of user operation paths, and can target key paths with pressure boosting, ensuring the safety and reliability of testing and improving the accuracy and effectiveness of stress testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120929371A_ABST
    Figure CN120929371A_ABST
Patent Text Reader

Abstract

The invention provides a pressure measurement method and device, electronic equipment and a storage medium. The method comprises the following steps: dynamically sampling online service traffic to obtain sampled traffic data; constructing a user behavior model based on the sampling flow data; according to the user behavior model, dynamically mixing real playback traffic and simulated enhanced traffic, and generating target pressure measurement traffic; and injecting the target pressure measurement flow into a test system to execute a pressure test. According to the invention, real service flow data is obtained through dynamic sampling, so that the distortion problem of fixed scripts and random sampling is solved; constructing a user behavior model based on the sampling data to restore user operation path features; the real playback flow and the simulated enhanced flow are dynamically mixed according to the model, so that the authenticity of the service logic is maintained, and directional pressurization can be performed for a key path; and finally, through injection of the target pressure measurement flow, performance verification in a specific service scene is realized. Therefore, the problem that a traditional method cannot give consideration to both test authenticity and target pressure verification is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of software performance testing technology, and in particular to a stress testing method, apparatus, electronic device and storage medium. Background Technology

[0002] With the increasing popularity of microservice architecture, performance testing of distributed systems faces new challenges. Traditional stress testing methods struggle to effectively simulate complex user behaviors in real-world business scenarios, especially in high-concurrency scenarios such as e-commerce promotions and online education, where existing technologies cannot accurately reproduce user operation paths and traffic characteristics.

[0003] Currently, the mainstream stress testing solutions mainly have the following two implementation methods: one is test case replay based on fixed scripts, which simulates user requests through pre-written test scripts; the other is replay testing based on simple traffic sampling, which directly replays online traffic after random sampling.

[0004] However, while these solutions can generate a certain amount of stress load, they lack the guarantee of the authenticity of business logic during the testing process, resulting in a fundamental difference between test traffic and real business traffic. They cannot accurately reflect the stress situation of key business paths, nor can they conduct targeted stress testing for specific scenarios. Summary of the Invention

[0005] The purpose of this application is to provide a stress testing method, apparatus, electronic device, and storage medium to address the problem that while current solutions can generate a certain stress load, they lack assurance of the authenticity of business logic during testing. The specific technical solution is as follows:

[0006] Firstly, this application provides a stress testing method, including:

[0007] Dynamically sample online business traffic to obtain sampled traffic data;

[0008] A user behavior model is constructed based on the sampled traffic data;

[0009] Based on the user behavior model, real replay traffic and simulated enhanced traffic are dynamically mixed to generate target stress test traffic;

[0010] The target stress test flow is injected into the test system to perform the stress test.

[0011] In one possible implementation, the step of dynamically sampling online service traffic to obtain sampled traffic data includes:

[0012] Obtain the pre-configured base sampling rate for the entire system, as well as the independent sampling rate configured for a specific business interface;

[0013] Based on the base sampling rate and each of the independent sampling rates, online business traffic is dynamically sampled according to a preset time window to obtain sampled traffic data. The preset time window includes: a periodic time collection window and / or an event-triggered collection window.

[0014] In one possible implementation, constructing the user behavior model based on the sampled traffic data includes:

[0015] Extract the user operation sequence from the sampled traffic;

[0016] The user operation sequence is analyzed using a state transition algorithm to calculate the transition probability parameters between each operation state;

[0017] The set of key business paths is determined based on the transition probability parameters, and the set of key business paths is used as the user behavior model.

[0018] In one possible implementation, the step of dynamically mixing real replay traffic and simulated enhanced traffic according to the user behavior model to generate target stress test traffic includes:

[0019] The sampled traffic data is used to extract real requests that meet the business characteristics requirements as the real replay traffic. The business characteristics requirements include that the request parameters are complete and can represent typical user behavior.

[0020] Based on the user behavior model, simulated requests are generated as the simulated enhanced traffic;

[0021] The actual playback flow and the simulated enhanced flow are mixed according to the mixing ratio to generate the target stress test flow.

[0022] In one possible implementation, the method further includes:

[0023] Get the difference between the current traffic value and the target traffic value of the current business path;

[0024] The amount of simulated enhanced traffic generated for the business path is calculated based on the path weight parameters in the user behavior model and the difference.

[0025] The mixing ratio is adjusted according to the amount produced.

[0026] In one possible implementation, the method further includes:

[0027] During the stress test of the test system, the system's operating indicators are monitored in real time;

[0028] When it is detected that the computing resource utilization of a single instance continues to exceed the first threshold for a first preset time, traffic injection into the instance is stopped and an alarm is triggered.

[0029] When the service-level error rate exceeds the second threshold and continues for a second preset duration, traffic injection into non-core interfaces will be automatically downgraded.

[0030] When the system-level database connection resources reach the maximum available number, a global circuit breaker is triggered and a system state snapshot is saved.

[0031] In one possible implementation, after injecting the target stress test flow into the test system to perform the stress test, the method further includes:

[0032] Obtain the dataset of microservice performance metrics recorded during the stress test;

[0033] Based on the service call topology, abnormal microservice nodes with abnormal response times are identified from the performance metric dataset;

[0034] Analyze the correlation between resource usage metrics and business metrics of the abnormal microservice nodes to determine the cause of performance anomalies;

[0035] Based on the causes of the performance anomalies, system optimization suggestions are generated, including code-level optimization schemes and infrastructure adjustment schemes.

[0036] Secondly, this application provides a pressure testing device, comprising:

[0037] The sampling module is used to dynamically sample online business traffic to obtain sampled traffic data;

[0038] The module is used to build a user behavior model based on the sampled traffic data;

[0039] The generation module is used to dynamically mix real replay traffic and simulated enhanced traffic according to the user behavior model to generate target stress test traffic;

[0040] The test module is used to inject the target stress test traffic into the test system to perform stress testing.

[0041] In one possible implementation, the sampling module is specifically used for:

[0042] Obtain the pre-configured base sampling rate for the entire system, as well as the independent sampling rate configured for a specific business interface;

[0043] Based on the base sampling rate and each of the independent sampling rates, online business traffic is dynamically sampled according to a preset time window to obtain sampled traffic data. The preset time window includes: a periodic time collection window and / or an event-triggered collection window.

[0044] In one possible implementation, the building module is specifically used for:

[0045] Extract the user operation sequence from the sampled traffic;

[0046] The user operation sequence is analyzed using a state transition algorithm to calculate the transition probability parameters between each operation state;

[0047] The set of key business paths is determined based on the transition probability parameters, and the set of key business paths is used as the user behavior model.

[0048] In one possible implementation, the generation module is specifically used for:

[0049] The sampled traffic data is used to extract real requests that meet the business characteristics requirements as the real replay traffic. The business characteristics requirements include that the request parameters are complete and can represent typical user behavior.

[0050] Based on the user behavior model, simulated requests are generated as the simulated enhanced traffic;

[0051] The actual playback flow and the simulated enhanced flow are mixed according to the mixing ratio to generate the target stress test flow.

[0052] In one possible implementation, the device further includes an adjustment module for:

[0053] Get the difference between the current traffic value and the target traffic value of the current business path;

[0054] The amount of simulated enhanced traffic generated for the business path is calculated based on the path weight parameters in the user behavior model and the difference.

[0055] The mixing ratio is adjusted according to the amount produced.

[0056] In one possible implementation, the device further includes a monitoring module for:

[0057] During the stress test of the test system, the system's operating indicators are monitored in real time;

[0058] When it is detected that the computing resource utilization of a single instance continues to exceed the first threshold for a first preset time, traffic injection into the instance is stopped and an alarm is triggered.

[0059] When the service-level error rate exceeds the second threshold and continues for a second preset duration, traffic injection into non-core interfaces will be automatically downgraded.

[0060] When the system-level database connection resources reach the maximum available number, a global circuit breaker is triggered and a system state snapshot is saved.

[0061] In one possible implementation, the apparatus further includes an acquisition module for:

[0062] Obtain the dataset of microservice performance metrics recorded during the stress test;

[0063] Based on the service call topology, abnormal microservice nodes with abnormal response times are identified from the performance metric dataset;

[0064] Analyze the correlation between resource usage metrics and business metrics of the abnormal microservice nodes to determine the cause of performance anomalies;

[0065] Based on the causes of the performance anomalies, system optimization suggestions are generated, including code-level optimization schemes and infrastructure adjustment schemes.

[0066] Thirdly, an electronic device is provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

[0067] Memory, used to store computer programs;

[0068] When a processor executes a program stored in memory, it implements any of the steps described in the first aspect.

[0069] Fourthly, a computer-readable storage medium is provided, characterized in that the computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of any of the methods described in the first aspect.

[0070] Fifthly, a computer program product containing instructions is provided, which, when run on a computer, causes the computer to perform any of the stress testing methods described above.

[0071] Beneficial effects of the embodiments in this application:

[0072] This application provides a stress testing method, apparatus, electronic device, and storage medium. First, it acquires real business traffic data through dynamic sampling, overcoming the distortion problems of fixed scripts and random sampling. Second, it constructs a user behavior model based on the sampled data, accurately reproducing the characteristics of user operation paths. Then, it dynamically mixes real replay traffic with simulated enhanced traffic according to the model, maintaining the authenticity of business logic while enabling targeted stress boosting for critical paths. Finally, through the precise injection of target stress testing traffic, performance verification under specific business scenarios is achieved. Thus, it fundamentally solves the core problem of traditional methods failing to balance test authenticity and target stress verification.

[0073] Of course, implementing any product or method of this application does not necessarily require achieving all of the advantages described above at the same time. Attached Figure Description

[0074] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0075] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0076] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0077] Figure 1 A flowchart of a stress testing method provided in an embodiment of this application;

[0078] Figure 2 A flowchart of another pressure testing method provided in the embodiments of this application;

[0079] Figure 3 A flowchart illustrating yet another stress testing method provided in this application embodiment;

[0080] Figure 4 This is a schematic diagram of the structure of a pressure testing device provided in an embodiment of this application;

[0081] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0082] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0083] The following disclosure provides numerous different embodiments or examples for implementing various structures of the invention. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the scope of the invention. Furthermore, reference numerals and / or letters may be repeated in different examples. Such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.

[0084] Figure 1 This is a flowchart illustrating a stress testing method provided in an embodiment of this application. This method can be applied to one or more electronic devices such as smartphones, laptops, desktop computers, portable computers, and servers. Furthermore, the execution entity of this method can be hardware or software. When the execution entity is hardware, it can be one or more of the aforementioned electronic devices. For example, a single electronic device can execute this method, or multiple electronic devices can cooperate with each other to execute this method. When the execution entity is software, this method can be implemented as multiple software programs or software modules, or as a single software program or software module. No specific limitations are imposed here.

[0085] like Figure 1 As shown, the method specifically includes:

[0086] S101. Dynamically sample online business traffic to obtain sampled traffic data.

[0087] Dynamic sampling refers to the process of selectively collecting real-time online business traffic according to preset rules.

[0088] In this embodiment, by configuring the global sampling rate and the interface-level sampling rate, and based on time window control, representative sampling traffic data is obtained to ensure the quality of the basic data for subsequent analysis.

[0089] Specifically, S101 may include the following steps: obtaining a basic sampling rate pre-configured for the system as a whole, and an independent sampling rate configured for a specified business interface; based on the basic sampling rate and each of the independent sampling rates, dynamically sampling online business traffic according to a preset time window to obtain sampled traffic data, wherein the preset time window includes: a periodic time collection window, and / or an event-triggered collection window.

[0090] The base sampling rate refers to the default sampling ratio applicable to all interfaces of the system; the independent sampling rate is the sampling ratio set separately for a specific business interface; the preset time window includes a fixed time interval that is executed periodically (periodic time acquisition window) and an acquisition period triggered by a specific business event (event-triggered acquisition window).

[0091] This solution acquires a pre-configured global base sampling rate and an interface-level independent sampling rate, and collects online business traffic in a differentiated manner according to a preset time window strategy. The periodic window ensures the continuity of regular traffic collection, while the event-triggered window focuses on sampling specific business scenarios (such as promotional activities). This dynamic sampling mechanism achieves both flexibility and controllability in the sampling process, and ensures that the collected traffic data comprehensively covers various business scenarios. It effectively solves the technical problem that traditional fixed sampling methods cannot balance sampling efficiency and data representativeness, laying a data foundation for subsequently building accurate user behavior models.

[0092] In another embodiment, dynamic sampling further includes: filtering invalid traffic requests through a behavior recognition model; and performing real-time desensitization processing on user-sensitive fields in the traffic.

[0093] Behavioral recognition models refer to classification models trained based on machine learning algorithms used to identify abnormal traffic characteristics; sensitive user fields include user IDs, identity credentials, and other private data.

[0094] During the dynamic sampling process, this scheme first filters out invalid traffic requests such as those from web crawlers using a behavior recognition model (such as an LSTM (Long-Short Term Memory Artificial Neural Network) model). At the same time, it performs real-time desensitization and replacement of sensitive fields in the traffic. This enhanced sampling mechanism effectively eliminates abnormal requests that interfere with the test results and ensures the security of user privacy data, thereby significantly improving the purity and usability of the sampled traffic and providing a higher quality data foundation for subsequent stress tests.

[0095] S102. Construct a user behavior model based on the sampled traffic data.

[0096] A user behavior model is a mathematical model that represents the patterns of user operations.

[0097] In this embodiment of the application, by analyzing the operation sequence in the sampled traffic, a state transition algorithm is used to calculate the transition probability between each operation state, and a data model that can accurately describe the user behavior characteristics is constructed.

[0098] Specifically, S102 may include the following steps: extracting user operation sequences from the sampled traffic; analyzing the user operation sequences using a state transition algorithm to calculate transition probability parameters between each operation state; determining a set of key business paths based on the transition probability parameters, and using the set of key business paths as the user behavior model.

[0099] User operation sequence refers to the continuous operation record generated by the user in the business system; state transition algorithm is a mathematical model used to analyze the transition rules between operation states (such as the Markov chain algorithm); transition probability parameter represents the possibility of transition between each operation state; critical business path set refers to the high-frequency operation paths that have a significant impact on system performance.

[0100] This solution first extracts complete user operation sequences from sampled traffic, calculates transition probability parameters between each operation state using a state transition algorithm, and then identifies high-frequency transition paths as a set of critical business paths based on these parameters, ultimately forming a complete user behavior model. By quantitatively analyzing real user behavior patterns, this solution accurately identifies the critical paths that have the greatest impact on system performance, providing data support for subsequent intelligent traffic orchestration and effectively solving the technical challenge of traditional stress testing's inability to accurately locate core business paths.

[0101] S103. Based on the user behavior model, dynamically mix real replay traffic and simulated enhanced traffic to generate target stress test traffic.

[0102] True playback traffic refers to the original, unmodified business requests directly extracted from the sampled traffic.

[0103] Simulated enhanced traffic is a test request generated based on user behavior models to simulate specific stress scenarios.

[0104] In this embodiment, firstly, real replay traffic is extracted according to preset rules (e.g., a 30%-50% ratio). Simultaneously, simulated enhanced traffic is generated based on critical path information in the user behavior model. Then, a dynamic traffic orchestrator intelligently mixes the two types of traffic according to the target scenario requirements, with the mixing ratio dynamically adjusted based on path weights. This maintains the authenticity of the core business logic while specifically enhancing the pressure on critical paths.

[0105] S104. Inject the target stress test flow into the test system to perform the stress test.

[0106] In this embodiment, the stress test is implemented using a phased, gradual pressure application method: First, a baseline test is conducted, establishing a system performance baseline with a 50% real flow rate replay ratio; after the system stabilizes, a gradual pressure increase phase begins, linearly increasing the load at a rate of 10% per minute until the target flow rate of 300% is reached. This approach, by establishing baseline performance indicators before gradually increasing the load, accurately assesses the system's basic performance while safely and controllably verifying the system's ultimate processing capacity, effectively avoiding the risk of instantaneous system overload that may occur with traditional one-time pressure application methods.

[0107] In addition, in another embodiment, the stress test process may also include the following steps: during the stress test performed by the test system, real-time monitoring of system operating indicators; when it is detected that the utilization rate of a single instance computing resources continuously exceeds a first threshold for a first preset duration, stopping the injection of traffic into the instance and triggering an alarm; when the service-level error rate exceeds a second threshold for a second preset duration, automatically downgrading the traffic injection of non-core interfaces; when the system-level database connection resources reach the maximum available number, triggering a global circuit breaker and saving a system state snapshot.

[0108] The first threshold and the second threshold refer to the critical values ​​set for computing resource utilization and error rate, respectively; the first preset duration and the second preset duration are the time conditions required to continuously exceed the thresholds; the maximum available quantity refers to the maximum number of connections configured in the database system.

[0109] During stress testing, this solution implements system protection through a three-level monitoring mechanism: at the instance level, when the utilization rate of computing resources such as CPU continuously exceeds a set threshold (e.g., 90%) for a specified duration (e.g., 60 seconds), traffic injection for that instance is immediately stopped and an alarm is triggered; at the service level, when the interface error rate continuously exceeds a threshold (e.g., 5%) for a specified duration (e.g., 30 seconds), traffic for non-core services is automatically reduced; at the system level, when the number of database connections reaches the maximum value, a global circuit breaker is initiated and a system snapshot is saved.

[0110] This tiered circuit breaker mechanism, through multi-level and differentiated protection strategies, not only ensures the adequacy of stress testing but also effectively prevents system overload and crashes, significantly improving the safety and reliability of the testing process.

[0111] In this embodiment, real business traffic data is first obtained through dynamic sampling, overcoming the distortion problems of fixed scripts and random sampling. Secondly, a user behavior model is constructed based on the sampled data, accurately reproducing the characteristics of user operation paths. Then, real replay traffic and simulated enhanced traffic are dynamically mixed according to the model, maintaining the authenticity of business logic while enabling targeted stress testing on critical paths. Finally, performance verification under specific business scenarios is achieved through the precise injection of target stress test traffic. Thus, the core problem of traditional methods being unable to balance test authenticity and target stress verification is fundamentally solved.

[0112] See Figure 2 This is a flowchart illustrating another embodiment of the stress testing method provided in this application. Figure 2 The process shown above Figure 1 Based on the illustrated process, describe how to dynamically mix real replay traffic and simulated augmented traffic according to the user behavior model to generate target load test traffic. For example... Figure 2 As shown, the process may include the following steps:

[0113] S201. Extract real requests that meet the business characteristics requirements from the sampled traffic data as the real replay traffic. The business characteristics requirements include complete request parameters and the ability to represent typical user behavior.

[0114] Business characteristic requirements refer to the criteria used to filter valid business requests.

[0115] Typical user behavior represents the most common user operation patterns in the system.

[0116] In this embodiment, by setting dual criteria of request parameter integrity and behavioral representativeness, genuine and valid business requests are selected from the original sampled data as replay traffic. This refined selection mechanism ensures the integrity of the business logic and the representativeness of the scenario in the replay traffic.

[0117] S202. Generate simulated requests based on the user behavior model as the simulated enhanced traffic.

[0118] A simulated request is a synthetic test request generated based on a user behavior model.

[0119] In this embodiment, simulated requests are generated based on the user behavior model (especially the set of critical business paths) constructed in S102, according to path weights (business importance × historical failure rate), as simulated enhanced traffic. This model-driven traffic generation method achieves accurate stress simulation for specific business scenarios.

[0120] S203. Mix the real playback flow and the simulated enhanced flow according to the mixing ratio to generate the target stress test flow.

[0121] The mixing ratio refers to the ratio of real traffic to simulated traffic.

[0122] In this embodiment, the real replay traffic extracted in S201 and the simulated enhanced traffic generated in S202 are mixed on demand by a dynamic traffic orchestrator (e.g., real traffic replay: maintaining the authenticity of business logic, with a fixed proportion of 30%-50%), and the proportion is dynamically adjusted according to the target pressure requirements; this intelligent mixing mechanism ensures both the authenticity of the test and the controllability of the pressure.

[0123] In one embodiment, the mixing ratio can be adjusted by the following steps, the method further including: obtaining the difference between the current traffic value and the target traffic value of the current business path; calculating the amount of simulated enhanced traffic generated for the business path based on the path weight parameter in the user behavior model and the difference; and adjusting the mixing ratio based on the amount of traffic generated.

[0124] Current traffic value refers to the number of requests processed in real time along the business path; target traffic value is the expected stress test metric; path weight parameter is a quantitative indicator calculated by combining business importance and historical failure rate (path weight = business importance × historical failure rate).

[0125] In this scheme, firstly, the traffic gap for each path is determined by calculating the difference between the actual request volume (current QPS, Queries Per Second) and the target pressure value (target QPS) of the current business path; then, combined with the path weight parameter preset in the user behavior model (which is calculated based on "business importance × historical failure rate"), the required amount of simulated enhanced traffic generation for each path is dynamically calculated according to the algorithm relationship of "enhancement multiple = target QPS / current QPS × path weight"; finally, the mixing ratio of real replay traffic and simulated enhanced traffic is adjusted in real time based on the calculation results.

[0126] This intelligent adjustment mechanism based on traffic gaps and path weights achieves precise matching between test traffic and business needs through a quantitative model. It ensures that the pressure on critical paths meets the standards while avoiding resource waste, significantly improving the targeting and efficiency of stress testing.

[0127] Figure 2 The process shown, through the technical chain of "real request screening - model-driven simulation - dynamic ratio mixing", not only maintains the authenticity of the core business logic (solving the distortion problem of traditional testing), but also enables targeted stress boosting for critical paths (achieving precise stress verification), significantly improving the accuracy and effectiveness of stress testing.

[0128] See Figure 3 This is a flowchart illustrating another embodiment of the stress testing method provided in this application. Figure 3 As shown, the process may include the following steps:

[0129] S301. Obtain the dataset of microservice performance metrics recorded during the stress test.

[0130] A microservice performance metrics dataset refers to a collection of monitoring data that includes multiple dimensions such as CPU utilization, memory usage, and response time.

[0131] In this embodiment of the application, a complete performance analysis dataset is constructed by collecting real-time operating metrics of each microservice during stress testing, providing a data foundation for subsequent problem localization.

[0132] S302. Based on the service call topology, identify abnormal microservice nodes with abnormal response times from the performance metric dataset.

[0133] Service call topology refers to the mesh structure formed by API (Application Programming Interface) calls between microservices.

[0134] In this embodiment, a pre-built microservice dependency graph is first loaded, and then a topology sorting analysis is performed on the performance metric dataset. Specifically, this includes: calculating the percentile value of the response time for each microservice node; identifying the edges of sudden changes in response time between adjacent nodes (e.g., upstream service response time = 50ms → downstream service response time = 500ms); if the change occurs between business services (e.g., order service → payment service), it indicates a business logic or code efficiency problem; if the change occurs between a service and middleware (e.g., payment service → MySQL), it indicates an infrastructure bottleneck (e.g., a "database connection pool exhausted" scenario); and marking microservices whose response time exceeds a preset threshold and are located on the critical path as abnormal nodes. This solution effectively solves the problem that traditional methods cannot locate cross-service performance bottlenecks through a topology-aware anomaly detection algorithm.

[0135] S303. Analyze the correlation between the resource usage indicators and business indicators of the abnormal microservice nodes to determine the cause of the performance anomaly.

[0136] Resource usage metrics include hardware metrics such as CPU and memory; business metrics include business performance metrics such as response time and error rate.

[0137] In this embodiment of the application, taking response time as the business metric and CPU as the resource usage metric as an example, time-aligned response time and CPU utilization data are extracted from abnormal nodes, and the correlation between resource usage metrics and business metrics is quantified using the following formula:

[0138] Correlation coefficient = Σ(Δ response time × Δ CPU utilization) / √(ΣΔ response time² × ΣΔ CPU utilization²); where: Δ response time: the change in response time at each sampling point (unit: milliseconds); Δ resource utilization: the change in CPU / memory utilization at the corresponding sampling point (unit: %).

[0139] Calculate the dynamic correlation degree within the sliding window (e.g., 30 seconds) using the formula above. When the correlation degree coefficient is consistently >0.7 (strong correlation), the resource is determined to be a performance bottleneck.

[0140] This solution uses quantitative analysis to accurately identify different types of performance problems, such as CPU overload and memory leaks.

[0141] S304. Generate system optimization suggestions based on the reasons for the performance anomalies. The optimization suggestions include code-level optimization schemes and infrastructure adjustment schemes.

[0142] In this embodiment, targeted suggestions (such as "automatically identify code hotspots" and "generate capacity planning reports") are generated based on the analysis results of S303, while providing a dual solution of software optimization and hardware upgrades. The logic for generating optimization suggestions includes: Code-level optimization schemes: When CPU-related bottlenecks are identified, it is recommended to optimize the algorithm's time complexity (such as "automatically identify code hotspots"); when memory problems occur, it is recommended to check caching strategies or memory leaks. Infrastructure adjustment schemes: Based on peak resource utilization, it is recommended to expand capacity (such as "adjusting the MySQL connection pool from 100 to 500"); for network latency, it is recommended to expand CDN nodes (such as "elastically expanding CDN nodes to 3 times").

[0143] Figure 3 The process described above collects multi-dimensional performance metrics data during stress testing, accurately identifies nodes with abnormal response times based on the microservice call topology, and analyzes the dynamic correlation between resource usage metrics and business metrics of abnormal nodes to determine the root cause of performance anomalies. Finally, it generates comprehensive optimization suggestions including code optimization and infrastructure adjustments. This solution achieves precise bottleneck localization with topology awareness, root cause diagnosis through quantitative analysis, and optimization strategy output through hardware and software collaboration. It fully covers the entire performance analysis process from anomaly detection to problem resolution, improving the accuracy of distributed system performance problem diagnosis and the effectiveness of optimization.

[0144] Based on the same technical concept, this application also provides a pressure testing device, such as... Figure 4 As shown, the device includes:

[0145] Sampling module 41 is used to dynamically sample online business traffic to obtain sampled traffic data;

[0146] Module 42 is used to build a user behavior model based on the sampled traffic data;

[0147] The generation module 43 is used to dynamically mix real replay traffic and simulated enhanced traffic according to the user behavior model to generate target stress test traffic;

[0148] Test module 44 is used to inject the target stress test flow into the test system to perform stress test.

[0149] In one possible implementation, the sampling module is specifically used for:

[0150] Obtain the pre-configured base sampling rate for the entire system, as well as the independent sampling rate configured for a specific business interface;

[0151] Based on the base sampling rate and each of the independent sampling rates, online business traffic is dynamically sampled according to a preset time window to obtain sampled traffic data. The preset time window includes: a periodic time collection window and / or an event-triggered collection window.

[0152] In one possible implementation, the building module is specifically used for:

[0153] Extract the user operation sequence from the sampled traffic;

[0154] The user operation sequence is analyzed using a state transition algorithm to calculate the transition probability parameters between each operation state;

[0155] The set of key business paths is determined based on the transition probability parameters, and the set of key business paths is used as the user behavior model.

[0156] In one possible implementation, the generation module is specifically used for:

[0157] The sampled traffic data is used to extract real requests that meet the business characteristics requirements as the real replay traffic. The business characteristics requirements include that the request parameters are complete and can represent typical user behavior.

[0158] Based on the user behavior model, simulated requests are generated as the simulated enhanced traffic;

[0159] The actual playback flow and the simulated enhanced flow are mixed according to the mixing ratio to generate the target stress test flow.

[0160] In one possible implementation, the device further includes an adjustment module for:

[0161] Get the difference between the current traffic value and the target traffic value of the current business path;

[0162] The amount of simulated enhanced traffic generated for the business path is calculated based on the path weight parameters in the user behavior model and the difference.

[0163] The mixing ratio is adjusted according to the amount produced.

[0164] In one possible implementation, the device further includes a monitoring module for:

[0165] During the stress test of the test system, the system's operating indicators are monitored in real time;

[0166] When it is detected that the computing resource utilization of a single instance continues to exceed the first threshold for a first preset time, traffic injection into the instance is stopped and an alarm is triggered.

[0167] When the service-level error rate exceeds the second threshold and continues for a second preset duration, traffic injection into non-core interfaces will be automatically downgraded.

[0168] When the system-level database connection resources reach the maximum available number, a global circuit breaker is triggered and a system state snapshot is saved.

[0169] In one possible implementation, the apparatus further includes an acquisition module for:

[0170] Obtain the dataset of microservice performance metrics recorded during the stress test;

[0171] Based on the service call topology, abnormal microservice nodes with abnormal response times are identified from the performance metric dataset;

[0172] Analyze the correlation between resource usage metrics and business metrics of the abnormal microservice nodes to determine the cause of performance anomalies;

[0173] Based on the causes of the performance anomalies, system optimization suggestions are generated, including code-level optimization schemes and infrastructure adjustment schemes.

[0174] Based on the same technical concept, embodiments of this application also provide an electronic device, such as... Figure 5 As shown, it includes a processor 111, a communication interface 112, a memory 113, and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.

[0175] Memory 113 is used to store computer programs;

[0176] When processor 111 executes a program stored in memory 113, it performs the following steps:

[0177] Dynamically sample online business traffic to obtain sampled traffic data;

[0178] A user behavior model is constructed based on the sampled traffic data;

[0179] Based on the user behavior model, real replay traffic and simulated enhanced traffic are dynamically mixed to generate target stress test traffic;

[0180] The target stress test flow is injected into the test system to perform the stress test.

[0181] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.

[0182] The communication interface is used for communication between the aforementioned electronic devices and other devices.

[0183] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0184] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0185] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of any of the above-described stress testing methods.

[0186] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform any of the stress testing methods described above.

[0187] The device embodiments described above are merely illustrative. 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 modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0188] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software plus a general-purpose hardware platform, or of course, using hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the related technology, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0189] It should be understood that the terminology used herein is for the purpose of describing particular exemplary embodiments only and is not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms “a,” “an,” and “described” as used herein may also include the plural forms. The terms “comprising,” “including,” “containing,” and “having” are inclusive and therefore indicate the presence of the stated features, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The method steps, processes, and operations described herein are not construed as requiring them to be performed in a particular order described or illustrated unless the order of performance is explicitly indicated. It should also be understood that additional or alternative steps may be used.

[0190] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A pressure testing method, characterized in that, The method includes: Dynamically sample online business traffic to obtain sampled traffic data; A user behavior model is constructed based on the sampled traffic data; Based on the user behavior model, real replay traffic and simulated enhanced traffic are dynamically mixed to generate target stress test traffic; The target stress test flow is injected into the test system to perform the stress test.

2. The method according to claim 1, characterized in that, The process of dynamically sampling online business traffic to obtain sampled traffic data includes: Obtain the pre-configured base sampling rate for the entire system, as well as the independent sampling rate configured for a specific business interface; Based on the base sampling rate and each of the independent sampling rates, online business traffic is dynamically sampled according to a preset time window to obtain sampled traffic data. The preset time window includes: a periodic time collection window and / or an event-triggered collection window.

3. The method according to claim 1, characterized in that, The process of constructing a user behavior model based on the sampled traffic data includes: Extract the user operation sequence from the sampled traffic; The user operation sequence is analyzed using a state transition algorithm to calculate the transition probability parameters between each operation state; The set of key business paths is determined based on the transition probability parameters, and the set of key business paths is used as the user behavior model.

4. The method according to claim 1, characterized in that, The step of dynamically mixing real replay traffic and simulated enhanced traffic based on the user behavior model to generate target stress test traffic includes: The sampled traffic data is used to extract real requests that meet the business characteristics requirements as the real replay traffic. The business characteristics requirements include that the request parameters are complete and can represent typical user behavior. Based on the user behavior model, simulated requests are generated as the simulated enhanced traffic; The actual playback flow and the simulated enhanced flow are mixed according to the mixing ratio to generate the target stress test flow.

5. The method according to claim 4, characterized in that, The method further includes: Get the difference between the current traffic value and the target traffic value of the current business path; The amount of simulated enhanced traffic generated for the business path is calculated based on the path weight parameters in the user behavior model and the difference. The mixing ratio is adjusted according to the amount produced.

6. The method according to claim 1, characterized in that, The method further includes: During the stress test of the test system, the system's operating indicators are monitored in real time; When it is detected that the computing resource utilization of a single instance continues to exceed the first threshold for a first preset time, traffic injection into the instance is stopped and an alarm is triggered. When the service-level error rate exceeds the second threshold and continues for a second preset duration, traffic injection into non-core interfaces will be automatically downgraded. When the system-level database connection resources reach the maximum available number, a global circuit breaker is triggered and a system state snapshot is saved.

7. The method according to claim 1, characterized in that, After injecting the target stress test flow into the test system to perform the stress test, the method further includes: Obtain the dataset of microservice performance metrics recorded during the stress test; Based on the service call topology, abnormal microservice nodes with abnormal response times are identified from the performance metric dataset; Analyze the correlation between resource usage metrics and business metrics of the abnormal microservice nodes to determine the cause of performance anomalies; Based on the causes of the performance anomalies, system optimization suggestions are generated, including code-level optimization schemes and infrastructure adjustment schemes.

8. A pressure testing device, characterized in that, The device includes: The sampling module is used to dynamically sample online business traffic to obtain sampled traffic data; The module is used to build a user behavior model based on the sampled traffic data; The generation module is used to dynamically mix real replay traffic and simulated enhanced traffic according to the user behavior model to generate target stress test traffic; The test module is used to inject the target stress test flow into the test system to perform stress testing.

9. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the stress testing method according to any one of claims 1-7.

10. 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 stress testing method according to any one of claims 1-7.

Citation Information

Cited By

  • Intelligent AI pressure test method, device and platform of financial service system

    CN121455793A