Data transmission method and device, electronic equipment, medium and product
By generating virtual source IP addresses and encapsulating them with UDP, the problem of unbalanced receive queues caused by UDP forwarding in Layer 4 load balancers is solved, achieving efficient load balancing.
Patent Information
- Application Number
- CN202511223101.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-28
- Publication Date
- 2025-11-28
AI Technical Summary
When a Layer 4 load balancer forwards UDP packets, the RSS of the UDP packets only supports hash calculations based on 'two tuples', which leads to an imbalance in the receiving queues of the backend service nodes.
By extracting the 5-tuple information from the data packet, a virtual source IP address is generated, and the data packet is encapsulated according to the User Datagram Protocol to form a UDP data packet with tuple information, which is then sent to the next destination node.
It achieves balanced distribution of requests from different clients and requests from the same client on different ports across multiple kernel protocol stacks, avoiding the imbalance problem of a single receive queue and realizing efficient load balancing.
Smart Images

Figure CN121037372A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of network communication, and in particular to a data transmission method and device, electronic equipment, medium and product. BACKGROUND
[0002] A four-layer load balancer is a key device of a network transmission layer (TCP / UDP layer), and is mainly used for distributing client requests among multiple backend service nodes, and through analysis of information such as source / desination IP, port and protocol type of a data packet, balanced scheduling of traffic is achieved, and the overall processing capability and availability of a service cluster are improved. In actual application, the data packet forwarding mode of the four-layer load balancer is mainly divided into two categories: TCP forwarding and UDP forwarding.
[0003] When the four-layer load balancer adopts UDP forwarding, the UDP protocol does not need to establish a connection, and resource consumption for handshake and state maintenance can be reduced, and the forwarding efficiency is higher, but in some network cards and network environments, RSS of the UDP data packet only supports hash calculation based on a 'two-tuple' (source IP and destination IP), and this will cause unbalanced reception queues of the backend service nodes. SUMMARY
[0004] The purpose of the embodiments of the present application is to provide a data transmission method and device, electronic equipment, medium and product, and to optimize resource utilization efficiency and solve the problem of unbalanced reception queue load caused by forwarding of UDP traffic by a network transmission node such as a four-layer load balancer.
[0005] In one aspect of the embodiments of the present application, a data transmission method is provided, and is applied to a network transmission node, and includes: receiving a first data packet and extracting five-tuple information of the first data packet, determining an IP address of a next destination node according to the five-tuple information; generating a virtual source IP address according to a source IP address and a source port number in the five-tuple information; encapsulating the first data packet into a second data packet according to a user datagram protocol, wherein a header field of the second data packet includes the IP address of the next destination node and the virtual source IP address, and a data field of the second data packet includes the first data packet; and sending the second data packet to the next destination node.
[0006] In an aspect of the embodiments of the present application, a data transmission apparatus is also provided, which comprises: an extraction module, configured to receive a first data packet and extract five-tuple information of the first data packet, and determine an IP address of a next destination node according to the five-tuple information; a processing module, configured to generate a virtual source IP address according to a source IP address and a source port number in the five-tuple information; an encapsulation module, configured to encapsulate the first data packet into a second data packet according to a user datagram protocol, wherein a header field of the second data packet comprises the IP address of the next destination node and the virtual source IP address, and a data field of the second data packet comprises the first data packet; and a sending module, configured to send the second data packet to the next destination node.
[0007] In an aspect of the embodiments of the present application, an electronic device is also provided, which comprises: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the data transmission method described above.
[0008] In an aspect of the embodiments of the present application, a computer readable storage medium is also provided, which stores a computer program, and the computer program is executed by a processor to implement the data transmission method described above.
[0009] In an aspect of the embodiments of the present application, a computer program product is also provided, which comprises a computer program, and the computer program is executed by a processor to implement the data transmission method described above.
[0010] The technical solutions provided by the embodiments of the present application have at least the following beneficial effects:
[0011] In the technical solutions provided by the embodiments of the present application, the network transmission node determines the IP address of the next destination node by extracting the five-tuple information of the first data packet, and generates the virtual source IP address according to the source IP address and the source port in the five-tuple information; then, the first data packet is encapsulated according to the user datagram protocol based on the IP address of the next destination node and the virtual source IP address, and the second data packet obtained by the encapsulation is sent to the next destination node. The second data packet constructed in this way is a UDP data packet, which not only retains the characteristics of UDP handshake-free and low delay to reduce resource consumption, but also expands the two-tuple information of the original UDP through the combination of the virtual source IP address and the IP address of the next destination node. Since the virtual source IP is generated according to the source IP address and the source port, the combination form of the expanded two-tuple information is rich, which can make the requests of different clients and the requests of different ports of the same client be dispersed to multiple kernel protocol stacks, effectively avoiding the imbalance problem of single receiving queue, and finally realizing efficient load balancing. BRIEF DESCRIPTION OF DRAWINGS
[0012] One or more embodiments are illustrated by way of example in the drawings in which like reference numerals indicate similar elements, and as such, continue to refer to a like reference numeral, one or more embodiments are not limited to the examples provided and can be used with other like systems and methods of operation. The drawings are not necessarily to scale, emphasis instead being placed upon illustrating the principles of the embodiments.
[0013] Figure 1 is an example flowchart of a data transmission method according to some embodiments of the present application;
[0014] Figure 2 is an example flowchart of a virtual source IP generation method involved in another data transmission method according to some embodiments of the present application;
[0015] Figure 3 is an example flowchart of another data transmission method according to some embodiments of the present application;
[0016] Figure 4 is an example block diagram of a data transmission apparatus according to some embodiments of the present application;
[0017] Figure 5 is an example block diagram of an electronic device according to some embodiments of the present application. DETAILED DESCRIPTION
[0018] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the embodiments of the present application will be described in detail below with reference to the drawings. However, those skilled in the art can understand that, in the embodiments of the present application, many technical details are proposed in order to make the readers better understand the present application. However, the technical solutions claimed by the present application can be implemented even if there are no technical details and various changes and modifications based on the following embodiments. The division of the following embodiments is for the convenience of description, and should not constitute any limitation on the specific implementation of the present application, and the embodiments can be combined and referred to each other without contradiction.
[0019] It should be understood that the "system", "apparatus", "unit" and / or "module" used in the specification is a method for distinguishing different components, elements, parts, portions or assemblies at different levels. However, if other words can achieve the same purpose, the words can be replaced by other expressions.
[0020] Unless otherwise specified, the technical terms used to describe components, elements, etc. in this specification are not singular but may include plural. Generally speaking, terms such as "comprising" or "including" only indicate that explicitly identified steps, elements, or components are included, and these steps, elements, and components do not constitute an exclusive list, as the described method or apparatus may also include other steps or components.
[0021] This specification uses flowcharts to illustrate the operational steps performed by the apparatus or system of related embodiments. However, unless otherwise specified, the order in which these steps are described should not be construed as a limitation on the order of execution. Those skilled in the art can adjust the order of these steps based on the knowledge and information conveyed by the embodiments in this specification. Adjustments include, but are not limited to, reversing the order of steps, merging multiple steps, and splitting a step.
[0022] A Layer 4 load balancer is a load balancing device or software that operates at Layer 4 (Transport Layer) in the OSI model of computer networks. It mainly determines how to distribute traffic to multiple backend servers based on the characteristics of the transport layer protocol (TCP or UDP).
[0023] Consistent hashing is an algorithm used for data sharding and load balancing in distributed systems. It solves the problem of traditional hashing algorithms requiring remapping of most data when the number of nodes (servers, cache nodes, etc.) changes, significantly improving the scalability and stability of the system.
[0024] XDP (eXpress Data Path) is a high-performance, programmable network packet processing framework provided by the Linux kernel. It is widely used in low-latency scenarios such as DDoS protection, load balancing, and packet filtering. XDP enables packet processing at the network card driver layer with extremely low latency, without going through the complete kernel network protocol stack.
[0025] TCP (Transmission Control Protocol) is one of the core protocols of the Internet. It is a connection-oriented, reliable, in-order, byte-stream-based transport layer protocol. It establishes a connection through a three-way handshake, provides packet loss retransmission, flow control, and congestion control, and ensures that data is delivered to the other end intact and error-free, making it suitable for scenarios with high data integrity requirements.
[0026] UDP (User Datagram Protocol) is a connectionless, unreliable, message-oriented transport layer protocol. It encapsulates application layer data directly into datagrams for transmission, without guaranteeing order or retransmitting lost packets. Therefore, it has low overhead and low latency, and is often used in scenarios that are speed-sensitive and can tolerate packet loss, such as real-time audio and video, DNS, and games.
[0027] RSS (Receive Side Scaling) is a network receiver multi-queue load balancing technology used to distribute data packets received by the network card to multiple CPU cores to achieve parallel processing, eliminate single-core bottlenecks, improve system throughput and reduce latency.
[0028] As the background technology shows, UDP, as the forwarding medium between the Layer 4 load balancer and the backend, can guarantee "fast and low-latency" forwarding efficiency at the protocol level (connectionless, no acknowledgment, simple header). However, if UDP is used as the forwarding medium for all traffic, the Layer 4 load balancer will cause uneven load distribution in the receive queue.
[0029] To address the aforementioned issues, some embodiments of this application provide a data transmission method applied to a network transmission node, which has a device IP address. In this method, the network transmission node determines the next destination node IP address based on 5-tuple information, and generates a virtual source IP address based on the source IP address and source port number in the 5-tuple information. Furthermore, based on the service node IP address and the virtual source IP address, the first data packet is encapsulated using UDP to obtain a second data packet.
[0030] The second data packet generated through the above process is still a UDP packet, but the source IP address in its header field has been replaced with a virtual source IP address generated by the network transmission node. This virtual source IP address contains at least the source IP address and source port number of the first data packet, and also integrates the IP address of the next destination node, forming a tuple of information. Because the combination dimensions of the tuple information are rich enough, requests from different clients, and requests from different ports of the same client, can be distributed across multiple kernel protocol stacks, effectively avoiding load imbalance in a single receive queue, thereby achieving efficient load balancing.
[0031] Figure 1 This is an exemplary flowchart illustrating a data transmission method according to some embodiments of this application, which can be executed by a network transmission node. In some embodiments, Figure 1 The process shown may include the following steps.
[0032] Step 110: The network transmission node receives the first data packet and extracts the 5-tuple information of the first data packet, and determines the IP address of the next destination node based on the 5-tuple information.
[0033] In step 110, the network transmission node is a load balancing device operating at Layer 4 (Transport Layer) in the OSI model of computer networks, also known as a Layer 4 Load Balancer. It primarily determines how to distribute traffic to the next destination node (i.e., the backend service node) based on the characteristics of the transport layer protocol (TCP or UDP). The next destination node, or backend service node, refers to the server or service instance that actually processes the client's original request. It is the final target node for the Layer 4 load balancer to distribute traffic, and its core role is to receive and process requests forwarded by the Layer 4 load balancer.
[0034] In some embodiments, the first data packet is a Transmission Control Protocol (TCP) packet or a User Datagram Protocol (UDP) packet.
[0035] In some embodiments, the network transmission node determines the IP address of the next destination node based on the 5-tuple information using a consistent hashing algorithm. For example, the network transmission node dynamically selects the next destination node based on the 5-tuple of the first data packet (including source IP address, destination IP address, source port, destination port, and transport layer protocol type). The specific process is as follows: First, the identification information (such as IP address) of each next destination node is mapped to a corresponding hash value using a preset hash function (such as CRC32 or MurmurHash); a hash ring is constructed, and these hash values are mapped to the corresponding positions on the ring; the IP 5-tuple information of the data packet (e.g., source IP address 1.1.1.1, destination IP address 2.2.2.2, source port 3000, destination port 80, protocol type TCP) is extracted, combined to generate a unique key value, and then hashed to obtain the hash value corresponding to the data packet; this hash value is mapped to the hash ring, and the nearest next destination node hash value mapping position is found from the mapping point along a preset direction (such as clockwise), the corresponding node is determined as the target node, and its IP address is obtained. This mechanism ensures that data packets from the same session are continuously routed to the same next destination node, thereby effectively maintaining the session state.
[0036] Step 120: The network transmission node generates a virtual source IP address based on the source IP address and source port number in the 5-tuple information.
[0037] In one example, the network transmission node uses bitwise operations to generate a corresponding virtual source IP address based on the source IP address (i.e., the client IP address) and the source port number (i.e., the client's port number). It also supports flexible control over the ratio and the number of bits reserved in the prefix (for example, when the client IP address is 111.112.113.114, the first 3 bits "111" or the first 6 bits "111.112" can be reserved, and the remaining part is generated by calculation).
[0038] The specific process is as follows: First, key information for generating the virtual IP address is obtained, namely the client IP address and the source port number initiating the client connection. The combination of these two uniquely identifies the specific client connection (different ports of the same client or connections from different clients can be distinguished using this information). Then, bitwise operations are performed on the above information to generate the virtual source IP. The operation rules can be flexibly adjusted according to service requirements: for example, some services may retain the first few bits of the client IP (ensuring the virtual IP and client IP are on the same subnet), while the remaining bits are generated based on the client IP and client port. The client IP address is used to distinguish data packets sent by different clients, and the client port is used to distinguish data packets sent by different ports of the same client. Generating the virtual source IP address based on the client IP address and client port ensures that data packets from different ports have different virtual IP addresses, allowing them to be subsequently assigned to different kernel protocol stacks, effectively avoiding the imbalance problem of a single receive queue. The reserved prefix of the client IP is included in the virtual source IP address to ensure the legitimacy of data packet forwarding (avoiding interception by the switch).
[0039] Step 130: The network transmission node encapsulates the first data packet into a second data packet according to the User Datagram Protocol.
[0040] The header field of the second data packet includes the next destination node IP address and the virtual source IP address, and the data field of the second data packet includes the first data packet.
[0041] In one example, the process by which a network transmission node constructs the second data packet is as follows:
[0042] First, construct the outer header fields, where the "Source IP" field is filled with the virtual source IP generated in step 120, and the "Destination IP" field is set to the determined next destination node IP.
[0043] Next, the header fields are constructed, where the "source port" can be a dynamically allocated available port or a fixed port depending on the scenario; the "destination port" is set to the fixed encapsulation port preset for the next destination. This port serves as the listening port for the next destination, which can quickly filter encapsulated data packets to simplify the receiving process and improve processing efficiency. It is also a key identifier of the destination in the forwarding link, ensuring that the outer encapsulated data packets are correctly routed to the next destination.
[0044] The payload portion is then processed: the original first data packet (including its header fields, transport layer header, business data, and other complete content) is used as the payload field (i.e., data field) of the second data packet, without modifying the original data throughout the process.
[0045] Finally, the outer header field, the header field, and the payload field are combined to form a complete second data packet.
[0046] This process retains the "no handshake, low latency" characteristics of UDP (the outer layer uses the UDP protocol), while expanding the composition of the tuple information through virtual source IP. This solves the problem of unbalanced receive queues caused by traditional UDP relying solely on tuples, and at the same time ensures that the original business data is intact and lossless, achieving efficient and balanced forwarding.
[0047] Step 140: The network transmission node sends the second data packet to the next destination node.
[0048] In one example, the network transmission node forwards the encapsulated second data packet directly to the next destination node through the XDP program deployed in the network card driver layer. After receiving the packet, the node first identifies and decapsulates it through the fixed encapsulation port in the outer header field, extracts the original first data packet, and performs business processing. At the same time, based on the preset bit operation rules, the CPU core can be determined through the virtual source IP address and destination IP address in the outer header field, and the data packet is sent to the corresponding kernel protocol stack for processing.
[0049] In one or more of the above embodiments, the network transmission node determines the next destination node IP by extracting the five-tuple information of the first data packet, and generates a virtual source IP based on the source IP and source port in the five-tuple information. Subsequently, the first data packet is encapsulated with UDP based on the next destination node IP and the virtual source IP, and the encapsulated second data packet is sent to the next destination node. The second data packet constructed in this way retains the characteristics of UDP's no-handshake and low-latency nature to reduce resource consumption, and expands the original UDP two-tuple information by combining the virtual source IP and the next destination node IP. Since the combination of the expanded two-tuple information is rich in form, it can ensure that requests from different clients, and even requests from different ports of the same client, can be distributed to multiple kernel protocol stacks, effectively avoiding the imbalance problem of a single receive queue, and ultimately achieving efficient load balancing.
[0050] To further improve load balancing, in step 120, the network transmission node can add variable parameters for generating virtual IPs, making the load balancing more even. Figure 2 This is an exemplary flowchart illustrating a virtual source IP generation method related to another data transmission method according to some embodiments of this application. Figure 2 As shown, step 220 provides another way to generate a virtual source IP address. Steps 210, 230 to 2400 are similar to steps 110, 130 and 140, and will not be described again here.
[0051] Step 220: The network transmission node generates a virtual source IP address based on the source IP address, source port number, and device IP address. The network transmission node uses bitwise operations to generate the virtual source IP address based on the source IP address, source port number, and device IP address. The device IP address is the network transmission node's device IP address.
[0052] In one example, the network transmission node uses a stateless bitwise operation to generate the virtual source IP address. Besides relying on the client IP address and port number, it also incorporates the network transmission node's own device IP address into the calculation. It also supports flexible control over the ratio and the number of bits reserved in the prefix. For example, it first obtains key information for generating the virtual IP—the client IP address, the source port number from which the connection was initiated, and the network transmission node's device IP address. The combination of these three elements further strengthens the unique identification capability of the client connection (connections from different ports of the same client, and connections from different clients, can all be accurately distinguished using this information). Then, it processes the above information through bitwise operations to generate the virtual source IP address. The operation rules can be flexibly adjusted according to service requirements: for example, some services may first reserve the first few bits of the client IP address (ensuring the virtual IP address and the client IP address are in the same subnet), and the remaining part is generated through joint operations using the client IP address, client port, and the network transmission node's IP address. In this example, a virtual source IP address is generated using three parameters: the client IP address, the client port, and the IP address of the network transmission node. This virtual source IP address is then added to the IP address of the next destination node to form a pseudo-quadruple. The addition of the device IP address of the network transmission node further enhances the richness of the computational dimensions, enabling efficient load balancing.
[0053] Exemplary flowcharts of data transmission methods in other embodiments of this application, such as... Figure 3 As shown, this design aims to achieve dynamic adaptation in hybrid network interface card (NIC) environments: it can optimize for older NICs that do not support 4-tuples while maintaining efficient forwarding for newer NICs that do support 4-tuples, ultimately achieving a balance between compatibility and performance. During this process, it is necessary to first confirm whether the first data packet has been acquired.
[0054] like Figure 3 As shown, steps 330 to 360 are similar to steps 110 to 140, and will not be described again here.
[0055] Step 310: The network transmission node reads the identification information of the network card and determines whether the identification information exists in the preset configuration table.
[0056] The configuration table is a network card configuration table that only supports UDP tuples.
[0057] In step 310, the network interface card (NIC) is a physical layer or data link layer device responsible for receiving and sending raw bit streams (such as Ethernet frames) and identifying local traffic through MAC addresses. In this embodiment, the NIC and the network transmission node are located on the same server. After the NIC receives packet data and writes it into a circular buffer, the network transmission node can directly read the packet metadata in the buffer.
[0058] In one example, the network transmission node reads the network interface card (NIC) identification information (such as model and interface number) of the intercepted data packets. This information is used to determine whether the NIC supports UDP four-tuples. Specifically, for NICs that do not support UDP four-tuples (only two-tuples), processing client-uploaded data packets in the conventional way will lead to unbalanced load balancing. Therefore, the data transmission method described above needs to be used to encapsulate the first data packet into a second data packet using UDP. NICs that support four-tuples can be processed directly using the conventional method without any additional special procedures. The configuration table described is for NICs that only support UDP two-tuples.
[0059] By querying this table, you can quickly determine whether the current network card needs to enter a special processing procedure. If the identifier is not in the configuration table (i.e., the network card supports four-tuples), then there is no need to enter this special procedure, and it can be forwarded directly using the normal method (such as relying on four-tuples for RSS load balancing). When the network card identifier is in the configuration table, it means that it does not support four-tuples, and the first data packet must be obtained and subsequent special processing must be performed (such as extracting five-tuple information, generating a virtual source IP address, UDP encapsulation, etc.) to solve the load balancing imbalance problem.
[0060] Step 320: If the identification information exists in the preset configuration table, the network transmission node obtains the first data packet from the network card.
[0061] In one example, network transmission nodes interact directly with the network interface card (NIC) through the XDP (eXpressDataPath) program deployed at the NIC driver layer. XDP intercepts the first data packet (containing complete header fields, port, payload, and other information) before it enters the kernel protocol stack and quickly passes it to the network transmission node. This direct interaction at the driver layer bypasses the redundant steps of the traditional kernel protocol stack, greatly reducing data capture latency and adapting to the needs of high-concurrency scenarios.
[0062] Step 330: The network transmission node receives the first data packet and extracts the 5-tuple information of the first data packet, and determines the IP address of the next destination node based on the 5-tuple information.
[0063] Step 340: The network transmission node generates a virtual source IP address based on the source IP address and source port number in the 5-tuple information.
[0064] Step 350: The network transmission node encapsulates the first data packet into a second data packet according to the User Datagram Protocol.
[0065] The header field of the second data packet includes the IP address of the next destination node and the virtual source IP address, and the data field of the second data packet includes the first data packet.
[0066] Step 360: The network transmission node sends the second data packet to the next destination node.
[0067] Through the above steps, firstly, by reading the network interface card (NIC) identifier and matching it with the configuration table, it is determined whether the NIC requires special processing (scenario filtering); if so (identified in the configuration table), the operation of "obtaining the first data packet from the NIC" is performed (physical acquisition); after obtaining the data packet, subsequent processing such as "extracting 5-tuple information" is performed (business processing). This design achieves dynamic adaptation to hybrid NIC environments: it ensures targeted optimization for older NICs that do not support 4-tuples (through a virtual source IP scheme) without affecting the regular and efficient forwarding of newer NICs that support 4-tuples, ultimately achieving a balance between compatibility and performance.
[0068] The steps described above are for clarity only. In practice, they can be combined into one step or some steps can be broken down into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent. Adding insignificant modifications or introducing insignificant designs to the algorithm or process, but without changing the core design of the algorithm and process, are also within the scope of protection of this patent.
[0069] Furthermore, the examples mentioned in the above embodiments can be freely combined, and any combination can be understood as an embodiment. The terms "embodiment" or "example" appearing in various locations in the specification do not necessarily refer to the same embodiment, nor are they independent or alternative embodiments mutually exclusive with other embodiments. Those skilled in the art will understand that the embodiments described herein can be combined with other embodiments.
[0070] This application specification also provides a data transmission device. Figure 4 This is an exemplary block diagram of a data transmission apparatus according to some embodiments of this application. In some embodiments, the data transmission apparatus includes an extraction module, a processing module, an encapsulation module, and a transmission module.
[0071] The system includes: an extraction module for receiving a first data packet and extracting its 5-tuple information, and determining the IP address of the next destination node based on the 5-tuple information; a processing module for generating a virtual source IP address based on the source IP address and source port number in the 5-tuple information; an encapsulation module for encapsulating the first data packet into a second data packet according to the User Datagram Protocol (UDP), wherein the header field of the second data packet includes the IP address of the next destination node and the virtual source IP address, and the data field of the second data packet includes the first data packet; and a sending module for sending the second data packet to the next destination node.
[0072] Another embodiment of this application also relates to an electronic device, such as... Figure 5 As shown, it includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the above-described data transmission method.
[0073] The memory and processor are connected via a bus, which can include any number of interconnecting buses and bridges, connecting various circuits of one or more processors and memories. The bus can also connect various other circuits, such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and will not be described further herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be a single element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by the processor is transmitted over the wireless medium via an antenna, which further receives data and transmits it to the processor.
[0074] The processor manages the bus and general processing, and also provides various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory is used to store data used by the processor during operation.
[0075] Another embodiment of this application relates to a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the above-described method embodiments.
[0076] That is, those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. This program is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0077] Some embodiments of this specification also provide a computer program product, including a computer program, which, when at least a portion of the computer program is executed by a processor, enables the data transmission method as described above. In some embodiments, the computer program product may refer only to the computer program, which may be carried on a storage medium or a processing device. In other embodiments, the computer program product may also be a storage medium or a processing device containing the aforementioned computer program. The processing device may include one or more processors, and the storage medium.
[0078] Those skilled in the art will understand that the above embodiments are specific implementations of this application, and in practical applications, various changes can be made in form and detail without departing from the spirit and scope of this application.
Claims
1. A data transmission method, characterized in that, Applied to network transmission nodes, including: Receive the first data packet and extract the five-tuple information of the first data packet, and determine the IP address of the next destination node based on the five-tuple information; A virtual source IP address is generated based on the source IP address and source port number in the 5-tuple information; The first data packet is encapsulated into a second data packet according to the User Datagram Protocol (UDP), wherein the header field of the second data packet includes the IP address of the next destination node and the virtual source IP address, and the data field of the second data packet includes the first data packet; The second data packet is sent to the next destination node.
2. The data transmission method according to claim 1, characterized in that, The network transmission node has a device IP address. Generating a virtual source IP address based on the source IP address and source port number in the five-tuple information includes: A virtual source IP address is generated based on the source IP address, the source port number, and the device IP address.
3. The data transmission method according to claim 1 or 2, characterized in that, The first data packet is a Transmission Control Protocol (TCP) data packet or a User Datagram Protocol (UDP) data packet.
4. The data transmission method according to claim 2, characterized in that, The step of generating a virtual source IP address based on the source IP address and source port number in the five-tuple information includes: The virtual source IP is determined using bitwise operations based on the source IP address, the source port number, and the device IP address.
5. The data transmission method according to any one of claims 1 to 4, characterized in that, The source port in the header field of the second data packet is a dynamically allocated local port number, and the destination port is a preset target port number.
6. The data transmission method according to any one of claims 1 to 5, characterized in that, The step of determining the next destination node IP address based on the 5-tuple information includes: Based on the 5-tuple information, the IP address of the next destination node is determined using a consistent hashing algorithm.
7. The data transmission method according to any one of claims 1 to 6, characterized in that, The first data packet is obtained from the network interface card (NIC), wherein the NIC and the network transmission node are configured on the same server.
8. The data transmission method according to any one of claims 1 to 7, characterized in that, The method further includes: Before obtaining the first data packet from the network card, read the identification information of the network card; If the identification information exists in a preset configuration table, then the first data packet is obtained, wherein the configuration table is a network interface card configuration table that only supports UDP tuples.
9. A data transmission device, characterized in that, include: The extraction module is used to receive the first data packet and extract the five-tuple information of the first data packet, and determine the IP address of the next destination node based on the five-tuple information; The processing module is used to generate a virtual source IP address based on the source IP address and source port number in the five-tuple information; An encapsulation module is used to encapsulate the first data packet into a second data packet according to the User Datagram Protocol, wherein the header field of the second data packet includes the IP address of the next destination node and the virtual source IP address, and the data field of the second data packet includes the first data packet; The sending module is used to send the second data packet to the next destination node.
10. An electronic device, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the data transfer method as described in any one of claims 1 to 8.
11. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the data transmission method as described in any one of claims 1 to 8.
12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the data transmission method as described in any one of claims 1 to 8.