Data transmission method and apparatus, device, and storage medium
By inserting a preset message header and adjusting the handshake message sequence number in the Layer 4 load balancer, the problem of the Layer 4 load balancer being unable to transmit the client IP address was solved, thus enabling the transmission of target data and improving work efficiency and performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING BAIDU NETCOM SCI & TECH CO LTD
- Filing Date
- 2023-06-12
- Publication Date
- 2026-05-01
AI Technical Summary
Layer 4 load balancers cannot effectively transmit client IP addresses and other related information, making it impossible for backend servers to audit and statistically analyze access sources. Furthermore, existing solutions do not support Proxy Protocols, resulting in complex implementation and high costs.
By inserting a preset header into the Layer 4 load balancer, adjusting the sequence number of the handshake message, and sending a preset header containing the target data before forwarding the client request message, the target data can be transmitted, avoiding the need to adjust the sequence number of subsequent request and response messages packet by packet.
It implements a four-layer load balancer to transmit target data to the server, enriching server functions, improving work efficiency, reducing computational load, improving performance, and reducing data processing latency.
Smart Images

Figure CN116614507B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of communication technology, and in particular to the fields of switches, load balancers and data transmission. Background Technology
[0002] A Layer 4 load balancer (also known as a Layer 4 switch) is a network device that performs load balancing on Transmission Control Protocol (TCP) connections or User Datagram Protocol (UDP) connections. It is widely deployed in data centers, enterprise networks, or cloud networks. Its function is to evenly distribute a large number of network requests from network clients to multiple backend servers, enabling multiple backend servers to respond to network requests simultaneously, thereby improving the overall performance and reliability of backend services. Summary of the Invention
[0003] This disclosure provides a data transmission method, apparatus, device, and storage medium.
[0004] According to one aspect of this disclosure, a data transmission method is provided, applied to a Layer 4 load balancer, comprising:
[0005] The system receives the original synchronization message sent by the client, subtracts the target value from the sequence number in the original synchronization message to obtain the target synchronization message, and sends the target synchronization message to the server. The target value is determined according to the length of the preset message header based on the preset protocol. The preset message header contains the target data and is used by the Layer 4 load balancer to send it to the server before forwarding the client's request message.
[0006] The system receives the original synchronization confirmation message sent by the server, adds the target value to the confirmation sequence number in the original synchronization confirmation message to obtain the target synchronization confirmation message, and sends the target synchronization confirmation message to the client.
[0007] The system receives the original confirmation message sent by the client, subtracts the target value from the sequence number in the original confirmation message to obtain the target confirmation message, and sends the target confirmation message to the server.
[0008] According to another aspect of this disclosure, a data transmission method is provided, applied to a Layer 4 load balancer, comprising:
[0009] The system receives the original request message sent by the client, adds the target value to the sequence number in the original request message to obtain the target request message, and sends the target request message to the server. The target value is determined according to the length of the preset message header based on the preset protocol. The preset message header contains the target data and is used by the Layer 4 load balancer to send it to the server before forwarding the client's request message.
[0010] The system receives the original response message sent by the server, subtracts the target value from the acknowledgment number in the original response message to obtain the target response message, and sends the target response message to the client.
[0011] According to another aspect of this disclosure, a data transmission apparatus is provided, configured in a Layer 4 load balancer, comprising:
[0012] The synchronization message processing module is used to receive the original synchronization message sent by the client, subtract the target value from the sequence number in the original synchronization message to obtain the target synchronization message, and send the target synchronization message to the server. The target value is determined according to the length of the preset message header based on the preset protocol. The preset message header contains the target data and is used by the Layer 4 load balancer to send it to the server before forwarding the client's request message.
[0013] The synchronization confirmation message processing module is used to receive the original synchronization confirmation message sent by the server, add the target value to the confirmation sequence number in the original synchronization confirmation message to obtain the target synchronization confirmation message, and send the target synchronization confirmation message to the client.
[0014] The acknowledgment message processing module is used to receive the original acknowledgment message sent by the client, subtract the target value from the sequence number in the original acknowledgment message to obtain the target acknowledgment message, and send the target acknowledgment message to the server.
[0015] According to another aspect of this disclosure, a data transmission apparatus is provided, configured in a Layer 4 load balancer, comprising:
[0016] The request message processing module is used to receive the original request message sent by the client, add the target value to the sequence number in the original request message to obtain the target request message, and send the target request message to the server. The target value is determined according to the length of the preset message header based on the preset protocol. The preset message header contains the target data. The preset message header is used by the Layer 4 load balancer to send to the server before forwarding the client's request message.
[0017] The response message processing module is used to receive the original response message sent by the server, subtract the target value from the acknowledgment number in the original response message to obtain the target response message, and send the target response message to the client.
[0018] According to another aspect of this disclosure, an electronic device is provided, comprising:
[0019] At least one processor; and
[0020] A memory communicatively connected to the at least one processor; wherein,
[0021] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the methods described in the embodiments of this disclosure.
[0022] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are configured to cause the computer to perform the methods described in embodiments of this disclosure.
[0023] According to another aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the methods described in any embodiment of this disclosure.
[0024] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0025] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0026] Figure 1 This is a schematic diagram of the working process of a four-layer load balancer in related technologies;
[0027] Figure 2 This is a flowchart of a data transmission method provided according to an embodiment of the present disclosure;
[0028] Figure 3 This is a flowchart of yet another data transmission method provided according to an embodiment of the present disclosure;
[0029] Figure 4 This is a schematic diagram of the interaction process of a data transmission method provided according to an embodiment of the present disclosure;
[0030] Figure 5 This is a flowchart of yet another data transmission method provided according to an embodiment of the present disclosure;
[0031] Figure 6 This is a flowchart of another data transmission method provided according to an embodiment of the present disclosure;
[0032] Figure 7 This is a flowchart of another data transmission method provided according to an embodiment of the present disclosure;
[0033] Figure 8 This is a schematic diagram of the interaction process of another data transmission method provided according to an embodiment of the present disclosure;
[0034] Figure 9 This is a schematic diagram of a data transmission device according to an embodiment of the present disclosure;
[0035] Figure 10 This is a schematic diagram of another data transmission device provided according to an embodiment of the present disclosure;
[0036] Figure 11 This is a block diagram of an electronic device used to implement the data transmission method of the embodiments of this disclosure. Detailed Implementation
[0037] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0038] To better understand the technical solutions of the embodiments of this disclosure, the relevant technologies are described below.
[0039] Layer 4 load balancers typically operate in proxy mode. Figure 1 This is a schematic diagram illustrating the working process of a four-layer load balancer in related technologies. For example... Figure 1As shown, in proxy mode, a request and response process between the client and the server usually includes the following four steps: (1) The client initiates a request, and the request message arrives at the load balancer; (2) The load balancer receives the request message, selects a backend server according to the scheduling algorithm, and then forwards the request message to the server; (3) After receiving the request message, the server generates a response message and sends the response message to the load balancer; (4) After receiving the server's response message, the load balancer forwards the response message to the client. The message includes the Internet Protocol (IP) header, the TCP header, and application layer data. The IP header includes the source IP and the destination IP. Because the load balancer is a proxy for access, the source address information seen by the backend server, such as the source IP address, is the proxy server IP (the load balancer's IP address), not the original client's IP address. In some application scenarios, the backend server needs to obtain the original client IP address for auditing and statistics of the access source. Currently, related technologies use a Layer 7 load balancer to transmit client IP addresses and other related information, which a Layer 4 load balancer cannot achieve.
[0040] Figure 2 This is a flowchart illustrating a data transmission method according to an embodiment of this disclosure. This embodiment is applicable to situations where data is transmitted to a server via a Layer 4 load balancer. The method can be executed by a data transmission device, which can be implemented in hardware and / or software and configured in an electronic device, which can be configured as a Layer 4 load balancer. (Reference) Figure 2 The method specifically includes the following:
[0041] S201. Receive the original synchronization message sent by the client, subtract the target value from the sequence number in the original synchronization message to obtain the target synchronization message, and send the target synchronization message to the server. The target value is determined according to the length of the preset message header based on the preset protocol. The preset message header contains the target data. The preset message header is used by the Layer 4 load balancer to send to the server before forwarding the client's request message.
[0042] S202. Receive the original synchronization confirmation message sent by the server, add the target value to the confirmation sequence number in the original synchronization confirmation message to obtain the target synchronization confirmation message, and send the target synchronization confirmation message to the client.
[0043] S203. Receive the original confirmation message sent by the client, subtract the target value from the sequence number in the original confirmation message to obtain the target confirmation message, and send the target confirmation message to the server.
[0044] The preset protocol can be any protocol capable of data transmission between the Layer 4 load balancer and the server, and the specific protocol type is not limited. For example, the preset protocol could include a proxy protocol. The proxy protocol is a commonly used network protocol in network proxy servers, used to transmit connection information to backend servers. Proxy Protocol is widely used in various proxy servers and has become an open standard. Using Proxy Protocol as the preset protocol can improve the applicability of the technical solution in this disclosure embodiment and reduce implementation difficulty, avoiding the implementation costs associated with modifications to the Layer 4 load balancer and server due to the use of customized protocols. Currently, devices supporting Proxy Protocol are all Layer 7 load balancers (i.e., application layer load balancers) because Proxy Protocol requires inserting the Proxy Protocol header at the application layer. Layer 7 load balancers operate at the application layer, focusing only on user data and not on packet sequence numbers, making information addition relatively simple. However, there are currently no solutions supporting Proxy Protocol for Layer 4 load balancers.
[0045] For example, the target data may include connection information related to the client and / or load balancer, such as the client's address information and / or the front-end address information of the Layer 4 load balancer; the target data may also include other custom types of data, which can be set according to actual needs. By transmitting target data to the server, the server can achieve richer functions. For example, the client's IP address can be used to count the source of access; another example is the front-end IP address of the Layer 4 load balancer, which is the IP address that receives the packets sent by the client, or the destination IP in the packets sent by the client. The Layer 4 load balancer may be configured with multiple services, and different services correspond to different front-end IP addresses. The server can determine which service in the Layer 4 load balancer the traffic corresponds to by obtaining the front-end IP address. Here, the server may also be a Layer 7 load balancer. After receiving the packets from the Layer 4 load balancer, the Layer 7 load balancer forwards them to the final back-end server.
[0046] In this embodiment, the target data is included in a preset header based on a preset protocol, so that the Layer 4 load balancer can transmit the target data to the server by sending the preset header. The specific method of sending the preset header is not limited; it can be added to the message forwarded to the server or included in the message constructed by the Layer 4 load balancer based on the preset protocol. The preset header can be sent to the server by the Layer 4 load balancer before forwarding the client's request message.
[0047] For example, when a client and a server establish a TCP connection, a three-way handshake is required, which involves exchanging handshake messages. These handshake messages include a SYN (synchronization) message, a SYN-ACK (synchronization acknowledgment) message, and an ACK (acknowledgment) message. The handshake messages also need to be forwarded by a Layer 4 load balancer. In this embodiment, because the Layer 4 load balancer sends an additional preset header to the server (assuming the preset header length is N), the server receives more data because of the extra data inserted into the TCP connection. This data is not sent by the client, thus affecting the sequence numbers in the messages (including the sequence number in the request message and the acknowledgment number in the response message). To eliminate this effect, the sequence numbers are adjusted in advance during the forwarding of the handshake messages to avoid affecting the interaction of the request and response messages. That is, the sequence numbers in subsequent request and response messages do not need to be adjusted packet by packet, avoiding the introduction of excessive computation. Especially in some cases, the TCP option field may also contain sequence numbers, such as the sack option. If the sequence numbers in the handshake packet are not adjusted, then the sequence numbers in these options also need to be adjusted packet by packet. Furthermore, TCP options are a flexible and expandable field with uncertain length, and the number and position of options are uncertain, making parsing difficult, implementation logic complex, and overhead greater.
[0048] For example, the original synchronization message can be understood as a synchronization message sent by the client to the Layer 4 load balancer. After receiving the original synchronization message, the Layer 4 load balancer subtracts the target value from the sequence number (seq) in the original synchronization message to obtain the target synchronization message to be sent to the server. The target value can be, for example, the preset header length N. Before obtaining the target synchronization message, in addition to adjusting the sequence number, other adjustment operations may also occur, which are not limited to this.
[0049] For example, after receiving the target synchronization message, the server can send a corresponding synchronization acknowledgment message to the Layer 4 load balancer, denoted as the original synchronization acknowledgment message. The Layer 4 load balancer receives the original synchronization acknowledgment message, adds the target value to the acknowledgment sequence number (ack_seq) in the original synchronization acknowledgment message, and obtains the target synchronization acknowledgment message to be sent to the client. Before receiving the target synchronization acknowledgment message, in addition to adjusting the acknowledgment sequence number, other adjustment operations may also occur, which are not limited to specific operations.
[0050] For example, after receiving the target synchronization acknowledgment message, the client can send a corresponding acknowledgment message to the Layer 4 load balancer, denoted as the original acknowledgment message. Upon receiving the original acknowledgment message, the Layer 4 load balancer subtracts the target value from the sequence number (seq) in the original acknowledgment message to obtain the target acknowledgment message to be sent to the server. Before receiving the target acknowledgment message, other adjustment operations may occur besides adjusting the sequence number; specific adjustments are not limited.
[0051] The data transmission scheme provided in this disclosure can send target data to the server using a Layer 4 load balancer, enriching the server's functions related to the target data. Before forwarding the client's request message, a preset message header containing the target data is sent, and the relevant sequence numbers in the handshake message are pre-adjusted according to the length of the preset message header. This avoids adjusting the sequence numbers in subsequent request and response messages packet by packet, avoiding the introduction of excessive computation, which helps improve the working efficiency of the Layer 4 load balancer, improve product performance, and reduce data processing latency.
[0052] In one optional implementation, after sending the target acknowledgment message to the server, the method further includes: receiving a request message sent by the client; and forwarding the request message to the server. Therefore, after adjusting the relevant sequence numbers during the handshake phase, the Layer 4 load balancer does not need to adjust the sequence numbers upon receiving the request message from the client; it can forward it normally, thus improving the efficiency of the Layer 4 load balancer.
[0053] In one optional implementation, after forwarding the request message to the server, the method further includes: receiving a response message sent by the server; and forwarding the response message to the client. Therefore, after adjusting the relevant sequence numbers during the handshake phase, the Layer 4 load balancer does not need to adjust the acknowledgment sequence number upon receiving the response message from the server; it can forward it normally, thus improving the efficiency of the Layer 4 load balancer.
[0054] Figure 3 This is a flowchart of another data transmission method provided according to an embodiment of this disclosure. Based on the above-described optional embodiments, this embodiment proposes an optional scheme: sending a preset message header by constructing a target message based on a preset protocol. See also... Figure 3 The method includes:
[0055] S301. Receive the original synchronization message sent by the client, subtract the target value from the sequence number in the original synchronization message to obtain the target synchronization message, and send the target synchronization message to the server.
[0056] Figure 4This is a schematic diagram of the interaction process of a data transmission method provided according to an embodiment of the present disclosure, such as... Figure 4 As shown, the sequence number seq=R in the original synchronization message (SYN) and the acknowledgment number ack_seq=0. The Layer 4 load balancer adjusts the sequence number and subtracts the target value N to obtain the sequence number seq=RN in the target synchronization message.
[0057] S302. Receive the original synchronization confirmation message sent by the server, add the target value to the confirmation sequence number in the original synchronization confirmation message to obtain the target synchronization confirmation message, and send the target synchronization confirmation message to the client.
[0058] like Figure 4 As shown, in the original SYN-ACK message, the sequence number seq=0 and the acknowledgment number ack_seq=R+1-N. The Layer 4 load balancer adjusts the acknowledgment number and adds the target value N to obtain the acknowledgment number ack_seq=R+1 in the target SYN-ACK message.
[0059] S303. Receive the original acknowledgment message sent by the client, subtract the target value from the sequence number in the original acknowledgment message to obtain the target acknowledgment message, and send the target acknowledgment message to the server.
[0060] like Figure 4 As shown, in the original acknowledgment message (ACK), the sequence number seq = R + 1 and the acknowledgment number ack_seq = 1. The Layer 4 load balancer adjusts the sequence number and subtracts the target value N to obtain the sequence number seq = R + 1 - N in the target acknowledgment message.
[0061] S301 to S303 refer to the TCP three-way handshake sequence number adjustment process.
[0062] S304. Construct a target message based on a preset protocol, wherein the target message includes a preset message header, and the preset message header contains target data.
[0063] S305. Send the target message to the server.
[0064] like Figure 4 As shown, taking the default protocol as Proxy Protocol as an example, a target message containing the Proxy Protocol header is constructed, and the length of the Proxy Protocol header is len=N.
[0065] S304 to S305 are the processes for sending preset message headers.
[0066] S306. Receive the request message sent by the client and forward the request message to the server.
[0067] S307. Receive the response message sent by the server and forward the response message to the client.
[0068] like Figure 4 As shown, after the TCP three-way handshake sequence number adjustment, subsequent data packets do not need to have their sequence numbers modified. For example, for any request packet with seq=S and ack_seq=X, there is no need to adjust for N during forwarding; similarly, for any response packet with seq=Y and ack_seq=A, there is no need to adjust for N during forwarding.
[0069] The data transmission method provided in this embodiment first adjusts the sequence number in the handshake message in advance according to the preset message header length during the handshake phase. Then, it sends the target data to the server by constructing a target message containing target data based on a preset protocol and sending the target message to the server. Subsequent request messages and response messages can be forwarded in a normal forwarding manner without the need for packet-by-packet sequence number adjustment. In the process of sending target data to the server through a Layer 4 load balancer, it avoids introducing a large amount of computation and ensures the working efficiency of the Layer 4 load balancer.
[0070] In one optional implementation, obtaining the target acknowledgment message by subtracting the target value from the sequence number in the original acknowledgment message includes: adding the preset message header to the original acknowledgment message and subtracting the target value from the sequence number in the original acknowledgment message to obtain the target acknowledgment message. The ACK message may or may not carry data. When it does not carry data, it does not consume a sequence number. By multiplexing the ACK message to send the preset message header, the transmission overhead of one message can be reduced, improving the interaction efficiency between the load balancer and the server.
[0071] In one optional implementation, adding the preset header to the original acknowledgment message includes: determining whether the number of remaining bytes in the original acknowledgment message is greater than or equal to a preset value; if so, adding the preset header to the original acknowledgment message, wherein the preset value is greater than or equal to the target value. This ensures the accurate transmission of the preset header.
[0072] The remaining bytes can be understood as the total number of bytes of data that the ACK packet can carry minus the number of bytes of original data carried in the original acknowledgment packet. Theoretically, if the remaining bytes in the original acknowledgment packet equal the target value, a preset header can be added to the original acknowledgment packet. In practice, the remaining bytes may need to be greater than the target value because bytes may need to be shifted before inserting the header. If the remaining space is just enough, it may mean that a lot of bytes need to be shifted, resulting in a large computational overhead. Therefore, to reduce the computational overhead caused by shifting bytes, the condition can be set to the remaining bytes being greater than the target value.
[0073] In one optional implementation, obtaining the target acknowledgment message by subtracting the target value from the sequence number in the original acknowledgment message includes: determining whether the number of remaining bytes in the original acknowledgment message is greater than or equal to a preset value; if not, subtracting the target value from the sequence number in the original acknowledgment message to obtain the target acknowledgment message. After sending the target acknowledgment message to the server, the method further includes: constructing a target message based on the preset protocol, wherein the target message includes the preset message header; and sending the target message to the server. Therefore, when the original acknowledgment message cannot carry the preset message header, a Layer 4 load balancer can separately construct a target message containing the preset message header, ensuring the transmission of the target data.
[0074] Figure 5 This is a flowchart of another data transmission method provided according to an embodiment of this disclosure. Based on the above-described optional embodiments, this embodiment proposes an optional scheme, determining the sending method of the preset message header according to actual conditions. See also... Figure 5 The method includes:
[0075] S501: Receive the original synchronization message sent by the client, subtract the target value from the sequence number in the original synchronization message to obtain the target synchronization message, and send the target synchronization message to the server.
[0076] S502: Receive the original synchronization confirmation message sent by the server, add the target value to the confirmation sequence number in the original synchronization confirmation message to obtain the target synchronization confirmation message, and send the target synchronization confirmation message to the client.
[0077] S503, Receive the original acknowledgment message sent by the client.
[0078] S504. Determine whether the number of remaining bytes in the original acknowledgment message is greater than or equal to a preset value. If yes, execute S505; otherwise, execute S506.
[0079] S505. Add a preset header to the original acknowledgment message, subtract the target value from the sequence number in the original acknowledgment message to obtain the target acknowledgment message, and send the target acknowledgment message to the server, executing 508.
[0080] S506. Subtract the target value from the sequence number in the original acknowledgment message to obtain the target acknowledgment message, and send the target acknowledgment message to the server.
[0081] S507. Construct a target message based on a preset protocol and send the target message to the server.
[0082] S508: Receive the request message sent by the client and forward the request message to the server.
[0083] S509: Receive the response message sent by the server and forward the response message to the client.
[0084] The data transmission method provided in this disclosure, during the handshake phase, pre-adjusts the sequence number in the handshake message according to the length of the preset message header, and dynamically determines and sends a preset message header containing target data to the server based on the number of remaining bytes in the original acknowledgment message sent by the client. This approach can balance the message transmission overhead between the Layer 4 load balancer and the server with the accurate transmission of the target data.
[0085] In one optional implementation, the Layer 4 load balancer includes load balancing software and pre-set hardware. The load balancing software handles the processing of handshake messages, while the pre-set hardware handles the processing of request and response messages. The handshake messages include synchronization messages, synchronization acknowledgment messages, and acknowledgment messages. Therefore, a Layer 4 load balancer can be implemented using an integrated hardware and software device, supporting the transmission of target data and improving the performance of the Layer 4 load balancer.
[0086] For example, the preset hardware could be dedicated hardware, such as a switching chip. Offloading the processing logic to the preset hardware can accelerate performance (e.g., by tenfold). However, currently, dedicated hardware cannot support sequence number adjustments in TCP options because TCP option processing is too complex. By implementing handshake message processing (e.g., S201 to S203) through load balancing software and request and response message processing (e.g., S306 to S307) through the preset hardware, the preset hardware does not need to execute sequence number adjustment logic, thus improving the overall performance of the Layer 4 load balancer.
[0087] Figure 6This is a flowchart of another data transmission method provided according to an embodiment of the present disclosure. This embodiment is applicable to situations where data is transmitted to a server via a Layer 4 load balancer. The method can be executed by a data transmission device, which can be implemented in hardware and / or software and can be configured in an electronic device, which can be configured as a Layer 4 load balancer. (Reference) Figure 6 The method specifically includes the following:
[0088] S601. Receive the original request message sent by the client, add the target value to the sequence number in the original request message to obtain the target request message, and send the target request message to the server. The target value is determined according to the length of the preset message header based on the preset protocol. The preset message header contains the target data. The preset message header is used by the Layer 4 load balancer to send to the server before forwarding the client's request message.
[0089] S602. Receive the original response message sent by the server, subtract the target value from the acknowledgment number in the original response message to obtain the target response message, and send the target response message to the client.
[0090] For explanations regarding the preset protocol, target data, and preset message header, please refer to the relevant content above, which will not be repeated here.
[0091] Optionally, the target data includes the client's address information and / or the front-end address information of the Layer 4 load balancer.
[0092] Optionally, the preset protocol includes a proxy protocol.
[0093] For example, the original request message can be understood as a request message sent by the client to the Layer 4 load balancer. Since the Layer 4 load balancer sends a preset protocol header of length N before forwarding the request message, adding the target value (such as N) to the sequence number (seq) in the original request message yields the target request message to be sent to the server. Before obtaining the target request message, in addition to adjusting the sequence number, other adjustment operations may also occur, which are not limited to this.
[0094] For example, after receiving the target request message, the server can send a corresponding response message to the Layer 4 load balancer, denoted as the original response message. The Layer 4 load balancer receives the original response message, subtracts the target value from the acknowledgment number (ack_seq) in the original response message, and obtains the target response message to be sent to the client. Before obtaining the target response message, in addition to adjusting the acknowledgment number, other adjustments may be performed, which are not limited to specific adjustments.
[0095] The data transmission scheme provided in this disclosure can send target data to the server using a Layer 4 load balancer, enriching the server's functions related to the target data. Furthermore, it sends a preset header containing the target data before forwarding the client's request message, and adjusts the relevant sequence numbers in subsequent request and response messages based on the length of the preset header, ensuring the accuracy of message interaction between the client and the server.
[0096] Figure 7 This is a flowchart of another data transmission method provided according to an embodiment of this disclosure. Based on the above-described optional embodiments, this embodiment proposes an optional scheme: sending a preset message header by constructing a target message based on a preset protocol. See also... Figure 7 The method includes:
[0097] S701. Construct a target message based on a preset protocol, wherein the target message includes a preset message header, and the preset message header contains target data.
[0098] In this embodiment of the disclosure, the relevant sequence numbers may not be adjusted during the handshake phase, that is, normal forwarding may be performed.
[0099] Figure 8 This is a schematic diagram of the interaction process of another data transmission method provided according to an embodiment of this disclosure, such as... Figure 8 As shown, during normal forwarding of the TCP three-way handshake phase, seq=R and ack_seq=0 in SYN, no adjustment is needed during forwarding; seq=0 and ack_seq=R+1 in SYN-ACK, no adjustment is needed during forwarding; and seq=R+1 and ack_seq=1 in ACK, no adjustment is needed during forwarding.
[0100] Subsequently, taking the default protocol as Proxy Protocol as an example, a target message containing the Proxy Protocol header is constructed, with the length of the Proxy Protocol header being len=N.
[0101] S702, Send the target message to the server.
[0102] S703: Receive the original request message sent by the client, add the target value to the sequence number in the original request message to obtain the target request message, and send the target request message to the server.
[0103] like Figure 8 As shown, for any request message where seq=S and ack_seq=X, during forwarding, the sequence number seq in the original request message is added to N to obtain the sequence number in the target request message, seq=S+N.
[0104] S704. Receive the original response message sent by the server, subtract the target value from the acknowledgment number in the original response message to obtain the target response message, and send the target response message to the client.
[0105] like Figure 8 As shown, for any response message where seq=Y and ack_seq=A, during forwarding, the acknowledgment number ack_seq in the original response message is subtracted from N to obtain the acknowledgment number in the target response message, ack_seq=AN.
[0106] The data transmission method provided in this embodiment does not adjust the sequence during the handshake phase. Instead, it sends the target data to the server by constructing a target message containing the target data based on a preset protocol and sending the target message to the server. Subsequent request and response messages are adjusted packet by packet based on the length of the preset protocol header to ensure the accuracy of message interaction between the client and the server.
[0107] In one optional implementation, before receiving the original request message sent by the client, the method further includes: receiving the original acknowledgment message sent by the client, adding the preset header to the original acknowledgment message to obtain a target acknowledgment message, and sending the target acknowledgment message to the server. Thus, by multiplexing the ACK message for sending the preset header, the transmission overhead of a single message can be reduced, improving the interaction efficiency between the load balancer and the server.
[0108] In one optional implementation, adding the preset header to the original acknowledgment message includes: determining whether the number of remaining bytes in the original acknowledgment message is greater than or equal to a preset value; if so, adding the preset header to the original acknowledgment message, wherein the preset value is greater than or equal to the target value. This ensures the accurate transmission of the preset header.
[0109] In one optional implementation, after determining whether the number of remaining bytes in the original acknowledgment message is greater than or equal to a preset value, if not, a target message based on a preset protocol is constructed before the original request message sent by the receiving client, wherein the target message includes the preset message header; the target message is then sent to the server. Thus, when the original acknowledgment message cannot carry the preset message header, a Layer 4 load balancer can separately construct a target message containing the preset message header, ensuring the transmission of the target data.
[0110] Figure 9This is a schematic diagram of a data transmission device according to an embodiment of the present disclosure. This embodiment is applicable to situations where data is transmitted to a server via a Layer 4 load balancer. The device can be implemented in hardware and / or software and can be configured in an electronic device, which can be configured as a Layer 4 load balancer. (Reference) Figure 9 The data transmission device 900 includes:
[0111] The synchronization message processing module 901 is used to receive the original synchronization message sent by the client, subtract the target value from the sequence number in the original synchronization message to obtain the target synchronization message, and send the target synchronization message to the server. The target value is determined according to the length of the preset message header based on the preset protocol. The preset message header contains the target data and is used by the Layer 4 load balancer to send it to the server before forwarding the client's request message.
[0112] The synchronization confirmation message processing module 902 is used to receive the original synchronization confirmation message sent by the server, add the target value to the confirmation sequence number in the original synchronization confirmation message to obtain the target synchronization confirmation message, and send the target synchronization confirmation message to the client.
[0113] The acknowledgment message processing module 903 is used to receive the original acknowledgment message sent by the client, subtract the target value from the sequence number in the original acknowledgment message to obtain the target acknowledgment message, and send the target acknowledgment message to the server.
[0114] The data transmission scheme provided in this disclosure can send target data to the server using a Layer 4 load balancer, enriching the server's functions related to the target data. Before forwarding the client's request message, a preset message header containing the target data is sent, and the relevant sequence numbers in the handshake message are pre-adjusted according to the length of the preset message header. This avoids adjusting the sequence numbers in subsequent request and response messages packet by packet, avoiding the introduction of excessive computation, which helps improve the working efficiency of the Layer 4 load balancer, improve product performance, and reduce data processing latency.
[0115] In one alternative implementation, it further includes:
[0116] The request message receiving module is used to receive the request message sent by the client after the target confirmation message is sent to the server;
[0117] The request message forwarding module is used to forward the request message to the server.
[0118] In one alternative implementation, it further includes:
[0119] The response message receiving module is used to receive the response message sent by the server after the request message is forwarded to the server.
[0120] The response message forwarding module is used to forward the response message to the client.
[0121] In one alternative implementation, it further includes:
[0122] The first message construction module is used to construct a target message based on the preset protocol after the target acknowledgment message is sent to the server, wherein the target message includes the preset message header;
[0123] The first message sending module sends the target message to the server.
[0124] In one optional implementation, the acknowledgment message processing module includes:
[0125] The original acknowledgment message receiving unit is used to receive the original acknowledgment message sent by the client;
[0126] The target confirmation message determination unit is used to add the preset message header to the original confirmation message and subtract the target value from the sequence number in the original confirmation message to obtain the target confirmation message.
[0127] The target confirmation message sending unit is used to send the target confirmation message to the server.
[0128] In one optional implementation, the target acknowledgment message determination unit includes:
[0129] The byte count determination subunit is used to determine whether the number of remaining bytes in the original acknowledgment message is greater than or equal to a preset value, wherein the preset value is greater than or equal to the target value;
[0130] The first determining subunit is configured to, when the number of remaining bytes is greater than or equal to a preset value, add the preset message header to the original acknowledgment message and subtract the target value from the sequence number in the original acknowledgment message to obtain the target acknowledgment message.
[0131] In one optional implementation, the target acknowledgment message determination unit further includes:
[0132] The second determining subunit is used to subtract the target value from the sequence number in the original acknowledgment message when the number of remaining bytes is less than a preset value, so as to obtain the target acknowledgment message;
[0133] The device further includes:
[0134] The second message construction module is used to construct a target message based on the preset protocol after the target acknowledgment message is sent to the server, wherein the target message includes the preset message header;
[0135] The second message sending module is used to send the target message to the server.
[0136] In one optional implementation, the Layer 4 load balancer includes load balancing software and preset hardware. The load balancing software performs related processing of handshake messages, and the preset hardware performs related processing of request messages and response messages. The handshake messages include synchronization messages, synchronization acknowledgment messages, and acknowledgment messages.
[0137] In one alternative implementation, the target data includes the client's address information and / or the front-end address information of the Layer 4 load balancer.
[0138] In one alternative implementation, the preset protocol includes a proxy protocol.
[0139] Figure 10 This is a schematic diagram of another data transmission device provided according to an embodiment of the present disclosure. This embodiment is applicable to situations where data is transmitted to a server via a Layer 4 load balancer. The device can be implemented in hardware and / or software and can be configured in an electronic device, which can be configured as a Layer 4 load balancer. (Reference) Figure 10 The data transmission device 1000 includes:
[0140] The request message processing module 1001 is used to receive the original request message sent by the client, add the target value to the sequence number in the original request message to obtain the target request message, and send the target request message to the server. The target value is determined according to the length of the preset message header based on the preset protocol. The preset message header contains the target data. The preset message header is used by the Layer 4 load balancer to send to the server before forwarding the client's request message.
[0141] The response message processing module 1002 is used to receive the original response message sent by the server, subtract the target value from the acknowledgment number in the original response message to obtain the target response message, and send the target response message to the client.
[0142] The data transmission scheme provided in this disclosure can send target data to the server using a Layer 4 load balancer, enriching the server's functions related to the target data. Furthermore, it sends a preset header containing the target data before forwarding the client's request message, and adjusts the relevant sequence numbers in subsequent request and response messages based on the length of the preset header, ensuring the accuracy of message interaction between the client and the server.
[0143] In one alternative implementation, it further includes:
[0144] The first construction module is used to construct a target message based on a preset protocol before the original request message sent by the receiving client, wherein the target message includes the preset message header;
[0145] The first sending module is used to send the target message to the server.
[0146] In one alternative implementation, it further includes:
[0147] The original acknowledgment message receiving module is used to receive the original acknowledgment message sent by the client before the original request message sent by the receiving client is sent.
[0148] The target confirmation message determination module is used to add the preset message header to the original confirmation message to obtain the target confirmation message, and send the target confirmation message to the server.
[0149] In one optional implementation, the target acknowledgment message determination module is specifically used for:
[0150] Determine whether the number of remaining bytes in the original acknowledgment message is greater than or equal to a preset value. If so, add the preset message header to the original acknowledgment message, wherein the preset value is greater than or equal to the target value.
[0151] In one alternative implementation, it further includes:
[0152] The second construction module is used to determine whether the number of remaining bytes in the original confirmation message is greater than or equal to a preset value. If not, it constructs a target message based on a preset protocol before receiving the original request message sent by the receiving client. The target message includes the preset message header.
[0153] The second sending module is used to send the target message to the server.
[0154] In one alternative implementation, the target data includes the client's address information and / or the front-end address information of the Layer 4 load balancer.
[0155] In one alternative implementation, the preset protocol includes a proxy protocol.
[0156] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in this technical solution comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0157] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0158] Figure 11 A schematic block diagram of an example electronic device 1100 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0159] like Figure 11 As shown, the electronic device 1100 includes a computing unit 1101, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1102 or a computer program loaded into a random access memory (RAM) 1103 from a storage unit 1108. The RAM 1103 may also store various programs and data required for the operation of the electronic device 1100. The computing unit 1101, ROM 1102, and RAM 1103 are interconnected via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.
[0160] Multiple components in electronic device 1100 are connected to I / O interface 1105, including: input unit 1106, such as keyboard, mouse, etc.; output unit 1107, such as various types of displays, speakers, etc.; storage unit 1108, such as disk, optical disk, etc.; and communication unit 1109, such as network card, modem, wireless transceiver, etc. Communication unit 1109 allows electronic device 1100 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0161] The computing unit 1101 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 1101 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1101 performs the various methods and processes described above, such as data transfer methods. For example, in some embodiments, the data transfer method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 1108. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 1100 via ROM 1102 and / or communication unit 1109. When the computer program is loaded into RAM 1103 and executed by the computing unit 1101, one or more steps of the data transfer method described above may be performed. Alternatively, in other embodiments, the computing unit 1101 may be configured to perform the data transfer method by any other suitable means (e.g., by means of firmware).
[0162] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include: implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0163] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0164] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0165] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0166] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0167] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is established by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service ecosystem that addresses the management difficulties and weak business scalability inherent in traditional physical hosting and VPS services. Servers can also be servers for distributed systems or servers integrated with blockchain technology.
[0168] Artificial intelligence (AI) is the study of enabling computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). It encompasses both hardware and software technologies. AI hardware technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, and big data processing. AI software technologies mainly include computer vision, speech recognition, natural language processing, machine learning / deep learning, big data processing, and knowledge graph technologies.
[0169] Cloud computing refers to a technology system that enables access to a shared pool of physical or virtual resources via a network. These resources can include servers, operating systems, networks, software, applications, and storage devices, and can be deployed and managed on demand and in a self-service manner. Cloud computing technology can provide efficient and powerful data processing capabilities for applications such as artificial intelligence and blockchain, as well as for model training.
[0170] It should be understood that the various forms of processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution provided in this disclosure can be achieved, and this is not limited herein.
[0171] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A data transmission method applied to a Layer 4 load balancer, comprising: The system receives the original synchronization message sent by the client, subtracts the target value from the sequence number in the original synchronization message to obtain the target synchronization message, and sends the target synchronization message to the server. The target value is determined based on the length of a preset message header according to a preset protocol. The preset message header contains target data and is sent by the Layer 4 load balancer to the server before forwarding the client's request message. The target data includes the client's address information and / or the Layer 4 load balancer's front-end address information. The client's address information is used for statistical analysis of the access source. The Layer 4 load balancer's front-end address information is the address information that receives the message sent by the client. The system receives the original synchronization confirmation message sent by the server, adds the target value to the confirmation sequence number in the original synchronization confirmation message to obtain the target synchronization confirmation message, and sends the target synchronization confirmation message to the client. The system receives the original confirmation message sent by the client, subtracts the target value from the sequence number in the original confirmation message to obtain the target confirmation message, and sends the target confirmation message to the server. Construct a target message based on the preset protocol, wherein the target message includes the preset message header; Send the target message to the server; or, The step of subtracting the target value from the sequence number in the original acknowledgment message to obtain the target acknowledgment message includes: The preset header is added to the original acknowledgment message, and the target value is subtracted from the sequence number in the original acknowledgment message to obtain the target acknowledgment message.
2. The method according to claim 1, further comprising, after sending the target acknowledgment message to the server: Receive the request message sent by the client; Forward the request message to the server; Receive the response message sent by the server; The response message is forwarded to the client.
3. The method according to claim 1, wherein, Adding the preset header to the original acknowledgment message includes: Determine whether the number of remaining bytes in the original acknowledgment message is greater than or equal to a preset value. If so, add the preset message header to the original acknowledgment message, wherein the preset value is greater than or equal to the target value.
4. The method according to claim 3, wherein subtracting the target value from the sequence number in the original acknowledgment message to obtain the target acknowledgment message comprises: If the number of remaining bytes in the original acknowledgment message is less than the preset value, then the target value is subtracted from the sequence number in the original acknowledgment message to obtain the target acknowledgment message; After sending the target confirmation message to the server, the method further includes: Construct a target message based on the preset protocol, wherein the target message includes the preset message header; The target message is sent to the server.
5. The method according to claim 1, wherein, The layer 4 load balancer includes load balancing software and preset hardware. The load balancing software performs the processing of handshake messages, and the preset hardware performs the processing of request messages and response messages. The handshake messages include synchronization messages, synchronization acknowledgment messages, and acknowledgment messages.
6. The method according to any one of claims 1-5, wherein the preset protocol includes a proxy protocol.
7. A data transmission method applied to a Layer 4 load balancer, comprising: Construct a target message based on a preset protocol, wherein the target message includes a preset message header; Send the target message to the server; or, The system receives the original acknowledgment message sent by the client, adds the preset message header to the original acknowledgment message to obtain the target acknowledgment message, and sends the target acknowledgment message to the server. The system receives an initial request message from a client, adds a target value to the sequence number in the initial request message to obtain a target request message, and sends the target request message to the server. The target value is determined based on the length of a preset header according to a preset protocol. The preset header contains target data and is sent by the Layer 4 load balancer to the server before forwarding the client's request message. The target data includes the client's address information and / or the Layer 4 load balancer's front-end address information. The client's address information is used for statistical analysis of the access source. The Layer 4 load balancer's front-end address information is the address information that receives the message sent by the client. The system receives the original response message sent by the server, subtracts the target value from the acknowledgment number in the original response message to obtain the target response message, and sends the target response message to the client.
8. The method according to claim 7, wherein, Adding the preset header to the original acknowledgment message includes: Determine whether the number of remaining bytes in the original acknowledgment message is greater than or equal to a preset value. If so, add the preset message header to the original acknowledgment message, wherein the preset value is greater than or equal to the target value.
9. The method according to claim 8, after determining whether the number of remaining bytes in the original acknowledgment message is greater than or equal to a preset value, further comprising: If not, before receiving the original request message sent by the client, a target message based on a preset protocol is constructed, wherein the target message includes the preset message header; The target message is sent to the server.
10. The method according to any one of claims 7-9, wherein the preset protocol includes a proxy protocol.
11. A data transmission device configured in a Layer 4 load balancer, comprising: A synchronization message processing module is used to receive the original synchronization message sent by the client, subtract a target value from the sequence number in the original synchronization message to obtain the target synchronization message, and send the target synchronization message to the server. The target value is determined based on the length of a preset message header according to a preset protocol. The preset message header contains target data and is used by the Layer 4 load balancer to send it to the server before forwarding the client's request message. The target data includes the client's address information and / or the Layer 4 load balancer's front-end address information. The client's address information is used for statistical analysis of the access source. The Layer 4 load balancer's front-end address information is the address information that receives the message sent by the client. The synchronization confirmation message processing module is used to receive the original synchronization confirmation message sent by the server, add the target value to the confirmation sequence number in the original synchronization confirmation message to obtain the target synchronization confirmation message, and send the target synchronization confirmation message to the client. The acknowledgment message processing module is used to receive the original acknowledgment message sent by the client, subtract the target value from the sequence number in the original acknowledgment message to obtain the target acknowledgment message, and send the target acknowledgment message to the server. The first message construction module is used to construct a target message based on the preset protocol, wherein the target message includes the preset message header; The first message sending module sends the target message to the server. or, The acknowledgment message processing module includes: The original acknowledgment message receiving unit is used to receive the original acknowledgment message sent by the client; The target confirmation message determination unit is used to add the preset message header to the original confirmation message and subtract the target value from the sequence number in the original confirmation message to obtain the target confirmation message. The target confirmation message sending unit is used to send the target confirmation message to the server.
12. The apparatus of claim 11, further comprising: The request message receiving module is used to receive the request message sent by the client after the target confirmation message is sent to the server; The request message forwarding module is used to forward the request message to the server; The response message receiving module is used to receive the response message sent by the server after the request message is forwarded to the server. The response message forwarding module is used to forward the response message to the client.
13. The apparatus according to claim 11, wherein, The target confirmation message determination unit includes: The byte count determination subunit is used to determine whether the number of remaining bytes in the original acknowledgment message is greater than or equal to a preset value, wherein the preset value is greater than or equal to the target value; The first determining subunit is configured to, when the number of remaining bytes is greater than or equal to a preset value, add the preset message header to the original acknowledgment message and subtract the target value from the sequence number in the original acknowledgment message to obtain the target acknowledgment message.
14. The apparatus according to claim 13, wherein the target confirmation message determination unit further comprises: The second determining subunit is used to subtract the target value from the sequence number in the original acknowledgment message when the number of remaining bytes is less than a preset value, so as to obtain the target acknowledgment message; The device further includes: The second message construction module is used to construct a target message based on the preset protocol after the target acknowledgment message is sent to the server, wherein the target message includes the preset message header; The second message sending module is used to send the target message to the server.
15. The apparatus according to claim 11, wherein, The layer 4 load balancer includes load balancing software and preset hardware. The load balancing software performs the processing of handshake messages, and the preset hardware performs the processing of request messages and response messages. The handshake messages include synchronization messages, synchronization acknowledgment messages, and acknowledgment messages.
16. The apparatus according to any one of claims 11-15, wherein the preset protocol includes a proxy protocol.
17. A data transmission device configured in a Layer 4 load balancer, comprising: The first construction module is used to construct a target message based on a preset protocol, wherein the target message includes a preset message header; The first sending module is used to send the target message to the server. or, Also includes: The original acknowledgment message receiving module is used to receive the original acknowledgment message sent by the client; The target confirmation message determination module is used to add the preset message header to the original confirmation message to obtain the target confirmation message, and send the target confirmation message to the server. A request message processing module is used to receive an original request message sent by a client, add a target value to the sequence number in the original request message to obtain a target request message, and send the target request message to the server. The target value is determined based on the length of a preset message header according to a preset protocol. The preset message header contains target data and is sent to the server by the Layer 4 load balancer before forwarding the client's request message. The target data includes the client's address information and / or the front-end address information of the Layer 4 load balancer. The client's address information is used for statistical analysis of the access source. The front-end address information of the Layer 4 load balancer is the address information that receives the message sent by the client. The response message processing module is used to receive the original response message sent by the server, subtract the target value from the acknowledgment number in the original response message to obtain the target response message, and send the target response message to the client.
18. The apparatus according to claim 17, wherein, The target confirmation message determination module is specifically used for: Determine whether the number of remaining bytes in the original acknowledgment message is greater than or equal to a preset value. If so, add the preset message header to the original acknowledgment message, wherein the preset value is greater than or equal to the target value.
19. The apparatus of claim 18, further comprising: The second construction module is used to determine whether the number of remaining bytes in the original confirmation message is greater than or equal to a preset value. If not, it constructs a target message based on a preset protocol before receiving the original request message sent by the receiving client. The target message includes the preset message header. The second sending module is used to send the target message to the server.
20. The apparatus according to any one of claims 17-19, wherein the preset protocol includes a proxy protocol.
21. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the method of any one of claims 1-10.
22. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-10.
Citation Information
Patent Citations
Message processing method, device and system
CN102938782A
Managing sequence values with added headers in computing devices
CN106233694A