Network performance testing method, device, electronic device and medium based on VPP

By using VPP-based network performance testing methods in a multi-threaded environment, the problem of low testing efficiency of traditional stream detection technology is solved, and more efficient network performance data acquisition and analysis is achieved.

CN119652795BActive Publication Date: 2025-04-18LIAONING COMM TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510147905.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-11
Publication Date
2025-04-18
Estimated Expiration
2045-02-11

AI Technical Summary

Technical Problem

Traditional flow-on-stream detection technology cannot fully utilize the concurrent processing potential of multi-core processors, resulting in low testing efficiency.

Method used

Using a network performance testing method based on VPP (Vector Packet Processing), the flow identification of the flow detection service corresponding to the data packets distributed by the network card is obtained in a multi-threaded environment, the structure pointer corresponding to the flow identification is obtained from the hash table, and the structure instance is obtained in the global linked list for storing and sending the flow detection data.

Benefits of technology

By conducting network performance testing under multi-threading, testing efficiency is improved and more efficient network performance data acquisition and analysis is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119652795B_ABST
    Figure CN119652795B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of flow detection, and in particular to a network performance test method, device, electronic device and medium based on VPP, the method comprising: obtaining a flow identifier of a flow detection service corresponding to a data packet distributed by a network card; obtaining a structure pointer corresponding to the flow identifier from a hash table; all flow detection thread ends share a hash table; obtaining a structure instance pointed to by a structure pointer in a global linked list; the structure instance includes a flow detection data pointer; performing flow detection on the DOH carried by the data packet, and storing the obtained flow detection data in a memory pointed to by the flow detection data pointer; sending the flow detection data in the memory pointed to by the flow detection data pointer to a management and control system for analysis to obtain a network performance test result. Through the method of the present application, network performance testing can be performed under multi-threading, thereby improving test efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of flow detection, and in particular to a network performance testing method, device, electronic device and medium based on VPP. Background Art

[0002] Flow detection is an in-band network performance testing technology that inserts test information into the header of real network service packets for periodic coloring, and reports the data to the management and control platform when the packets pass through the nodes. The management and control platform then analyzes the reported data and presents the test results. Flow detection can reflect network performance indicators such as network latency, packet loss, and jitter in real time and accurately perceive network performance failures.

[0003] However, traditional streaming detection is tested through a single thread, which cannot fully utilize the concurrent processing potential of modern multi-core processors and has low testing efficiency. Summary of the invention

[0004] In view of this, the purpose of the present application is to provide a network performance testing method, device, electronic device and medium based on VPP, which can perform network performance testing under multi-threading and improve testing efficiency.

[0005] In a first aspect, an embodiment of the present application provides a network performance testing method based on VPP, which is applied to any flow detection thread end, and the method includes:

[0006] Obtaining the flow identifier of the flow detection service corresponding to the data packet distributed by the network card;

[0007] Get the structure pointer corresponding to the flow identifier from the hash table; all flow detection threads share a hash table;

[0008] Get the structure instance pointed to by the structure pointer in the global linked list; the structure instance includes the flow detection data pointer;

[0009] Perform in-flow detection on the DOH carried by the data packet, and store the obtained in-flow detection data in the memory pointed to by the in-flow detection data pointer;

[0010] The flow detection data in the memory pointed to by the flow detection data pointer is sent to the management and control system for analysis to obtain the network performance test result.

[0011] In a possible implementation, before obtaining the structure pointer corresponding to the flow identifier from the hash table, the method further includes:

[0012] Determine whether a structure pointer corresponding to the stream identifier is stored in the hash table;

[0013] If the structure pointer corresponding to the stream identifier is not stored in the hash table, a structure instance corresponding to the stream identifier is created; and the value corresponding to the next node pointer in the structure instance is set to the structure pointer corresponding to the first node in the global linked list;

[0014] Allocate memory for the structure instance and obtain the structure pointer corresponding to the structure instance;

[0015] Store the stream ID as the key and the structure pointer as the value in the hash table.

[0016] In a possible implementation manner, the structure instance further includes a current flow detection period index corresponding to the flow detection service; and the method further includes:

[0017] When the flow identifier corresponds to the flow detection service, the value corresponding to the current flow detection period index is increased by one by using an atomic operation.

[0018] In a possible implementation, the method further includes:

[0019] At the beginning of a new flow detection cycle, determining whether the new flow detection cycle is to be initialized;

[0020] If the new flow detection period does not perform flow detection initialization, the first packet competition is performed;

[0021] If the first packet competition is successful, the new flow detection period is initialized for flow detection.

[0022] In a possible implementation, the structure instance further includes a data packet statistics array; the data packet statistics array stores a second-order pointer for pointing to a memory space storing the number of data packets detected by each flow detection thread end in each flow detection cycle;

[0023] After obtaining the structure instance pointed to by the structure pointer in the global linked list, the method further includes:

[0024] According to the data packet statistics array, the number of data packets detected by the local end in the flow detection period corresponding to the data packet is updated.

[0025] In a possible implementation, the method further includes:

[0026] Determine whether the value corresponding to the earliest flow detection period index of the number of packets not counted is less than or equal to the value corresponding to the current flow detection period index in the structure instance;

[0027] If the value corresponding to the earliest with-flow detection period index for which the number of packets has not been counted is less than or equal to the value corresponding to the current with-flow detection period index, the with-flow detection period corresponding to the earliest with-flow detection period index for which the number of packets has not been counted is determined as the target counting period;

[0028] If the target statistical period has ended, then according to the data packet statistical array, the number of data packets detected by all flow detection thread ends in the target statistical period is accumulated by using atomic operations and exchange operations to obtain the total number of data packets corresponding to the target statistical period;

[0029] The total number of data packets is stored in the memory pointed to by the flow detection data pointer;

[0030] The earliest with-flow detection period index for which the number of packets has not been statistically counted is increased by one, and the process jumps to determining whether the value corresponding to the earliest with-flow detection period index for which the number of packets has not been statistically counted is less than or equal to the value corresponding to the current with-flow detection period index in the structure instance.

[0031] In a second aspect, an embodiment of the present application further provides a network performance testing device based on VPP, the device comprising:

[0032] An acquisition module, used to acquire a flow identifier of a flow detection service corresponding to a data packet distributed by a network card;

[0033] The acquisition module is also used to obtain the structure pointer corresponding to the flow identifier from the hash table; all flow detection thread ends share a hash table;

[0034] The acquisition module is also used to acquire the structure instance pointed to by the structure pointer in the global linked list; the structure instance includes a flow detection data pointer;

[0035] A flow detection module is used to perform flow detection on the DOH carried by the data packet, and store the obtained flow detection data in the memory pointed to by the flow detection data pointer;

[0036] The sending module is used to send the flow detection data in the memory pointed to by the flow detection data pointer to the management and control system for analysis to obtain the network performance test result.

[0037] In a third aspect, an embodiment of the present application further provides a flow detection network device, the flow detection network device comprising: a network card and at least one flow detection thread end;

[0038] The network card is used to distribute data packets to the flow detection thread end;

[0039] The flow detection thread end is used to obtain the flow identifier of the flow detection service corresponding to the data packet distributed by the network card; obtain the structure pointer corresponding to the flow identifier from the hash table; all flow detection thread ends share a hash table; obtain the structure instance pointed to by the structure pointer in the global linked list; the structure instance includes the flow detection data pointer; perform flow detection on the DOH carried by the data packet, and store the obtained flow detection data in the memory pointed to by the flow detection data pointer; send the flow detection data in the memory pointed to by the flow detection data pointer to the management and control system for analysis to obtain the network performance test result.

[0040] In a fourth aspect, an embodiment of the present application further provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor. When the electronic device is running, the processor and the storage medium communicate through the bus, and the processor executes the machine-readable instructions to perform any step of the VPP-based network performance testing method as described in the first aspect.

[0041] In a fifth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the network performance testing method based on VPP in any one of the first aspects are executed.

[0042] The embodiment of the present application provides a network performance test method, device, electronic device and medium based on VPP, the method comprising: obtaining the flow identifier of the flow detection service corresponding to the data packet distributed by the network card; obtaining the structure pointer corresponding to the flow identifier from the hash table; all flow detection thread ends share a hash table; obtaining the structure instance pointed to by the structure pointer in the global linked list; the structure instance includes a flow detection data pointer; performing flow detection on the DOH carried by the data packet, and storing the obtained flow detection data in the memory pointed to by the flow detection data pointer; sending the flow detection data in the memory pointed to by the flow detection data pointer to the management and control system for analysis to obtain the network performance test results. Through the method of the present application, network performance testing can be performed under multi-threading to improve test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0044] Figure 1 A flowchart of a network performance testing method based on VPP provided in an embodiment of the present application is shown;

[0045] Figure 2 A flowchart of another VPP-based network performance testing method provided in an embodiment of the present application is shown;

[0046] Figure 3 A flowchart of another VPP-based network performance testing method provided in an embodiment of the present application is shown;

[0047] Figure 4 A schematic diagram of the structure of a network performance testing device based on VPP provided in an embodiment of the present application is shown;

[0048] Figure 5 A schematic structural diagram of a flow detection device provided in an embodiment of the present application is shown;

[0049] Figure 6 A schematic structural diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0050] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.

[0051] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0052] In order to enable those skilled in the art to use the contents of this application, the following implementation is provided in conjunction with a specific application scenario, the field of flow detection. For those skilled in the art, the general principles defined herein can be applied to other embodiments and application scenarios without departing from the spirit and scope of this application. Although this application is mainly described around the field of flow detection, it should be understood that this is only an exemplary embodiment.

[0053] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.

[0054] The following is a detailed description of a network performance testing method based on VPP provided in an embodiment of the present application.

[0055] Reference Figure 1 As shown, it is a flow chart of a network performance testing method based on VPP provided in an embodiment of the present application. The method is applied to any flow detection thread end in a flow detection network device. The exemplary steps of the embodiment of the present application are described below:

[0056] S101: Obtain a flow identifier of a flow detection service corresponding to a data packet distributed by a network card.

[0057] In the implementation mode of the present application, under the VPP open source framework, after receiving the data packet, the network card uses the RSS function to distribute each data packet to a flow detection thread end; after receiving the data packet distributed by the network card, the flow detection thread end obtains the flow ID of the flow detection service corresponding to the data packet. The flow ID is used to identify the flow detection service, and each flow detection service corresponds to a flow ID. Different flow detection services correspond to different flow IDs.

[0058] Here, VPP is the abbreviation of Vector Packet Processing, which is a scalable open source framework developed by Cisco that provides easy-to-use, high-quality switching and routing functions. VPP (Vector Packet Processing) supports the RSS (Receive Side Scaling) function, which is a distributed processing mechanism used to distribute network traffic among multiple CPU cores to improve the efficiency and scalability of network packet processing.

[0059] In addition, the flow detection network device where the flow detection thread end is located may be a head node, an intermediate node or a tail node that performs flow detection on the data packet; the method of obtaining the flow identifier of the flow detection service corresponding to the data packet is different depending on the node type (head node, intermediate node or tail node).

[0060] Specifically, if the flow detection network device where the flow detection thread end is located is a head node that performs flow detection on the data packet, the flow identifier of the flow detection service corresponding to the data packet is obtained through the following steps: matching the flow detection rule corresponding to the data packet from the flow detection rule issued by the management and control system; and determining the flow identifier of the flow detection service corresponding to the flow detection rule as the flow identifier of the flow detection service corresponding to the data packet.

[0061] In the implementation mode of the present application, different types of data packets correspond to different matching methods; if the data packet is a second / third layer virtual private network type data packet, then based on the outer IPv6 address locator of the data packet, the corresponding flow detection rule of the data packet is matched from the flow detection rule issued by the management and control system. If the data packet is a five-tuple matching type data packet, then based on the next layer protocol type (four-layer protocol such as TCP, UDP, ICMP, etc.) protocol of the data packet, source address (expressed in mask format) source, destination address (expressed in mask format) destination, source port sport, destination port dport, the corresponding flow detection rule of the data packet is matched from the flow detection rule issued by the management and control system. If the flow detection rule corresponding to the data packet cannot be matched, it means that the data packet does not need to be detected by the flow, and other business processing except the flow detection business can be directly performed on the data packet under the VPP framework, and the address of the processed data packet is routed. After routing, the processed data packet is handed over to the network card for forwarding.

[0062] In addition, if the flow detection network device where the flow detection thread end is located is a head node that performs flow detection on the data packet, before obtaining the structure pointer corresponding to the flow identifier from the hash table, the method also includes: performing DOH (Destination Options Header) extension header encapsulation and periodic coloring on the data packet based on the flow detection rule matched by the data packet.

[0063] Specifically, if the flow detection network device where the flow detection thread end is located is an intermediate node for performing flow detection on the data packet, and the flow detection mode corresponding to the flow detection thread end is the hop-by-hop detection mode, the flow identifier of the flow detection service corresponding to the data packet is obtained through the following steps: matching the destination address of the IPv6 header in the data packet with the local network function segment identifier sr_localsid; sr_localsid is also in the format of the IPv6 address; if the match is not successful, it means that the data packet does not need to be subjected to flow detection, and the data packet is subjected to a routing operation, and after the routing operation, the processed data packet is handed over to the network card for forwarding; if the match is successful, the DOH extension header of the data packet is parsed to obtain DOH data (the DOH data includes various data related to the flow detection service, such as the flow identifier of the flow detection service); and other service processing except the flow detection service is performed on the data packet after the encapsulation and rewriting operation under the VPP framework, and a routing operation is performed on the processed data packet, and after the routing operation, the processed data packet is handed over to the network card for forwarding.

[0064] Here, the data packet is encapsulated and rewritten when passing through the encapsulation and rewriting node in the flow detection function, so as to change the destination address of the IPv6 header in the data packet to the IPv6 address of the segment list corresponding to the index of segments left.

[0065] Among them, the encapsulation and rewriting nodes include sr-pl-rewrite-encaps, sr-pl-rewrite-encaps-v4, and sr-pl-rewrite-encaps-v12. The sr-pl-rewrite-encaps node is used to encapsulate standard IPv6 packets so that IPv6 packets can complete the specified segment routing path in the SRv6 network. The sr-pl-rewrite-encaps-v4 node provides support for IPv4 and performs SRv6 encapsulation on IPv4 packets. It is used in scenarios where IPv4 packets need to be transmitted through SRv6 tunnels in SRv6 networks. The sr-pl-rewrite-encaps-v12 node is suitable for scenarios where SRv6 tunnel encapsulation of Layer 2 frames is required. In SRv6 networks, it is sometimes necessary to transmit Ethernet frames instead of IP packets through SRv6 tunnels.

[0066] Specifically, if the flow detection network device where the flow detection thread end is located is the tail node that performs flow detection on the data packet, the flow identifier of the flow detection service corresponding to the data packet is obtained through the following steps: matching the destination address of the IPv6 header of the data packet with the local network function segment identifier sr_localsid; sr_localsid is also in the format of the IPv6 address; if the match is not successful, it means that the data packet does not need to be subjected to flow detection, and a routing operation is performed on the data packet. After the routing operation, the processed data packet is handed over to the network card for forwarding; if the match is successful, the DOH extension header of the data packet is parsed to obtain DOH data (the DOH data contains various data related to the flow detection service, such as the flow identifier of the flow detection service), and the SRH and DOH extension headers of the data packet are removed; in the VPP framework, other service processing except the flow detection service is performed on the data packet after the encapsulation and rewriting operation, and a routing operation is performed on the processed data packet. After the routing operation, the processed data packet is handed over to the network card for forwarding.

[0067] S102, obtaining a structure pointer corresponding to the flow identifier from a hash table; all flow detection thread ends share a hash table.

[0068] In the implementation mode of the present application, a structure pointer corresponding to the flow identifier is obtained from a hash table of 8-byte key-8-byte value. The hash table is used to store key-value pairs with the flow identifier as the key and the structure pointer as the value. The structure pointer is used to point to a structure instance in the global linked list storing the flow detection data pointer. The flow detection data pointer is used to point to the data obtained by the flow detection in the memory.

[0069] Specifically, the structure pointer corresponding to the stream identifier is obtained from the hash table through the following steps:

[0070] Step 1: Determine whether a structure pointer corresponding to the stream identifier is stored in the hash table.

[0071] In the implementation mode of the present application, the structure pointer corresponding to the flow identifier is searched in the hash table by calling the bihash function. If the bihash function returns a non-zero value, it means that the structure pointer corresponding to the flow identifier is not stored in the hash table. If the structure pointer corresponding to the flow identifier is stored in the hash table, the bihash function will return the structure pointer corresponding to the flow identifier.

[0072] Step 2: If the structure pointer corresponding to the stream identifier is not stored in the hash table, create a structure instance corresponding to the stream identifier; and set the value corresponding to the next node pointer in the structure instance to the structure pointer corresponding to the first node in the global linked list.

[0073] In the implementation mode of the present application, if the structure pointer corresponding to the flow identifier is not stored in the hash table, it means that this is a new flow identifier, and a new structure instance needs to be created for the new flow identifier. The next node pointer refers to the structure pointer of the next structure instance corresponding to the structure instance in the global linked list, which is used to form the linked list structure of the global linked list.

[0074] In addition, by setting the value corresponding to the next node pointer in the structure instance to the structure pointer corresponding to the first node in the global linked list, it can be ensured that the newly created structure instance will also be inserted into the head of the global linked list, so that the structure instance corresponding to the newly arrived stream identifier is always kept at the front end of the global linked list, which is conducive to real-time and efficient access.

[0075] Step 3: Allocate memory for the structure instance and obtain the structure pointer corresponding to the structure instance.

[0076] In the implementation manner of the present application, memory is allocated to a structure instance through a memory allocation function to obtain a structure pointer corresponding to the structure instance.

[0077] Step 4: Use the stream identifier as the key and the structure pointer as the value to store it in the hash table.

[0078] Here, although multiple flow detection thread ends may try to create a structure instance for the same new flow identifier at the same time, due to the atomicity of memory allocation and hash table operations, it can be guaranteed that only one flow detection thread end creates the hash table or inserts a new key-value pair into the hash table at the same time, and shares the result with other flow detection thread ends. When other flow detection thread ends find that the flow identifier already exists, they will directly obtain the new structure instance that has been successfully created and inserted, avoiding duplicate creation and waste of resources. In this way, a traffic management technology solution that can efficiently process new flow identifiers and maintain data consistency and thread safety can be achieved, thereby improving the performance and accuracy of traffic monitoring and analysis in large-scale concurrent network environments.

[0079] S103, obtaining a structure instance pointed to by a structure pointer in a global linked list; the structure instance includes a pointer to flow detection data.

[0080] In the implementation manner of the present application, the global linked list is used to store the structure instances pointed to by each structure pointer. The in-stream detection data pointer is used to point to the in-stream detection data.

[0081] Furthermore, the structure instance also includes a data packet statistics array; after step S103, the method further includes: updating the number of data packets detected by the local end in the flow detection period corresponding to the data packet according to the data packet statistics array.

[0082] In the implementation manner of the present application, a second-order pointer for pointing to a memory space storing the number of data packets detected by each flow detection thread end in each flow detection cycle is stored in the data packet statistics array. A memory space for searching the number of data packets of the local end in the flow detection cycle corresponding to the data packet is stored in the data packet statistics array; the number of data packets in the memory space is increased by one.

[0083] Here, each flow detection thread end has an independent data packet number statistics space to ensure that each flow detection thread end does not interfere with each other when performing data packet statistics tasks, ensuring data consistency and accuracy. In specific implementation, the system allocates a dedicated data packet counting array per_thread_tail_packet_count (a memory space that stores the number of data packets of each end in each flow detection cycle) to each flow detection thread end participating in the statistics, and ensures that different flow detection thread ends access their own counting areas through the index thread_idx - 1 of the flow detection thread end. During the data packet processing process, whether at the beginning of a new cycle or continuing the old cycle, each flow detection thread end can increment the number of packets in its exclusive statistics space without affecting the statistical results of other flow detection thread ends. When processing data with color tags, accurate distinction and statistics of data streams with different color tags are achieved. Through this unique design, the data contention and confusion problems that may occur when counting network traffic in an environment with multiple flow detection thread ends are effectively solved, ensuring that the number of network traffic packets can be reliably and accurately counted in high-concurrency scenarios, providing a solid foundation for subsequent network performance analysis and optimization.

[0084] S104: Perform in-flow detection on the DOH carried by the data packet, and store the obtained in-flow detection data in the memory pointed to by the in-flow detection data pointer.

[0085] In the implementation manner of the present application, in-stream detection is performed based on the aforementioned packaged DOH data or the parsed DOH data.

[0086] S105: Send the flow detection data in the memory pointed to by the flow detection data pointer to the management and control system for analysis to obtain a network performance test result.

[0087] In the implementation mode of the present application, the flow detection data in the memory pointed to by the flow detection data pointer is sent to the data reporting port; the memory pointed to by the flow detection data pointer contains the information required for flow detection, such as packet loss, one-way delay and jitter statistics. The data reporting port sends the unreported flow detection data of the flow detection period to the management and control system for analysis through the Telemetry protocol according to the reporting index in the structure instance to obtain the network performance test results. After receiving the flow detection data from each flow detection network device, the management and control system will analyze and count these data (including calculating indicators such as average packet loss rate, one-way delay and jitter range).

[0088] The reporting index is used to represent the latest flow detection cycle that has been reported to the control system.

[0089] Furthermore, the structure instance also includes a current flow detection period index corresponding to the flow detection service; the method also includes: when the flow identifier corresponds to the flow detection service, using an atomic operation to add one to the value corresponding to the current flow detection period index.

[0090] In the implementation manner of the present application, the current flow detection period index refers to the current flow detection period of the flow detection service corresponding to the flow identifier determined based on the flow detection rule corresponding to the flow identifier.

[0091] Here, periodic iteration through atomic operations can ensure thread safety in an environment with multiple flow detection threads, and ensure data consistency in a concurrent environment through atomic operations.

[0092] Furthermore, after sending the flow detection data in the memory pointed to by the flow detection data pointer to the management and control system for analysis, the method also includes: performing other business processing on the data packet except the flow detection business under the VPP framework, performing path finding operation on the processed data packet, and handing the processed data packet to the network card for forwarding after path finding.

[0093] The embodiment of the present application provides a network performance test method based on VPP, which includes: obtaining the flow identifier of the flow detection service corresponding to the data packet distributed by the network card; obtaining the structure pointer corresponding to the flow identifier from the hash table; all flow detection thread ends share a hash table; obtaining the structure instance pointed to by the structure pointer in the global linked list; the structure instance includes a flow detection data pointer; performing flow detection on the DOH carried by the data packet, and storing the obtained flow detection data in the memory pointed to by the flow detection data pointer; sending the flow detection data in the memory pointed to by the flow detection data pointer to the management and control system for analysis to obtain the network performance test results. Through the method of the present application, network performance testing can be performed under multi-threading, improving test efficiency.

[0094] Reference Figure 2 As shown, it is a flow chart of another VPP-based network performance testing method provided in an embodiment of the present application. The method is applied to any flow detection thread end. The exemplary steps of the embodiment of the present application are described below:

[0095] S201: When a new flow detection cycle starts, determine whether the new flow detection cycle is to be initialized.

[0096] In the implementation manner of the present application, after the cycle is changed, when a new flow detection cycle starts, it is determined whether the new flow detection cycle performs flow detection initialization.

[0097] S202: If the new flow detection period has not been initialized, first packet competition is performed.

[0098] In the implementation mode of the present application, during the first protection competition process, atomic comparison and exchange instructions are used to ensure that only one flow detection thread end can obtain the processing right of the first data packet in a multi-threaded environment, effectively preventing the occurrence of data competition and synchronization problems.

[0099] S203: If the first packet competition is successful, initialize the new flow detection period.

[0100] In the implementation manner of the present application, if the flow detection thread end wins the processing right of the first data packet, the flow detection initialization of the new flow detection period will be executed. The flow detection initialization refers to initializing the traffic statistical parameters of the new flow detection period (such as the flow detection timestamp, Flow ID, cycle sequence number, data color label and other key data) by calling the initialization function.

[0101] Furthermore, at the end of the flow detection cycle, if the flow detection network device where the flow detection thread end is located is a head node that performs flow detection on the data packet, then according to the data packet statistical array, the number of data packets detected by all flow detection thread ends in the flow detection cycle is accumulated by using atomic operations and exchange operations to obtain the total number of data packets corresponding to the flow detection cycle; and the total number of data packets corresponding to the flow detection cycle is stored in the memory pointed to by the flow detection data pointer.

[0102] The present application provides another VPP-based network performance testing method, which can initialize a new flow detection cycle.

[0103] Reference Figure 3 As shown, it is a flow chart of another VPP-based network performance testing method provided in an embodiment of the present application. The method is applied to any flow detection thread end. The exemplary steps of the embodiment of the present application are described below:

[0104] S301: Determine whether the value corresponding to the earliest index of the with-flow detection period for which the number of packets has not been counted is less than or equal to the value corresponding to the current with-flow detection period index in the structure instance.

[0105] In the implementation manner of the present application, since the intermediate node and the tail node receive the data packet colored by the head node, only when the flow detection network device where the flow detection thread end is located is the intermediate node and the tail node that performs flow detection on the data packet, there may be a situation where the number of data packets is not counted in multiple flow detection cycles. Therefore, if the flow detection network device where the flow detection thread end is located is the intermediate node that performs flow detection on the data packet, and the flow detection mode corresponding to the flow detection thread end is the hop-by-hop detection mode, then it is determined whether the value corresponding to the earliest flow detection cycle index that did not count the number of data packets is less than or equal to the value corresponding to the current flow detection cycle index in the structure instance. If the flow detection network device where the flow detection thread end is located is the tail node that performs flow detection on the data packet, then it is determined whether the value corresponding to the earliest flow detection cycle index that did not count the number of data packets is less than or equal to the value corresponding to the current flow detection cycle index in the structure instance.

[0106] The earliest flow detection period index for which the number of packets has not been statistically counted refers to the flow detection period index for which the number of packets at all flow detection thread ends has not been statistically counted.

[0107] S302: If the value corresponding to the earliest with-flow detection period index for which the number of packets has not been counted is less than or equal to the value corresponding to the current with-flow detection period index, determine the with-flow detection period corresponding to the earliest with-flow detection period index for which the number of packets has not been counted as the target counting period.

[0108] In the implementation manner of the present application, if the value corresponding to the earliest flow detection period index for which the number of packets has not been counted is less than or equal to the value corresponding to the current flow detection period index, it indicates that there may be a flow detection period that has ended but for which the number of packets has not been counted.

[0109] S303: If the target statistical period has ended, then according to the data packet statistical array, the number of data packets detected by all flow detection thread ends in the target statistical period is accumulated by using atomic operations and exchange operations to obtain the total number of data packets corresponding to the target statistical period.

[0110] In the implementation mode of the present application, if the difference between the duration corresponding to the target statistical period and the preset period duration corresponding to the target statistical period is greater than the preset extension period; if it is greater, the target statistical period has ended. The preset period duration is determined based on the corresponding flow detection rule. According to the data packet statistics array in the structure instance, the number of data packets detected by all flow detection thread ends in the target statistical period is accumulated by atomic operations and exchange operations to obtain the total number of data packets corresponding to the target statistical period.

[0111] S304: Store the total number of data packets into the memory pointed to by the flow detection data pointer.

[0112] S305: Add 1 to the earliest index of the with-flow detection period for which the number of packets has not been counted, and jump to determine whether the value corresponding to the earliest index of the with-flow detection period for which the number of packets has not been counted is less than or equal to the value corresponding to the current index of the with-flow detection period in the structure instance.

[0113] The present application provides another network performance testing method based on VPP, which can perform data packet statistics for each flow detection period.

[0114] Based on the same inventive concept, the embodiments of the present application also provide a VPP-based network performance testing device corresponding to the VPP-based network performance testing method. Since the principle of solving the problem by the device in the embodiments of the present application is similar to the above-mentioned VPP-based network performance testing method in the embodiments of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0115] Reference Figure 4 FIG. 1 is a schematic diagram of a network performance testing device based on VPP provided in an embodiment of the present application, which is applied to any flow detection thread end, and the device includes:

[0116] The acquisition module 401 is used to acquire the flow identifier of the flow detection service corresponding to the data packet distributed by the network card;

[0117] The acquisition module 401 is further used to obtain a structure pointer corresponding to the flow identifier from a hash table; all flow detection thread ends share a hash table;

[0118] The acquisition module 401 is also used to acquire the structure instance pointed to by the structure pointer in the global linked list; the structure instance includes the flow detection data pointer;

[0119] A flow detection module 402, configured to perform flow detection on the DOH carried by the data packet, and store the obtained flow detection data in the memory pointed to by the flow detection data pointer;

[0120] The sending module 403 is used to send the flow detection data in the memory pointed to by the flow detection data pointer to the management and control system for analysis to obtain the network performance test result.

[0121] In a possible implementation, the device further includes: a determination module 404, a creation module 405, an allocation module 406, and a storage module 407;

[0122] The judging module 404 is used to judge whether the structure pointer corresponding to the flow identifier is stored in the hash table before obtaining the structure pointer corresponding to the flow identifier from the hash table;

[0123] A creation module 405 is used to create a structure instance corresponding to the flow identifier if the structure pointer corresponding to the flow identifier is not stored in the hash table; and set the value corresponding to the next node pointer in the structure instance to the structure pointer corresponding to the first node in the global linked list;

[0124] Allocation module 406, used to allocate memory for the structure instance and obtain a structure pointer corresponding to the structure instance;

[0125] The storage module 407 is used to store the flow identifier as a key and the structure pointer as a value into the hash table.

[0126] In a possible implementation manner, the structure instance also includes a current flow detection period index corresponding to the flow detection service; the device also includes: a period changing module 408;

[0127] The period changing module 408 is configured to add one to the value corresponding to the current flow detection period index by using an atomic operation when the flow identifier corresponds to the flow detection service that performs period changing.

[0128] In a possible implementation, the periodic iteration module 408 is further configured to:

[0129] At the beginning of a new flow detection cycle, determining whether the new flow detection cycle is to be initialized;

[0130] If the new flow detection period does not perform flow detection initialization, the first packet competition is performed;

[0131] If the first packet competition is successful, the new flow detection period is initialized for flow detection.

[0132] In a possible implementation, the structure instance further includes a data packet statistics array; the data packet statistics array stores a second-order pointer for pointing to a memory space storing the number of data packets detected by each flow detection thread end in each flow detection cycle;

[0133] After obtaining the structure instance pointed to by the structure pointer in the global linked list, the device further includes: an updating module 409;

[0134] The updating module 409 is used to update the number of data packets detected by the local end in the flow detection period corresponding to the data packets according to the data packet statistics array.

[0135] In a possible implementation manner, the device further includes: a data packet quantity statistics module 410; the data packet quantity statistics module 410 is configured to:

[0136] Determine whether the value corresponding to the earliest flow detection period index of the number of packets not counted is less than or equal to the value corresponding to the current flow detection period index in the structure instance;

[0137] If the value corresponding to the earliest with-flow detection period index for which the number of packets has not been counted is less than or equal to the value corresponding to the current with-flow detection period index, the with-flow detection period corresponding to the earliest with-flow detection period index for which the number of packets has not been counted is determined as the target counting period;

[0138] If the target statistical period has ended, then according to the data packet statistical array, the number of data packets detected by all flow detection thread ends in the target statistical period is accumulated by using atomic operations and exchange operations to obtain the total number of data packets corresponding to the target statistical period;

[0139] The total number of data packets is stored in the memory pointed to by the flow detection data pointer;

[0140] The earliest with-flow detection period index for which the number of packets has not been statistically counted is increased by one, and the process jumps to determining whether the value corresponding to the earliest with-flow detection period index for which the number of packets has not been statistically counted is less than or equal to the value corresponding to the current with-flow detection period index in the structure instance.

[0141] The embodiment of the present application provides a network performance test device based on VPP, which includes: an acquisition module 401, which is used to obtain the flow identifier of the flow detection service corresponding to the data packet distributed by the network card; the acquisition module 401 is also used to obtain the structure pointer corresponding to the flow identifier from the hash table; all flow detection thread ends share a hash table; the acquisition module 401 is also used to obtain the structure instance pointed to by the structure pointer in the global linked list; the structure instance includes a flow detection data pointer; the flow detection module 402 is used to perform flow detection on the DOH carried by the data packet, and store the obtained flow detection data in the memory pointed to by the flow detection data pointer; the sending module 403 is used to send the flow detection data in the memory pointed to by the flow detection data pointer to the management and control system for analysis to obtain the network performance test results. Through the method of the present application, network performance testing can be performed under multi-threading to improve test efficiency.

[0142] Reference Figure 5 , which is a schematic diagram of the structure of a flow detection network device provided by an embodiment of the present application, the flow detection network device includes: a network card 501 and at least one flow detection thread terminal 502; the network card 501 and each flow detection thread terminal 502 are in communication connection;

[0143] The network card 501 is used to distribute the data packets to the flow detection thread terminal 502;

[0144] The flow detection thread end 502 is used to obtain the flow identifier of the flow detection service corresponding to the data packet distributed by the network card; obtain the structure pointer corresponding to the flow identifier from the hash table; all flow detection thread ends share a hash table; obtain the structure instance pointed to by the structure pointer in the global linked list; the structure instance includes a flow detection data pointer; perform flow detection on the DOH carried by the data packet, and store the obtained flow detection data in the memory pointed to by the flow detection data pointer; send the flow detection data in the memory pointed to by the flow detection data pointer to the management and control system for analysis to obtain the network performance test result.

[0145] Here, the flow detection network device can be any flow detection network device, such as a router, a switch, an SRv6 network device, etc. In addition to the flow detection thread end 502 used for flow detection, the flow detection network device can also include a configuration thread end used for configuration, specifically for issuing cli command processing, timer tasks, etc.

[0146] The number of thread ends is related to the business performance requirements. For example, if the DOT single-core forwarding performance is 5G and the whole machine throughput is required to reach 20G, at least 5 cores should be guaranteed to be used for service, of which 1 core is used as the configuration thread end. The other 4 cores are used as the flow detection thread end 502.

[0147] In a possible implementation, before obtaining the structure pointer corresponding to the flow identifier from the hash table, the flow detection thread terminal 502 is further used to:

[0148] Determine whether a structure pointer corresponding to the stream identifier is stored in the hash table;

[0149] If the structure pointer corresponding to the stream identifier is not stored in the hash table, a structure instance corresponding to the stream identifier is created; and the value corresponding to the next node pointer in the structure instance is set to the structure pointer corresponding to the first node in the global linked list;

[0150] Allocate memory for the structure instance and obtain the structure pointer corresponding to the structure instance;

[0151] Store the stream ID as the key and the structure pointer as the value in the hash table.

[0152] In a possible implementation manner, the structure instance also includes a current flow detection period index corresponding to the flow detection service; the flow detection thread end 502 is also used for:

[0153] When the flow identifier corresponds to the flow detection service, the value corresponding to the current flow detection period index is increased by one by using an atomic operation.

[0154] In a possible implementation manner, the flow detection thread terminal 502 is further used for:

[0155] At the beginning of a new flow detection cycle, determining whether the new flow detection cycle is to be initialized;

[0156] If the new flow detection period does not perform flow detection initialization, the first packet competition is performed;

[0157] If the first packet competition is successful, the new flow detection period is initialized for flow detection.

[0158] In a possible implementation, the structure instance further includes a data packet statistics array; the data packet statistics array stores a second-order pointer for pointing to a memory space storing the number of data packets detected by each flow detection thread end in each flow detection cycle;

[0159] After obtaining the structure instance pointed to by the structure pointer in the global linked list, the flow detection thread terminal 502 is also used to:

[0160] According to the data packet statistics array, the number of data packets detected by the local end in the flow detection period corresponding to the data packet is updated.

[0161] In a possible implementation manner, the flow detection thread terminal 502 is further used for:

[0162] Determine whether the value corresponding to the earliest flow detection period index of the number of packets not counted is less than or equal to the value corresponding to the current flow detection period index in the structure instance;

[0163] If the value corresponding to the earliest with-flow detection period index for which the number of packets has not been counted is less than or equal to the value corresponding to the current with-flow detection period index, the with-flow detection period corresponding to the earliest with-flow detection period index for which the number of packets has not been counted is determined as the target counting period;

[0164] If the target statistical period has ended, then according to the data packet statistical array, the number of data packets detected by all flow detection thread ends in the target statistical period is accumulated by using atomic operations and exchange operations to obtain the total number of data packets corresponding to the target statistical period;

[0165] The total number of data packets is stored in the memory pointed to by the flow detection data pointer;

[0166] The earliest with-flow detection period index for which the number of packets has not been statistically counted is increased by one, and the process jumps to determining whether the value corresponding to the earliest with-flow detection period index for which the number of packets has not been statistically counted is less than or equal to the value corresponding to the current with-flow detection period index in the structure instance.

[0167] like Figure 6 As shown, an electronic device 600 provided in an embodiment of the present application includes: a processor 601, a memory 602 and a bus, the memory 602 stores machine-readable instructions executable by the processor 601, and when the electronic device is running, the processor 601 communicates with the memory 602 through the bus, and the processor 601 executes the machine-readable instructions to perform the steps of the above-mentioned VPP-based network performance testing method.

[0168] Specifically, the above-mentioned memory 602 and processor 601 can be general-purpose memory and processor, which are not specifically limited here. When the processor 601 runs the computer program stored in the memory 602, the above-mentioned VPP-based network performance testing method can be executed.

[0169] Corresponding to the above-mentioned VPP-based network performance testing method, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned VPP-based network performance testing method are executed.

[0170] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the method embodiment, and will not be repeated in this application. In the several embodiments provided in this application, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.

[0171] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0172] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0173] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the information processing method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.

[0174] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A network performance testing method based on VPP, characterized in that: The method is applied to any flow detection thread end, and the method includes: Obtaining the flow identifier of the flow detection service corresponding to the data packet distributed by the network card; Obtaining a structure pointer corresponding to the flow identifier from a hash table; all flow detection thread ends share one hash table; Obtaining a structure instance pointed to by the structure pointer in the global linked list; the structure instance includes a flow detection data pointer; Performing in-flight detection on the DOH carried by the data packet, and storing the obtained in-flight detection data in the memory pointed to by the in-flight detection data pointer; The flow detection data in the memory pointed to by the flow detection data pointer is sent to the management and control system for analysis to obtain the network performance test result.

2. The VPP-based network performance testing method according to claim 1, characterized in that: Before obtaining the structure pointer corresponding to the flow identifier from the hash table, the method further includes: Determine whether a structure pointer corresponding to the flow identifier is stored in the hash table; If the structure pointer corresponding to the flow identifier is not stored in the hash table, a structure instance corresponding to the flow identifier is created; and the value corresponding to the next node pointer in the structure instance is set to the structure pointer corresponding to the first node in the global linked list; Allocate memory for the structure instance and obtain a structure pointer corresponding to the structure instance; The stream identifier is used as a key and the structure pointer is used as a value and stored in the hash table.

3. The VPP-based network performance testing method according to claim 1 or 2, characterized in that: The structure instance also includes a current flow detection cycle index corresponding to the flow detection service; The method further comprises: When the flow identifier corresponds to the accompanying flow detection service and performs periodic iteration, an atomic operation is adopted to add one to the value corresponding to the current accompanying flow detection period index.

4. The VPP-based network performance testing method according to claim 1 or 2, characterized in that: The method further comprises: At the beginning of a new flow detection cycle, determining whether the new flow detection cycle is initialized for flow detection; If the new flow detection period does not perform flow detection initialization, first packet competition is performed; If the first packet competition is successful, the new flow detection period is initialized for flow detection.

5. The VPP-based network performance testing method according to claim 1 or 2, characterized in that: The structure instance also includes a data packet statistics array; the data packet statistics array stores a second-order pointer for pointing to a memory space storing the number of data packets detected by each flow detection thread end in each flow detection cycle; After obtaining the structure instance pointed to by the structure pointer in the global linked list, the method further includes: According to the data packet statistics array, the number of data packets detected by the local end during the flow detection period corresponding to the data packet is updated.

6. The VPP-based network performance testing method according to claim 5, characterized in that: The method further comprises: Determine whether the value corresponding to the earliest flow detection period index of the number of packets not counted is less than or equal to the value corresponding to the current flow detection period index in the structure instance; If the value corresponding to the earliest with-flow detection period index for which the number of packets has not been counted is less than or equal to the value corresponding to the current with-flow detection period index, the with-flow detection period corresponding to the earliest with-flow detection period index for which the number of packets has not been counted is determined as the target counting period; If the target statistical period has ended, then according to the data packet statistical array, the number of data packets detected by all the flow detection thread ends in the target statistical period is accumulated by using atomic operations and exchange operations to obtain the total number of data packets corresponding to the target statistical period; The total number of data packets is stored in the memory pointed to by the flow detection data pointer; The earliest with-flow detection period index for the number of packets not statistically counted is increased by one, and the step of determining whether the value corresponding to the earliest with-flow detection period index for the number of packets not statistically counted is less than or equal to the value corresponding to the current with-flow detection period index in the structure instance.

7. A network performance testing device based on VPP, characterized in that: The device comprises: An acquisition module, used to acquire a flow identifier of a flow detection service corresponding to a data packet distributed by a network card; The acquisition module is further used to acquire a structure pointer corresponding to the flow identifier from a hash table; all flow detection thread ends share one hash table; The acquisition module is further used to acquire the structure instance pointed to by the structure pointer in the global linked list; the structure instance includes a flow detection data pointer; A flow detection module, used for performing flow detection on the DOH carried by the data packet, and storing the obtained flow detection data in the memory pointed to by the flow detection data pointer; The sending module is used to send the flow detection data in the memory pointed to by the flow detection data pointer to the management and control system for analysis to obtain the network performance test result.

8. A network device for detecting a flow, characterized in that: The flow detection network device comprises: a network card and at least one flow detection thread end; The network card is used to distribute the data packets to the flow detection thread end; The flow detection thread end is used to obtain the flow identifier of the flow detection service corresponding to the data packet distributed by the network card; obtain the structure pointer corresponding to the flow identifier from the hash table; all flow detection thread ends share one hash table; obtain the structure instance pointed to by the structure pointer in the global linked list; the structure instance includes a flow detection data pointer; perform flow detection on the DOH carried by the data packet, and store the obtained flow detection data in the memory pointed to by the flow detection data pointer; send the flow detection data in the memory pointed to by the flow detection data pointer to the management and control system for analysis to obtain a network performance test result.

9. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of the VPP-based network performance testing method as described in any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the VPP-based network performance testing method according to any one of claims 1 to 6 are executed.

Citation Information

Patent Citations

  • Message transmission method and related equipment

    CN116980150A

  • Inter-core communication bandwidth measurement method, system and equipment for multi-core processor

    CN117640471A