Method, device and system for accelerating transmission of packets
By modifying request packets in the load balancer to include their IP addresses, the problem of slow transmission speed of server response packets over the public network is solved, achieving reverse acceleration of packets and improving user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUAWEI DEVICE CO LTD
- Filing Date
- 2021-11-10
- Publication Date
- 2026-04-17
AI Technical Summary
In internet data centers, server response messages are transmitted slowly over the public network, affecting user experience. Existing technologies make it difficult to achieve reverse acceleration of messages.
By using a load balancer, the request message is modified to carry its IP address as the first message, enabling the response message generated by the server to be sent to the load balancer via a dedicated line, and then returned to the terminal via the dedicated line, thus achieving reverse acceleration of the message.
It achieves bidirectional packet acceleration, reduces end-to-end network latency, and improves the user's network experience.
Smart Images

Figure CN116112300B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of network technology, and in particular to a method, apparatus and system for accelerating message transmission. Background Technology
[0002] To avoid overload and crashes caused by a single server directly responding to all massive user requests, Internet data centers deploy load balancers (LB) as an essential component when dealing with and responding to massive user requests. LB is responsible for distributing a relatively even distribution of a large number of user requests to the backend servers that actually process the requests.
[0003] Load balancers are also used when dynamic acceleration services accelerate packet transmission via dedicated lines. In dynamic acceleration services, the load balancer at the dynamic acceleration site distributes request packets sent by the router to backend servers. The router then routes these packets via dedicated lines to routers in the backend data center, and finally to the servers assigned by the load balancer. However, servers often cannot accelerate the return of response packets via this path because the destination address of the response packets generated by the server is the user terminal that made the request. Therefore, the response packets are forwarded by routers in the backend data center and sent to the user terminal via the public network (such as the Internet). However, the transmission volume of the public network is enormous, so the transmission speed of the downlink response packets is often very slow compared to the uplink request packets, affecting the user experience. Summary of the Invention
[0004] This application provides a method, apparatus, and system for accelerating message transmission, thereby enabling reverse acceleration of messages.
[0005] Firstly, this application provides a method for accelerating message transmission, applied to a load balancer, comprising: receiving a request message; modifying the request message into a first message, wherein the first message carries the Internet Protocol (IP) address of the load balancer; and sending the first message, wherein the payload of the first message is the same as that of the request message, and the destination IP address of the first message is the IP address of a server. This method, by modifying the request message into a first message carrying the IP address of the load balancer, enables the server receiving the first message to obtain the IP address of the load balancer, thereby making it possible for the server to send the generated response message to the load balancer via a dedicated line, thus enabling reverse acceleration of the message transmission.
[0006] In one possible implementation, the aforementioned receive request message may include: determining, based on the Ethernet header field value of the request message, that the request message is a message used to request data. Where it is possible for the server to send a response message to the load balancer via a leased line, determining the request message allows the load balancer to distinguish between uplink and downlink messages and thus take appropriate action.
[0007] In one possible implementation, changing the above request message to a first message may include: adding the IP address of the load balancer to the option field of the IP header of the above request message, so that the first message carries the IP address of the load balancer.
[0008] In one possible implementation, changing the above request message to the first message may further include: modifying the header length (IHL) field value of the IP header of the above request message to be greater than 5 to adapt to changes in the IP header length.
[0009] In one possible implementation, the method may further include: receiving a second message generated by the server based on the first message; modifying the second message into a third message, wherein the third message does not carry the IP address of the load balancer, but carries the payload of the second message, and the destination IP address of the third message is the source IP address of the request message; and sending the third message. This allows the response message generated by the server to be forwarded to the requesting terminal after reaching the load balancer. In this case, the message transmission generated in the network due to the terminal's request is bidirectionally accelerated via a dedicated line.
[0010] In one possible implementation, receiving the second message may include: determining, based on the Ethernet header field value in the second message, that the second message is a message used to respond to the request message, so as to distinguish between uplink and downlink messages and thus perform corresponding processing.
[0011] In one possible implementation, changing the second message to a third message may include: modifying the Ethernet header field value of the second message to a value that can be recognized by the public network, so that the data requested by the terminal can eventually reach the terminal.
[0012] In one possible implementation, changing the second message to a third message may include: deleting the outer IP header of the second message; wherein the destination IP field value of the outer IP header is the IP address of the load balancer, so that the data requested by the terminal can eventually reach the terminal.
[0013] Secondly, this application provides a method for accelerating message transmission, applied to a server, which may include: receiving a first message, the first message being obtained by a load balancer rewriting a request message, the payload of the first message being the same as that of the request message, and the first message carrying the IP address of the load balancer; generating a second message based on the first message, the destination address of the second message being the IP address of the load balancer; and sending the second message. This method, by setting the destination IP address of the second message to the IP address of the load balancer, enables the response message generated by the server in response to the request message to be transmitted via a dedicated line, thereby achieving reverse acceleration of the message transmission.
[0014] In one possible implementation, after receiving the first message, the method may further include: when the IHL field value in the first message is greater than 5, determining that the first message is a message used to request data and carrying the IP address of the load balancer.
[0015] In one possible implementation, generating the second message based on the first message may include: generating the payload of the second message based on the payload of the first message and a fixed IP header, and generating the outer IP header of the second message based on the IP address of the load balancer; wherein the destination address field of the outer IP header is the IP address of the load balancer.
[0016] In one possible implementation, generating a second message based on the first message may include: the field values in the Ethernet header of the second message generated based on the first message being preset values.
[0017] Thirdly, this application provides a load balancer for implementing the above-described method for accelerating message transmission, comprising: a first receiving module, a first modifying module, and a first sending module. The first receiving module is used to receive a request message; the first modifying module is used to modify the request message into a first message, wherein the first message carries the Internet Protocol (IP) address of the load balancer; the first sending module is used to send the first message, wherein the payload of the first message is the same as that of the request message, and the destination IP address of the first message is the IP address of the server.
[0018] In one possible implementation, the first receiving module can be used to: determine that the request message is a message for requesting data based on the Ethernet header field value of the request message.
[0019] In one possible implementation, the first modification module described above can be used to add the IP address of the load balancer to the option field of the IP header of the request message.
[0020] In one possible implementation, the first message modification module described above can also be used to: modify the header length (IHL) field value of the IP header of the request message to be greater than 5.
[0021] In one possible implementation, the load balancer may further include: a second receiving module, a second reporting module, and a second sending module.
[0022] The second receiving module is used to receive the second message, which is generated by the server based on the first message; the second message modification module is used to modify the second message into a third message, which does not carry the IP address of the load balancer, carries the payload of the second message, and the destination IP address of the third message is the source IP address of the request message; the second sending module is used to send the third message.
[0023] In one possible implementation, the second receiving module can be used to: determine, based on the Ethernet header field value in the second message, that the second message is a message used to respond to the request message.
[0024] In one possible implementation, the aforementioned second message modification module can be used to modify the value of the Ethernet header field of the aforementioned second message to a value that can be recognized by the public network.
[0025] In one possible implementation, the second message modification module can be used to: delete the outer IP header of the second message; wherein the destination IP field value of the outer IP header is the IP address of the load balancer.
[0026] Fourthly, this application provides a server for implementing the above-described method for accelerating message transmission, comprising: a receiving module, a generating module, and a sending module. The receiving module receives a first message obtained by rewriting a request message by a load balancer, the payload of which is the same as that of the request message, and the first message carries the IP address of the load balancer; the generating module generates a second message based on the first message, the destination address of which is the IP address of the load balancer; and the sending module sends the second message.
[0027] In one possible implementation, the server may further include a discrimination module, configured to, after the receiving module receives the first message, determine that the first message is a message for requesting data and carrying the IP address of the load balancer when the IHL field value in the first message is greater than 5.
[0028] In one possible implementation, the generation module can be used to: generate the payload of the second message based on the payload of the first message and the fixed IP header, and generate the outer IP header of the second message based on the IP address of the load balancer; wherein the destination address field of the outer IP header is the IP address of the load balancer.
[0029] In one possible implementation, the above-mentioned generation module can be used to: set the field values in the Ethernet header of the second message generated based on the first message to preset values.
[0030] Fifthly, this application provides a system for accelerating message transmission, including a load balancer according to any of the third aspects above and a server according to any of the fourth aspects above.
[0031] Sixthly, this application provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the method of any one of the first to third aspects.
[0032] In a seventh aspect, this application provides a computer program, which, when executed by a computer, performs the method of any one of the first to second aspects.
[0033] In one possible design, the program in aspect seven can be stored wholly or partially on a storage medium packaged with the processor, or it can be stored wholly or partially on a memory not packaged with the processor. Attached Figure Description
[0034] Figure 1 This is a schematic diagram of the network architecture in an embodiment of this application;
[0035] Figure 2 This is a schematic diagram of the uplink message structure in an embodiment of this application;
[0036] Figure 3 This is a signaling flow example diagram of a method for accelerating message transmission in an embodiment of this application;
[0037] Figure 4 This is a schematic diagram of the IP packet header options field in the embodiments of this application;
[0038] Figure 5 This is another signaling flow example diagram of a method for accelerating message transmission in the embodiments of this application;
[0039] Figure 6 This is another example signaling flow diagram of a method for accelerating message transmission in the embodiments of this application;
[0040] Figure 7This is a schematic diagram illustrating a scenario in which the method for accelerating message transmission is applied in the embodiments of this application;
[0041] Figure 8 This is another signaling flow example diagram of a method for accelerating message transmission in the embodiments of this application;
[0042] Figure 9 This is another signaling flow example diagram of a method for accelerating message transmission in the embodiments of this application;
[0043] Figure 10 This is a schematic diagram of the structure of message p1 in an embodiment of this application;
[0044] Figure 11 This is a schematic diagram of the structure of message p2 in an embodiment of this application;
[0045] Figure 12 This is a schematic diagram of the structure of message p3 in an embodiment of this application;
[0046] Figure 13 This is a schematic diagram of the structure of message p4 in an embodiment of this application;
[0047] Figure 14 This is a schematic diagram of the load balancer structure in an embodiment of this application;
[0048] Figure 15 This is a schematic diagram of the server structure in an embodiment of this application. Detailed Implementation
[0049] The terminology used in the implementation section of this application is for the purpose of explaining specific embodiments of this application only, and is not intended to limit this application.
[0050] When transmitting messages, using a load balancer and multiple servers with average performance is a more cost-effective horizontal scaling (scale-out) solution for handling large numbers of user requests. Compared to vertical scaling (scale-up) solutions that simply increase the processing power and specifications of a single server, this approach offers better scalability. For example, if a server for a certain type of application can handle 10,000 user requests concurrently, deploying one load balancer and 100 servers of the same specifications in the data center can handle 100 x 10,000 (1 million) user requests simultaneously, without needing to deploy a single expensive high-specification server capable of handling 1 million concurrent user requests (the price of which far exceeds that of 100 ordinary servers and a load balancer, and there is a single point of failure risk). Furthermore, when the number of user requests increases, the load balancer solution only requires adding more ordinary business servers at the backend and modifying the load balancer's configuration, making it more scalable than using a single high-specification server.
[0051] To improve the network experience for end users accessing application services located in data centers, multiple load balancers, such as Network Load Balancers (NLBs) and Server Load Balancers (SLBs), can be deployed in data centers in major regions, provinces, or cities across the country. These load balancers are directly connected to large-scale data centers providing internet services via dedicated physical network lines or leased lines. The data center where the load balancers are deployed and connected to the data center via a leased line can be called a dynamic acceleration site. The bandwidth of this leased line can be 1Gbps, 10Gbps, or 100Gbps, providing dedicated bandwidth and reliable network transmission services to a large client such as a government agency, public institution, or branch office of a large enterprise. Therefore, this leased line can accelerate packet transmission. The dynamic acceleration site forwards user requests from its location to the large data center via this leased line, where the data center processes the user requests and returns responses, thus providing dynamic acceleration services for the packet transmission of user terminals.
[0052] by Figure 1 Taking the network architecture shown as an example, a load balancer 10 and a router 20 directly connected to a data center 40 via a leased line 30 are deployed in a certain area. The data center 40 deploys a router 50 connected to router 20 via the leased line 30, and multiple servers 60 connected to router 50. The load balancer 10 can provide dynamic accelerated transmission network services for Layer 4 network protocols such as TCP or UDP at the dynamic acceleration site, and the servers 60 can be TCP or UDP application servers.
[0053] After a user terminal accesses the network wirelessly (such as via Wi-Fi, cellular network, etc.) or via wired connection, the request message is transmitted to router 20, which then routes the request message to load balancer 10. The message received by load balancer 10 is as follows: Figure 2As shown, the IP header includes an Ethernet header, an IP header, and a payload. The Ethernet header includes the MAC destination, MAC source, and EtherType fields. The IP header includes the version, IP header length (IHL), IPv4 header, total length, other IPv4 header fields, header checksum, source IP, and destination IP fields. The IHL field indicates the length of the IP header. Multiplying the IHL value by 4 gives the IP header length. The minimum IHL value is 0x5, meaning the minimum IP header length is 20 bytes, or the fixed portion of the IP header is 20 bytes. Typically, uplink and downlink packets use a fixed 20-byte IP header, with an IHL value of 0x5. The variable portions of the IP header are shown below. Figure 4 The IP option field shown has a variable length. When this IP option field is enabled, the length of the IP header increases, and correspondingly, the IHL value increases until the product of IHL and 4 equals the length of the IP header. Load balancer 10 selects one server 60 from multiple servers 60 in data center 40 to process the request packet according to a load balancing algorithm, and writes the IP address of the selected server as the destination IP address of the request packet into the destination IP field of the IP header. Then, router 20 routes the request packet to router 50 via leased line 30. Router 50 routes the request packet to the corresponding server 60 for processing based on the destination IP address in the request packet, generating a response packet. To enable the response packet to also achieve accelerated transmission via the leased line 30, i.e., to achieve reverse packet acceleration, this application improves both the load balancer of the dynamically accelerated site and the server in the data center. For example, after router 20 routes the user terminal's request to the load balancer 10, the load balancer 10 further adds its own IP address to the request message. Then, router 20 sends the request message to router 50 in data center 40 via leased line 30. Router 50 routes the request message containing the load balancer 10's IP address to the corresponding server 60. After server 60 generates a response message, it further adds the load balancer 10's IP address to the response message, causing the response message to be routed by router 50 to the load balancer 10 via leased line 30 and router 20. The load balancer 10 then removes its own IP address from the response message, and router 20 then routes the message to the requesting terminal based on the destination IP address in the response message.
[0054] By adding its own IP address to the request packet, the load balancer enables subsequent servers to use the load balancer's IP address as the destination address for their response packets. This makes it possible to send the response packets to the load balancer via the dedicated line, thus enabling reverse packet acceleration. By setting the load balancer's IP address as the destination address in the generated response packet, the server sends the response packet via the dedicated line to the load balancer in the dynamically accelerated site, achieving reverse packet acceleration. Furthermore, by removing the IP address from the response packet on the load balancer side, the accelerated response packet successfully reaches its final destination terminal.
[0055] The request message sent from the terminal to the server is usually called an uplink message, and the response message generated by the server in response to the request message is returned to the terminal; this response message is called a downlink message. Methods for accelerating message transmission can be applied to both uplink and downlink message acceleration. Downlink message acceleration, in contrast to uplink acceleration, can also be called reverse acceleration.
[0056] by Figure 1 Taking the request message sent by the terminal shown as an example, the method for accelerating message transmission is explained. Figure 3 As shown, after the terminal sends a request to the data center 40, its request message is connected to router 20 in the dynamic acceleration site. Router 20 sends the request message to load balancer 10 to allocate an application server for the request message. Load balancer 10 implements a method for accelerating message transmission, which may specifically include:
[0057] Step 31: Load balancer 10 receives the request message. The format of the request message is as follows: Figure 2 As shown. In an optional implementation, the load balancer 10 receiving the request message may include: determining that the request message is a message for requesting data based on the Ethernet header field value of the request message. For example, after receiving the request message, the load balancer 10 parses it and finds that the Ethernet type field value in the Ethernet header field of the message is 0x0800, then considers the first message to be an uplink message, i.e., a request message from the terminal sent by the router 20.
[0058] Step 32: Load balancer 10 modifies the above request message into a first message, which carries the IP address of load balancer 10. Typically, load balancer 10 also selects a server 60 from the servers 60 in the data center as the destination IP address of the request message using a load balancing algorithm. Therefore, in the rewritten first message, the destination IP address field in the IP header is the IP address of server 60, so that the first message can be routed to server 60 by router 20.
[0059] In an alternative implementation, the load balancer 10 changing the request message to the first message may include adding the IP address of the load balancer 10 to the option field of the IP header of the request message. The option field of the IP header is as follows: Figure 4 As shown, the IP address of the load balancer can be written into the option data field of the option header using customizable rules in the option field of the IP header.
[0060] In one alternative implementation, the load balancer 10 may change the request packet to the first packet by modifying the IHL field value of the IP header of the request packet to be greater than 5. For example, adding a value such as 5 to the IP header of the request packet. Figure 4 The IP option field shown includes: a Copy field, an Option Class field, an Option Number field, an Option Length field, an Option Data field, and a Padding field. The IP address of load balancer 10 can be added to the Option Data field. Because the IP header is lengthened by adding the IP option field, the IHL field value is modified accordingly to a number greater than 5. This allows server 60 to determine whether the first packet carries the IP address of load balancer 10 based on the IHL field value. For example, load balancer 10 is configured to enable the IP option field for processing uplink packets, adding its own IP address to the option data field of this field, and setting the IHL field value in the IP header of the request packet to a value greater than 5, such as 0x7 or 0x8. Simultaneously, server 60 is configured to determine that when an IHL value greater than 5 is found, the value in the option data field of the IP option field in the received packet's IP header is the IP address of the load balancer. Thus, after receiving the first message, the server parses it and finds that the IHL field value is greater than 5. This indicates that the first message is a request message rewritten by load balancer 10, and that the second message carries the IP address of load balancer 10. For example, server 60 is configured to read the IP address of load balancer 10 from the option data field of the IP header of the first message.
[0061] Step 33: Load balancer 10 sends the first message mentioned above. The payload of the first message is the same as that of the request message, and the destination IP address is the IP address of server 60. Therefore, router 20 routes the first message to router 50 via leased line 30 according to the destination IP address in the first message, and then forwards it to server 60 through router 50. The first message carries the content of the request message, that is, router 20 sends the user terminal's request message to server 60.
[0062] Normally, the destination IP address in an uplink message is obtained by the terminal through the Domain Name System (DNS). Here, the destination IP address in the request message sent by the terminal is the IP address of the load balancer. After the load balancer selects a server using its load balancing algorithm, it sets the destination IP address of the second message to the IP address of the selected server. The MAC address in the message changes every time it passes through a device. When the message passes through a router, the router changes the source MAC address in the Ethernet header to its own MAC address and the destination MAC address to the load balancer's MAC address. Since this is not the focus of this application, it will not be elaborated upon here.
[0063] Server 60 implements methods for accelerating message transmission, such as... Figure 5 As shown, it includes:
[0064] Step 51: Server 60 receives the first message mentioned above. The first message is obtained by rewriting the request message by load balancer 10. The payload of the first message is the same as that of the request message, and the first message carries the IP address of load balancer 10.
[0065] Step 52: Server 60 generates a second message based on the first message, the destination address of which is the IP address of the load balancer 10. In an optional embodiment, after server 60 receives the first message, the method for accelerating message transmission may further include, when the IHL field value in the first message is greater than 5, server 60 determines that the first message is a message requesting data and carrying the IP address of the load balancer 10. For example, after receiving the first message, server 60 parses it to obtain the IHL field value. Based on the IHL field value, server 60 knows that the message carries the IP address of the load balancer 10. The first message contains... Figure 4 In the option data field of the IP header shown, the IP address of the load balancer 10 can be entered. The server 60 can read and save the IP address from the option data field of the IP header in this first packet.
[0066] In one optional implementation, server 60 can generate the payload of the second message based on the payload of the first message and a fixed IP header, and generate the outer IP header of the second message based on the IP address of the load balancer 10; wherein the destination address field of the outer IP header can be the IP address of the load balancer 10. It is understood that when the message header has two layers of IP headers, its checksum is generally different from the checksum in a single-layer IP header. In one optional implementation, the field values in the Ethernet header of the second message generated by server 60 based on the first message can be preset values. For example, server 60 sets the ethertype field value of the second message to 0x89F5. Correspondingly, when the load balancer 10 parses the ethertype field value to 0x89F5, it determines that the message with the ethertype field value of 0x89F5 is a downlink message, that is, server 60 responds to the second message generated from the first message and performs corresponding subsequent processing.
[0067] Step 53: Server 60 sends the second message. Since the destination IP address of this second message is the IP address of the load balancer 10, the second message sent by server 60 is routed by router 50 to router 20 of the dynamic acceleration site via leased line 30. Router 20 of the dynamic acceleration site routes the response message to the load balancer 10 according to the destination IP address in the outer IP packet of the response message.
[0068] Load balancer 10 implementation as follows Figure 6 The method shown for accelerating message transmission includes:
[0069] Step 61: Load balancer 10 receives a second message, which is generated by server 60 based on the first message. In an optional implementation, receiving the second message by load balancer 10 may include: determining, based on the Ethernet header field value in the second message, whether the second message is a message used to respond to the request message, i.e., an acknowledgment message or a downlink message. For example, when load balancer 10 parses the Ethernet header field value of the second message as a preset value, it can determine that the second message is an acknowledgment message sent by server 60. The Ethernet header field is not limited to the ethertype field, and the ethertype field value is not limited to 0x89F5.
[0070] Step 62: Load balancer 10 changes the second packet to a third packet. The third packet does not carry the IP address of load balancer 10, but it carries the payload of the second packet, and the destination IP address of the third packet is the source IP address of the request packet. In an optional implementation, changing the second packet to a third packet may include modifying the Ethernet header field value of the second packet to a publicly recognizable value, such as changing the ethertype field value to 0x0800. In an optional implementation, changing the second packet to a third packet may include deleting the outer IP header of the second packet; wherein the destination IP field of the outer IP header is the IP address of load balancer 10.
[0071] Step 63: Load balancer 10 sends the third message. Since the destination IP address of the third message is the source IP address of the aforementioned request message, i.e., the IP address of the terminal that sent the request message, the third message is forwarded by router 20 and finally sent to the terminal. Furthermore, the third message carries the payload of the second message, which is generated by server 60 based on the first message. The first message carries the payload of the request message, meaning the second message is a response message to the request message. This response message generated by server 60 is sent to load balancer 10 via a dedicated line, where the destination address is modified and the message is forwarded before finally reaching the requesting terminal. In this way, during the terminal's network access, both uplink and downlink messages receive bidirectional acceleration via the dedicated line.
[0072] One application scenario for methods used to accelerate message transmission is as follows: Figure 7 As shown, to improve the network experience for end users in City A 00 accessing application services located in data center 401, a dynamic acceleration service is provided on the network side. In this scenario, data center 401 includes router 50 and multiple UDP servers 601. City A 00 deploys a dynamic acceleration site, including one or more NLB 101s and routers 20, as well as a leased line 30 for direct connection to the large-scale data center 401 providing internet services. NLB 101 and UDP servers 601 are primarily used to handle service requests via the UDP protocol.
[0073] For ease of description, the load balancer used to accelerate packet transmission in the above embodiments is referred to as a load balancer in Bi-Directional Acceleration (BiDiAccel) mode.
[0074] when Figure 7 When using the BiDiAccel mode of the NLB 101 in the scenario shown, the bidirectional data transmission generated by the terminal accessing the network is as follows: Figure 8 As shown.
[0075] After the UDP request message p1 sent by the terminal arrives at the dynamic acceleration site, it is routed to NLB 101 in BiDiAccel mode via router 20.
[0076] In BiDiAccel mode, NLB 101 parses the Ethernet header of message p1. Message p1 is as follows: Figure 10 As shown, the Ethernet header includes a destination MAC field, a source MAC field, and an EtherType field. The destination MAC field is the MAC address of the NLB network interface card (NIC), i.e., the NLB's MAC address, and is 6 bytes long. The source MAC field is the MAC address of the upstream router, i.e., the router of the dynamic acceleration site, and is also 6 bytes long. The EtherType field has a value of 0x0800 and is 2 bytes long. The IP header includes a version field, an IHL field, an IPv4 header field, a total length field, other IPv4 header fields, a header checksum field, a source IP field, and a destination IP field. The IPv4 header field is 4 bits long; the IHL field is 0x5 and 4 bits long; the IPv4 header field is 1 byte long; the total length field is 0xN and 2 bytes long; the other IPv4 header fields are 6 bytes long; the header checksum field is 2 bytes long; the source IP field is the public IP address of the terminal device and is 4 bytes long; the destination IP field is the binary representation of 227.76.219.240 and is 4 bytes long. The payload of message p1 is UDP protocol content. The Ethertype field in the Ethernet header of message p1 is checked for a normal value (0x0800). All user request messages have this Ethertype field value; 0x0800 indicates that the message is an IPv4 message. When the Ethertype field value is 0x0800, the NLB 101 recognizes message p1 as a request message sent by a router user terminal.
[0077] According to the load balancing algorithm, NLB 101 assigns UDP server 601 in the backend data center as the server to process packet p1. Therefore, packet p1 is assigned to server 601 for processing. Consequently, the destination address in the IP header of packet p1 is changed to the IP address of UDP server 601. Furthermore, NLB 101 enables the IP header options field and adds its own IP address, such as 222.76.219.240, to its options data field, modifying the IHL field value in the IP header to 0x7, resulting in the following... Figure 11 The message p2 shown is shown.
[0078] NLB 101 sends message p2 to the network card, which is then routed through router 20 to the backend data center router 50 via leased line 30, and then to the target UDP server 601.
[0079] The backend UDP server 601 receives packet p2. Based on the IHL field value in the parsed IP header, it identifies that packet p2's IP header contains an option field, meaning it recognizes packet p2 as a request packet processed and forwarded by an NLB 101 in BiDiAccel mode. It then extracts the NLB 101's IP address 222.76.219.240 from the option data field of the IP option in packet p2's IP header and records it as ip_nlb. Furthermore, the backend UDP server 601 generates a response packet in response to packet p2's request. It encapsulates the response packet with an IP header (i.e., an outer IP header), filling the destination IP address field of the outer IP header with the NLB 101's IP address 222.76.219.240. It also sets the Ethertype field in the Ethernet header of the response packet to a specified value, such as 0x89F5, resulting in... Figure 12 The message p3 is shown. Afterwards, the backend UDP server 601 sends message p3 to the network card. Message p3 is routed by router 50, based on the destination IP address in the outer IP header, through leased line 30 to router 20 in the dynamic acceleration site, and then by router 20 to NLB 101 in BiDiAccel mode.
[0080] The NLB 101 in BiDiAccel mode at the dynamic acceleration site receives and parses packet p3. Finding the Ethertype field value of p3 to be 0x89F5, it determines that p3 is a downlink packet, i.e., a response packet sent by the backend UDP server 601 supporting BiDiAccel mode. The NLB 101 in BiDiAccel mode strips the outer IP header from p3 and rewrites the Ethertype field in the Ethernet header of p3 to 0x0800 (the normal value for IPv4), resulting in the following... Figure 13 The message p4 is shown. NLB 101 sends message p4 to the network card. Since the destination IP address of message p4 is the IP address of the terminal that made the request, message p4 is routed to the terminal via router 20 of the dynamic acceleration site.
[0081] As can be seen, the BiDiAccel mode of NLB 101 allows the UDP server 601 to return the response message to NLB 101, and then NLB 101 forwards the response message back to the requesting user terminal. This allows the reverse response message to also be transmitted back to the dynamic acceleration site via the dedicated line, ensuring that both bidirectional traffic is dynamically accelerated, further reducing end-to-end network latency, and thus improving the user's application experience.
[0082] Another method to accelerate message transmission is the signaling process, such as... Figure 9 As shown, the mobile terminal sends a request message P1, which is routed to the NLB via the first router of the dynamic acceleration site. Here, the request message P1 is either a UDP request message or a TCP request message.
[0083] The NLB identifies message P1 as a request message P1 sent by a user terminal based on the Ethertype field in the Ethernet header. The NLB enables the IP Option field in the IP header of request message P1 and adds the NLB's IP address to the IP Option field, resulting in message P2. The NLB then sends message P2. It can be understood that the destination address of message P2 is the IP address of server b2, obtained by the NLB through its load balancing algorithm. Here, "b2" is the server's ID; typically, the data center also has other application servers, such as server b1, server b3, server b4, etc.
[0084] Message P2 is sent to the data center via a dedicated line through the first router of the dynamic acceleration site, and then routed to the corresponding server b2 through the second router of the data center.
[0085] Backend server b2 receives message P2, extracts the IP address from the IP option field of the outer IP header of P2 (i.e., the NLB's IP address), records it as ip_nlb, processes the request in message P2, and generates a response message. Further, it encapsulates this response message with an IP header, using ip_nlb as the destination IP address in this IP header, and changes the Ethertype field value to 0x89F5, resulting in message P3, which is then sent. Message P3 is routed to the dynamic acceleration site via a dedicated line through the second router in the data center. The first router at the dynamic acceleration site routes message P3 to the NLB.
[0086] The NLB identifies message P3 as being sent by the server based on the Ethertype field in the Ethernet header of message P3. The NLB then strips the outer IP header of message P3, rewrites the Ethertype field value to 0x0800 (standard IP message), and obtains the response message P4. The NLB sends message P4, which is routed to the user terminal via the first router.
[0087] Figure 8 The illustrated embodiment uses bidirectional acceleration of UDP protocol packets as an example to illustrate a method for accelerating packet transmission. Figure 9 In the illustrated embodiments, the accelerated packets can be either TCP or UDP protocol packets. The above embodiments allow dynamic acceleration sites to provide accelerated transmission for bidirectional traffic, further reducing end-to-end network latency and improving the application service access experience for end users.
[0088] Another application scenario involves data centers also having NLBs. These NLBs can be traditional load balancers, and there are no requirements regarding whether they support the BiDiAccel mode. In this application scenario, the processing flow of the BiDiAccel mode NLB in the dynamic acceleration site and the processing flow of the data center backend server are the same as in the above embodiments.
[0089] In another application scenario, the NLB in BiDiAccel mode at a dynamic acceleration site can be a cluster. In this scenario, the processing flow of the NLB in BiDiAccel mode at the dynamic acceleration site and the processing flow of the data center backend server are the same as in the above embodiments.
[0090] The exemplary method described above for accelerating message transmission enables the application server to generate a response message, which is then sent to the dynamic acceleration site via a dedicated line. The dynamic acceleration site then returns the response message to the user terminal via the Internet. This is in contrast to the NLB method using Direct Service Return (DSR), where the NLB sends received TCP or UDP user requests back to TCP or UDP application servers located in the data center via a dedicated line. Once the TCP or UDP application server processes the user request and generates a response message, these response messages are no longer distributed by the NLB but are directly sent by the application server to the Internet and returned to the user's mobile terminal or laptop. The exemplary method described above enables the dynamic acceleration service to accelerate the Layer 4 TCP or UDP response messages returned by the application server. Compared to methods that only accelerate Layer 4 TCP or UDP request messages sent from the user terminal to the data center server in a one-way direction, the acceleration effect is effectively improved. For example, assuming that the dynamic acceleration service can reduce the one-way network latency from the user to the Beijing data center from 1s to 200ms, the acceleration method using the DSR load balancer described above cannot provide accelerated transmission service for the reverse server response messages. Its end-to-end network latency improvement is 200ms + 1s = 1.2s. However, the dynamic acceleration service using the above exemplary method for accelerating message transmission, under ideal conditions, can reduce the end-to-end network latency from 1s x 2 = 2s to 200ms x 2 = 400ms through its bidirectional acceleration service.
[0091] Implementation of load balancers, for example Figure 14 As shown, the method for accelerating message transmission in the above embodiments includes: a first receiving module 141, a first message transmission module 142, and a first sending module 143.
[0092] The first receiving module 141 is used to receive a request message; the first modifying module 142 is used to modify the request message into a first message, wherein the first message carries the Internet Protocol IP address of the load balancer; the first sending module 143 is used to send the first message, wherein the payload of the first message is the same as that of the request message, and the destination IP address of the first message is the IP address of the server.
[0093] In an optional implementation, the first receiving module 141 can be used to: determine that the request message is a message for requesting data based on the Ethernet header field value of the request message.
[0094] In an optional implementation, the first modification module 142 can be used to add the IP address of the load balancer to the option field of the IP header of the request message.
[0095] In an optional implementation, the first message modification module 142 can also be used to modify the header length (IHL) field value of the IP header of the request message to be greater than 5.
[0096] In an optional implementation, the load balancer 140 may further include: a second receiving module 144, a second reporting module 145, and a second sending module 146.
[0097] The second receiving module 144 is used to receive a second message, which is generated by the server based on the first message; the second message modification module 145 is used to modify the second message into a third message, which does not carry the IP address of the load balancer, but carries the payload of the second message, and the destination IP address of the third message is the source IP address of the request message; the second sending module 146 is used to send the third message.
[0098] In an optional implementation, the second receiving module 144 can be used to: determine, based on the Ethernet header field value in the second message, that the second message is a message used to respond to the request message.
[0099] In an optional implementation, the second message modification module 145 can be used to modify the value of the Ethernet header field of the second message to a value that can be recognized by the public network.
[0100] In an optional implementation, the second message modification module 145 can be used to: delete the outer IP header of the second message; wherein the destination IP field value of the outer IP header is the IP address of the load balancer.
[0101] Server implementation, for example Figure 15 As shown, the method for accelerating message transmission in the above embodiments includes: a receiving module 151, a generating module 152, and a sending module 153.
[0102] The receiving module 151 is used to receive a first message, which is obtained by rewriting a request message by the load balancer. The payload of the first message is the same as that of the request message, and the first message carries the IP address of the load balancer. The generating module 152 is used to generate a second message based on the first message. The destination address of the second message is the IP address of the load balancer. The sending module 153 is used to send the second message.
[0103] In an optional implementation, the server 150 may further include a discrimination module 154, which, after the receiving module 151 receives the first message, determines that the first message is a message for requesting data and carrying the IP address of the load balancer when the IHL field value in the first message is greater than 5.
[0104] In an optional implementation, the generation module 152 can be used to: generate the payload of the second message based on the payload of the first message and the fixed IP header, and generate the outer IP header of the second message based on the IP address of the load balancer; wherein the destination address field of the outer IP header is the IP address of the load balancer.
[0105] In an optional implementation, the generation module 152 is configured to: set the field values in the Ethernet header of the second message generated based on the first message to preset values.
[0106] Systems for accelerating message transmission include the load balancer and the server in any of the above embodiments.
[0107] It is understood that some or all of the steps or operations in the above embodiments are merely examples, and other operations or variations thereof can be performed in the embodiments of this application. Furthermore, the steps may be performed in different orders as presented in the above embodiments, and it is not necessary to perform all the operations in the above embodiments.
[0108] This application also provides an electronic device, including: one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and the one or more computer programs include instructions that, when executed by the device, cause the device to perform the method provided in this application.
[0109] This application also provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the method provided in this application.
[0110] This application also provides a computer program product, which includes a computer program that, when run on a computer, causes the computer to perform the method provided in this application.
[0111] Those skilled in the art will recognize that the units and algorithm steps described in the embodiments disclosed herein can be implemented using electronic hardware, computer software, or a combination of electronic hardware and software. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0112] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0113] In the several embodiments provided in this application, any function, if implemented as a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0114] The above description is merely a specific embodiment of this application. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the protection scope of this application. The protection scope of this application should be determined by the protection scope of the claims.
Claims
1. A method for accelerating transmission of a packet, the method comprising: Applications in load balancers include: Receive request message; Changing the request message to a first message, wherein the first message carries the Internet Protocol IP address of the load balancer, and the source IP address in the IP header of the first message is the same as the source IP address in the IP header of the request message, the process of changing the request message to a first message includes: adding the IP address of the load balancer to the option field of the IP header of the request message; Send the first message, wherein the payload of the first message is the same as that of the request message, and the destination IP address of the first message is the IP address of the server; Receive a second message, which is generated by the server based on the first message. The destination address of the second message is the IP address of the load balancer, and the payload of the second message is generated based on the payload of the first message and the source IP address. The second message is changed to a third message, which does not carry the IP address of the load balancer, but carries the payload of the second message, and the destination IP address of the third message is the source IP address of the request message. Send the third message.
2. The method of claim 1, wherein, The receive request message includes: Based on the Ethernet header field value of the request message, the request message is determined to be a message used to request data.
3. The method of claim 1, wherein, Changing the request message to the first message also includes: Modify the IHL field value of the IP header of the request message to be greater than 5.
4. The method of claim 1, wherein, The receipt of the second message includes: Based on the Ethernet header field value in the second message, it is determined that the second message is a message used to respond to the request message.
5. The method according to claim 1, characterized in that, Change the second message to the third message, including: Modify the value of the Ethernet header field of the second message to a value that can be recognized by the public network.
6. The method according to any one of claims 1 to 5, characterized in that, Change the second message to the third message, including: Delete the outer IP header of the second message; wherein the destination IP field value of the outer IP header is the IP address of the load balancer.
7. A method for accelerating message transmission, characterized in that, Applied to servers, including: Receive a first message, which is obtained by rewriting a request message by a load balancer. The payload of the first message is the same as that of the request message, and the option field of the IP header of the first message carries the IP address of the load balancer. The source IP address in the IP header of the first message is the same as that in the IP header of the request message. A second message is generated based on the first message. The destination address of the second message is the IP address of the load balancer. The payload of the second message is generated based on the payload of the first message and the source IP address. The payload of the second message is a response message to the request message. The second message is sent, causing the load balancer to change the second message into a third message and send the third message. The third message does not carry the IP address of the load balancer, but carries the payload of the second message. The destination IP address of the third message is the source IP address of the request message.
8. The method according to claim 7, characterized in that, After receiving the first message, the method further includes: When the IHL field value in the first message is greater than 5, the first message is determined to be a message used to request data and carrying the IP address of the load balancer.
9. The method according to claim 7, characterized in that, Generate a second message based on the first message, including: The payload of the second packet is generated based on the payload of the first packet and the fixed IP header, and the outer IP header of the second packet is generated based on the IP address of the load balancer; wherein the destination address field of the outer IP header is the IP address of the load balancer.
10. The method according to any one of claims 7 to 9, characterized in that, Generate a second message based on the first message, including: The field values in the Ethernet header of the second message generated based on the first message are preset values.
11. A load balancer, characterized in that, include: The first receiving module is used to receive request messages; The first message modification module is used to modify the request message into a first message, wherein the first message carries the Internet Protocol IP address of the load balancer, and the source IP address in the IP header of the first message is the same as the source IP address in the IP header of the request message. Modifying the request message into a first message includes: adding the IP address of the load balancer to the option field of the IP header of the request message. A first sending module is configured to send the first message, wherein the payload of the first message is the same as that of the request message, and the destination IP address of the first message is the IP address of the server. The second receiving module is used to receive a second message, which is generated by the server based on the first message. The destination address of the second message is the IP address of the load balancer, and the payload of the second message is generated based on the payload of the first message and the source IP address. The second message modification module is used to modify the second message into a third message, wherein the third message does not carry the IP address of the load balancer, the third message carries the payload of the second message, and the destination IP address of the third message is the source IP address of the request message; The second sending module is used to send the third message.
12. The load balancer according to claim 11, characterized in that, The first receiving module is used for: Based on the Ethernet header field value of the request message, the request message is determined to be a message used to request data.
13. The load balancer according to claim 11, characterized in that, The first reporting and modification module is also used for: Modify the IHL field value of the IP header of the request message to be greater than 5.
14. The load balancer according to claim 11, characterized in that, The second receiving module is used for: Based on the Ethernet header field value in the second message, it is determined that the second message is a message used to respond to the request message.
15. The load balancer according to claim 11, characterized in that, The second reporting and modification module is used for: Modify the value of the Ethernet header field of the second message to a value that can be recognized by the public network.
16. The load balancer according to any one of claims 11 to 15, characterized in that, The second reporting and modification module is used for: Delete the outer IP header of the second message; wherein the destination IP field value of the outer IP header is the IP address of the load balancer.
17. A server, characterized in that, include: The receiving module is used to receive a first message, which is obtained by rewriting a request message by a load balancer. The payload of the first message is the same as that of the request message, and the option field of the IP header of the first message carries the IP address of the load balancer. The source IP address in the IP header of the first message is the same as the source IP address in the IP header of the request message. The generation module is used to generate a second message based on the first message, wherein the destination address of the second message is the IP address of the load balancer, the payload of the second message is generated based on the payload of the first message and the source IP address, and the payload of the second message is a response message to the request message; The sending module is used to send the second message, causing the load balancer to change the second message into a third message and send the third message. The third message does not carry the IP address of the load balancer, but carries the payload of the second message. The destination IP address of the third message is the source IP address of the request message.
18. The server according to claim 17, characterized in that, The server also includes: The discrimination module is used to determine, after the receiving module receives the first message, that the first message is a message for requesting data and carrying the IP address of the load balancer when the IHL field value in the first message is greater than 5.
19. The server according to claim 17, characterized in that, The generation module is used for: The payload of the second packet is generated based on the payload of the first packet and the fixed IP header, and the outer IP header of the second packet is generated based on the IP address of the load balancer; wherein the destination address field of the outer IP header is the IP address of the load balancer.
20. The server according to any one of claims 17 to 19, characterized in that, The generation module is used for: The field values in the Ethernet header of the second message generated based on the first message are preset values.
21. A system for accelerating message transmission, characterized in that, Includes the load balancer as described in any one of claims 11 to 16 and the server as described in any one of claims 17 to 20.
22. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when run on a computer, causes the computer to perform the method described in any one of claims 1 to 10.
Citation Information
Patent Citations
Load balancing method, apparatus and system
CN106686085A
Load balancing method, device and system
CN111866064A
Message processing method and device, load balancer and server
CN112437127A