Test method and device based on flow playback, electronic equipment and storage medium

Through high-speed network library, bytecode enhancement technology and timestamp synchronization mechanism, the problem that existing testing methods cannot reproduce real network conditions is solved, and efficient and accurate traffic playback and performance testing is achieved, suitable for complex network applications. and high traffic scenarios.

CN119109820APending Publication Date: 2024-12-10BEIJING BAILONG MAYUN TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411308742.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

Existing test methods cannot fully reproduce the behavior under real network conditions. Traditional traffic capture and playback methods require highly technical hardware and software support, and consume a large amount of computing and storage resources in high-traffic scenarios, making it difficult to maintain data consistency and accuracy.

Method used

High-speed network libraries such as DPDK or PF_RING are used for packet capture, combined with bytecode enhancement technology and BPF compiler for data filtering and compression, introduced timestamp synchronization mechanism and multi-threading technology, used message queues for traffic distribution and playback, and integrated Performance monitoring tools such as Prometheus and Grafana support multi-protocol and encryption processing.

Benefits of technology

It realizes efficient data capture and playback in high-speed network environments, ensures the integrity and accuracy of test data, reduces storage space requirements and operation and maintenance costs, provides data security and flexibility, and is suitable for various network applications and services. performance testing and security evaluation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119109820A_ABST
    Figure CN119109820A_ABST
Patent Text Reader

Abstract

The invention provides a test method and device based on traffic playback, electronic equipment and a storage medium, and the method comprises the following steps: capturing traffic data, adding a packet capturing tool, and improving the data packet capturing performance of the packet capturing tool by using a high-speed network library; data processing and storage: filtering the data packet and optimizing the data, and storing the processed data in an elasticSearch; encrypting sensitive data; a timestamp synchronization mechanism is introduced, and a flow playback system is established; by using the high-speed network library, efficient data capture can be realized in a high-speed network environment, data packet loss is reduced, and integrity and accuracy of test data are ensured. The method is particularly important for scenes such as performance testing and network monitoring, and through the time synchronization and high concurrency technology, a traffic playback system can accurately play back network traffic and simulate a real network environment, and an effective tool is provided for performance testing of network equipment and applications.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a testing method, in particular to a testing method based on traffic playback, and belongs to the field of computer technology. Background Art

[0002] Traffic playback refers to simulating user behavior by recording and replaying network traffic to test the performance, security, and stability of network applications or services. This technology is widely used in software development, network security, performance testing, and other fields.

[0003] With the continuous development of network applications, it is becoming increasingly important to ensure the stability and performance of applications under various network conditions. Existing testing methods often rely on simulated traffic, which cannot fully reproduce the behavior under real network conditions and may miss key performance bottlenecks or error conditions. Traditional traffic capture and playback methods usually involve highly technical implementations and require specialized hardware and software support. There are technical challenges in maintaining the consistency and accuracy of traffic data under different network environments and configurations. Traffic playback requires a lot of computing and storage resources, especially in high-traffic scenarios.

[0004] To this end, a test method, device, electronic device and storage medium based on traffic playback are proposed. Summary of the invention

[0005] In view of this, the present invention provides a test method, device, electronic device and storage medium based on traffic playback to solve or alleviate the technical problems existing in the prior art and at least provide a beneficial choice.

[0006] The technical solution of the embodiment of the present invention is implemented as follows: a test method based on traffic playback, comprising the following steps:

[0007] S1. Capture of traffic data - add a packet capture tool and use a high-speed network library to improve the packet capture performance of the packet capture tool;

[0008] S2, data processing and storage - filter data packets and optimize data, and store the processed data in elasticSearch;

[0009] S3, sensitive data encryption;

[0010] S4. Introduce timestamp synchronization mechanism - establish traffic playback system;

[0011] S5. Combining message queues and multi-threading technology to distribute and replay traffic - read the recorded information from elasticSearch, obtain the recorded request information according to the record ID, replay the request information, and replace the recorded context with the current environment context;

[0012] S6, multi-protocol support;

[0013] S7. Integrated performance monitoring tools.

[0014] Further preferably, in S1, the high-speed network library adopts DPDK or PF_RING to directly interact with the network card and bypass the network stack of the operating system;

[0015] The packet capture tool also uses bytecode enhancement technology to modify the bytecode for aspect wrapping, and implements the recording of request data and request data context in the aspect.

[0016] Further preferably, in S2, the filtering rules are converted into kernel-level codes using a BPF compiler, and the data is compressed in real time based on the data deduplication technology of the hash table and the fast compression algorithm;

[0017] The fast compression algorithm is LZ4, LZ77 or LZ78 algorithm.

[0018] Further preferably, in S3, the encryption uses the AES encryption algorithm to encrypt the sensitive data and hash the IP address to ensure the security of the data during transmission and storage.

[0019] Further preferably, in S4, the time accuracy of the traffic playback is ensured by utilizing a timestamp synchronization mechanism.

[0020] Further preferably, in S5, the distribution and playback of high concurrent traffic are achieved by utilizing message queues and multi-threading technology, and the traffic characteristics under the original network environment are simulated in conjunction with a timestamp synchronization mechanism.

[0021] Further preferably, in S6, by adding multi-protocol support, the system can provide parsing modules for different network protocols and provide an extensible plug-in mechanism to support rapid integration of new protocols;

[0022] Wherein, the parsing module includes but is not limited to HTTP parser and TCP stream reassembly module;

[0023] In the S7, the performance monitoring tools are Prometheus and / or Grafana, which are used to monitor the performance indicators during the traffic playback test in real time, and dynamically adjust resource allocation and optimize performance based on the monitoring data.

[0024] Further preferably, a testing device comprises:

[0025] Use the packet capture tool of the DPDK or PF_RING high-speed network library to capture data packets in a higher-speed network environment and record the request data and the request data context;

[0026] Data processing and storage module, used to pre-process the captured data, filter out test-related data packets, and compress and deduplicate the data packets;

[0027] Security and privacy module, which is used to encrypt sensitive data using the AES encryption algorithm and hash IP addresses;

[0028] Traffic playback module, which uses the timestamp synchronization mechanism combined with message queue and multi-threading technology to accurately simulate the traffic characteristics in the original network environment and provide a real test scenario for the performance test of network equipment and applications;

[0029] Multi-protocol support module, used to process and analyze traffic of multiple network protocols to meet the testing requirements of different network applications;

[0030] Performance monitoring and optimization tools are used to monitor and optimize system performance indicators in real time.

[0031] Further preferably, an electronic device includes a memory and a processor, the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to perform the above-mentioned test method based on traffic playback.

[0032] Further preferably, a computer-readable storage medium stores computer program instructions, and when the computer program instructions are read and executed by a processor, the above-mentioned test method based on traffic playback is executed.

[0033] The embodiment of the present invention has the following advantages due to the adoption of the above technical solution:

[0034] 1. The present invention can achieve efficient data capture in a high-speed network environment by using a high-speed network library, reduce data packet loss, and ensure the integrity and accuracy of test data. This is particularly important for scenarios such as performance testing and network monitoring. Through time synchronization and high concurrency technology, the traffic playback system can accurately playback network traffic, simulate a real network environment, and provide an effective tool for performance testing of network devices and applications.

[0035] Second, the present invention uses real-time data compression, filtering and deduplication technology to effectively reduce the storage and processing of irrelevant data, reduce storage space requirements, and increase data processing speed. This helps to improve testing efficiency and reduce operation and maintenance costs.

[0036] 3. The present invention adopts encryption and anonymization technology, which can protect the security of captured data, prevent the leakage of sensitive information, and meet the increasingly stringent requirements of data protection regulations. The present invention supports the parsing and processing of multiple network protocols, can adapt to different network applications and testing needs, and has good versatility and flexibility.

[0037] 4. The present invention integrates performance monitoring tools to monitor the performance of the system in real time and optimize it in a timely manner to ensure stable operation and efficient performance of the system.

[0038] 5. The present invention is applicable to the testing of various network applications and services, including complex distributed systems, cloud services, and multi-layer application architectures, providing wide applicability. By simulating real traffic, developers and testers can more accurately identify and resolve performance bottlenecks, thereby optimizing the overall performance of the application. By replaying real attack traffic, the security of the application can be more effectively tested and enhanced, and security vulnerabilities can be discovered and fixed in advance.

[0039] The above summary is for illustrative purposes only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments and features described above, further aspects, embodiments and features of the present invention will be readily apparent by reference to the accompanying drawings and the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0041] Figure 1 is a flow chart of the steps of the present invention;

[0042] Figure 2 is a schematic block diagram of a traffic playback system of the present invention;

[0043] Figure 3 A schematic diagram of the flow chart of the stability verification of the traffic playback system of the present invention. DETAILED DESCRIPTION

[0044] In the following, only some exemplary embodiments are briefly described. As those skilled in the art will appreciate, the described embodiments may be modified in various ways without departing from the spirit or scope of the present invention. Therefore, the drawings and descriptions are considered to be exemplary and non-restrictive in nature.

[0045] It should be noted that the terms "first", "second", "symmetrical", "array", etc. are only used to distinguish between description and position description purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the definition of "first", "symmetrical", etc. can explicitly or implicitly include one or more of these features; similarly, when the number of certain features is not limited in the form of words such as "two" or "three", it should be noted that this feature also explicitly or implicitly includes one or more feature quantities.

[0046] Explanation of related terms:

[0047] DPDK: is an open source library that provides a set of development tools and APIs for high-speed data planes. The main goal of DPDK is to simplify the development of user space network stacks and improve the performance of network processing. DPDK allows developers to quickly build high-performance network applications based on general-purpose hardware, such as load balancers, firewalls, and intrusion detection systems, by using a large number of kernel modules and drivers. DPDK also provides rich features such as network monitoring, traffic shaping, QoS, etc.

[0048] PF_RING: is a user space network monitoring and exploitation framework that can capture and analyze network traffic. PF_RING provides high performance traffic capture and low latency raw packet processing capabilities, making it ideal for network monitoring and intrusion detection systems (IDS). PF_RING supports a variety of network interfaces and protocols, including Ethernet, wireless networks, and VLANs. In addition, PF_RING provides a powerful filter system that allows users to filter and process packets based on specific network conditions.

[0049] Bytecode Enhancement Technology: is a technology that modifies or adds new functions to Java bytecode at runtime. This technology can dynamically increase or modify the behavior of Java applications without modifying the original source code. Bytecode Enhancement Technology is very useful in many scenarios, including performance tuning, security enhancement, function expansion, etc.

[0050] Java Instrumentation API: is a standard API provided by Java for modifying bytecode at runtime. This API allows developers to observe and modify the behavior of Java applications through instrumentation. Instrumentation is achieved by inserting new code into the bytecode of the application. This new code can be used to record method calls, modify method return values, throw exceptions, etc.

[0051] LZ77: is a dictionary encoding algorithm that compresses data by searching for repeated sequences in the data. The algorithm uses a fixed window to store recently accessed strings and tries to match the current input with the string in the window. If a match is found, the current input can be represented by a smaller code, otherwise the entire string is copied into the window. LZ77 is suitable for compression of text data and small data blocks, but not for large data blocks because its compression rate decreases as the size of the data block increases.

[0052] LZ78: An improved version of LZ77, it introduces the concept of a pattern dictionary, which can dynamically build a dictionary based on the input data. The algorithm splits the input data into strings and then tries to find these strings in the pattern dictionary. If a matching string is found, it is represented by the index in the dictionary, otherwise the string is added to the dictionary. LZ78 is suitable for the compression of text data and data with repeated patterns, but may not be as efficient as LZ77 when processing random data.

[0053] LZ4: is a fast compression algorithm that combines the features of LZ77 and LZ78 and introduces some new technologies. LZ4 uses a fixed-size dictionary and uses hash functions to quickly locate matching strings. The algorithm can process data quickly when compressing and is also very fast when decompressing, which is very suitable for real-time compression and low-latency application scenarios. LZ4 is particularly suitable for data compression in memory because it can provide very high compression speeds and relatively high compression ratios.

[0054] Elasticsearch: is a powerful open source distributed search and analysis engine that is at the core of the ElasticStack and can store, search, and analyze large amounts of data, and supports real-time operations53. Elasticsearch uses the inverted index as its core technology, which is a data structure that speeds up document lookups by associating words with lists of documents containing those words9. In addition, Elasticsearch introduced ES|QL, a new query language for filtering, transforming, and analyzing data stored in Elasticsearch.

[0055] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0056] Embodiment 1

[0057] like Figure 1-3 As shown, an embodiment of the present invention provides a test method based on traffic playback, comprising the following steps:

[0058] S1. Capture of traffic data - add a packet capture tool and use a high-speed network library to improve the packet capture performance of the packet capture tool;

[0059] S2, data processing and storage - filter data packets and optimize data, and store the processed data in elasticSearch;

[0060] S3, sensitive data encryption;

[0061] S4. Introduce timestamp synchronization mechanism - establish traffic playback system;

[0062] S5. Combining message queues and multi-threading technology to distribute and replay traffic - read the recorded information from elasticSearch, obtain the recorded request information according to the record ID, replay the request information, and replace the recorded context with the current environment context;

[0063] S6, multi-protocol support;

[0064] S7. Integrated performance monitoring tools.

[0065] In one embodiment, in S1, the high-speed network library uses DPDK to directly interact with the network card, bypassing the network stack of the operating system;

[0066] Use the DPDK high-speed network library to improve packet capture performance. The DPDK high-speed network library can interact directly with the network card, bypassing the operating system's network stack, thereby significantly reducing packet processing time, enabling it to achieve near-zero packet loss data capture in a 10Gbps or even higher-speed network environment, ensuring the integrity and accuracy of the test data.

[0067] The packet capture tool also uses bytecode enhancement technology (Java instrument API) to modify the bytecode to implement slice wrapping, and implements the recording of request data and request data context in the slice.

[0068] In one embodiment, in S2, a BPF compiler is used to convert the filtering rules into kernel-level codes, and data is compressed in real time based on the data deduplication technology of the hash table and the fast compression algorithm;

[0069] Among them, the fast compression algorithm is the LZ4 algorithm;

[0070] The BPF compiler is used to convert the filtering rules into efficient kernel-level code. The hash table-based data deduplication technology is implemented, and the LZ4 fast compression algorithm is used to compress the data in real time to filter out the test-related data packets, greatly reducing the storage and processing of irrelevant data. Real-time compression and data deduplication can effectively reduce storage space requirements and improve data processing efficiency.

[0071] The BPF compiler is a tool used to compile eBPF programs, which are written in a high-level language called LLVM BC (LLVM bitcode). eBPF is a mechanism in the Linux kernel that allows users to run small programs in the kernel without modifying the kernel code or loading kernel modules. eBPF programs can be used for various purposes, including network and security filtering, system monitoring, and performance analysis.

[0072] In one embodiment, in S3, the encryption uses the AES encryption algorithm to encrypt sensitive data and hash the IP address to ensure the security of the data during transmission and storage;

[0073] Sensitive data is encrypted using the AES encryption algorithm. IP addresses are hashed to protect user privacy, ensure data security during transmission and storage, and prevent data leakage. Anonymization is used to meet data protection regulations and protect personal privacy.

[0074] The purpose of hashing an IP address is to convert it into a fixed-length hash value, which is used to map the IP address to other data structures, such as hash tables, for fast lookup, grouping, or distribution. Hashing can be used in a variety of applications, including load balancing, data storage, network routing, etc.

[0075] A common way to hash IP addresses is to use a hash function. A hash function is a function that converts an input (in this case, an IP address) into a fixed-length output, which is usually much smaller than the length of the input. An ideal hash function should be easy to compute and evenly distribute different inputs to different parts of the hash space to reduce the possibility of collisions.

[0076] In one embodiment, in S4, the time accuracy of traffic playback is ensured by using a timestamp synchronization mechanism, and in S5, the distribution and playback of high concurrent traffic is achieved by using message queues and multi-threading technology, and the timestamp synchronization mechanism is used to simulate the traffic characteristics in the original network environment;

[0077] Through time synchronization mechanism, message queue and multi-threaded high concurrency technology, the traffic replay system can accurately replay network traffic, simulate the real network environment, and provide an effective tool for performance testing of network equipment and applications. It is suitable for testing in high-load network environments.

[0078] The timestamp synchronization mechanism refers to a series of technologies and protocols used in computer networks to maintain the accuracy and consistency of system time. In the network, due to the characteristics of the clock source (such as crystal oscillator), network delay, system load and other factors, the clocks of various systems may gradually deviate. The purpose of the timestamp synchronization mechanism is to minimize this time deviation and ensure that the time of different nodes in the network is as close to the real time as possible.

[0079] In one embodiment, in S6, by adding multi-protocol support, the system can provide parsing modules for different network protocols and provide an extensible plug-in mechanism to support the rapid integration of new protocols;

[0080] Wherein, the parsing module includes but is not limited to HTTP parser and TCP stream reassembly module;

[0081] In S7, the performance monitoring tools are Prometheus and Grafana, which are used to monitor the performance indicators during the traffic playback test in real time, and dynamically adjust resource allocation and optimize performance based on the monitoring data.

[0082] By adding multi-protocol support, the traffic playback system can process and analyze traffic of multiple network protocols to meet the testing requirements of different network applications. The plug-in mechanism ensures the flexibility and scalability of the system.

[0083] By using Prometheus and Grafana performance monitoring tools, system performance indicators are monitored in real time and optimized in a timely manner, ensuring the stable operation and efficient performance of the system, and being able to reasonably utilize system resources while ensuring performance.

[0084] By combining Prometheus and Grafana, a powerful monitoring and troubleshooting tool can be provided for system administrators and developers. Prometheus is responsible for collecting and storing data, while Grafana is responsible for displaying this data in a graphical way, making complex data analysis more intuitive and easy to understand.

[0085] Prometheus is an open source monitoring system that collects and stores metrics and provides queries for these metrics in a format. The core concepts of Prometheus include:

[0086] Time series data: Prometheus stores time series data where time is a key part of the data. A time series is a quantity that is arranged in chronological order and is used to track changes over time.

[0087] Pull model: The Prometheus client periodically sends indicator data to the Prometheus server. This method is called the pull model because it is initiated by the client.

[0088] Labels: Prometheus allows users to attach labels to metrics, which makes it possible to filter and aggregate data based on these labels.

[0089] Expressions and PromQL: Prometheus supports complex expression evaluation, as well as Prometheus Query Language (PromQL), which allows users to query and manipulate time series data.

[0090] Grafana is an open source data visualization platform that allows users to import and visualize data from a variety of data sources (including Prometheus). Grafana's core features include:

[0091] Dashboards: Grafana allows users to create and manage dashboards consisting of multiple panels that can display data in Prometheus.

[0092] Data source: Grafana supports multiple data sources, including Graphite, InfluxDB, Elasticsearch, etc. in addition to Prometheus.

[0093] Customization: Grafana provides a wealth of customization options, including chart types, colors, alert rules, etc.

[0094] Plugins: The Grafana community provides a range of plugins to support more advanced features and data sources.

[0095] The specific operation is as follows: Use the bytecode enhancement technology to modify the bytecode through the packet capture tool to achieve aspect wrapping, and realize the recording of request data and request data context in the aspect; then preprocess the captured data, including removing sensitive information, data compression and formatting. Store the processed data in elasticSearch; then read the recorded information from elasticSearch through the traffic playback system, and obtain the recorded request information according to the record ID, and replay the request information, and replace the recorded context with the current environment context to ensure the success rate of playback, and support adjusting the playback speed, simulating different network conditions, and mocking the external calls of online requests such as mysql, dubbo, hsf, and mocking all external calls, replacing them with the request data of the recorded request parameters, and replacing them with the recorded data.

[0096] Embodiment 2

[0097] The embodiment of the present invention also provides a test method based on traffic playback, comprising the following steps:

[0098] S1. Capture of traffic data - add a packet capture tool and use a high-speed network library to improve the packet capture performance of the packet capture tool;

[0099] S2, data processing and storage - filter data packets and optimize data, and store the processed data in elasticSearch;

[0100] S3, sensitive data encryption;

[0101] S4. Introduce timestamp synchronization mechanism - establish traffic playback system;

[0102] S5. Combining message queues and multi-threading technology to distribute and replay traffic - read the recorded information from elasticSearch, obtain the recorded request information according to the record ID, replay the request information, and replace the recorded context with the current environment context;

[0103] S6, multi-protocol support;

[0104] S7. Integrated performance monitoring tools.

[0105] In one embodiment, in S1, the high-speed network library uses PF_RING to directly interact with the network card and bypass the network stack of the operating system;

[0106] Use the PF_RING high-speed network library to improve packet capture performance. The PF_RING high-speed network library filters and processes packets according to specific network conditions, thereby significantly reducing packet processing time and ensuring the integrity and accuracy of test data in a high-speed network environment.

[0107] The packet capture tool also uses bytecode enhancement technology (Java instrument API) to modify the bytecode to implement slice wrapping, and implements the recording of request data and request data context in the slice.

[0108] In one embodiment, in S2, a BPF compiler is used to convert the filtering rules into kernel-level codes, and data is compressed in real time based on the data deduplication technology of the hash table and the fast compression algorithm;

[0109] Among them, the fast compression algorithm is the LZ77 algorithm;

[0110] The BPF compiler is used to convert the filtering rules into efficient kernel-level code. The hash table-based data deduplication technology is implemented, and the LZ77 fast compression algorithm is used to compress the data by searching for repeated sequences in the data, so as to significantly reduce the storage and processing of irrelevant data. Real-time compression and data deduplication can effectively reduce storage space requirements and improve data processing efficiency.

[0111] In one embodiment, in S3, the encryption uses the AES encryption algorithm to encrypt sensitive data and hash the IP address to ensure the security of the data during transmission and storage;

[0112] Sensitive data is encrypted using the AES encryption algorithm. IP addresses are hashed to protect user privacy, ensure data security during transmission and storage, and prevent data leakage. Anonymization is used to meet data protection regulations and protect personal privacy.

[0113] In one embodiment, in S4, the time accuracy of traffic playback is ensured by using a timestamp synchronization mechanism, and in S5, the distribution and playback of high concurrent traffic is achieved by using message queues and multi-threading technology, and the timestamp synchronization mechanism is used to simulate the traffic characteristics in the original network environment;

[0114] Through time synchronization mechanism, message queue and multi-threaded high concurrency technology, the traffic replay system can accurately replay network traffic, simulate the real network environment, and provide an effective tool for performance testing of network equipment and applications. It is suitable for testing in high-load network environments.

[0115] In one embodiment, in S6, by adding multi-protocol support, the system can provide parsing modules for different network protocols and provide an extensible plug-in mechanism to support the rapid integration of new protocols;

[0116] Wherein, the parsing module includes but is not limited to HTTP parser and TCP stream reassembly module;

[0117] In S7, the performance monitoring tool is Prometheus, which is used to monitor the performance indicators during the traffic playback test in real time, and dynamically adjust resource allocation and optimize performance based on the monitoring data.

[0118] By adding multi-protocol support, the traffic playback system can process and analyze traffic of multiple network protocols to meet the testing requirements of different network applications. The plug-in mechanism ensures the flexibility and scalability of the system.

[0119] By using the Prometheus performance monitoring tool to collect and store data, the system performance indicators are monitored in real time to ensure the stable operation and efficient performance of the system.

[0120] The specific operation method is as follows Figure 2 As shown in the figure, the bytecode is modified by using the bytecode enhancement technology through the packet capture tool to achieve the aspect wrapping, and the request data and the request data context are recorded in the aspect; then the captured data is preprocessed, including removing sensitive information, data compression and formatting. The processed data is stored in elasticSearch; then the recorded information is read from elasticSearch through the traffic playback system, and the recorded request information is obtained according to the record ID, and the request information is replayed, and the recorded context is replaced with the current environment context to ensure the success rate of playback, and support the adjustment of playback speed, simulate different network conditions, and mock the external calls of online requests such as mysql, dubbo, hsf, and mock all external calls, replace them with the request data of the recorded request parameters, and replace them with the recorded data.

[0121] Embodiment 3

[0122] Based on the first embodiment, the present invention further provides a testing device, the testing device comprising:

[0123] Use the packet capture tool of the DPDK high-speed network library to capture data packets in a higher-speed network environment and record the request data and the request data context;

[0124] The data processing and storage module is used to pre-process the captured data, filter out the test-related data packets, and compress and deduplicate the data packets;

[0125] Security and privacy module, which is used to encrypt sensitive data using the AES encryption algorithm and hash IP addresses;

[0126] Traffic playback module, which uses the timestamp synchronization mechanism combined with message queue and multi-threading technology to accurately simulate the traffic characteristics in the original network environment and provide a real test scenario for the performance test of network equipment and applications;

[0127] Multi-protocol support module, used to process and analyze traffic of multiple network protocols to meet the testing requirements of different network applications;

[0128] Performance monitoring and optimization tools are used to monitor and optimize system performance indicators in real time.

[0129] Embodiment 4

[0130] Based on the second embodiment, the embodiment of the present invention further provides a testing device, the testing device comprising:

[0131] Use the packet capture tool of the PF_RI NG high-speed network library to capture data packets in a higher-speed network environment and record the request data and the request data context;

[0132] The data processing and storage module is used to pre-process the captured data, filter out the test-related data packets, and compress and deduplicate the data packets;

[0133] Security and privacy module, which is used to encrypt sensitive data using the AES encryption algorithm and hash IP addresses;

[0134] Traffic playback module, which uses the timestamp synchronization mechanism combined with message queue and multi-threading technology to accurately simulate the traffic characteristics in the original network environment and provide a real test scenario for the performance test of network equipment and applications;

[0135] Multi-protocol support module, used to process and analyze traffic of multiple network protocols to meet the testing requirements of different network applications;

[0136] Performance monitoring and optimization tools are used to monitor and optimize system performance indicators in real time.

[0137] Embodiment 5

[0138] An embodiment of the present invention further provides an electronic device, which includes a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the test method based on traffic playback of embodiment one or embodiment two.

[0139] Embodiment 6

[0140] An embodiment of the present invention further provides a computer-readable storage medium, in which computer program instructions are stored. When the computer program instructions are read and executed by a processor, the test method based on traffic playback of embodiment 1 or embodiment 2 is executed.

[0141] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of various changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A test method based on traffic playback, characterized in that: The following steps are involved: S1. Capture of traffic data - add a packet capture tool and use a high-speed network library to improve the packet capture performance of the packet capture tool; S2, data processing and storage - filter data packets and optimize data, and store the processed data in elasticSearch; S3, sensitive data encryption; S4. Introduce timestamp synchronization mechanism - establish traffic playback system; S5. Combining message queues and multi-threading technology to distribute and replay traffic - read the recorded information from elasticSearch, obtain the recorded request information according to the record ID, replay the request information, and replace the recorded context with the current environment context; S6, multi-protocol support; S7. Integrated performance monitoring tools.

2. The test method based on traffic playback according to claim 1 is characterized in that: In S1, the high-speed network library uses DPDK or PF_RING to directly interact with the network card and bypass the network stack of the operating system; The packet capture tool also uses bytecode enhancement technology to modify the bytecode for aspect wrapping, and implements the recording of request data and request data context in the aspect.

3. The test method based on traffic playback according to claim 1 is characterized in that: In S2, the filtering rules are converted into kernel-level codes using a BPF compiler, and data is compressed in real time based on a hash table data deduplication technology and a fast compression algorithm; The fast compression algorithm is LZ4, LZ77 or LZ78 algorithm.

4. The test method based on traffic playback according to claim 1 is characterized in that: In the S3, the AES encryption algorithm is used to encrypt sensitive data and the IP address is hashed to ensure the security of the data during transmission and storage.

5. The test method based on traffic playback according to claim 1 is characterized in that: In S4, the time accuracy of traffic playback is ensured by utilizing a timestamp synchronization mechanism.

6. The test method based on traffic playback according to claim 5 is characterized in that: In S5, the distribution and playback of high concurrent traffic are achieved by utilizing message queues and multi-threading technology, and the traffic characteristics under the original network environment are simulated in conjunction with the timestamp synchronization mechanism.

7. The test method based on traffic playback according to claim 1 is characterized in that: In the S6, by adding multi-protocol support, the system can provide parsing modules for different network protocols and provide an extensible plug-in mechanism to support the rapid integration of new protocols; Wherein, the parsing module includes but is not limited to HTTP parser and TCP stream reassembly module; In the S7, the performance monitoring tools are Prometheus and / or Grafana, which are used to monitor the performance indicators during the traffic playback test in real time, and dynamically adjust resource allocation and optimize performance based on the monitoring data.

8. A test device based on the traffic playback test method according to any one of claims 1 to 7, characterized in that: The testing device comprises: Use the packet capture tool of the DPDK or PF_RING high-speed network library to capture data packets in a higher-speed network environment and record the request data and the request data context; Data processing and storage module, used to pre-process the captured data, filter out test-related data packets, and compress and deduplicate the data packets; Security and privacy module, which is used to encrypt sensitive data using the AES encryption algorithm and hash IP addresses; Traffic playback module, which uses the timestamp synchronization mechanism combined with message queue and multi-threading technology to accurately simulate the traffic characteristics in the original network environment and provide a real test scenario for the performance test of network equipment and applications; Multi-protocol support module, used to process and analyze traffic of multiple network protocols to meet the testing requirements of different network applications; Performance monitoring and optimization tools are used to monitor and optimize system performance indicators in real time.

9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to perform the traffic playback-based testing method described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The readable storage medium stores computer program instructions, and when the computer program instructions are read and executed by a processor, the test method based on traffic playback described in any one of claims 1 to 7 is executed.

Citation Information

Cited By

  • Automatic testing method based on traffic replication and playback strategy and code interception technology

    CN120123253A