Client TCP (Transmission Control Protocol) connection migration method, system, equipment and medium

By introducing proxy servers into the IoT server cluster, the client's insensitive TCP connection migration is realized, which solves the problem of loss of reconnection data and high reconnection costs during server offline maintenance, and improves migration efficiency and data integrity.

CN119652953AActive Publication Date: 2025-03-18HANGZHOU YINGYUN TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202510174550.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-18
Publication Date
2025-03-18
Estimated Expiration
2045-02-18

AI Technical Summary

Technical Problem

In an IoT server cluster, since the server needs to be temporarily offline and maintained, there are problems such as loss of reconnection data and high reconnection costs when migrating the client TCP connection.

Method used

By introducing a proxy server between the server and the client, the proxy server can be controlled to migrate a specified TCP connection from one server to another server, realizing client-insensitive TCP connection migration. The specific steps include the old server electrically connecting to the new server through a proxy server, obtaining downstream and upstream data, determining the transmission status, and migrating unsent and unprocessed data to the new server.

Benefits of technology

It realizes client-insensitive TCP connection migration, solves the problem of data loss and high reconnection costs, and improves migration efficiency and data integrity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119652953A_ABST
    Figure CN119652953A_ABST
Patent Text Reader

Abstract

The invention relates to a client TCP connection migration method, system and device and a medium, and the method comprises the steps: receiving a migration instruction in response to a proxy server, and obtaining downlink data from an old server, the downlink data being data sent from the old server to the proxy server. And the proxy server sends the migration point of the downlink stream data and the migration point of the uplink stream initial data to a new server as stream labels. And the new server remotely calls the old server, and the old server obtains the uplink stream data according to the uplink stream data migration point. And the old server sends the unsent data and the unprocessed data to the proxy server, and the proxy server sends the unsent data and the unprocessed data to the new server. The proxy server can be controlled to migrate a specified TCP connection from one server to another server, so that client-side non-inductive TCP connection migration is realized. The problems of reconnection data loss and high reconnection cost in migration of the TCP connection of the client in the prior art are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a method, system, device and medium for migrating a client TCP connection. Background Art

[0002] Due to the particularity of the Internet of Things, IoT servers (clusters) need to maintain a large number of (millions, hundreds of millions) of TCP persistent connections with a large number of (millions, hundreds of millions) of devices. A TCP persistent connection refers to a long-lasting connection established between a client and a server, during which the client and server can continue to perform multiple data interactions without having to re-establish a connection for each interaction.

[0003] However, in the actual production environment, the server needs to be temporarily offline for maintenance due to various reasons (service function upgrade, patch repair, security patch, server physical migration, server expansion / reduction). Therefore, there is an urgent need for a client TCP connection migration method, system, device and medium to migrate server users to other clusters or other servers in the same cluster to achieve seamless migration of client TCP connections. Summary of the invention

[0004] The embodiments of the present application provide a method, system and medium for migrating a client TCP connection to at least solve the above-mentioned problems.

[0005] In a first aspect, an embodiment of the present application provides a method for migrating a TCP connection of a client, including an old server and a new server, wherein the old server is electrically connected to the new server via a proxy server; the method comprises: In response to the proxy server receiving the migration instruction, acquiring downstream data from the old server, the downstream data being data sent from the old server to the proxy server; The proxy server sends the migration point of the downstream data and the migration point of the upstream initial data as a stream header to the new server; The new server remotely calls the old server, and the old server obtains the upstream data according to the upstream data migration point; Based on the downstream data and the upstream data, the transmission status of the downstream and upstream is determined. Based on the transmission status, the old server migrates the downstream data not sent to the client and the unprocessed upstream data uploaded by the client to the new server.

[0006] In one embodiment, obtaining downstream flow data from the old server includes: The old server obtains the unsent downstream data from the buffer, wherein the unsent downstream data includes data in the sending buffer, data in flight, and data that has been determined not to be received; Determining a migration point of the initial data of the downstream flow that the proxy server confirms receipt of, based on the counter recording the sent data and based on the fact that the downstream flow has not sent data; The old server notifies the proxy server through an out-of-band control channel that the initial data migration point of the downstream flow has been received; The proxy server obtains the downstream target data migration point and informs the old server through an out-of-band control channel; The target downstream unsent data and sent data are confirmed through the downstream target data migration point, and the target downstream unsent data is used as downstream data.

[0007] In one embodiment, the new server remotely calls the old server, and the old server obtains the upstream data according to the upstream data migration point, including: After processing the stream header, the new server remotely calls the old server; Acquire unsent upstream unprocessed data from the buffer of the proxy server, wherein the unsent upstream unprocessed data includes data in a sending buffer, data in flight, and data that has been determined not to be received; According to the counter record sending data, based on the upstream unprocessed data, determining the upstream initial data migration point that the proxy server confirms receipt; The old server notifies the proxy server through an out-of-band control channel that the upstream initial data migration point has been received; The proxy server obtains the upstream target data migration point and informs the old server through an out-of-band control channel; The unprocessed data that has not been sent and the unprocessed data that has been sent of the target upstream are confirmed through the upstream target data migration point, and the unprocessed data that has not been sent of the target upstream is used as the upstream data.

[0008] In one embodiment, the step of recording the sent data according to the counter and determining the initial data migration point of the downstream flow that the proxy server confirms receipt based on the fact that the downstream flow has not sent data includes: The initial data migration point of the downstream flow that the proxy server confirms to receive is determined according to the difference between the sent data recorded by the counter and the unsent data of the downstream flow.

[0009] In one embodiment, the proxy server obtains the downstream target data migration point, including: When the offset of the migration point received by the proxy server is greater than or equal to the initial offset, the downstream target data migration point is obtained; wherein, When the offset of the migration point received by the proxy server is less than the initial offset, unsent data of the downstream flow is pulled from the receiving buffer until the offset is greater than or equal to the initial offset.

[0010] In one embodiment, the step of confirming, through the downstream target data migration point, that the target downstream stream has not sent data includes: According to the difference between the sent data recorded by the counter and the downstream target data migration point, confirm that the target downstream has not sent data; wherein, The counter records the sent data as the total byte data sent, and the downstream target data migration point is the byte data that has been confirmed to be received.

[0011] In one embodiment, before obtaining the downstream flow data from the old server in response to the proxy server receiving the migration instruction, the method further includes: In response to migrating data from the old server to the new server, the old server sends a migration instruction to the proxy server through a remote call channel, and sends address information of the new server to the proxy server.

[0012] In a second aspect, an embodiment of the present application provides a migration system for a client TCP connection, comprising an old server and a new server, wherein the old server is electrically connected to the new server through a proxy server; the system comprises a downstream data acquisition module, a stream header sending module, an upstream data acquisition module, and a migration module, wherein: The downstream data acquisition module is used to acquire downstream data from the old server in response to the proxy server receiving the migration instruction, wherein the downstream data is data sent from the old server to the proxy server; The stream header sending module is used for the proxy server to send the migration point of the downstream data and the migration point of the upstream initial data as a stream header to the new server; The module for obtaining upstream data is used for the new server to remotely call the old server, and the old server obtains the upstream data according to the upstream data migration point; The migration module is used to determine the transmission status of the downstream and upstream based on the downstream data and the upstream data. Based on the transmission status, the old server migrates the downstream data not sent to the client and the unprocessed upstream data uploaded by the client to the new server.

[0013] In a third aspect, an embodiment of the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, a method for migrating a client TCP connection as described in the first aspect above is implemented.

[0014] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a method for migrating a client TCP connection as described in the first aspect above.

[0015] The client TCP connection migration method, system and medium provided by the embodiments of the present application have at least the following technical effects.

[0016] By responding to the proxy server receiving the migration instruction, the downstream data is obtained from the old server, and the downstream data is the data sent from the old server to the proxy server. The proxy server sends the migration point of the downstream data and the migration point of the upstream initial data as a stream header to the new server. The new server remotely calls the old server, and the old server obtains the upstream data according to the upstream data migration point. The old server sends the unsent data and the unprocessed data to the proxy server, and the proxy server sends the unsent data and the unprocessed data to the new server. The present application adds a new layer of special proxy server between the server and the client, and the proxy server can be controlled to migrate the specified TCP connection from one server to another server, thereby realizing TCP connection migration without the client noticing. It solves the problems of reconnection data loss and high reconnection cost in the migration of client TCP connection in related technologies.

[0017] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1 is a flow chart of a method for migrating a client TCP connection; Figure 2 is a flow chart of obtaining downstream data according to an exemplary embodiment; Figure 3 is a specific flow chart of the first part of obtaining downstream data according to an exemplary embodiment; Figure 4 is a specific flow chart of the second part of obtaining downstream data according to an exemplary embodiment; Figure 5 is a schematic diagram showing a migration result according to an exemplary embodiment; Figure 6 is a flow chart of obtaining upstream data according to an exemplary embodiment; Figure 7 is a structural block diagram of a client TCP connection migration system according to an exemplary embodiment; Figure 8 FIG. 1 is a structural block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0019] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0020] Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. In addition, it can also be understood that although the efforts made in this development process may be complicated and lengthy, for ordinary technicians in this field related to the content disclosed in this application, some changes in design, manufacturing or production based on the technical content disclosed in this application are just conventional technical means, and should not be understood as insufficient content disclosed in this application.

[0021] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0022] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantity limitation, and may indicate the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.

[0023] In this document, it should be understood that the terms involved may be technical means for implementing a part of the present invention or other summary technical terms. For example, the terms may include: TCP connection: In this application, there are two connections: the old connection between the proxy server and the old server and the new connection between the proxy server and the new server.

[0024] Downstream data and upstream data: There are two data flows in the TCP connection between the proxy server and the server. They are downstream data, which is the flow data from the server to the proxy server; and upstream data, which is the flow data from the proxy server to the server.

[0025] Initial data migration point: When the sender sends data to the receiver, the data migration point received by the receiver. At this time, the sender and the receiver are mutually uncertain about the data they send and receive. Because the network has fluidity and there is a buffer inside the system, the fluid data sent by the sender may not be reachable, and the data in the buffer may reach the application layer at any time. Therefore, the initial data migration point at this time is uncertain and only serves as the initial data migration point. The initial data migration point includes the downstream initial data migration point and the upstream initial data migration point.

[0026] Target data migration point: When a sender sends data to a receiver, the data migration point that the receiver actually receives. At this time, the sender and the receiver have determined the data sent and received. Therefore, the target data migration point is determined at this time and is used as the target data migration point. The target data migration point includes the downstream target data migration point and the upstream target data migration point.

[0027] Out of Band (OOB): This channel is independent of the TCP connection migrated by this application. This channel can be point-to-point or multi-hop. In this application, there are two OOB channels: one is from the old server to the proxy server, and the other is from the proxy server to the new server.

[0028] Low-level-stack: The layers below the application layer store raw TCP data in queues or buffers. In the PoC (Proof of Concept) of this application, there are two low-level stacks: 1. BEAM virtual machine, erlang port queue for send queue, erlang port buffer for receive buffer; 2. Linux TCP stack, Linux socket send / receive buffer.

[0029] Unprocessed data: Unprocessed data comes only from the old connection between the proxy server and the old server. Unprocessed data is data extracted from the underlying stack of application behavior, so this data is the raw data received from the client without processing. To ensure reliable application data transmission, this data cannot be discarded because the peer will not resend this data. For the server, unprocessed data should be sent from the old server to the new server so that processing can be resumed on the new server.

[0030] Unsent data: Unsent data is a data buffer sent by the application to the lower stack, which may or may not be received or partially received by the peer. When the migration is triggered, the sender extracts the unsent data buffer from the lower stack and reconstructs it. However, the reception status of the extracted unsent data buffer data is uncertain because it contains in-flight data that may or may not be received by the peer. For a specific data stream, when the initial data migration point is determined and the target data migration point is not determined, the unsent data is undetermined. When both the initial data migration point and the target data migration point are determined, the unsent data is also determined, so it is safe to resend. When migrating a TCP connection, each data stream has one unsent data. The unsent data is transmitted from the old server to the new server, and the new server must send it to the new connection according to the migration stream header. Among them, the actual unsent data includes the upstream unsent data and the downstream unsent data.

[0031] Stream header: The first few bytes of data after the TCP connection is established between the proxy server and the new server. They are not application data. They contain key information for the migration to succeed. In the PoC, a header for each stream is set for the new connection between the proxy server and the new server. Since the server needs to distinguish between the migration header and application data, the first few bytes of the migration header contain reserved distinguishing bytes for distinguishing application data.

[0032] The following is a specific embodiment of a client TCP connection migration method, system, device and medium: In the actual production environment, the server needs to be temporarily offline for maintenance due to various reasons (service function upgrade, patch repair, security patch, server physical migration, server expansion / reduction). Therefore, the server needs to migrate users to other clusters or other servers in the same cluster. Generally, this server needs to interrupt communication with the client connected to it. When interrupting communication and then reconnecting, there are the following problems: 1. Application data transmission is interrupted, increasing data arrival delay.

[0033] 2. The client needs to handle the exception and resume the connection to another available server.

[0034] 3. Due to the client's location, it may take longer for the client to restore the connection.

[0035] 4. On some resource-constrained clients, application data may be actively discarded due to insufficient buffering capacity.

[0036] 5. Some clients that have enabled strong authentication mode may take longer to resume data transmission.

[0037] 6. A large number of client reconnections increase the bandwidth overhead of the egress network, especially handshake reconnections with certificate verification.

[0038] 7. After reconnection, it is necessary to retransmit according to the upper layer application protocol of TCP. The entire upper layer message needs to be retransmitted, and some may need to retransmit more data. For example, in the MQTT protocol, when a 128MB MQTT control message is transferred to 107M, it is necessary to retransmit the first 107M message or even more after reconnection, depending on how much the application layer receives and the QoS level.

[0039] To this end, the present application proposes a client TCP connection migration method, system, device and medium to solve the above-mentioned problems.

[0040] In a first aspect, an embodiment of the present application provides a method for migrating a client TCP connection. Figure 1 It is a flow chart of a method for migrating a client TCP connection, such as Figure 1As shown, a method for migrating a client TCP connection includes an old server and a new server, wherein the old server is electrically connected to the new server via a proxy server; wherein the old server is electrically connected to the proxy server, the proxy server is electrically connected to the new server, and the new server is electrically connected to the client via the proxy server, and the method includes the following steps: Step S101 : in response to the proxy server receiving the migration instruction, the proxy server obtains downstream data from the old server, where the downstream data is data sent from the old server to the proxy server.

[0041] Step S102: The proxy server sends the migration point of the downstream data and the migration point of the upstream initial data as a stream header to the new server.

[0042] Step S103: The new server remotely calls the old server, and the old server obtains the upstream data according to the upstream data migration point.

[0043] Step S104: Determine the transmission status of the downstream and upstream data based on the downstream data and the upstream data. Based on the transmission status, the old server migrates the downstream data not sent to the client and the unprocessed upstream data uploaded by the client to the new server.

[0044] In summary, a method, system and medium for migrating a client TCP connection provided by an embodiment of the present application have at least the following technical effects. By responding to a proxy server receiving a migration instruction, downstream data is obtained from the old server, and the downstream data is data sent from the old server to the proxy server. The proxy server sends the migration point of the downstream data and the migration point of the upstream initial data as a stream header to the new server. The new server remotely calls the old server, and the old server obtains the upstream data according to the upstream data migration point. The old server sends the unsent data and the unprocessed data to the proxy server, and the proxy server sends the unsent data and the unprocessed data to the new server. The present application adds a new layer of special proxy server between the server and the client, and the proxy server can be controlled to migrate a specified TCP connection from one server to another server, thereby realizing TCP connection migration without the client's perception. It solves the problems of reconnection data loss and high reconnection cost in the migration of client TCP connections in related technologies.

[0045] It is worth noting that the proxy server is a single entity with specific functions, such as monitoring data flow status, processing data migration, etc. A proxy cluster is a collection of multiple proxy servers that work together to complete complex tasks and improve system performance and availability. The proxy server described in the embodiments of the present application can be a proxy server or a proxy cluster.

[0046] In one embodiment, before obtaining the downstream flow data from the old server in response to the proxy server receiving the migration instruction, the method further includes: In response to migrating data from the old server to the new server, the old server sends a migration instruction to the proxy server through a remote call channel, and sends the address information of the new server to the proxy server.

[0047] The old server uses the Remote Procedure Call (RPC) channel to send migration instructions to the proxy server. The remote procedure call channel is a dedicated communication path, independent of the data transmission channel, for sending control information and instructions. This design ensures the safe and reliable transmission of control instructions without being affected by the data flow. The migration instruction contains the initial downstream data migration point and the address information of the new server. The address information of the new server includes the IP address and port number, etc., to guide the proxy server to establish a new connection with the new server.

[0048] The benefits of using the remote call channel RPC instead of the original TCP connection are: First, independence. It will not pollute the data transmitted by the original application layer.

[0049] Second, low cost. The proxy server only needs to listen to the out-of-band RPC port and respond to the calculation when a request occurs. When there is no need for migration, the proxy does not need to monitor or analyze the TCP connection for data transmission between the proxy and the server. Low computing cost.

[0050] Third, there is no blocking problem. Out-of-band RPC has short connections, good controllability, and is flexible and retryable.

[0051] Fourth, high efficiency. The same RPC can trigger the migration of multiple TCP connections instead of just one.

[0052] Figure 2 is a flow chart of obtaining downstream data according to an exemplary embodiment. Figure 2 As shown, step S101, in response to the proxy server receiving the migration instruction, obtains the downstream flow data from the old server. Specifically, the following steps are included: Step S1011: The old server obtains the downstream unsent data from the buffer, wherein the downstream unsent data includes data in the sending buffer, data in flight, and data that has been determined not to be received.

[0053] The old server obtains the unsent data of the downstream flow from the buffer, where the unsent data of the downstream flow includes the data in the send buffer, the data in flight status, and the data that has been confirmed to be unreceived. Among them, the send buffer includes the virtual machine send buffer and the operating system send buffer. The data in flight status is the data that has been sent but not yet confirmed. The data that has been confirmed to be unreceived: the data that has been sent and confirmed by the receiver but not yet received is located in the operating system receive buffer and may be reported to the application layer after 0.001 seconds for confirmation and reception, that is, the data that has been received by the receiving end transport layer but not sent to the application layer. Ensure that all unfinished data transmission tasks are taken into account to avoid data loss. Ensure data consistency to avoid incomplete data due to partial data not being sent.

[0054] Step S1012: According to the data sent by the counter, based on the fact that the downstream data has not been sent, determine the initial data migration point of the downstream that is confirmed to be received by the proxy server.

[0055] The amount of data sent is recorded using a counter, and the initial data migration point of the downstream flow received by the proxy server is determined based on the unsent data of the downstream flow obtained from the buffer. Specifically, the initial data migration point of the downstream flow received by the proxy server is determined based on the difference between the sent data recorded by the counter and the unsent data of the downstream flow.

[0056] Step S1013: The old server informs the proxy server through the out-of-band control channel that it has received the initial data migration point of the downstream flow.

[0057] Step S1014: The proxy server obtains the downstream target data migration point and informs the old server through the out-of-band control channel; Obtaining the actually received downstream target data migration point includes calculating the actually received downstream target data migration point when the offset of the proxy server receiving the migration point is greater than or equal to the initial offset; wherein, when the offset of the proxy server receiving the migration point is less than the initial offset, pulling the downstream unsent data from the receiving buffer until the offset is greater than or equal to the initial offset.

[0058] Step S1015: confirm the target downstream unsent data and sent data through the downstream target data migration point, and use the target downstream unsent data as downstream data.

[0059] For example, FIG3 is a specific flowchart of the first part of obtaining downstream data according to an exemplary embodiment, wherein part (a) is a flowchart diagram, and part (b) is information corresponding to each data segment. Figure 4 FIG. 1 is a specific flow chart of the second part of obtaining downstream data according to an exemplary embodiment, wherein part (a) is a flow chart, and part (b) is information corresponding to each data segment. Figure 3 As shown, the counter records that 6 bytes of data have been sent. The application layer data is segmented into [A, B, C, D, E, F] segments (Segs). For the convenience of description, it is assumed that the length of seg is 1 byte. A has been received by the receiver's application layer, B is in the operating system receive buffer, and C and D are in-flight data, that is, sent by the sender but not confirmed by the receiver's transport layer. The proxy server has received confirmation from the old server that it has received 2 bytes. Therefore, A has been removed. The old server operating system send buffer still retains B, C, D, E, F because C and D are still in-flight. And B has not been removed because of batch processing (efficiency) and is in the operating system receive buffer.

[0060] When the migration is triggered, such as Figure 3 As shown, perform the following steps: In the first step, the old server migration program pulls the unsent data from the virtual machine send buffer and the operating system send buffer and rebuilds the unsent buffer with a total of 5 bytes and an offset of 1.

[0061] In the second step, the old server migration program calculates the initial data migration point of the downstream flow (6-5=1). Note that the proxy server has received the old server's confirmation that it has received 2 bytes, which is not visible to the upper layer.

[0062] In the third step, the old server informs the proxy server through the out-of-band control channel that it has received at least 1 byte of offset.

[0063] At this time, at the application layer, the status of the old server and the proxy server cannot be determined by each other, because there is flight status data on the network and buffer data inside the system. The flight status data may not be available, and the data in the receiving buffer may be reported to the application layer at any time.

[0064] like Figure 4 As shown in the figure, in the fourth step, the proxy server receives the offset of A as 1. If the local receiving counter is <1, it continues to pull to the receiving buffer until the counter is ≥1, then point B is determined, that is, the downstream target data migration point is determined. The proxy server informs the old server through the out-of-band control channel that the offset of point B is 2. According to the offset of A received by the proxy server ≥1, point B is determined, so it can be known that the offset is any value greater than 1, which is determined by the transmission state at that time. However, for the convenience of description, it is assumed that the offset is "2" here.

[0065] In the fifth step, the old server can remove 1 (2-1) bytes from the unsent data in the downstream stream according to the B=2 offset, that is, seg B is removed.

[0066] At this point, the data that the old server has not sent is known (C, D, E, F), and the data that the receiving end has received is also known (A, B).

[0067] Figure 5 is a schematic diagram showing a migration result according to an exemplary embodiment. Figure 5 As shown, when the unsent data is determined to be known (C, D, E, F), and the data already received by the receiving end is also known (A, B), the new receiver receives the data of the old receiver (A, B), and receives data from the sender (C, D, E, F), and the sender only needs to send subsequent new data to the new receiver.

[0068] It is worth noting that the status of both parties is confirmed here, there is no uncertain buffer data or flight status data, and the data is all at the application layer.

[0069] Figure 3 , Figure 4 and Figure 5 The sender in can be the old server or the proxy server, the old receiver can be the proxy server or the new server, and the new receiver can be the new server.

[0070] The technical effects of step S101 include the following: First, connections that are blocked can be migrated. When the client has limited bandwidth or insufficient consumption, downlink data will accumulate at the old server, which is a blocked state. In this embodiment, there is no need to wait for the old server to complete the transmission of the blocked data. Step S101 accurately calculates and migrates the blocked data to the new server to ensure the integrity and continuity of the migrated data. It also greatly improves the efficiency of large-scale connection migration and shortens the operation migration time.

[0071] Second, it saves bandwidth overhead during migration. Because it is at the data stream level, not the application data packet level, there is no need to consider the application layer message boundary. Migration can be directly interrupted during application layer message transmission without waiting for the application layer message to be fully transmitted or retransmitting the entire application layer message.

[0072] Third, the computational cost is low. Because it is at the data stream level, not the application data packet level, the proxy does not need to monitor and parse the data stream when no migration occurs. There is no need to maintain the data packet status.

[0073] In one embodiment, step S102, the proxy server sends the migration point of the downstream data and the migration point of the upstream initial data as a stream header to the new server. Specifically, it includes: The proxy server encapsulates the migration point of the downstream data and the migration point of the upstream data as a stream header and sends it to the new server through the new connection. By sending the migration point of the downstream data and the migration point of the upstream data as a stream header, it can be ensured that the new server can quickly identify the migration data and prepare to receive the subsequent data stream.

[0074] The technical effects of step S102 include the following points: First, use stream headers to make it easier for the server to distinguish new connections from migrated connections, reduce implementation costs, and facilitate troubleshooting.

[0075] Second, the application data to be migrated is transmitted after the stream header, so this channel is reused. This improves the utilization of the connection between the proxy and the server and reduces duplicate new connections. Especially in the case of large-scale migration, it greatly reduces the pressure on the new server and improves the success rate and efficiency of migration.

[0076] Figure 6 is a flow chart of obtaining upstream data according to an exemplary embodiment. Figure 6 As shown, in step S103, the new server remotely calls the old server, and the old server obtains the upstream data according to the upstream data migration point. Specifically, the following steps are included: Step S1031: After processing the stream header, the new server makes a remote call to the old server.

[0077] After processing the stream header, the new server can effectively make a remote call to the old server. Through the remote call, it can ensure that the new server can obtain the necessary information from the old server, ensuring the smooth progress of data migration.

[0078] Step S1032: Obtain unsent upstream unprocessed data from the buffer of the old server, wherein the unsent upstream unprocessed data includes unprocessed data in the sending buffer, unprocessed data in flight, and unprocessed data that has been determined not to be received.

[0079] The old server obtains the unsent upstream unprocessed data from the buffer, where the unsent upstream unprocessed data includes the unprocessed data in the send buffer, the data in flight status, and the data that has been confirmed to be unreceived. Among them, the send buffer includes the virtual machine send buffer and the operating system send buffer. The unprocessed data in flight status is the data that has been sent but not yet confirmed by the other end. The unprocessed data that has been confirmed to be unreceived: the data that has been sent and confirmed by the receiver but not yet received is located in the operating system receive buffer and may be reported to the application layer after 0.001 seconds for confirmation and reception, that is, the data that has been sent but not processed by the server. Ensure that all unfinished data transmission tasks are taken into account to avoid data loss. Ensure data consistency to avoid incomplete data due to partial data not being sent.

[0080] Step S1033: According to the counter record of the sent data, based on the upstream unprocessed data, determine the upstream initial data migration point that the proxy server confirms receipt.

[0081] Step S1034: The old server informs the proxy server through the out-of-band control channel that the upstream initial data migration point has been received.

[0082] Obtaining the actually received upstream target data migration point includes: when the offset of the migration point received by the proxy server is greater than or equal to the initial offset, obtaining the actually received upstream target data migration point; wherein, when the offset of the migration point received by the proxy server is less than the initial offset, pulling the unsent upstream unprocessed data from the receiving buffer until the offset is greater than or equal to the initial offset. It is worth noting that the initial offset is determined according to the actual situation. According to the execution operation triggered by the above migration, and as Figure 4 As shown, the proxy server informs the old server through the out-of-band control channel that the offset of point B is 2. According to the offset of point A received by the proxy server ≥ 1 (that is, "1" is the initial offset), point B (point B offset is 2) is determined.

[0083] Step S1035: The proxy server obtains the upstream target data migration point and informs the old server through the out-of-band control channel.

[0084] Step S1036: confirm the unprocessed data that has not been sent and the unprocessed data that has been sent by the target upstream through the upstream target data migration point, and use the unprocessed data that has not been sent by the target upstream as the upstream data.

[0085] The process of obtaining the upstream data in step S103 ensures the integrity and consistency of the data and improves the reliability and efficiency of data transmission. Specifically, it avoids data loss and ensures the continuity and integrity of the data.

[0086] The technical effects of step S103 include the following: First, independent RPC. For communication between new and old servers, independent QoS guarantee priority can be set.

[0087] Second, high efficiency. The same RPC can trigger the migration of multiple TCP connections instead of just one.

[0088] Third, unprocessed data can be directly migrated. When the old server has limited processing capacity, uplink data will accumulate on the old server waiting to be processed. The embodiment of the present application accurately calculates the offset to migrate the unprocessed data to the new server for processing, ensuring the integrity and continuity of the migrated unprocessed data. This greatly improves the efficiency of large-scale connection migration and shortens the migration waiting time.

[0089] Fourth, it saves bandwidth overhead during migration. Because it is at the data stream level, not the application data packet level, there is no need to consider the application layer message boundary, and migration can be directly truncated during application layer message transmission without waiting for the application layer message to be fully transmitted or retransmitting the entire application layer message.

[0090] In one embodiment, step S104 determines the transmission status of the downstream and upstream data based on the downstream data and the upstream data. Based on the transmission status, the old server migrates the downstream data not sent to the client and the unprocessed upstream data uploaded by the client to the new server.

[0091] Specifically, the old server sends downstream data (unsent data) and upstream data (unprocessed data) to the proxy server, and the proxy server sends downstream data and upstream data to the new server. The new server receives and processes the unprocessed data to ensure data integrity and consistency. The new server receives the unsent data and unprocessed data through the proxy server, and then sends the new data to the new server to complete the data migration.

[0092] By sending unsent data and unprocessed data and processing the unprocessed data on the new server, client-unnoticed TCP connection migration can be achieved, which can ensure the consistency and integrity of data during the migration process, while reducing data retransmission, and solving the problems of reconnection data loss and high reconnection cost in the migration of client TCP connections in related technologies.

[0093] The technical effects of this embodiment also include: 1. Client-free migration. 2. No need to redundantly retransmit upper-layer application messages. 3. Fast migration without waiting for data to arrive on the network or for buffers to be cleared. 4. Less network bandwidth usage. 5. No additional egress network traffic. 6. Full controllability. 7. Proxy resources are usually less used, and only extra overhead is required during migration. 8. Blocked connections can be migrated.

[0094] In summary, the embodiment of the present application provides a method for migrating a client TCP connection, which obtains received and confirmed downstream data from the old server in response to a proxy server receiving a migration instruction. The proxy server sends the downstream data and the upstream data migration point as a stream header to the new server. The new server remotely calls the old server, and the old server obtains the upstream data according to the upstream data migration point. Based on the downstream data, the unsent data of the downstream data is determined, and based on the upstream data, the unprocessed data of the upstream data is determined. The old server sends the downstream data and the upstream data to the proxy server, and the proxy server sends the downstream data and the upstream data to the new server. The new server processes the unprocessed data and sends the processed data and the unsent data to the client to complete the client TCP migration. The present application adds a new layer of special proxy server between the server and the client, and the proxy server can be controlled to migrate a specified TCP connection from one server to another server, thereby realizing TCP connection migration without the client's perception. The problem of reconnection data loss and high reconnection cost in the migration of client TCP connections in the related technology is solved.

[0095] In a second aspect, an embodiment of the present application provides a migration system for a client TCP connection. Figure 7 FIG. 1 is a block diagram of a client TCP connection migration system according to an exemplary embodiment. Figure 7 As shown, it includes an old server and a new server, and the old server is electrically connected to the new server through a proxy server; the system includes a downstream data acquisition module 710, a stream header sending module 720, an upstream data acquisition module 730 and a migration module 740, wherein: The downstream data acquisition module 710 is used to acquire downstream data from the old server in response to the proxy server receiving the migration instruction, where the downstream data is data sent from the old server to the proxy server; The stream header sending module 720 is used for the proxy server to send the migration point of the downstream data and the migration point of the upstream initial data as a stream header to the new server; The module 730 for obtaining upstream data is used for the new server to remotely call the old server, and the old server obtains the upstream data according to the upstream data migration point; The migration module 740 is used to determine the transmission status of the downstream and upstream based on the downstream data and the upstream data. Based on the transmission status, the old server migrates the downstream data not sent to the client and the unprocessed upstream data uploaded by the client to the new server.

[0096] In summary, the present application provides a client TCP connection migration system. By acquiring a downstream data module, a stream header sending module, an upstream data acquisition module, and a migration module, a special proxy server is added between the server and the client. The proxy server can be controlled to migrate a specified TCP connection from one server to another server, thereby realizing TCP connection migration without the client's awareness. This solves the problem of reconnection data loss and high reconnection cost in the migration of client TCP connections in related technologies.

[0097] It should be noted that the client TCP connection migration system provided in this embodiment is used to implement the above implementation mode, and the descriptions that have been made will not be repeated. As used above, the terms "module", "unit", "subunit", etc. can be a combination of software and / or hardware that implements the predetermined functions. Although the device described in the above embodiment is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0098] In a third aspect, an embodiment of the present application provides an electronic device, Figure 8 FIG. 1 is a block diagram of an electronic device according to an exemplary embodiment. Figure 8 As shown, the electronic device may include a processor 81 and a memory 82 storing computer program instructions.

[0099] Specifically, the processor 81 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0100] Among them, the memory 82 may include a large-capacity memory for data or instructions. By way of example and not limitation, the memory 82 may include a hard disk drive (HDD), a floppy disk drive, a solid-state drive (SSD), a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 82 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 82 may be inside or outside the data processing device. In a specific embodiment, the memory 82 is a non-volatile memory. In a specific embodiment, the memory 82 includes a read-only memory (ROM) and a random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically alterable ROM (EAROM) or a flash memory (FLASH), or a combination of two or more of these. Under appropriate circumstances, the RAM can be a static random access memory (SRAM) or a dynamic random access memory (DRAM), wherein the DRAM can be a fast page mode dynamic random access memory (FPMDRAM), an extended data output dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.

[0101] The memory 82 may be used to store or cache various data files required for processing and / or communication, as well as possible computer program instructions executed by the processor 81 .

[0102] The processor 81 implements any one of the client TCP connection migration methods in the above embodiments by reading and executing computer program instructions stored in the memory 82 .

[0103] In one embodiment, a migration device for a client TCP connection may further include a communication interface 83 and a bus 80. Figure 8 As shown, the processor 81, the memory 82, and the communication interface 83 are connected via a bus 80 and communicate with each other.

[0104] The communication interface 83 is used to implement communication between the modules, devices, units and / or equipment in the embodiment of the present application. The communication interface 83 can also implement data communication with other components such as: external devices, image / data acquisition equipment, databases, external storage, and image / data processing workstations.

[0105] The bus 80 includes hardware, software or both, coupling components of a client TCP-connected migration device to each other. The bus 80 includes but is not limited to at least one of the following: a data bus, an address bus, a control bus, an expansion bus, and a local bus. By way of example and not limitation, bus 80 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infini Band interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses or a combination of two or more of these. Where appropriate, bus 80 may include one or more buses. Although embodiments of the present application describe and illustrate a particular bus, the present application contemplates any suitable bus or interconnect.

[0106] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements a client TCP connection migration method provided in the first aspect.

[0107] The readable storage medium may include but is not limited to: a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device or any suitable combination of the above.

[0108] In a possible implementation, the present invention can also be implemented in the form of a program product, which includes program code. When the program product runs on a terminal device, the program code is used to enable the terminal device to execute the steps of a client TCP connection migration method provided in the first aspect.

[0109] Among them, the program code for executing the present invention can be written in any combination of one or more programming languages, and the program code can be executed completely on the user device, partially on the user device, as an independent software package, partially on the user device and partially on a remote device, or completely on the remote device.

[0110] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0111] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A method for migrating a client TCP connection, characterized in that: The method comprises an old server and a new server, wherein the old server is electrically connected to the new server via a proxy server; and the method comprises: In response to the proxy server receiving the migration instruction, acquiring downstream data from the old server, the downstream data being data sent from the old server to the proxy server; The proxy server sends the migration point of the downstream data and the migration point of the upstream initial data as a stream header to the new server; The new server remotely calls the old server, and the old server obtains the upstream data according to the upstream data migration point; Based on the downstream data and the upstream data, the transmission status of the downstream and upstream is determined. Based on the transmission status, the old server migrates the downstream data not sent to the client and the unprocessed upstream data uploaded by the client to the new server.

2. The method according to claim 1, characterized in that: Obtaining downstream data from the old server, including: The old server obtains the unsent downstream data from the buffer, wherein the unsent downstream data includes data in the sending buffer, data in flight, and data that has been determined not to be received; Determining a migration point of the initial data of the downstream flow that the proxy server confirms receipt of, based on the counter recording the sent data and based on the fact that the downstream flow has not sent data; The old server notifies the proxy server through an out-of-band control channel that the initial data migration point of the downstream flow has been received; The proxy server obtains the downstream target data migration point and informs the old server through an out-of-band control channel; The target downstream unsent data and sent data are confirmed through the downstream target data migration point, and the target downstream unsent data is used as downstream data.

3. The method according to claim 1, characterized in that The new server remotely calls the old server, and the old server obtains the upstream data according to the upstream data migration point, including: After processing the stream header, the new server remotely calls the old server; Acquire unsent upstream unprocessed data from the buffer of the proxy server, wherein the unsent upstream unprocessed data includes data in a sending buffer, data in flight, and data that has been determined not to be received; According to the counter record sending data, based on the upstream unprocessed data, determining the upstream initial data migration point that the proxy server confirms receipt; The old server notifies the proxy server through an out-of-band control channel that the upstream initial data migration point has been received; The proxy server obtains the upstream target data migration point and informs the old server through an out-of-band control channel; The unprocessed data that has not been sent and the unprocessed data that has been sent of the target upstream are confirmed through the upstream target data migration point, and the unprocessed data that has not been sent of the target upstream is used as the upstream data.

4. The method according to claim 2, characterized in that: The step of recording the sent data according to the counter and determining the initial data migration point of the downstream flow that the proxy server confirms receipt based on the fact that the downstream flow has not sent data comprises: The initial data migration point of the downstream flow that the proxy server confirms to receive is determined according to the difference between the sent data recorded by the counter and the unsent data of the downstream flow.

5. The method according to claim 2, characterized in that: The proxy server obtains the downstream target data migration point, including: When the offset of the migration point received by the proxy server is greater than or equal to the initial offset, the downstream target data migration point is obtained; wherein, When the offset of the migration point received by the proxy server is less than the initial offset, unsent data of the downstream flow is pulled from the receiving buffer until the offset is greater than or equal to the initial offset.

6. The method according to claim 2, characterized in that The step of confirming, through the downstream target data migration point, that the target downstream stream has not sent data includes: According to the difference between the sent data recorded by the counter and the downstream target data migration point, confirm that the target downstream has not sent data; wherein, The counter records the sent data as the total byte data sent, and the downstream target data migration point is the byte data that has been confirmed to be received.

7. The method according to claim 1, characterized in that Before obtaining the downstream flow data from the old server in response to the proxy server receiving the migration instruction, the method further includes: In response to migrating data from the old server to the new server, the old server sends a migration instruction to the proxy server through a remote call channel, and sends address information of the new server to the proxy server.

8. A client TCP connection migration system, characterized in that: The system comprises an old server and a new server, wherein the old server is electrically connected to the new server via a proxy server; the system comprises a module for acquiring downstream data, a module for sending stream headers, a module for acquiring upstream data, and a migration module, wherein: The downstream data acquisition module is used to acquire downstream data from the old server in response to the proxy server receiving the migration instruction, wherein the downstream data is data sent from the old server to the proxy server; The stream header sending module is used for the proxy server to send the migration point of the downstream data and the migration point of the upstream initial data as a stream header to the new server; The module for obtaining upstream data is used for the new server to remotely call the old server, and the old server obtains the upstream data according to the upstream data migration point; The migration module is used to determine the transmission status of the downstream and upstream based on the downstream data and the upstream data. Based on the transmission status, the old server migrates the downstream data not sent to the client and the unprocessed upstream data uploaded by the client to the new server.

9. An electronic device, characterized in that: The invention comprises a memory and a processor, a computer program stored in the memory and executable on the processor, and the processor implements a method for migrating a client TCP connection as claimed in any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, a method for migrating a client TCP connection is implemented as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Stored data migration method

    CN104683476A

  • Telephone conference seamless switching method

    CN106341409A

  • File transmission method, apparatus and system

    CN106657413A

  • TCP connection migration method and device

    CN109862088A

  • Resource management method, monitoring server, proxy server and storage medium

    CN110597631A