Data processing method, system, device and medium based on connection state migration

By dynamically migrating connection states to other computing units within the content delivery network, the problem of uneven public network bandwidth under the OSPF/ECMP strategy is solved, improving the system's throughput and response performance, and achieving dynamic balancing of bandwidth resources and load balancing that is imperceptible to clients.

CN123055658APending Publication Date: 2026-11-06HANGZHOU YOUYUN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611433095.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-16
Publication Date
2026-11-06

AI Technical Summary

Technical Problem

In existing technologies, the hash results of the OSPF protocol and ECMP strategy used by content delivery networks and cloud service providers remain unchanged throughout the lifecycle of the TCP connection. This causes a single computing unit to process multiple large file download tasks for a long time, resulting in uneven public network bandwidth usage and affecting overall throughput and real-time response performance.

Method used

By monitoring the load status of the client access interface, when preset conditions are met, the connection status is dynamically migrated to other computing units. The migration of connection status is achieved by using virtual network addresses and data transmission channels, thereby releasing bandwidth resources and avoiding overload of a single computing unit.

Benefits of technology

It achieves dynamic balancing of public network egress bandwidth, improves the overall system throughput and real-time response performance, avoids the problem of rigid resource allocation, and is imperceptible to the client.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123055658A_ABST
    Figure CN123055658A_ABST
Patent Text Reader

Abstract

The application discloses a data processing method and system based on connection state migration, a device and a medium. The method is applied to multiple computing units in the same local area network, and specifically comprises the following steps: controlling a first computing unit to monitor a client access interface; when the load state of the client access interface reaches a first preset condition, determining a target migration connection from multiple connections currently in an active state; generating a migration data packet based on the connection state information of the target migration connection and to-be-sent data, and sending the migration data packet to a second computing unit by the first computing unit; controlling the second computing unit to receive the migration data packet through a data transmission channel, binding a port corresponding to the target migration connection based on the connection state information in the migration data packet, and sending the to-be-sent data to a client. The embodiment of the application can realize dynamic migration of the connection state, avoid overloading of a single computing unit, and thus improve the overall throughput capacity and real-time response performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer network technology, and specifically to a data processing method, system, device, and medium based on connection state transition. Background Technology

[0002] Currently, Content Delivery Networks (CDNs) and cloud service providers generally use the Open Shortest Path First (OSPF) protocol in conjunction with the Equal-Cost Multi-Path (ECMP) strategy to achieve Layer 4 load balancing.

[0003] Specifically, the switch typically performs hash calculations based on the five-tuples connected by the Transmission Control Protocol (TCP) to evenly distribute request traffic from clients to multiple hosts in the cluster.

[0004] However, since the hash result of the OSPF / ECMP policy usually remains unchanged throughout the entire TCP connection lifecycle, all requests and responses for the same connection are processed by the same host. This means that when the host is handling multiple large file download tasks, its public network bandwidth may be occupied for a long time (for example, when the host bandwidth is small or the cluster is small, such an imbalance is likely to occur, that is, multiple large file downloads are concentrated on a single host). This causes other normal requests on the host to respond slowly or even time out, which severely restricts the overall throughput and real-time response performance, reduces data processing efficiency, and affects user experience. Summary of the Invention

[0005] In view of the above-mentioned defects or deficiencies in the prior art, it is desirable to provide a data processing method, system, device and medium based on connection state migration. This method can realize the dynamic migration of connection state to avoid overloading of a single computing unit, thereby improving the overall throughput and real-time response performance.

[0006] In a first aspect, the present invention provides a data processing method based on connection state transition, applicable to multiple computing units within the same local area network, the method comprising: The first computing unit monitors the client access interface. When the load status of the client access interface reaches a first preset condition, it determines the target migration connection from multiple currently active connections. The load status is determined based on the outbound throughput of the client access interface and / or the number of active application layer requests. Based on the connection status information of the target migration connection and the data to be sent, a migration data packet is generated, and the first computing unit sends the migration data packet to the second computing unit; wherein, the second computing unit and the first computing unit are configured with the same virtual network address and a data transmission channel is pre-established; The second computing unit receives migration data packets through the data transmission channel, binds the port corresponding to the target migration connection based on the connection status information in the migration data packets, and sends the data to be sent to the client.

[0007] In one possible implementation, the first preset condition includes: The outbound throughput of the client access interface reaches the first threshold, and / or The number of application-layer requests that are active on the client access interface exceeds the second threshold.

[0008] In one possible implementation, determining the target migration connection from multiple currently active connections includes: Iterate through the multiple currently active connections corresponding to the first computing unit and obtain the data transmission information for each connection; Based on the data transmission information corresponding to each connection, the connection whose data transmission mode and data transmission size meet the second preset condition is determined as the target migration connection.

[0009] In one possible implementation, the process of obtaining the connection state information of the target migration connection includes: The first control computing unit sets the communication interface corresponding to the target migration connection to repair mode, and obtains the connection status information maintained in the kernel by the communication interface through the parameter reading method of the communication interface; wherein, the connection status information includes at least: sequence number information, connection parameters, and connection identifier; A migration data packet is generated based on the connection state information of the target migration connection and the data to be sent, including: The unsent end-of-line data of the target migration connection in the application buffer is identified as data to be sent, and the connection status information and the data to be sent are packaged together to form a migration data packet.

[0010] In one possible implementation, after the second computing unit receives the migration data packet, the method further includes: Control the second computing unit to create a new communication interface and set transparent transmission parameters; The target migration connection is bound to the port corresponding to it based on the connection state information in the migration data packet, including: Set the new communication interface to repair mode, restore the connection state information in the migration data packet to the state of the new communication interface in the kernel by setting the parameters of the new communication interface, and bind the new communication interface to the port corresponding to the target migration connection.

[0011] In one possible implementation, sending the data to be sent to the client includes: The control unit exits the repair mode via the new communication interface, and the second computing unit sends the data to be sent to the client through the new communication interface.

[0012] In one possible implementation, the method further includes: Using the message filtering rules on the first computing unit, subsequent request messages from the client are matched and route tags are set; According to the policy routing rules, packets with routing tags are associated with a specified independent routing table, and a default route pointing to the second computing unit is set in the independent routing table so that subsequent request packets are forwarded to the second computing unit.

[0013] Secondly, a data processing system based on connection state transition is provided, characterized in that it is applied to multiple computing units within the same local area network, and the system includes: The first processing unit is configured to control the first computing unit to monitor the client access interface, and when the load status of the client access interface reaches a first preset condition, determine the target migration connection from multiple currently active connections; wherein, the load status is determined based on the outgoing throughput of the client access interface and / or the number of active application layer requests. The sending unit is used to generate a migration data packet based on the connection status information of the target migration connection and the data to be sent, and the first computing unit sends the migration data packet to the second computing unit; wherein the second computing unit and the first computing unit are configured with the same virtual network address and a data transmission channel is pre-established; The second processing unit is used to control the second computing unit to receive migration data packets through the data transmission channel, bind the port corresponding to the target migration connection based on the connection status information in the migration data packets, and send the data to be sent to the client.

[0014] Thirdly, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, it implements the method of any one of the first aspects above.

[0015] Fourthly, a computer program product is provided, which contains instructions that, when the instructions are executed, execute any of the methods described in the first aspect above.

[0016] The data processing method, system, device, and medium based on connection state migration provided in this application dynamically migrate the connection state when the load on the client access interface reaches a preset condition. The connection state information of the target migration connection and the data to be sent are transmitted to other computing units, thereby releasing the bandwidth resources of the original computing units and effectively avoiding the problem of rigid resource allocation. Based on this, this embodiment has the advantage of being able to dynamically migrate the connection state to avoid overloading a single computing unit, thereby improving the overall throughput and real-time response performance of the system. Attached Figure Description

[0017] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 This is a schematic flowchart of a data processing method based on connection state transition provided in an embodiment of this application; Figure 2 This is a timing diagram of the migration between the first computing unit and the second computing unit provided in the embodiments of this application; Figure 3 This is a block diagram of a data processing system 300 based on connection state transition provided in an embodiment of this application; Figure 4 This is a schematic diagram of the structure of the communication device provided in the embodiments of this application. Detailed Implementation

[0018] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.

[0019] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. The present application will now be described in detail with reference to the accompanying drawings and embodiments. Furthermore, the term "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The terms "first" and "second," etc., in the specification and claims of the embodiments of this application are used to distinguish different objects, not to describe a specific order of objects.

[0020] First, the terminology used in this application will be explained as follows: (1) Content Delivery Network (CDN): is a system that can cache website content to multiple nodes around the world, so that users can obtain data from the nearest node, thereby speeding up access and reducing the pressure on the source server; (2) Open Shortest Path First (OSPF) protocol: It is an interior gateway routing protocol that calculates routes based on link state, uses bandwidth as the basis for path selection, supports large-scale networks and fast convergence, and is widely used in enterprise networks; (3) Equal-Cost Multi-Path (ECMP) strategy: This is a network load balancing strategy that allows devices to use multiple paths with equal metric values ​​to forward traffic simultaneously, thereby improving bandwidth utilization and link redundancy. (4) The five-tuple of a TCP connection includes the source IP address, source port number, destination IP address, destination port number, and transport layer protocol. (5) Chunked Transfer Encoding (HTTP Fragmentation): This is an important data transmission mechanism in the HTTP / 1.1 protocol; it allows the server to divide the response data into multiple small chunks and send them to the client one chunk at a time without knowing the length of the entire response content before sending. (6) HTTP 302 Redirect (also known as HTTP 302 Found): is a standard status code in the HTTP protocol that indicates that the requested resource has been temporarily moved to a new URL specified by the Location header; Correspondingly, the client should continue to use the original URL to make subsequent requests (because the redirection is temporary), but the current request should be automatically redirected to the new address; (7) Address Resolution Protocol Request (ARP): This is a broadcast request message in the ARP protocol, used to resolve the MAC address (i.e., physical address) of the target IP address in the same IPv4 network.

[0021] In current content delivery network and cloud service architectures, Layer 4 load balancing mechanisms generally rely on the coordinated operation of the OSPF protocol and ECMP policy. Specifically, switches can distribute client request traffic to multiple computing units (i.e., multiple hosts) in a server cluster by calculating the five-tuple hash value of TCP connections. It should be noted that this method is simple to deploy, has high performance, and is widely used in high-traffic scenarios.

[0022] However, since the hash mechanism remains constant throughout the entire TCP connection lifecycle, all data fragments of a single connection are always processed by the same computing unit, which leads to significant shortcomings of the above load balancing method in certain specific scenarios.

[0023] For example, when each host in a server cluster has a small public network bandwidth (e.g., 100Mbps), but a client requests to download a very large file (e.g., several GB of video or firmware package) via HTTP chunking, the transmission of each chunk (usually 1MB) will consume a certain amount of bandwidth and time. If the host happens to be processing multiple large file download tasks, its public network bandwidth may be occupied for a long time, resulting in slow or even timed-out responses to other normal requests on the host.

[0024] In addition, the public network bandwidth of other hosts in the server cluster may be idle. This long-term imbalance of public network load seriously affects the overall service quality and resource utilization.

[0025] To address the aforementioned issues, existing technologies have introduced OSPF link weight adjustments and application-layer redirection. However, adjusting OSPF link weights requires global route convergence, which can easily affect all existing connections and prevent fine-grained control at the connection level. Application-layer redirection, on the other hand, requires clients to re-request another host (e.g., HTTP 302 redirection), which can interrupt ongoing downloads, result in a poor user experience, and require client support for redirection.

[0026] Therefore, existing technologies are still unable to release occupied bandwidth resources in a timely manner when the load surges.

[0027] In response, this application provides a data processing method based on connection state migration. This method can migrate downlink data of only a portion of the overloaded TCP connections to other idle computing units in the cluster (such as the second computing unit mentioned above) without the client's awareness or interruption of the existing connection, and does not require maintaining complex offset states, so as to achieve dynamic bandwidth balancing of the public network exit (i.e., the corresponding client access interface).

[0028] In one possible implementation, Figure 1This is a flowchart illustrating a data processing method based on connection state transition provided in an embodiment of this application, such as... Figure 1 As shown, this method is applied to multiple computing units within the same local area network, and specifically includes the following steps: Step S101: Control the first computing unit to monitor the client access interface. When the load status of the client access interface reaches the first preset condition, determine the target migration connection from multiple currently active connections.

[0029] Among them, multiple computing units refer to multiple independent computing devices that work together to provide services in the same local network environment. Each computing unit may include servers, virtual machines or containers, such as hosts; the client access interface refers to the network interface on the computing unit used to receive and send client network requests, that is, the corresponding public network interface.

[0030] For example, the first computing unit can be controlled to periodically query the statistical data of the client access interface in order to monitor the client access interface; such statistical data is, for example, the number of bytes received and sent per second, the number of data packets, etc.

[0031] Optionally, a background process can be configured for the first computing unit to continuously listen for client access to the interface.

[0032] In one possible implementation, when the load state of the client access interface reaches a first preset condition, the first computing unit is controlled to determine a target migration connection from multiple currently active connections.

[0033] For example, the first preset condition may be that the outbound throughput of the client access interface reaches a first threshold, and / or the number of application layer requests that are active on the client access interface is greater than a second threshold; wherein, the outbound throughput of the client access interface can be determined based on the outbound traffic of the client access interface, and the number of application layer requests that are active is the number of active requests (i.e., the number of connections initiated by the client).

[0034] For example, the first threshold is a preset bandwidth value of 99Mbps or a quantity ratio of 99%; the second threshold is a preset value of 10.

[0035] Correspondingly, in one example, the first computing unit monitors the outbound bandwidth and the number of simultaneous responses of its gateway program in real time. When the outbound traffic is higher than the preset bandwidth value of 99Mbps (99%) for 30 seconds and the number of simultaneous packets sent exceeds the preset value of 10, it determines that the load status of the client access interface has reached the first preset condition; wherein, the outbound of its gateway program is, for example, the public network interface eth0.

[0036] In one possible implementation, multiple currently active connections corresponding to the first computing unit can be traversed to obtain the data transmission information of each connection. Based on the data transmission information of each connection, the connection whose data transmission mode and data transmission size meet the second preset condition can be determined as the target migration connection.

[0037] Among them, the multiple connections that are currently active can be the TCP connections currently active in the first computing unit, that is, the TCP connections with the client.

[0038] For example, the data transmission information corresponding to each connection can be determined based on the number of fragments transmitted, the total number of bytes transmitted, and the connection duration.

[0039] Specifically, when the data transmission information of a certain connection indicates that the data transmission mode of the connection is fragmented transmission and the data transmission size is greater than a preset threshold (i.e., large file transmission), it is determined that both the data transmission mode and the data transmission size meet the second preset condition, and at this time the connection can be identified as the target migration connection.

[0040] Correspondingly, in one example, the first computing unit traverses the currently active TCP connections. When the data transmission information of a certain TCP connection indicates that the TCP connection is transmitting a large file (e.g., 50 1MB fragments have been transmitted), and the data volume in the sending queue of the TCP connection remains large, then the TCP connection is identified as the target migration connection.

[0041] Step S102: A migration data packet is generated based on the connection status information of the target migration connection and the data to be sent, and the migration data packet is sent to the second computing unit by the first computing unit.

[0042] The second computing unit shares the same virtual network address (i.e., virtual IP address, or VIP) as the first computing unit and does not respond to ARP requests. Furthermore, a data transmission channel is pre-established between the second and first computing units. It should be noted that the second computing unit is typically selected based on having ample idle bandwidth.

[0043] For example, the data transmission channel between the first computing unit and the second computing unit may include a direct link channel and a status synchronization channel.

[0044] Specifically, the direct link channel can be an IP tunnel established on the private network link between the first computing unit and the second computing unit for subsequent forwarding of client request packets; the state synchronization channel can be a reliable TCP connection channel established between the first computing unit and the second computing unit.

[0045] In one example, taking the IP tunnel established on the private network link as a Generic Routing Encapsulation (GRE) tunnel, the first computing unit can execute the following code to establish a direct link channel: ip tunnel add gre1 mode gre remote 10.0.0.2 local 10.0.0.1 ttl 255 ip link set gre1 up ip addr add 10.1.1.1 / 30 dev gre1 The second computing unit can execute the following code to establish a direct link channel: ip tunnel add gre1 mode gre remote 10.0.0.1 local 10.0.0.2 ttl 255 ip link set gre1 up ip addr add 10.1.1.2 / 30 dev gre1 Secondly, the first computing unit can actively connect to the TCP listening port (e.g., port 9000) of the second computing unit to establish a long TCP connection with the second computing unit; port 9000 can serve as the server access point for the state synchronization channel.

[0046] In one possible implementation, the first computing unit can be controlled to set the communication interface corresponding to the target migration connection to repair mode, and obtain the connection status information maintained in the kernel by the communication interface through the parameter reading method of the communication interface; wherein, the connection status information includes at least: sequence number information, connection parameters and connection identifier.

[0047] For example, the `setsockopt()` function can be called to set the communication interface socket corresponding to the target migration connection to repair mode. Correspondingly, the first computing unit can execute the following code to put the socket into repair mode: int repair = 1 setsockopt(fd, SOL_TCP, TCP_REPAIR,&repair, sizeof(repair)) For example, the connection state information of the communication interface socket maintained in the kernel can be obtained by reading the parameters of the communication interface using the getsockopt() function.

[0048] Specifically, the sequence number information contained in the connection state information is the current sequence number of the receive queue and the send queue (if the send queue is empty, the sequence number seq is the starting sequence number that the data to be sent should use); the connection parameters contained in the connection state information include the maximum segment size (MSS), window scaling factor, selective acknowledgment (SACK), and timestamp, etc.; the connection identifier contained in the connection state information can be a five-tuple: source IP address (i.e., the IP address of the device sending the data packet), source port number (i.e., the port number of the application or process running on the device sending the data packet), destination IP address (i.e., the IP address of the target device receiving the data packet), destination port number (i.e., the port number of the application or process running on the target device receiving the data packet), and transport layer protocol number (i.e., the protocol type used).

[0049] Correspondingly, the first computing unit can execute the following code to obtain the serial number information: int queue = TCP_SEND_QUEUE; setsockopt(fd,SOL_TCP,TCP_REPAIR_QUEUE,&queue,sizeof(queue)); uint32_t snd_seq; getsockopt(fd,SOL_TCP,TCP_QUEUE_SEQ,&snd_seq,sizeof(snd_seq)); Execute the following code to obtain connection parameters: struct tcp_repair_opt opts; getsockopt(fd,SOL_TCP,TCP_REPAIR_OPTIONS,&opts,sizeof(opts)) Execute the following code to obtain the connection identifier: struct sockaddr_in client_addr, vip_addr; socklen_t addrlen = sizeof(client_addr); getpeername(fd, (struct sockaddr &client_addr, &addrlen); getsockname(fd, (struct sockaddr )&vip_addr,&addrlen); In one possible implementation, after obtaining the connection status information of the target migration connection, the unsent end data of the target migration connection in the application buffer can be identified as data to be sent, and the first computing unit can be controlled to package the connection status information and the data to be sent to form a migration data packet.

[0050] For example, based on the client request data method of HTTP Range fragmentation, the last piece of data of a certain fragment in the application buffer that has not been sent by the target migration connection can be determined as the data to be sent; where the data to be sent can be denoted as last_chunk and has a length of L.

[0051] For example, the client requests a large file using the HTTP Range method, and each segment is a fixed size of 1MB.

[0052] Correspondingly, the first computing unit can execute the following code to obtain the data to be sent: char last_chunk

[1500] ; int L = get_last_chunk_data(last_chunk); / / Application layer function The following code can be executed to package TCP connection state information and the last_chunk data to be sent into a migration data packet: migrate_packet pkt; pkt.snd_seq = snd_seq; pkt.opts = opts; pkt.client = client_addr; pkt.vip = vip_addr; pkt.last_chunk_len = L; memcpy(pkt.last_chunk_data, last_chunk, L); For example, after generating the migration data packet, the first computing unit can be controlled to send the migration data packet to the second computing unit through the state synchronization channel.

[0053] Correspondingly, the first computing unit can execute the following code to send the migration data packet: send(sync_fd,&pkt, sizeof(pkt), 0); Step S103: Control the second computing unit to receive migration data packets through the data transmission channel, bind the port corresponding to the target migration connection based on the connection status information in the migration data packets, and send the data to be sent to the client.

[0054] For example, when the second computing unit receives the migration data packet through the aforementioned state synchronization channel, it can create a new communication interface and set transparent transmission parameters to allow binding to a non-local IP.

[0055] Correspondingly, the second computing unit can execute the following code to create a new communication interface: c int new_fd = socket(AF_INET, SOCK_STREAM, 0); int val = 1; setsockopt(new_fd, SOL_IP, IP_TRANSPARENT,&val, sizeof(val)); In one possible implementation, the second computing unit can be controlled to set the new communication interface to repair mode. By setting the parameters of the new communication interface, the connection state information in the migration data packet can be restored to the state of the new communication interface in the kernel. The new communication interface can then be bound to the port corresponding to the target migration connection to complete the binding of the port corresponding to the target migration connection.

[0056] For example, the setsockopt() function can be called to set the new communication interface socket to repair mode. Correspondingly, the second computing unit can execute the following code to put the new communication interface into repair mode: int repair = 1; setsockopt(new_fd, SOL_TCP, TCP_REPAIR,&repair, sizeof(repair)); For example, the connection state information in the migration data packet can be restored to the state of the new communication interface in the kernel by using the new communication interface parameter setting method setsockopt(), that is, the sequence number, connection parameters and other states can be restored.

[0057] Correspondingly, the second computing unit can execute the following code to achieve recovery: / / Restore the send queue sequence number int queue = TCP_SEND_QUEUE; setsockopt(new_fd, SOL_TCP, TCP_REPAIR_QUEUE,&queue, sizeof(queue)); setsockopt(new_fd, SOL_TCP, TCP_QUEUE_SEQ,&pkt.snd_seq, sizeof(pkt.snd_seq)); / / Restore connection option setsockopt(new_fd, SOL_TCP, TCP_REPAIR_OPTIONS,&pkt.opts, sizeof(pkt.opts)) For example, after completing the above state recovery, the new communication interface is bound to the port corresponding to the target migration connection, that is, the virtual IP address VIP is bound to the same port, and the connect() function is called to connect to the client; it should be noted that no real handshake is initiated in this recovery mode.

[0058] Correspondingly, the second computing unit can execute the following code to complete the above binding and connection: / / Bind VIP bind(new_fd, (struct sockaddr )&pkt.vip, sizeof(pkt.vip)); / / Connect to the client (do not send SYN in repair mode) connect(new_fd,(structsockaddr )&pkt.client, sizeof(pkt.client)) In one possible implementation, after the binding and connection are completed, the second computing unit can be controlled to send the data to be sent to the client.

[0059] For example, send() can be called to send data to be sent; where the data uses VIP as the source IP and the TCP sequence number is sent continuously starting from seq.

[0060] Correspondingly, the second computing unit can execute the following code to first exit the repair mode of the communication interface, and then send the data to be sent: / / Exit repair mode repair = 0; setsockopt(new_fd, SOL_TCP, TCP_REPAIR,&repair, sizeof(repair)); / / Send the last piece of data send(new_fd, pkt.last_chunk_data, pkt.last_chunk_len, 0) Based on the above processing, the TCP connection between the first computing unit and the client was successfully migrated to the second computing unit, and the second computing unit completed the transmission of the last piece of data in the current fragment.

[0061] In CDN or cluster servers, the data processing method based on connection state migration provided in this application embodiment, based on the Linux kernel's TCP_REPAIR mechanism and combined with the HTTP fragmentation transmission characteristics, realizes dynamic load balancing of public network egress bandwidth (i.e., provides a load balancing method based on TCP_REPAIR) to solve the problem of uneven distribution of public network bandwidth in OSPF / ECMP load balancing scenarios of large file fragmentation transmission; specifically, by migrating TCP connections on overloaded hosts to idle hosts during fragmentation transmission gaps, the idle hosts handle subsequent fragmentation requests and responses, and the client is completely unaware of this.

[0062] In another embodiment of this application, a specific method for determining the migration execution time is also provided.

[0063] In one possible implementation, the method based on client request data is HTTP Range fragmentation. The first computing unit can monitor the progress of the HTTP fragments currently being sent by the target migration connection, so as to prepare to execute the migration when only the last piece of data remains in the current fragment and has not yet been written to the kernel send buffer.

[0064] For example, the length of the last data block is less than or equal to the TCP Maximum Segment Size (MSS); for instance, the size of the last data block is 1200 bytes, which is less than the MSS of 1460 bytes.

[0065] For example, when the migration conditions are met, the first computing unit pauses sending the last piece of data and prepares to perform the migration. It should be noted that the current TCP connection's send queue is empty, the send sequence number is seq, and the connection is active.

[0066] In another embodiment of this application, further implementation details of the data processing method based on connection state transition are also provided.

[0067] In this embodiment, the first computing unit can be configured with policy routing to forward subsequent request messages from the client belonging to the connection (i.e., the HTTP Range request for the next fragment) to the second computing unit through the previously established data transmission channel (e.g., the IP tunnel mentioned above).

[0068] In one possible implementation, message filtering rules on the first computing unit can be used to match subsequent request messages from the client and set routing tags; wherein, the routing tag is, for example, a specific firewall tag.

[0069] For example, the mangle table in iptables can be used as a packet filtering rule to achieve matching; the matching criteria for subsequent request packets can be: source IP is client x, destination IP is VIP, and destination port is service port.

[0070] Correspondingly, the first computing unit can execute the following code to implement the matching tag: # Marks a message originating from client C and destined for VIP. iptables -t mangle -A PREROUTING -s 198.51.100.10 -d 203.0.113.100 -ptcp --dport 80 -j MARK --set-mark 100 In one possible implementation, packets with routing tags can be associated with a specified independent routing table according to policy routing rules, and a default route pointing to the second computing unit can be set in the independent routing table so that subsequent request packets are forwarded to the second computing unit.

[0071] For example, you can add a policy routing rule: `ip rule add fwmark` <mark>lookup<TABLE_ID> and in the routing table<TABLE_ID> Set a default route to point to the private network tunnel address of the second computing unit.

[0072] Correspondingly, the first computing unit can execute the following code to achieve the above forwarding effect: echo "100 tunnel_route">> / etc / iproute2 / rt_tables ip route add default via 10.1.1.2 dev gre1 table tunnel_route ip rule add fwmark 100 lookup tunnel_route In one possible implementation, after completing the above configuration, the first computing unit closes the original socket (or sets it to an inactive state).

[0073] Based on this, if the next fragmentation request (HTTP Range request) sent by the client arrives at the first computing unit, the first computing unit can route the request to the second computing unit through the direct link channel according to the above-configured policy.

[0074] Correspondingly, since the socket of the second computing unit has been rebuilt and bound to the same five-tuple, when the second computing unit receives a request message, the kernel automatically associates the request with the socket of the second computing unit so that the application of the second computing unit can read the request, parse the Range header, and obtain the corresponding fragment data from the backend shared storage or cache cluster. Then, it sends a response to the client through the public network card of the second computing unit with the VIP as the source IP.

[0075] Correspondingly, after the client receives the above response, it continues to send the next fragment request. This fragment request is also forwarded to the second computing unit through the first computing unit. The second computing unit continues to process all subsequent fragments until the file transfer is completed.

[0076] Correspondingly, when the file transfer is completed (or the connection is closed), the second computing unit closes the socket and notifies the first computing unit through the state synchronization channel, so that the first computing unit can delete the corresponding iptables rules and policy routing entries, thereby releasing resources.

[0077] In one example, after the file transfer is complete, the client actively sends a FIN to close the connection. After the second computing unit processes the FIN, it closes new_fd and notifies the first computing unit through the state synchronization channel.

[0078] Correspondingly, the first computing unit can execute the following code to delete iptables rules and policy routes: iptables -D PREROUTING -t mangle -s 198.51.100.10 -d 203.0.113.100 -ptcp --dport 80 -j MARK --set-mark 100 IP rule del fwmark 100 ip route del default table tunnel_route In another embodiment of this application, an example of a data processing method based on connection state transition is also provided.

[0079] In one possible implementation, Figure 2 This is a migration timing diagram of the fragmentation transmission and migration timing provided in the embodiments of this application, such as... Figure 2 As shown, the TCP_REPAIR-based load balancing method provided in this embodiment is applied to a first computing unit and a second computing unit within the same local area network. The first computing unit is host A, the second computing unit is host B, and the requesting client is client C.

[0080] In this setup, both A and B are configured with the same Virtual IP Address (VIP) and do not respond to ARP requests. The switch uses OSPF ECMP to evenly distribute client requests destined for the VIP to A and B. Client C requests large files using HTTP Range fragmentation, with each fragment being a fixed size (e.g., 1MB). After one fragment is responded to, client C automatically initiates the next fragment request. All requests reuse the same TCP connection.

[0081] Specifically, the implementation environment includes: Host A: Public IP address 203.0.113.1, private IP address 10.0.0.1, public bandwidth 100Mbps.

[0082] Host B: Public IP address 203.0.113.2, private IP address 10.0.0.2, public bandwidth 100Mbps.

[0083] Shared VIP: 203.0.113.100 (configured on the loopback interfaces of A and B, arp_ignore=1, arp_announce=2).

[0084] Switch: Configure two ECMP static routes with destination VIP 203.0.113.100 and next hops to the public IP addresses of A and B, respectively.

[0085] Client C (IP 198.51.100.10) requests to download a 2GB file via VIP 203.0.113.100:80, using HTTP fragmentation, with each fragment being 1MB. During the initial connection establishment, the switch hashes to host A.

[0086] Backend storage: Shared storage cluster (such as Ceph), where hosts A and B can access file content through the same path.

[0087] Correspondingly, the implementation steps include the following: Step S1: Tunnel and communication channel establishment (pre-configuration); Establish a GRE tunnel between A and B. At the same time, A actively connects to port 9000 of B to establish a TCP long connection as a state synchronization channel.

[0088] Step S2: Public network outbound traffic monitoring; A continuously monitors the outbound traffic rate of the public network interface eth0; when the outbound traffic reaches 99Mbps (99%) and lasts for 30 seconds, and there are more than 10 active requests, the traffic balancing process is triggered.

[0089] Step S3: Select the connection to be migrated; A iterates through the currently active TCP connections. When it is determined that client C's connection is transmitting a large file (50 1MB fragments have been transmitted) and the data volume in the send queue of this connection remains large, it selects this connection for migration.

[0090] Step S4: Wait for the current shard to reach the last piece of data; A monitors the sending progress of the current 51st fragment; when the fragment has already sent (1MB - the size of the last block) of data, and only the last block of data remains (for example, the size of the last block is 1200 bytes, which is less than MSS 1460) and has not yet been written to the kernel send buffer, A pauses the sending of the last block of data.

[0091] At this time, the TCP send queue is empty, and the current send sequence number is seq.

[0092] Step S5: Extract connection state information and the last piece of data based on TCP_REPAIR; Step S6: Re-establish the connection and send the last piece of data based on TCP_REPAIR; Step S7: Request message forwarding policy configuration; Configure policy routing on A to forward all subsequent TCP packets from client C to B through a GRE tunnel.

[0093] Step S8: Connection handover and subsequent request processing; Client A closes the original socket: `close(fd)`. Afterwards, client C sends an HTTP Range request for the 52nd fragment (e.g., `Range: bytes=52428800-53477375`). This request reaches A and, due to iptables tags and policy routing, is forwarded to B through the GRE tunnel. B receives the request packet from the tunnel interface. Since B's socket has been rebuilt and bound to the same 5-tuple (client C: port),... (VIP: 80), the kernel automatically associates the request with new_fd. Correspondingly, the application on B reads the request, parses the Range header, reads the 52nd data fragment (1MB) from shared memory, and then calls send via new_fd to return the data to the client. It should be noted that because the source IP is VIP and the TCP sequence numbers are consecutive, the client assumes the data comes from the same connection.

[0094] Step S9: Continue processing subsequent fragments; After receiving the 52nd fragment response, the client continues to send requests for the 53rd, 54th, and so on, which are also forwarded to B by A. B continuously retrieves the corresponding fragments from shared storage and responds until the file transfer is complete. Throughout the entire process, the client maintains that it is communicating with A.

[0095] Step S10: Migration complete and cleanup; After the file transfer is complete, the client actively sends a FIN to close the connection. After processing the FIN, B closes new_fd and notifies A through the state synchronization channel. A then deletes the iptables rules and policy routes.

[0096] The data processing method based on connection state migration provided in this embodiment can achieve transparent connection migration using TCP_REPAIR at the last moment of fragment transmission, and B takes over the processing of all subsequent fragments, thereby balancing the public network egress bandwidth.

[0097] Specifically, this embodiment has the following technical effects: First, the TCP connection state is completely consistent, with consecutive sequence numbers and no RST or FIN. Subsequent client requests are forwarded to B, and the response still uses the VIP as the source IP, so the client is completely unaware of it. Second, after receiving subsequent fragment requests, B directly retrieves the corresponding fragment data from the backend storage without maintaining the sent offset, which conforms to the stateless characteristics of HTTP fragmented transmission. Third, only the selected connections are migrated, while other connections are still handled by the original host, achieving fine-grained control over connection granularity. Fourth, migrating the subsequent fragment processing of large file download tasks to the idle host B rapidly reduces the public network bandwidth pressure on A, utilizes the idle bandwidth of B, and improves the overall throughput of the cluster. Fifth, no additional hardware is required. It utilizes the standard features native to the Linux kernel, such as TCP_REPAIR, policy routing, and IP tunneling, making it easy to deploy quickly in existing CDN nodes or cloud environments.

[0098] In another embodiment of this application, a specific distribution of the data processing system 10 based on connection state migration is also provided.

[0099] In one possible implementation, Figure 3 This is a block diagram of a data processing system 300 based on connection state transition provided in an embodiment of this application, as shown below. Figure 3 As shown, the data processing system 300 based on connection state migration includes a first processing unit 301, a sending unit 302, and a second processing unit 303.

[0100] For example, the first processing unit 301 is configured to control the first computing unit to monitor the client access interface, and when the load status of the client access interface reaches a first preset condition, determine the target migration connection from multiple currently active connections; wherein the load status is determined based on the outgoing throughput of the client access interface and / or the number of active application layer requests.

[0101] The sending unit 302 is used to generate a migration data packet based on the connection status information of the target migration connection and the data to be sent, and the first computing unit sends the migration data packet to the second computing unit; wherein the second computing unit and the first computing unit are configured with the same virtual network address and a data transmission channel is pre-established. The second processing unit 303 is used to control the second computing unit to receive migration data packets through the data transmission channel, bind the port corresponding to the target migration connection based on the connection status information in the migration data packets, and send the data to be sent to the client.

[0102] The following is for reference. Figure 4 , Figure 4 A schematic diagram of a communication device suitable for implementing embodiments of this application is shown, such as... Figure 4 As shown, the communication device 400 includes a central processing unit (CPU) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage section 408 into a random access memory (RAM) 403. The RAM 403 also stores various programs and data required for the system's operating instructions. The CPU 401, ROM 402, and RAM 403 are interconnected via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.

[0103] The following components are connected to the input / output (I / O) interface 405: an input section 406 including a keyboard, mouse, etc.; an output section 407 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 408 including a hard disk, etc.; and a communication section 409 including a network interface card such as a LAN card, modem, etc. The communication section 409 performs communication processing via a network such as the Internet. A drive 410 is also connected to the input / output (I / O) interface 405 as needed. A removable medium 411, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 410 as needed so that computer programs read from it can be installed into the storage section 408 as needed.

[0104] Specifically, according to embodiments of this application, the flowchart above refers to... Figure 1 The described process can be implemented as a computer software program. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowchart. In such an embodiment, the computer program contains program code for performing the methods shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via communication section 409, and / or installed from removable medium 411. When the computer program is executed by central processing unit (CPU) 401, it performs the functions defined in the system of this application.

[0105] It should be noted that the computer-readable medium shown in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, 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 device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium compatible with computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0106] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operational instructions of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two connected blocks may actually be executed substantially in parallel, or they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified functions or operational instructions, or using a combination of dedicated hardware and computer instructions.

[0107] The units or modules described in the embodiments of this application can be implemented in software or hardware. The described units or modules can also be housed in a processor; for example, a processor may be described as including a semantic extraction unit, a weight allocation unit, and a determination unit. The names of these units or modules do not necessarily constitute a limitation on the unit or module itself.

[0108] On the other hand, this application also provides a computer-readable storage medium, which may be included in the communication device described in the above embodiments, or may exist independently and not assembled into the communication device. The aforementioned computer-readable storage medium stores one or more programs that, when used by one or more processors, execute the methods described in this application. For example, it may execute... Figure 1 The steps of the method shown are as follows.

[0109] This application provides a computer program product including instructions that, when executed, cause the method described in this application to be performed. For example, it can execute... Figure 1 The steps of the method shown are as follows.

[0110] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of disclosure in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the foregoing disclosed concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.< / mark>

Claims

1. A data processing method based on connection state migration, characterized in that, The method, applicable to multiple computing units within the same local area network, includes: The first computing unit monitors the client access interface. When the load status of the client access interface reaches a first preset condition, a target migration connection is determined from multiple currently active connections. The load status is determined based on the outbound throughput of the client access interface and / or the number of active application layer requests. Based on the connection status information of the target migration connection and the data to be sent, a migration data packet is generated, and the first computing unit sends the migration data packet to the second computing unit; wherein, the second computing unit and the first computing unit are configured with the same virtual network address and a data transmission channel is pre-established; The second computing unit is controlled to receive the migration data packet through the data transmission channel, bind the port corresponding to the target migration connection based on the connection status information in the migration data packet, and send the data to be sent to the client.

2. The data processing method based on connection state transition according to claim 1, characterized in that, The first preset conditions include: The outbound throughput of the client access interface reaches a first threshold, and / or The number of application layer requests that are active on the client access interface exceeds the second threshold.

3. The data processing method based on connection state transition according to claim 1, characterized in that, The step of determining the target migration connection from multiple currently active connections includes: Iterate through the multiple currently active connections corresponding to the first computing unit to obtain the data transmission information of each connection; Based on the data transmission information corresponding to each connection, the connection whose data transmission mode and data transmission size meet the second preset condition is determined as the target migration connection.

4. The data processing method based on connection state transition according to claim 1, characterized in that, The process of obtaining the connection state information of the target migration connection includes: The first computing unit is controlled to set the communication interface corresponding to the target migration connection to repair mode, and obtains the connection status information maintained in the kernel by the communication interface through the parameter reading method of the communication interface; wherein, the connection status information includes at least: sequence number information, connection parameters, and connection identifier; The process of generating a migration data packet based on the connection status information of the target migration connection and the data to be sent includes: The unsent end-of-line data of the target migration connection in the application buffer is identified as the data to be sent, and the connection status information and the data to be sent are packaged together to form the migration data packet.

5. The data processing method based on connection state transition according to claim 1, characterized in that, After the second computing unit receives the migration data packet, the method further includes: Control the second computing unit to create a new communication interface and set transparent transmission parameters; The step of binding the port corresponding to the target migration connection based on the connection state information in the migration data packet includes: The new communication interface is set to repair mode. By setting the parameters of the new communication interface, the connection status information in the migration data packet is restored to the state of the new communication interface in the kernel. The new communication interface is then bound to the port corresponding to the target migration connection.

6. The data processing method based on connection state transition according to claim 5, characterized in that, Sending the data to be sent to the client includes: The control unit exits the repair mode via the new communication interface, and the second computing unit sends the data to be sent to the client via the new communication interface.

7. The data processing method based on connection state transition according to claim 1, characterized in that, The method further includes: Using the message filtering rules on the first computing unit, subsequent request messages from the client are matched and route tags are set; According to the policy routing rules, the packets with the route tag are associated with the specified independent routing table, and a default route pointing to the second computing unit is set in the independent routing table so that the subsequent request packets are forwarded to the second computing unit.

8. A data processing system based on connection state transition, characterized in that, The system, applicable to multiple computing units within the same local area network, includes: The first processing unit is configured to control the first computing unit to monitor the client access interface, and when the load state of the client access interface reaches a first preset condition, determine the target migration connection from multiple currently active connections; wherein, the load state is determined based on the outgoing throughput of the client access interface and / or the number of active application layer requests. The sending unit is used to generate a migration data packet based on the connection status information of the target migration connection and the data to be sent, and the first computing unit sends the migration data packet to the second computing unit; wherein the second computing unit and the first computing unit are configured with the same virtual network address and a data transmission channel is pre-established; The second processing unit is configured to control the second computing unit to receive the migration data packet through the data transmission channel, bind the port corresponding to the target migration connection based on the connection status information in the migration data packet, and send the data to be sent to the client.

9. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 7.