Test method and device based on flow playback, computer equipment and storage medium
By collecting and replaying real traffic data from production environments in critical business systems such as finance and healthcare, and utilizing edge nodes for distributed testing tasks, the problem of reproducing production environment issues was solved, achieving efficient and accurate testing results.
Patent Information
- Application Number
- CN202511397074.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-26
- Publication Date
- 2025-12-16
AI Technical Summary
In critical business systems such as finance and healthcare, problems in the production environment are difficult to reproduce quickly and accurately, resulting in low testing efficiency.
By using a traffic replay-based testing method, real traffic data from the production environment is collected. Edge nodes are used for distributed collection and test task division to generate and execute traffic replay test tasks, accurately reproducing the problem.
It improved the efficiency and accuracy of problem reproduction, enhanced testing efficiency, ensured that the traffic replayed in the test environment was consistent with that in the production environment, and reduced the amount of redundant data.
Smart Images

Figure CN121151284A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of simulation testing technology, and in particular to a test method, apparatus, computer equipment and storage medium based on traffic playback. Background Technology
[0002] In software development and maintenance, especially in critical business systems with extremely high requirements for stability and data security, such as those in finance and healthcare, some problems that are difficult to reproduce may occur in the production environment. For example, during the execution of large-scale end-of-month clearing operations, there is a very low probability of data inconsistencies in accounting processing; during peak outpatient periods, hospital information systems may experience occasional delays or even failures in the issuance and execution of specific medical orders, affecting clinical workflows. These problems may be related to specific traffic patterns, load conditions, or environmental configurations. To determine the cause of these problems, traditional methods typically rely on simulated data or manually constructed test cases, applying these test cases to the test environment for problem testing. However, due to the differences between the test environment and the production environment, and the time-consuming process of manually constructing test cases, problems are often difficult to reproduce quickly and accurately, resulting in low testing efficiency. Therefore, how to improve the efficiency and accuracy of problem reproduction, and thus improve testing efficiency, has become an urgent problem to be solved. Summary of the Invention
[0003] This application provides a test method, apparatus, computer equipment, and storage medium based on traffic playback to improve the efficiency and accuracy of problem reproduction, thereby improving test efficiency.
[0004] Firstly, this application provides a testing method based on traffic replay, the method comprising: Based on the edge nodes corresponding to each production environment, the production traffic data corresponding to each production environment is collected and transmitted to the preset data traffic warehouse to obtain the full traffic data. Based on the analysis of the problem to be reproduced and the full traffic data by the central management platform, a traffic replay test task is generated, and the traffic replay test task is divided according to the task partitioning model to obtain at least one traffic replay sub-task. Each of the traffic replay test subtasks is distributed to the edge nodes, and the traffic replay test subtasks are executed based on the edge nodes to send the production traffic data to the test environment for traffic replay and obtain the test results of the system under test.
[0005] Secondly, this application also provides a test apparatus based on traffic replay, the apparatus comprising: The traffic data acquisition module is used to collect production traffic data corresponding to each production environment based on the edge nodes corresponding to each production environment, and transmit it to the preset data traffic warehouse to obtain full traffic data. The test task generation module is used to analyze the problem to be reproduced and the full traffic data based on the central management platform, generate traffic replay test tasks, and divide the traffic replay test tasks based on the task partitioning model to obtain at least one traffic replay sub-task. The test result acquisition module is used to distribute each of the traffic replay test subtasks to the edge nodes, and execute the traffic replay test subtasks based on the edge nodes to send the production traffic data to the test environment for traffic replay and obtain the test results of the system under test.
[0006] Thirdly, this application also provides a computer device, the computer device including a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program and, when executing the computer program, implement the test method based on traffic playback as described above.
[0007] Fourthly, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to implement the above-described test method based on traffic playback.
[0008] This application discloses a testing method, apparatus, computer equipment, and storage medium based on traffic replay. It collects production traffic data corresponding to each production environment using edge nodes and transmits it to a preset data traffic warehouse to obtain full traffic data. A central management platform analyzes the problem to be reproduced and the full traffic data to generate a traffic replay test task. Based on a task partitioning model, the traffic replay test task is divided to obtain at least one traffic replay subtask. Each traffic replay test subtask is distributed to the edge nodes, and the traffic replay test subtask is executed on the edge nodes to send the production traffic data to the test environment for traffic replay, obtaining the test results of the system under test. This application accurately reproduces problems occurring in the production environment by replaying real traffic. Simultaneously, the use of edge nodes for distributed traffic collection and execution of traffic replay test subtasks improves problem reproduction efficiency, thereby improving testing efficiency. Attached Figure Description
[0009] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0010] Figure 1 This is a schematic flowchart of a test method based on traffic replay provided in the first embodiment of this application; Figure 2 This is a schematic flowchart of a test method based on traffic replay provided in the second embodiment of this application; Figure 3 This is a schematic flowchart of a test method based on traffic replay provided in the third embodiment of this application; Figure 4 A schematic block diagram of a test apparatus based on traffic playback provided for embodiments of this application; Figure 5 A schematic block diagram of the structure of a computer device provided for an embodiment of this application. Detailed Implementation
[0011] 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.
[0012] The flowchart shown in the attached diagram is for illustrative purposes only and does not necessarily include all content and operations / steps, nor does it necessarily have to be performed in the order described. For example, some operations / steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation.
[0013] It should be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of the application. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0014] 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.
[0015] This application provides a testing method, apparatus, computer device, and storage medium based on traffic replay. The traffic replay-based testing method can be applied to servers, accurately reproducing problems encountered in the production environment by replaying real traffic. Furthermore, the use of edge nodes for distributed traffic acquisition and traffic replay test subtask execution improves problem reproduction efficiency, thereby enhancing testing efficiency. The server can be a standalone server or a server cluster.
[0016] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0017] Please see Figure 1 , Figure 1 This is a schematic flowchart illustrating a traffic replay-based testing method provided in an embodiment of this application. This traffic replay-based testing method can be applied to servers to accurately reproduce problems occurring in the production environment by replaying real traffic from the production environment. Furthermore, the use of edge nodes for distributed traffic collection and traffic replay test subtask execution improves problem reproduction efficiency, thereby enhancing testing efficiency.
[0018] like Figure 1 As shown, the test method based on traffic replay specifically includes steps S101 to S103.
[0019] S101. Based on the edge nodes corresponding to each production environment, collect the production traffic data corresponding to each production environment and transmit it to the preset data traffic warehouse to obtain the full traffic data. In one embodiment, lightweight edge nodes are deployed on the server cluster or network critical path corresponding to each production environment. The edge nodes collect real-time or historical traffic data through data collectors (such as packet capture tools, log tools, etc.), including real business traffic such as HTTP requests, database queries, and message queue messages, as well as auxiliary information such as system logs and response data.
[0020] Edge nodes preprocess the collected traffic data to obtain production traffic data. The preprocessing steps include filtering invalid traffic (such as duplicate requests and static resource requests), and performing preliminary desensitization on sensitive information (such as mobile phone numbers and ID card numbers) (such as replacing them with placeholders) while preserving the integrity of business logic (such as request parameters and call chains).
[0021] The preprocessed traffic data is uploaded to a pre-set data traffic warehouse (such as a distributed database) through an encrypted channel to form full traffic data covering the core business traffic and abnormal traffic of each production environment.
[0022] Furthermore, before step S101, the method further includes: analyzing the problem to be reproduced based on the central management platform to determine the correlation between various types of data and the problem to be reproduced; matching the sampling rate of various types of data based on the correlation, so that each edge node can collect traffic data according to the sampling rate of various types of data, and perform data anonymization to obtain the production traffic data.
[0023] In one embodiment, traffic data collection can employ a dynamic sampling strategy. Error return data and core business interfaces (such as payment / login interfaces) are sampled at 100% full volume; non-core data returned normally (such as static resource requests) are collected at an adjustable sampling rate of 0-100%, reducing redundant data volume.
[0024] In a specific embodiment, the central management platform extracts features from the problem to be reproduced, obtains the core features of the problem, and evaluates the correlation between the data and the problem to be reproduced. For example, highly correlated data may be data that directly triggers the problem or core business data (such as erroneous traffic or core interface requests during the problem period); moderately correlated data may be indirectly related auxiliary data (such as normal traffic or logs of dependent interfaces during the problem period); and low-correlation data may be irrelevant or redundant data (such as static resource requests or traffic during non-problem periods).
[0025] Based on the data correlation level, the sampling rate is matched with a dynamic sampling strategy to ensure that high-value data is collected first, while reducing the amount of redundant data.
[0026] In one embodiment, edge nodes sample data according to the sampling rate issued by the central management platform, and perform sensitive information removal and formatting on the collected traffic data to ensure data security, compliance, and suitability for the testing environment.
[0027] In the above embodiments, the sampling rate of various types of data is obtained based on the correlation between the data and the problem, realizing dynamic sampling, reducing the sampling workload, improving sampling efficiency, and thus improving the problem reproduction efficiency.
[0028] S102. Based on the central management platform, analyze the problem to be reproduced and the full traffic data to generate a traffic replay test task. Based on the task partitioning model, divide the traffic replay test task to obtain at least one traffic replay sub-task. In one embodiment, the central management platform receives issues reported from the actual production environment as issues to be reproduced (such as monitoring alarms and user feedback). Combining the issue description of the issues to be reproduced (such as payment interface timeout from 14:00 to 14:30 on October 1, 2023), it retrieves the corresponding time period and business module traffic data fragments (such as payment interface traffic fragments) from the full traffic data stored in the data traffic warehouse.
[0029] By performing log correlation analysis (such as matching request IDs in error logs), we can locate the key traffic characteristics that trigger the problem (such as specific user IDs and combinations of request parameters), and generate traffic replay test tasks for the problem to be reproduced based on the associated traffic data corresponding to the key traffic characteristics.
[0030] In one embodiment, the traffic testing task is divided using a task partitioning model to obtain at least one traffic replay testing subtask. Each subtask includes information such as the traffic segment to be replayed and traffic replay parameters.
[0031] Furthermore, before step S102, the method further includes: acquiring at least one historical problem and a historical replay task corresponding to each historical problem; processing each historical replay task based on a pre-trained model to obtain a prediction sub-task for each historical replay task; acquiring the problem reproduction result after the execution of each prediction sub-task, and comparing the problem reproduction result with the historical problem to determine the problem reproduction degree of each prediction sub-task; when the problem reproduction degree is greater than or equal to a preset threshold, using the pre-trained model as the task partitioning model.
[0032] In one embodiment, resolved historical issues are extracted from the production environment monitoring system and the work order system, including issue descriptions (such as occasional timeouts of the user login interface) and issue characteristics (such as timestamps, business modules, error types, and scope of impact).
[0033] Extract historical replay task data corresponding to historical issues from the test environment logs, including task metadata, subtask division results, and issue reproduction results.
[0034] In one embodiment, historical issues are associated with corresponding historical replay tasks by issue ID and task ID to form training sample pairs. Each sample contains issue features, task partitioning strategy, and reproduction results.
[0035] The pre-trained model learns historical task partitioning strategies to generate predicted subtasks for new tasks. The pre-trained model adopts a hybrid model architecture, combining a rule engine and a machine learning model. The rule engine has built-in basic partitioning rules; the machine learning model can be a classification / regression model trained based on historical samples.
[0036] In one embodiment, the historical playback task partitioning strategy is used as the label, and the model is trained through supervised learning. The optimization objective is to maximize the reproduction success rate. Cross-validation is used to optimize the model parameters and avoid overfitting.
[0037] Input the traffic replay test task into the pre-trained model, and the model outputs a prediction subtask. Execute the prediction subtask, and compare the reproduced results with historical issues. If the error type, metric fluctuations, and scope of impact are completely consistent with historical issues, then the problem has been completely reproduced. When the reproduction degree of the pre-trained model reaches a preset threshold (complete reproduction), it is officially determined as the task partitioning model.
[0038] Further, step S102 includes: analyzing the traffic replay test task based on the task partitioning model, determining at least one subtask and traffic replay parameters for each subtask, and generating task execution instructions based on the traffic replay parameters; generating at least one traffic replay subtask based on each subtask and the corresponding task execution instructions.
[0039] In one embodiment, the task partitioning model first extracts features from the input traffic replay test task, including traffic data features (such as data volume and request scale, business tags, time range and anomaly features) and environment and resource features (test environment features and edge node status), to clarify the task boundaries and core requirements.
[0040] In one embodiment, the traffic replay test task is analyzed to clarify the core objective of the test task and map it to the constraints that the subtasks must meet. For example, if the core objective is to reproduce the payment interface timeout, the constraint is that the payment interface subtask must 100% cover the erroneous traffic.
[0041] In one embodiment, the task partitioning model splits the traffic replay test task into multiple independent subtasks to ensure distributed execution efficiency and problem reproduction accuracy. For each subtask, the task partitioning model automatically configures traffic replay parameters based on task characteristics and historical replay results to ensure simulation of the load characteristics of a real production environment.
[0042] In one embodiment, traffic segments of a subtask are bound to corresponding task execution instructions to generate a complete traffic replay subtask, which serves as the execution unit of the edge node.
[0043] In the above embodiments, the complex traffic replay test task is transformed into a distributed subtask by using a task partitioning model, which not only ensures the accuracy of problem reproduction but also improves execution efficiency and test efficiency.
[0044] S103. Distribute each of the traffic replay test subtasks to the edge nodes, and execute the traffic replay test subtasks based on the edge nodes to send the production traffic data to the test environment for traffic replay and obtain the test results of the system under test.
[0045] In one embodiment, the central management platform distributes subtasks to corresponding edge nodes using a load balancing strategy. After receiving a subtask, the edge node reads the corresponding traffic data from its local storage and parses the data.
[0046] Each edge node replays traffic to the system under test in the test environment to simulate production load, such as 5000 concurrent user requests.
[0047] In one embodiment, the playback process supports real-time adjustment of playback rate, timeout retry mechanism and other configuration adjustment operations to adapt to the needs of the test scenario.
[0048] In one embodiment, edge nodes invoke monitoring tools to track the replay process in real time, recording whether the target problem is reproduced (e.g., payment interface timeout), abnormal log fragments (e.g., error stack traces), performance metric curves (e.g., response time fluctuation graphs), etc., generating preliminary test results, and verifying them to obtain basic verification results. The central management platform then performs a comprehensive analysis of the basic verification results from each edge node to obtain the final test results.
[0049] The above embodiments provide a testing method, apparatus, computer equipment, and storage medium based on traffic replay. Based on edge nodes corresponding to each production environment, production traffic data corresponding to each production environment is collected and transmitted to a preset data traffic warehouse to obtain full traffic data. A central management platform analyzes the problem to be reproduced and the full traffic data to generate a traffic replay test task. Based on a task partitioning model, the traffic replay test task is divided to obtain at least one traffic replay sub-task. Each traffic replay test sub-task is distributed to the edge nodes, and the traffic replay test sub-task is executed on the edge nodes to send the production traffic data to the test environment for traffic replay, obtaining the test results of the system under test. This application accurately reproduces problems occurring in the production environment by replaying real traffic in the production environment. Simultaneously, the use of edge nodes for distributed traffic collection and execution of traffic replay test sub-tasks improves the efficiency of problem reproduction, thereby improving testing efficiency.
[0050] Please see Figure 2 , Figure 2 This is a schematic flowchart illustrating a traffic replay-based testing method provided in an embodiment of this application. This traffic replay-based testing method can be applied to a server to perform precise searches in a data traffic warehouse based on problem keywords, obtaining traffic data fragments strongly related to the problem to generate replay tasks. This ensures that the traffic replayed in the subsequent testing environment is the traffic at the time the problem occurred, rather than artificially constructed or distorted test cases. While ensuring data accuracy, it reduces the amount of data, thereby improving the efficiency and accuracy of problem reproduction.
[0051] like Figure 2 As shown, the test method based on traffic replay specifically includes steps S201 to S203.
[0052] S201. Based on the central management platform, perform natural language processing on the problem to be reproduced to obtain problem keywords; In one embodiment, obtain the natural language description text of the problem to be reproduced, for example: From 14:00 to 14:30 on October 1, 2023, the payment interface for users in North China frequently returned 500 errors, and the response time exceeded 3 seconds.
[0053] Use a tokenization tool to split the text into lexical units, remove stop words (such as "of", "in"), and retain core words, such as North China region, payment interface, 500 error, response time, etc.
[0054] Call a named entity recognition model to identify key entities, including time entities (2023-10-01 14:00-14:30), geographical entities (such as North China region), business entities (such as payment interface), problem types, and performance metrics.
[0055] In one embodiment, a pre-trained language model can also be used to optimize the accuracy of keyword extraction and support fuzzy semantic understanding (such as timeouts and slow responses are both mapped to the response time metric). Combining with business dictionaries, such as internal interface naming specifications and error code manuals, can improve the accuracy of entity recognition and avoid ambiguity.
[0056] S202. Retrieve in the full volume of traffic data based on the problem keywords, determine the traffic data segment corresponding to the problem to be reproduced, and generate the traffic playback test task based on the traffic data segment and the problem to be reproduced.
[0057] In one embodiment, the data traffic warehouse builds indexes according to dimensions such as business interfaces, timestamps, error codes, and geographical tags to store the full volume of traffic data.
[0058] In one embodiment, perform combined retrieval in the data traffic warehouse according to the extracted keywords. Such as time dimension, business dimension, problem type dimension, and geographical dimension, etc. Exemplarily, filter the traffic with timestamps within the range of "202,3-10-01 14:00-14:30"; match the requests with interface paths containing "payment"; filter the traffic with response status codes of 500; combine the geographical tags of the production environment traffic (such as IP ownership) to filter the requests of users in the North China region.
[0059] Deduplicate the retrieval results (such as duplicate traffic with the same request ID), aggregate the data of each dimension after deduplication into the traffic data segment corresponding to the problem to be reproduced. Perform natural language processing on the traffic segment and the problem description, and analyze the matching degree between the traffic segment and the problem description to ensure that the traffic data segment is the segment corresponding to the occurrence of the problem to be reproduced and can effectively reproduce the problem.
[0060] In one embodiment, the test task basic information is generated by combining traffic segments and the problem to be reproduced, including the task objective, such as reproducing "payment interface 500 error and response timeout"; the traffic range, such as the payment interface error traffic in North China from 14:00 to 14:30 on October 1, 2023; and the playback parameters, such as concurrency and playback rate.
[0061] In the above embodiments, a precise search is performed in the data traffic warehouse based on the problem keywords to obtain traffic data fragments that are strongly related to the problem and generate replay tasks. This ensures that the traffic replayed in the subsequent test environment is the traffic when the problem occurred, rather than artificially constructed and distorted test cases. While ensuring data accuracy, the amount of data is reduced, thereby improving the efficiency and accuracy of problem reproduction.
[0062] Please see Figure 3 , Figure 3 This is a schematic flowchart illustrating a traffic replay-based testing method provided in an embodiment of this application. This traffic replay-based testing method can be applied to servers, enabling collaboration between lightweight edge node processing and in-depth analysis by the central platform. This ensures the efficiency of large-scale traffic replay while accurately locating the root cause of problems and generating actionable remediation suggestions, ultimately achieving efficient problem reproduction and improving the efficiency of problem investigation and repair.
[0063] like Figure 3 As shown, the test method based on traffic replay specifically includes steps S301 to S304.
[0064] S301. Based on the edge node, the received traffic playback subtask is parsed to obtain the task execution instruction, and the production traffic data is sent to the test environment according to the task execution instruction; S302. Perform traffic replay in the test environment, run the system under test, monitor the performance indicators of the system under test, and obtain the test results of each traffic replay test subtask. S303. Based on the edge nodes, perform basic verification on the test results of each traffic replay test subtask, obtain basic verification results, and return each basic verification result to the central management platform. S304. Based on the central management platform, the received basic verification results are comprehensively analyzed to obtain the test results.
[0065] In one embodiment, the edge node receives the traffic replay subtask distributed by the central management platform, parses the instruction content through the task parsing module, and extracts key parameters, including the traffic range (i.e. the production traffic segment to be replayed) and traffic replay parameters (such as concurrency and replay rate).
[0066] Based on the traffic range, read the traffic data corresponding to the traffic replay subtask from local storage, start the lightweight replay tool, and send the corresponding traffic data to the test environment according to the task execution instructions.
[0067] In one embodiment, the task execution instruction includes parameters such as the timestamp order and time interval of the produced traffic data, instructing the edge node when to send its corresponding traffic data to the test environment.
[0068] In one embodiment, the test environment simulator receives traffic data sent by edge nodes and injects it into the system under test (such as e-commerce payment service, order system) according to the restored timing and concurrency. The system under test runs independently in the test environment, receives and processes the replay traffic, and simulates the business logic of the production environment (such as order creation, payment deduction, inventory deduction).
[0069] In one embodiment, monitoring tools are used to monitor host metrics such as CPU utilization, memory usage, disk I / O, and network bandwidth of the system under test; application layer metrics such as interface response time, throughput, error rate, and database query time; and business metrics such as order success rate, payment conversion rate, and cache hit rate.
[0070] In one embodiment, the metric data obtained from monitoring is aggregated to obtain the test results of the subtask, and the test results are returned to the corresponding edge node. The edge node preprocesses the received test results, including filtering invalid data (such as successful logs of normal requests) and retaining information such as abnormal metrics and error logs.
[0071] In one embodiment, the edge node performs basic comparative verification on the test results of the traffic replay test subtask according to basic verification rules to obtain verification results. The verification results are then encapsulated in a standardized format to obtain basic verification results, which include the subtask ID, the subtask's problem reproduction status, key metrics (response time, error rate), and verification rule matching results.
[0072] In one embodiment, the basic verification results returned by all edge nodes are received by the central management platform, aggregated, and standardized to obtain global verification results. The global verification results are then comprehensively analyzed to obtain test results.
[0073] Further, step S304 includes: aggregating the basic verification results based on the central management platform to obtain a global verification result, comparing the global verification result with the problem to be reproduced, and determining the reproduction status of the problem to be reproduced; when the reproduction status meets preset requirements, calling the root cause analysis model to analyze the global verification result to obtain the root cause analysis result and the problem repair suggestion; and generating the test result based on the global verification result, the root cause analysis result, and the problem repair suggestion.
[0074] In one embodiment, based on the central management platform, the basic verification results of each edge node are standardized. This standardization process may include: format unification, converting the basic verification results of different edge nodes into a unified format; data cleaning, filtering invalid data and removing duplicate records. Multi-dimensional aggregation analysis is then performed on the formatted data. Specifically, the results of all sub-tasks under the same test task are correlated to form a task-level view, i.e., the global verification results.
[0075] In one embodiment, the global verification result is compared with the characteristics of the problem to be reproduced (such as error type, performance threshold, and scope of impact) to determine whether the problem has been successfully reproduced.
[0076] Specifically, first, the core features of the problem to be reproduced are extracted, including natural language processing of the text description of the problem to be reproduced to obtain problem features. Then, the global verification results are compared with the index values corresponding to each problem feature to determine whether the index values under each problem feature are completely consistent. If they are completely consistent, it indicates that the problem to be reproduced has been reproduced, that is, the reproduction status is reproduced.
[0077] In one embodiment, the reproduction status includes: complete reproduction: the global verification result is consistent with the indicator values corresponding to each problem feature; partial reproduction: the error type matches, but the performance indicators or scope of impact are not completely consistent; no reproduction: the indicator values corresponding to the core features are inconsistent.
[0078] In one embodiment, when the reproduction status is complete, the next step of root cause analysis is initiated, the root cause analysis model is invoked, and the root cause analysis results and remediation suggestions are obtained.
[0079] In one embodiment, the root cause analysis model includes a rule engine and an AI (Artificial Intelligence) agent (such as an LLM (Large Language Model)). The rule engine incorporates known common failure modes. The AI agent analyzes unknown and complex errors. The central management platform sends global verification results, complete error logs, relevant code snippets, performance metrics, and other information to the AI agent for inference, obtaining root cause analysis results and remediation suggestions.
[0080] When the reproduction status meets the preset requirements (complete reproduction), the central management platform calls the root cause analysis model (combining the rule engine and AI agent) to perform in-depth analysis of the global verification results, locate the root cause of the problem and generate repair suggestions.
[0081] Specifically, the rule engine makes an initial judgment and matches common root cause results. For example, if "database connection pool exhausted" is detected, the root cause "connection pool not expanded" in the rule base is matched. The AI agent analyzes the error stack to locate the specific line of code and determines the causal relationship through the time-series correlation algorithm.
[0082] In one embodiment, the root cause analysis model generates multi-dimensional remediation suggestions based on the root cause analysis results, combined with a rule base and AI recommendations. The global validation results, root cause analysis results, and remediation suggestions are integrated into a structured test report, which serves as the final test result output.
[0083] In the above embodiments, the synergy between lightweight edge node processing and in-depth analysis of the central platform ensures the efficiency of large-scale traffic replay, accurately locates the root cause of the problem and generates actionable repair suggestions, ultimately achieving efficient problem reproduction and improving the efficiency of problem investigation and repair.
[0084] Please see Figure 4 , Figure 4 This application provides a schematic block diagram of a traffic playback-based testing apparatus, which is used to execute the aforementioned traffic playback-based testing method. The traffic playback-based testing apparatus can be configured on a server.
[0085] like Figure 4 As shown, the test device 400 based on traffic playback includes: The traffic data acquisition module 401 is used to collect production traffic data corresponding to each production environment based on the edge nodes corresponding to each production environment, and transmit it to the preset data traffic warehouse to obtain full traffic data. The test task generation module 402 is used to analyze the problem to be reproduced and the full traffic data based on the central management platform, generate a traffic replay test task, and divide the traffic replay test task based on the task division model to obtain at least one traffic replay sub-task. The test result acquisition module 403 is used to distribute each of the traffic replay test subtasks to the edge nodes, and execute the traffic replay test subtasks based on the edge nodes to send the production traffic data to the test environment for traffic replay and obtain the test results of the system under test.
[0086] Furthermore, the test task generation module 402 includes: The problem keyword acquisition unit is used to perform natural language processing on the problem to be reproduced based on the central management platform to obtain problem keywords; The test task generation unit is used to search the full traffic data based on the problem keywords, determine the traffic data segment corresponding to the problem to be reproduced, and generate the traffic replay test task based on the traffic data segment and the problem to be reproduced.
[0087] Furthermore, the test device 400 based on traffic replay also includes a model training module, which includes: A historical data acquisition unit is used to acquire at least one historical question and the historical playback task corresponding to each historical question; The prediction subtask acquisition unit is used to process each of the historical playback tasks based on the pre-trained model to obtain the prediction subtasks of each of the historical playback tasks. The problem reproducibility degree acquisition unit is used to obtain the problem reproducibility results after the execution of each prediction subtask, and compare the problem reproducibility results with the historical problems to determine the problem reproducibility degree of each prediction subtask; The task partitioning model acquisition unit is used to use the pre-trained model as the task partitioning model when the reproducibility of the problem is greater than or equal to a preset threshold.
[0088] Furthermore, the test task generation module 402 includes: An execution instruction generation unit is used to analyze the traffic replay test task based on the task partitioning model, determine at least one subtask and traffic replay parameters of each subtask, and generate task execution instructions based on the traffic replay parameters. The subtask generation unit is used to generate at least one of the traffic replay subtasks based on each of the subtasks and the task execution instructions corresponding to each of the subtasks.
[0089] Furthermore, the test result acquisition module 403 includes: The subtask parsing unit is used to parse the received traffic replay subtask based on the edge node, obtain the task execution instruction, and send the production traffic data to the test environment according to the task execution instruction; The test result acquisition unit is used to perform traffic replay in the test environment, run the system under test, monitor the performance indicators of the system under test, and obtain the test results of each traffic replay test subtask. The basic verification result acquisition unit is used to perform basic verification on the test results of each traffic replay test subtask based on the edge node, obtain basic verification results, and return each basic verification result to the central management platform. The test result comprehensive analysis unit is used to perform comprehensive analysis on the received basic verification results based on the central management platform to obtain the test results.
[0090] Furthermore, the test result comprehensive analysis unit includes: The reproduction status acquisition subunit is used to aggregate the basic verification results based on the central management platform to obtain a global verification result, and compare the global verification result with the problem to be reproduced to determine the reproduction status of the problem to be reproduced. The verification result analysis subunit is used to call the root cause analysis model to analyze the global verification result when the reproduction state meets the preset requirements, and obtain the root cause analysis result and problem repair suggestions. The test result generation subunit is used to generate the test results based on the global verification results, the root cause analysis results, and the problem repair suggestions.
[0091] Furthermore, the test device 400 based on traffic playback also includes a sampling rate determination module, which includes: The correlation determination unit is used to analyze the problem to be reproduced based on the central management platform and determine the correlation between various types of data and the problem to be reproduced. The sampling rate determination unit is used to match the sampling rate of various types of data based on the correlation degree, so that each edge node can collect traffic data according to the sampling rate of various types of data, and perform data anonymization to obtain the production traffic data.
[0092] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the above-described apparatus and modules can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0093] The aforementioned device can be implemented as a computer program, which can be used in, for example... Figure 5 It runs on the computer device shown.
[0094] Please see Figure 5 , Figure 5 This is a schematic block diagram illustrating the structure of a computer device according to an embodiment of this application. The computer device may be a server.
[0095] See Figure 5The computer device includes a processor, memory, and network interface connected via a system bus, wherein the memory may include non-volatile storage media and internal memory.
[0096] Non-volatile storage media can store operating systems and computer programs. These computer programs include program instructions that, when executed, cause the processor to perform any flow-based playback test method.
[0097] The processor provides computing and control capabilities, supporting the operation of the entire computer device.
[0098] Internal memory provides an environment for the execution of computer programs stored in non-volatile storage media. When executed by a processor, the computer program enables the processor to perform any test method based on flow playback.
[0099] This network interface is used for network communication, such as sending assigned tasks. Those skilled in the art will understand that... Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0100] It should be understood that the processor can be a Central Processing Unit (CPU), but it can also be other general-purpose processors, 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, discrete hardware components, etc. Among these, a general-purpose processor can be a microprocessor or any conventional processor.
[0101] In one embodiment, the processor is configured to run a computer program stored in memory to perform the following steps: Based on the edge nodes corresponding to each production environment, the production traffic data corresponding to each production environment is collected and transmitted to the preset data traffic warehouse to obtain the full traffic data. Based on the analysis of the problem to be reproduced and the full traffic data by the central management platform, a traffic replay test task is generated, and the traffic replay test task is divided according to the task partitioning model to obtain at least one traffic replay sub-task. Each of the traffic replay test subtasks is distributed to the edge nodes, and the traffic replay test subtasks are executed based on the edge nodes to send the production traffic data to the test environment for traffic replay and obtain the test results of the system under test.
[0102] In one embodiment, when the processor analyzes the problem to be reproduced and the full traffic data based on the central management platform to generate a traffic replay test task, it is used to: Based on the central management platform, natural language processing is performed on the problem to be reproduced to obtain problem keywords; Based on the problem keywords, a search is performed on the full traffic data to determine the traffic data segment corresponding to the problem to be reproduced, and based on the traffic data segment and the problem to be reproduced, the traffic replay test task is generated.
[0103] In one embodiment, before the processor analyzes the problem to be reproduced and the full traffic data based on the central management platform, generates a traffic replay test task, and divides the traffic replay test task based on the task partitioning model to obtain at least one traffic replay subtask, it is also configured to: Obtain at least one historical question and the corresponding historical replay task for each historical question; The historical playback tasks are processed based on the pre-trained model to obtain the prediction sub-tasks of each historical playback task. Obtain the problem reproduction results after each prediction subtask is executed, and compare the problem reproduction results with the historical problems to determine the degree of problem reproduction of each prediction subtask; When the degree of problem reproducibility is greater than or equal to a preset threshold, the pre-trained model is used as the task partitioning model.
[0104] In one embodiment, when the processor divides the traffic replay test task based on a task partitioning model to obtain at least one traffic replay subtask, it is configured to: Based on the task partitioning model, the traffic replay test task is analyzed to determine at least one subtask and the traffic replay parameters of each subtask, and task execution instructions are generated based on the traffic replay parameters. Based on each of the subtasks and the corresponding task execution instructions, at least one of the traffic replay subtasks is generated.
[0105] In one embodiment, when the processor executes the traffic replay test subtask based on the edge node to send the production traffic data to the test environment for traffic replay and obtain the test results of the system under test, it is configured to: Based on the edge node, the received traffic replay subtask is parsed to obtain the task execution instruction, and the production traffic data is sent to the test environment according to the task execution instruction; Traffic replay is performed in the test environment, and the system under test is run to monitor the performance indicators of the system under test and obtain the test results of each traffic replay test subtask. Based on the edge nodes, the test results of each traffic replay test subtask are basically verified to obtain the basic verification results, and each basic verification result is returned to the central management platform. The central management platform performs a comprehensive analysis of the received basic verification results to obtain the test results.
[0106] In one embodiment, when the processor performs comprehensive analysis on the received basic verification results based on the central management platform to obtain the test results, it is configured to: The central management platform aggregates the basic verification results to obtain a global verification result, and compares the global verification result with the problem to be reproduced to determine the reproduction status of the problem. When the reproduction status meets the preset requirements, the root cause analysis model is invoked to analyze the global verification results, and the root cause analysis results and problem repair suggestions are obtained. The test results are generated based on the global verification results, the root cause analysis results, and the problem remediation suggestions.
[0107] In one embodiment, before the processor collects production traffic data corresponding to each production environment based on the edge nodes corresponding to each production environment and transmits it to a preset data traffic warehouse to obtain the full traffic data, it is also used to implement: The problem to be reproduced is analyzed based on the central management platform to determine the correlation between various types of data and the problem to be reproduced. Based on the correlation, the sampling rate of various types of data is matched so that each edge node can collect traffic data according to the sampling rate of various types of data, and perform data anonymization to obtain the production traffic data.
[0108] The embodiments of this application also provide a computer-readable storage medium storing a computer program, the computer program including program instructions, and the processor executing the program instructions to implement any of the traffic playback-based test methods provided in the embodiments of this application.
[0109] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiments, such as the hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, SmartMedia Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the computer device.
[0110] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A testing method based on traffic replay, characterized in that, include: Based on the edge nodes corresponding to each production environment, the production traffic data corresponding to each production environment is collected and transmitted to the preset data traffic warehouse to obtain the full traffic data. Based on the analysis of the problem to be reproduced and the full traffic data by the central management platform, a traffic replay test task is generated, and the traffic replay test task is divided according to the task partitioning model to obtain at least one traffic replay sub-task. Each of the traffic replay test subtasks is distributed to the edge nodes, and the traffic replay test subtasks are executed based on the edge nodes to send the production traffic data to the test environment for traffic replay and obtain the test results of the system under test.
2. The test method based on traffic playback according to claim 1, characterized in that, The process of analyzing the problem to be reproduced and the full traffic data based on the central management platform to generate a traffic replay test task includes: Based on the central management platform, natural language processing is performed on the problem to be reproduced to obtain problem keywords; Based on the problem keywords, a search is performed on the full traffic data to determine the traffic data segment corresponding to the problem to be reproduced, and based on the traffic data segment and the problem to be reproduced, the traffic replay test task is generated.
3. The test method based on traffic playback according to claim 1, characterized in that, Before analyzing the problem to be reproduced and the full traffic data based on the central management platform, generating a traffic replay test task, and dividing the traffic replay test task based on the task partitioning model to obtain at least one traffic replay subtask, the process further includes: Obtain at least one historical question and the corresponding historical replay task for each historical question; The historical playback tasks are processed based on the pre-trained model to obtain the prediction sub-tasks of each historical playback task. Obtain the problem reproduction results after each prediction subtask is executed, and compare the problem reproduction results with the historical problems to determine the degree of problem reproduction of each prediction subtask; When the degree of problem reproducibility is greater than or equal to a preset threshold, the pre-trained model is used as the task partitioning model.
4. The test method based on traffic replay according to claim 1, characterized in that, The task partitioning model is used to divide the traffic replay test task to obtain at least one traffic replay subtask, including: Based on the task partitioning model, the traffic replay test task is analyzed to determine at least one subtask and the traffic replay parameters of each subtask, and task execution instructions are generated based on the traffic replay parameters. Based on each of the subtasks and the corresponding task execution instructions, at least one of the traffic replay subtasks is generated.
5. The test method based on traffic playback according to claim 1, characterized in that, The step of executing the traffic replay test subtask based on the edge node to send the production traffic data to the test environment for traffic replay and obtain the test results of the system under test includes: Based on the edge node, the received traffic replay subtask is parsed to obtain the task execution instruction, and the production traffic data is sent to the test environment according to the task execution instruction; Traffic replay is performed in the test environment, and the system under test is run to monitor the performance indicators of the system under test and obtain the test results of each traffic replay test subtask. Based on the edge nodes, the test results of each traffic replay test subtask are basically verified to obtain the basic verification results, and each basic verification result is returned to the central management platform. The central management platform performs a comprehensive analysis of the received basic verification results to obtain the test results.
6. The test method based on traffic playback according to claim 5, characterized in that, The test results are obtained by comprehensively analyzing the received basic verification results based on the central management platform, including: The central management platform aggregates the basic verification results to obtain a global verification result, and compares the global verification result with the problem to be reproduced to determine the reproduction status of the problem. When the reproduction status meets the preset requirements, the root cause analysis model is invoked to analyze the global verification results, and the root cause analysis results and problem repair suggestions are obtained. The test results are generated based on the global verification results, the root cause analysis results, and the problem remediation suggestions.
7. The test method based on traffic playback according to any one of claims 1 to 6, characterized in that, Before acquiring full traffic data by collecting production traffic data corresponding to each production environment based on edge nodes of each production environment and transmitting it to a preset data traffic warehouse, the process also includes: The problem to be reproduced is analyzed based on the central management platform to determine the correlation between various types of data and the problem to be reproduced. Based on the correlation, the sampling rate of various types of data is matched so that each edge node can collect traffic data according to the sampling rate of various types of data, and perform data anonymization to obtain the production traffic data.
8. A testing device based on traffic playback, characterized in that, include: The traffic data acquisition module is used to collect production traffic data corresponding to each production environment based on the edge nodes corresponding to each production environment, and transmit it to the preset data traffic warehouse to obtain full traffic data. The test task generation module is used to analyze the problem to be reproduced and the full traffic data based on the central management platform, generate traffic replay test tasks, and divide the traffic replay test tasks based on the task partitioning model to obtain at least one traffic replay sub-task. The test result acquisition module is used to distribute each of the traffic replay test subtasks to the edge nodes, and execute the traffic replay test subtasks based on the edge nodes to send the production traffic data to the test environment for traffic replay and obtain the test results of the system under test.
9. A computer device, characterized in that, The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is configured to execute the computer program and, in executing the computer program, implement the test method based on traffic replay as described in any one of claims 1 to 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, causes the processor to implement the test method based on traffic playback as described in any one of claims 1 to 7.