Connection management method, device and equipment of service node cluster and medium

CN122601736APending Publication Date: 2026-08-18BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610714285.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-22
Publication Date
2026-08-18

AI Technical Summary

Technical Problem

[0004]相关技术中,针对服务节点与客户端的连接管理,通常仅支持对IP连接的检查与切换,当服务节点失效或下线时,对应TCP连接会因状态丢失而被迫中断,服务节点可以通过与客户端重新连接恢复,但重连效率较低;另一种方式可以通过IP地址切换至另一服务节点,但由于TCP连接状态恢复不同步,存在无法正确恢复连接上下文的问题,影响服务可用性

Benefits of technology

[0010]Compared with the prior art, the technical solution provided in this disclosure has the following advantages: The connection management scheme for the service node cluster provided in this disclosure detects whether each service node in the service node cluster meets the migration triggering condition; if the first service node in the service node cluster is detected to meet the migration triggering condition, a second service node is determined from the idle service nodes in the service node cluster, and the first service node is controlled to acquire the migration lock corresponding to the service node cluster, wherein the migration lock is acquired by one service node at the same time; in response to the first service node successfully acquiring the migration lock, the second service node is controlled to acquire the connection status information of the first service node for the transmission control protocol, and a transmission control protocol connection is added to the local connection pool according to the connection status information; the first service node in the routing rules of the service node cluster is modified to the second service node, so as to migrate the client's access request to the first service node to the second service node based on the routing rules and the transmission control protocol connection. By adopting the above technical solution, for service nodes in the service node cluster that meet the migration trigger conditions, the new service node can obtain the connection status information of the service node to be migrated for the Transmission Control Protocol (TCP) during the migration process, add the TCP connection, and achieve seamless switching of client data traffic from one service node to another by modifying the routing rules, avoiding service interruption and reconnection, improving service availability, and ensuring that only one service node's migration task is executed at the same time by acquiring the migration lock, thus ensuring the atomicity and consistency of the migration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122601736A_ABST
    Figure CN122601736A_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure relate to a connection management method and device of a service node cluster, and a medium, wherein the method comprises: if it is detected that a first service node in the service node cluster meets a migration trigger condition, determining a second service node from idle service nodes in the service node cluster, and controlling the first service node to acquire a migration lock corresponding to the service node cluster, wherein the migration lock is acquired by one service node at the same time; in response to the first service node successfully acquiring the migration lock, controlling the second service node to acquire connection state information of a transmission control protocol of the first service node, adding a transmission control protocol connection in a local connection pool according to the connection state information; and modifying the first service node in a routing rule of the service node cluster to the second service node, so as to migrate an access request of a client to the first service node to the second service node based on the routing rule and the transmission control protocol connection. The service availability is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a method, apparatus, device and medium for connection management of a service node cluster. Background Technology

[0002] In a service node cluster, the management of multiple service nodes includes operations such as node updates and failover. A service node can be a server that connects to clients to provide services.

[0003] During the communication between the service node and the client, the service node and the client establish a Transmission Control Protocol (TCP) connection. The client encapsulates the data to be sent in TCP segments, and the TCP segments are encapsulated in Internet Protocol (IP) data. The IP data packets are sent to the service node through the IP connection. The response data returned by the service node is also transmitted through the IP connection, and the TCP connection ensures that the data accurately reaches the client. The client can be, for example, a browser.

[0004] In related technologies, connection management between service nodes and clients typically only supports checking and switching IP connections. When a service node fails or goes offline, the corresponding TCP connection will be forced to terminate due to state loss. The service node can recover by reconnecting with the client, but the reconnection efficiency is low. Another method is to switch to another service node via IP address, but due to the asynchronous recovery of TCP connection state, there is a problem that the connection context cannot be restored correctly, affecting service availability. Summary of the Invention

[0005] To address the aforementioned technical issues, this disclosure provides a method, apparatus, device, and medium for managing the connection of a service node cluster.

[0006] This disclosure provides a connection management method for a service node cluster, the method comprising: Check whether each service node in the service node cluster meets the migration trigger conditions; If the first service node in the service node cluster is detected to meet the migration triggering condition, a second service node is determined from the idle service nodes in the service node cluster, and the first service node is controlled to acquire the migration lock corresponding to the service node cluster, wherein the migration lock is acquired by a service node at the same time. In response to the first service node successfully acquiring the migration lock, the second service node is controlled to acquire the connection status information of the first service node for the transmission control protocol, and add a transmission control protocol connection to the local connection pool according to the connection status information; The first service node in the routing rules of the service node cluster is modified to the second service node, so that, based on the routing rules and the transmission control protocol connection, the client's access request to the first service node is migrated to the second service node.

[0007] This disclosure also provides a connection management device for a service node cluster, the device comprising: The detection module is used to detect whether each service node in the service node cluster meets the migration trigger conditions; The triggering module is used to determine a second service node from the idle service nodes in the service node cluster if the first service node in the service node cluster is detected to meet the migration triggering condition, and to control the first service node to acquire the migration lock corresponding to the service node cluster, wherein the migration lock is acquired by a service node at the same time. The first migration module is configured to, in response to the first service node successfully acquiring the migration lock, control the second service node to acquire the first service node's connection status information for the Transmission Control Protocol (TCP) and add a TCP connection to the local connection pool based on the connection status information. The second migration module is used to modify the first service node in the routing rules of the service node cluster to the second service node, so as to migrate the client's access request to the first service node to the second service node based on the routing rules and the transmission control protocol connection.

[0008] This disclosure also provides an electronic device, the electronic device comprising: a processor; a memory for storing executable instructions of the processor; the processor being configured to read the executable instructions from the memory and execute the instructions to implement the connection management method for a service node cluster as provided in this disclosure.

[0009] This disclosure also provides a computer-readable storage medium storing a computer program for executing the connection management method for a service node cluster as provided in this disclosure.

[0010] Compared with the prior art, the technical solution provided in this disclosure has the following advantages: The connection management scheme for the service node cluster provided in this disclosure detects whether each service node in the service node cluster meets the migration triggering condition; if the first service node in the service node cluster is detected to meet the migration triggering condition, a second service node is determined from the idle service nodes in the service node cluster, and the first service node is controlled to acquire the migration lock corresponding to the service node cluster, wherein the migration lock is acquired by one service node at the same time; in response to the first service node successfully acquiring the migration lock, the second service node is controlled to acquire the connection status information of the first service node for the transmission control protocol, and a transmission control protocol connection is added to the local connection pool according to the connection status information; the first service node in the routing rules of the service node cluster is modified to the second service node, so as to migrate the client's access request to the first service node to the second service node based on the routing rules and the transmission control protocol connection. By adopting the above technical solution, for service nodes in the service node cluster that meet the migration trigger conditions, the new service node can obtain the connection status information of the service node to be migrated for the Transmission Control Protocol (TCP) during the migration process, add the TCP connection, and achieve seamless switching of client data traffic from one service node to another by modifying the routing rules, avoiding service interruption and reconnection, improving service availability, and ensuring that only one service node's migration task is executed at the same time by acquiring the migration lock, thus ensuring the atomicity and consistency of the migration. Attached Figure Description

[0011] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.

[0012] Figure 1 A flowchart illustrating a connection management method for a service node cluster provided in an embodiment of this disclosure; Figure 2 A schematic diagram of a connection management system for a service node cluster provided in an embodiment of this disclosure; Figure 3 A flowchart illustrating another connection management method for a service node cluster provided in this embodiment of the present disclosure; Figure 4 A schematic diagram illustrating a connection management process for a service node cluster provided in an embodiment of this disclosure; Figure 5 A schematic diagram of the structure of a connection management device for a service node cluster provided in an embodiment of this disclosure; Figure 6This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0013] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0014] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0015] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.

[0016] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.

[0017] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0018] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0019] To address the service availability issue arising from node failure during the connection management process between service nodes and clients in a related technical service node cluster, this disclosure provides a connection management method for a service node cluster. The method will be described below with reference to specific embodiments.

[0020] Figure 1This is a flowchart illustrating a connection management method for a service node cluster provided in an embodiment of the present disclosure. This method can be executed by a connection management device for the service node cluster, which can be implemented in software and / or hardware, and is generally integrated into an electronic device. Figure 1 As shown, the method includes: Step 101: Check whether each service node in the service node cluster meets the migration trigger conditions.

[0021] The connection management method for service node clusters in this disclosure is applied to the connection management system for service node clusters. The connection management system for service node clusters is used to manage the service node clusters. The service node clusters may include multiple service nodes and can be applied to scenarios that require long-term connections, such as high-concurrency web services, application programming interface (API) gateways, and game servers, as well as businesses with high requirements for service continuity and load balancing services in cloud-native environments. The service node clusters can be implemented, for example, based on a high-performance Layer 4 load balancer.

[0022] For example, Figure 2 This is a schematic diagram of a connection management system for a service node cluster provided in an embodiment of the present disclosure, as shown below. Figure 2 As shown, the connection management system for the service node cluster can include a controller, a data manager, and a shared memory. The controller is used to manage the lifecycle of multiple service nodes and perform node migration. The data manager is used to collect the connection status information of the service nodes' transmission control protocol and write it into the shared memory, and to synchronize the connection status information between different service nodes. The shared memory is used to store the connection status information of the service nodes.

[0023] A service node can be a server that connects to and provides services to clients. Migration trigger conditions can be specific conditions used to determine if a service node meets the requirements for migration. Whether migration trigger conditions are met can be determined based on factors such as the service node's health status, load, and connectivity, or it can be determined based on operational instructions.

[0024] The connection management device of the service node cluster (hereinafter referred to as the connection management device) can detect each service node in the service node cluster through the controller, and detect whether each service node meets the migration triggering conditions. Specifically, it can obtain the test information of each service node and make a judgment based on the test information, which may be the relevant information when judging the migration triggering conditions.

[0025] Step 102: If the first service node in the service node cluster is detected to meet the migration triggering condition, determine the second service node from the idle service nodes in the service node cluster, and control the first service node to acquire the migration lock corresponding to the service node cluster. The migration lock is acquired by one service node at the same time.

[0026] The first service node can be any service node that has encountered an anomaly and needs to be migrated; the number of first service nodes is unlimited. Idle service nodes can be service nodes in the service node cluster that are in a normal connection state and are not currently occupied; the number of idle service nodes can be multiple. The second service node can be the target node for the migration, and can be randomly selected from the idle service nodes. A migration lock can be a mechanism that coordinates the execution of migration tasks by multiple service nodes, ensuring that only one service node can execute the migration task at a time, avoiding conflicts. In this embodiment, the implementation of the migration lock can be chosen according to the actual situation; for example, it can be implemented using the lease mechanism of the distributed key-value storage system etcd.

[0027] For example, Figure 3 A flowchart illustrating another connection management method for a service node cluster provided in this disclosure embodiment is shown below. Figure 3 As shown, in one feasible implementation, detecting that the first service node in the service node cluster meets the migration triggering condition may include: Step 301: Obtain the test information of the first service node, wherein the test information includes at least one of the following: the number of node health check failures, node load, and number of connections.

[0028] The information to be tested can reflect the multi-dimensional working status of service nodes, and can be used to determine whether service nodes need to be migrated. The number of failed node health checks can be the number of consecutive failed health checks on a service node. A health check can be a check performed on a service node to confirm its normal working status; for example, check methods can include heartbeat detection, availability detection, etc. Node load can be a quantitative indicator representing the resource usage and pressure of a service node. Node load can include Central Processing Unit (CPU) load, memory complexity, disk complexity, etc. The number of connections can be the total number of active network connections currently maintained by the service node.

[0029] The connection management device can collect test information from the first service node through the controller. Specifically, it can collect the information once at a preset time interval. The test information can include at least one of the following: the number of node health check failures, node load, and number of connections. Subsequent judgments are made based on this test information.

[0030] Step 302: In response to the information to be tested satisfying at least one of the following: the number of node health check failures is greater than the number threshold, the node load is greater than the load threshold, and the number of connections is greater than the number threshold, then the first service node is determined to meet the migration triggering conditions.

[0031] The failure count threshold can be set as the maximum number of times a node health check will fail. If the failure count exceeds the threshold, it indicates that the service node may be malfunctioning. The load threshold can be set as the maximum load on a node. If the load exceeds this threshold, it indicates that the load exceeds the service node's capacity. The connection count threshold can be set as the maximum number of connections. If the number of connections on a service node exceeds this threshold, it indicates that the service node may be encountering a performance bottleneck.

[0032] The connection management device can obtain at least one of the number threshold, load threshold, and quantity threshold through the controller, and make at least one of the following judgments on the information to be tested: whether the number of node health checks is greater than the number threshold, whether the node load is greater than the load threshold, and whether the number of connections is greater than the quantity threshold. If the judgment result of the information to be tested for at least one of these is yes, it is determined that the state of the first service node is abnormal and needs to be migrated, that is, the first service node meets the migration triggering condition; if the judgment result of the information to be tested for all of these is no, it is determined that the first service node does not meet the migration triggering condition.

[0033] The above solution, with its proactive migration detection mechanism for multiple service nodes, uses multi-dimensional data for detection, enabling it to quickly and accurately detect service nodes that need to be migrated, reducing the scope of fault impact, supporting planned maintenance, and improving operational flexibility.

[0034] If the connection management device detects that a service node in the service node cluster meets the migration triggering condition through the controller, then the service node is designated as the first service node. Subsequently, it can select one service node from multiple idle service nodes as the second service node, and the selection method is not limited. Then, it can control the first service node to attempt to acquire the migration lock. Specifically, it can control the first service node to attempt to write its node identifier into the migration lock. The node identifier of the first service node can be information that uniquely identifies the first service node, such as the node name or node identifier (ID) of the first service node.

[0035] Step 103: In response to the first service node successfully acquiring the migration lock, control the second service node to obtain the first service node's connection status information for the Transmission Control Protocol (TCP), and add a TCP connection to the local connection pool based on the connection status information.

[0036] Connection state information can be all data describing the current state of all connections in the Transmission Control Protocol (TCP) of the service node. This information is collected in real-time by capturing connection state change events through the netlink interface of a high-performance Layer 4 load balancer or the kernel module hook mechanism. Connection state change events can include new connection creation, connection updates, and connection destruction. Optionally, connection state information for the TCP connection includes at least one of the following: connection identifier, connection state, time information, and parameter information. The connection identifier can include source IP address, source port, destination IP address, destination port, protocol type, etc. The connection state can include sequence number, acknowledgment number, window size, etc. The time information can include connection establishment time, last active time, etc., and the parameter information can include congestion control parameters and TCP options, etc.

[0037] After the first service node acquires the migration lock, the connection management device, through the controller, can control the second service node to add the first service node's Transmission Control Protocol (TCP) connection to the local connection pool. Specifically, it can first obtain the first service node's TCP connection status information, and then add the TCP connection to the local connection pool based on this information, making it a normally functioning connection and preparing it for subsequent use. The local connection pool can be a component within the second service node used to manage connections between clients. A certain number of connections can be pre-created and maintained in this local connection pool for use when clients request them, and these connections can be reused. These connections can include TCP connections and IP connections, etc.

[0038] In some embodiments, the successful acquisition of the migration lock by the first service node may include: determining that the first service node has successfully acquired the migration lock in response to the control of the first service node to successfully write the node identifier of the first service node into the migration lock, wherein the migration lock includes a key and a value, the key including a unique identifier of the migration lock, and the value including the node identifier of the first service node.

[0039] A migration lock can include key-value pairs. The key corresponds to a unique lock key, including a unique identifier for the migration lock. The value stores the node identifier of the service node corresponding to the currently executing migration task, indicating that the migration task of that service node holds the migration lock. When the connection management device controls the first service node to acquire the migration lock through the controller, it can determine whether the key-value pair in the migration lock exists. If it does not exist, it means that the current migration lock is not held, and the node identifier of the first service node can be written into the value corresponding to the key. If the writing is successful, it is determined that the first service node has acquired the migration lock. In the above scheme, by acquiring the migration lock before the migration is executed and then performing the migration, it is ensured that only one service node is performing a migration task at a time, avoiding concurrent conflicts and ensuring data consistency.

[0040] In some embodiments, controlling the second service node to obtain the connection status information of the first service node for the Transmission Control Protocol (TCP) may include: controlling the second service node to obtain the connection status information of the first service node for the TCP from its local storage space; if the local storage space of the second service node does not contain the connection status information of the first service node for the TCP, then writing the connection status information of the first service node for the TCP into the shared memory through the data manager, and synchronizing the connection status information of the first service node for the TCP to the second service node through the shared memory.

[0041] The data manager is used to collect the connection status information of the transmission control protocol of the service nodes and write it into the shared memory, and to synchronize the connection status information between different service nodes; the shared memory is used to store the connection status information of the service nodes.

[0042] When the connection management device controls the second service node to obtain the connection status information of the first service node for the transmission control protocol through the controller, it can first control the second service node to determine whether the local storage control includes the connection status information of the first service node's transmission control protocol. If so, it means that the connection status information of all service nodes has been synchronized in multiple service nodes in advance through the data manager and shared memory, and can be directly extracted; otherwise, the data manager can collect the connection status information of the first service node's transmission control protocol. The number of transmission control protocol connections can be multiple. The multiple connection status information is merged into a batch and written into the shared memory. Then, the watch mechanism of the shared memory is used to detect in real time and synchronize the connection status information of the first service node's transmission control protocol to other service nodes except the first service node, including the second service node; the second service node can then obtain the connection status information of the first service node's transmission control protocol.

[0043] In the above scheme, the data manager can capture the connection status information of the transmission control protocol of the service node and write it into the shared memory. Batch writing can be performed to improve writing efficiency. The connection status information in the shared memory is synchronized to different service nodes as it changes. Persistent storage of connection status information is achieved based on the shared memory, avoiding the loss of status information due to node failure. It supports multiple service nodes to access the connection status at the same time, providing a data foundation for migration. Through batch synchronization and compression optimization, network transmission overhead is reduced and synchronization efficiency is improved.

[0044] Step 104: Modify the first service node in the routing rules of the service node cluster to the second service node, so as to migrate the client's access request to the first service node to the second service node based on the routing rules and transmission control protocol connection.

[0045] Routing rules can be a path selection mechanism that guides data transmission from a client to a specific service node during data transmission between multiple service nodes and the client. They can be represented by a rule table.

[0046] The connection management device can modify the first service node in the routing rules to the second service node through the controller. Specifically, it can change the IP address of the first service node to the IP address of the second service node. When the client sends an access request, the access request carries the IP address of the second service node. Based on the routing rules, the IP connection established with the first service node can be changed to an IP connection established with the second service node. Furthermore, the data transmission of access requests and other data is carried out with the second service node based on the existing transmission control protocol connection in the second service node. This enables seamless migration to the second service node when the first service node needs to be migrated, avoiding service interruption and reconnection.

[0047] The connection management scheme for the service node cluster provided in this disclosure detects whether each service node in the service node cluster meets the migration triggering conditions. If the first service node in the service node cluster is detected to meet the migration triggering conditions, a second service node is determined from the idle service nodes in the service node cluster, and the first service node is controlled to acquire the migration lock corresponding to the service node cluster. The migration lock is acquired by one service node at the same time. In response to the first service node successfully acquiring the migration lock, the second service node is controlled to acquire the connection status information of the first service node for the Transmission Control Protocol (TCP), and a TCP connection is added to the local connection pool according to the connection status information. The first service node in the routing rules of the service node cluster is modified to the second service node, so as to migrate the client's access request to the first service node to the second service node based on the routing rules and the TCP connection. By adopting the above technical solution, for service nodes in the service node cluster that meet the migration trigger conditions, the new service node can obtain the connection status information of the service node to be migrated for the Transmission Control Protocol (TCP) during the migration process, add the TCP connection, and achieve seamless switching of client data traffic from one service node to another by modifying the routing rules, avoiding service interruption and reconnection, improving service availability, and ensuring that only one service node's migration task is executed at the same time by acquiring the migration lock, thus ensuring the atomicity and consistency of the migration.

[0048] In some embodiments, the connection management method for the service node cluster may further include: displaying a message indicating that the migration lock is occupied in response to a failure to control the first service node to write to the migration lock.

[0049] When the connection management device controls the first service node to attempt to acquire a migration lock, if the migration lock already exists, it means that the migration lock has been occupied by another service node of the migration task by writing its node identifier into its service node. The acquisition of the migration lock is determined to have failed, a prompt message indicating that the migration lock is occupied is displayed, and the process enters a waiting process. The migration lock is then acquired again after it is released. The display of the prompt message allows the user to quickly understand the current acquisition status of the migration lock.

[0050] In some embodiments, the connection management method for the service node cluster may further include: releasing the migration lock in response to the first service node acquiring the migration lock for a preset time or receiving a migration completion instruction.

[0051] The acquisition duration can be the duration for which the first service node acquires the migration lock. The preset time can be a timeout set for the migration lock. For example, taking the migration lock implemented through etcd's lease mechanism, the migration lock is bound to a lease, and the lease's lifespan is the migration lock's timeout. The lifespan of the key-value pair is associated with the lease. The specific settings can be configured according to actual needs; for example, the preset time could be 300 seconds. The migration completion command can be a command sent by the second service node after the migration task from the first service node to the second service node is completed, updating the migration task's status to "completed."

[0052] After acquiring a migration lock, the connection management device can determine whether the acquisition duration has reached a preset time. If so, the migration lock can be released. Alternatively, if the acquisition duration has not reached the preset time but a migration completion command is received after the migration task is completed, the migration lock can also be released. Releasing the migration lock can involve deleting the value corresponding to the key in the migration lock and canceling its binding with the lease. By releasing the migration lock after the migration lock times out or after the migration task is completed, deadlocks that could affect other migration tasks are avoided.

[0053] The connection management scheme for the service node cluster of this disclosure embodiment will be further illustrated by a specific example below. For example, Figure 4 This is a schematic diagram illustrating a connection management process for a service node cluster provided in an embodiment of this disclosure, as shown below. Figure 4As shown, the controller in the connection management system of the service node cluster, also known as the control plane, can include a cluster manager, a migration decision engine, and a migration coordinator. The cluster manager is used to manage the cluster lifecycle of the service node cluster, specifically including node registration, node deregistration, node management, health checks, maintaining the cluster node list, and managing the node state machine. The migration decision engine performs trigger judgment and target selection, that is, based on factors such as node health status, load, and operation and maintenance requirements, it uses a migration triggering algorithm to decide when to trigger migration and the target node for migration. The migration coordinator performs lock management and task coordination, specifically using migration locks to ensure that only one migration task is executed at a time, coordinating the migration process of the source node and the target node, and ensuring the atomicity and consistency of the migration.

[0054] In the connection management system of the service node cluster, the data manager, also known as the data plane, can include a connection state collector, a state synchronizer, a connection state restorer, and a load balancer engine. The state synchronizer's functions include capturing the connection state information of the service node's transmission control protocol in real time, serializing the connection state information and synchronizing it to the shared memory, reading the connection state information from the shared memory and synchronizing it to other service nodes, and ensuring the order and consistency of connection state information updates through version control during synchronization.

[0055] The diagram illustrates the specific steps of each module in the data manager during the migration from the first service node to the second service node. For the first service node, the steps are as follows: The status acquisition module monitors connections and acquires status information, specifically the connection status information of the first service node's transmission control protocol; the status synchronizer performs serialization and batch writing, serializing the acquired connection status information into a unified format, such as JSON or Protocol Buffers, and batch compressing multiple connection status information entries to reduce network transmission overhead, merging multiple connection status information changes into a single batch write to improve write efficiency; the load balancer engine can be, for example, the DPVS (Data Plane Development Kit - Linux Virtual Server) engine. DPVS is a high-performance Layer 4 load balancer based on DPDK, used for traffic processing and connection management, but it does not process the received traffic data during the migration process. The steps for the second service node are as follows: The state recovery module performs state reconstruction and connection restoration, that is, it reconstructs the connection state table based on the connection state information of the first service node's transmission control protocol and adds the first service node's transmission control protocol connection to the local connection pool; the state synchronizer is used for listening and batch reading, that is, after listening to the connection state information in the shared memory, it reads and synchronizes it to the second service node in batches; the load balancer engine performs traffic takeover and connection management of the service node cluster, and takes over the traffic data of the first service node after migration.

[0056] In the connection management system of the service node cluster, the shared storage is also known as the shared storage center. etcd can be used as a distributed key-value database to provide strong consistency guarantees. The lease mechanism of etcd is used to implement distributed locks, namely the migration locks mentioned above. The watch mechanism of etcd is used to realize real-time notification of state changes. The stored data, as shown in the figure, can include: connection state information, migration task information, node registration information, and migration locks, etc. Corresponding key processing parameters can include the lifetime of connection state information, the timeout of migration locks, the time interval for batch synchronization, and the maximum number of connections in a single batch synchronization. The lifetime of connection state information can be the storage time for connection state information in shared memory; after this time, the connection state information can be deleted. For example, the lifetime of connection state information can be 3600 seconds. The timeout of migration locks can be the effective time of the migration lock; after this timeout, the migration lock is automatically released. For example, the timeout of migration locks can be 300 seconds. The time interval for batch synchronization can be the periodic time for batch writing and synchronizing connection state information to service nodes, for example, 100 milliseconds. The maximum number of connections in a single batch synchronization can be the maximum value of the specific number of connection state information items synchronized in a single batch, for example, 1000.

[0057] The migration process can specifically include: Step 1: Migration Triggering and Preparation Phase. The migration decision engine checks whether each service node in the service node cluster meets the migration triggering conditions. If the first service node meets the migration triggering conditions, the second service node to be migrated is selected from the idle service nodes in the service node cluster. The migration coordinator controls the first service node to acquire the migration lock, ensuring that only one migration task occurs at a time. Step 2: Connection State Synchronization Phase. The second service node is controlled to obtain the connection state information of the first service node for the Transmission Control Protocol from its local storage space. If the local storage space of the second service node does not contain the connection state information of the first service node for the Transmission Control Protocol, the state synchronizer will synchronize the first service node's connection state information. All active Transmission Control Protocol (TCP) connection state information is batch synchronized to shared memory and then to the second service node. The second service node rebuilds the connection state table in its local memory based on the TCP connection state information of the first service node and creates TCP connections in its local connection pool. Step 3: During the migration process, the first service node stops processing TCP connection data packets, and the second service node takes over the TCP connection data packets. Data packets are not processed during the migration process; they are processed after the migration is completed and received by the second service node. Step 4: During the traffic switching phase, the controller updates the routing rules to switch traffic from the first service node to the second service node. For example, it uses the flow table rules of Border Gateway Protocol (BGP), Equal-Cost Multi-Path (ECMP), or Data Plane Development Kit (DPDK) to achieve a fast switch. The second service node begins to receive and process subsequent data packets for this TCP connection. Step 5: During the migration completion and cleanup phase, the second service node confirms that all connection states have been restored, updates the migration task status to complete, cleans up the connection state information of the first service node, and releases the migration lock.

[0058] This solution has the following key features: a real-time synchronization mechanism for TCP connection state information based on shared memory, achieving persistent storage of connection state, avoiding state loss due to node failure, supporting simultaneous access to connection state by multiple nodes, providing a data foundation for migration, and reducing network transmission overhead and improving synchronization efficiency through batch synchronization and compression optimization; a migration management mechanism based on migration locks, ensuring that only one migration task is executed at a time during the migration process, guaranteeing the atomicity of the migration process, avoiding migration conflicts, and stopping the processing of connection data packets from the source node during the migration process to avoid duplicate data packet processing and prevent inconsistent connection states; a conflict detection and resolution mechanism based on version control, ensuring consistency of state updates, avoiding overwriting and loss, supporting concurrent updates by multiple nodes, improving system throughput, and enabling auditing and tracing of state changes through version numbers; and a proactive migration triggering mechanism based on health checks, migrating connections in advance, reducing the scope of failure impact, supporting planned maintenance, improving operational flexibility, and achieving load balancing and optimizing resource utilization through proactive migration.

[0059] This solution offers the following benefits: It enables real-time and reliable synchronization of TCP connection state information between nodes; it facilitates rapid and seamless switching of data traffic from source to target nodes, ultimately achieving zero service interruption in maintenance and fault scenarios, improving service availability, reducing business losses due to node failures, and enhancing customer satisfaction; it supports planned maintenance, eliminating the need for maintenance operations during off-peak periods, reducing fault recovery time, lowering the workload of maintenance personnel, supporting automated maintenance, reducing manual intervention, and lowering maintenance costs; and it expands application scenarios, supporting more applications with high requirements for connection continuity, and is suitable for long-connection services such as gaming, real-time communication, and financial transactions.

[0060] Figure 5 This is a schematic diagram of a connection management device for a service node cluster provided in an embodiment of this disclosure. This device can be implemented by software and / or hardware, and is generally integrated into an electronic device. Figure 5 As shown, the device includes: Detection module 501 is used to detect whether each service node in the service node cluster meets the migration triggering conditions; Trigger module 502 is used to determine a second service node from the idle service nodes in the service node cluster if the first service node in the service node cluster is detected to meet the migration triggering condition, and control the first service node to acquire the migration lock corresponding to the service node cluster, wherein the migration lock is acquired by a service node at the same time. The first migration module 503 is configured to, in response to the first service node successfully acquiring the migration lock, control the second service node to acquire the first service node’s connection status information for the transmission control protocol, and add a transmission control protocol connection in the local connection pool according to the connection status information. The second migration module 504 is used to modify the first service node in the routing rules of the service node cluster to the second service node, so as to migrate the client's access request to the first service node to the second service node based on the routing rules and the transmission control protocol connection.

[0061] Optionally, the trigger module 502 is specifically used for: Obtain the test information of the first service node, wherein the test information includes at least one of the following: the number of node health check failures, node load, and number of connections; If the information to be tested satisfies at least one of the following: the number of node health check failures is greater than a threshold, the node load is greater than a threshold, or the number of connections is greater than a threshold, then the first service node is determined to meet the migration triggering conditions.

[0062] Optionally, the first migration module 503 includes a locking unit, the locking unit being used for: In response to the control that the first service node successfully writes its node identifier into the migration lock, it is determined that the first service node has successfully acquired the migration lock, wherein the migration lock includes a key and a value, the key including a unique identifier of the migration lock, and the value including the node identifier of the first service node.

[0063] Optionally, the device further includes a prompting module, the prompting module being used for: If the first service node fails to write to the migration lock, a message indicating that the migration lock is occupied is displayed.

[0064] Optionally, the device further includes a release module, the release module being used for: The migration lock is released when the first service node has held the migration lock for a preset period of time or when it receives a migration completion instruction.

[0065] Optionally, the first migration module 503 includes an adding unit, the adding unit being used for: The second service node is controlled to retrieve the connection status information of the first service node for the transmission control protocol from its local storage space. If the local storage space of the second service node does not include the connection status information of the first service node for the transmission control protocol, then the connection status information of the first service node for the transmission control protocol is written to the shared memory through the data manager, and the connection status information of the first service node for the transmission control protocol is synchronized to the second service node through the shared memory.

[0066] Optionally, the connection status information for the transmission control protocol includes at least one of the following: connection identifier, connection status, time information, and parameter information for the transmission control protocol connection.

[0067] The connection management device for the service node cluster provided in this disclosure can execute the connection management method for the service node cluster provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of executing the method.

[0068] This disclosure also provides a computer program product, including a computer program / instruction. When executed by a processor, the computer program / instruction implements the connection management method for the service node cluster provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0069] Figure 6 This is a schematic diagram of an electronic device provided in an embodiment of the present disclosure. See below for details. Figure 6 The diagram illustrates a structural schematic suitable for implementing the electronic device 600 in the embodiments of this disclosure. The electronic device 600 in the embodiments of this disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (PADs), portable media players (PMPs), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0070] like Figure 6As shown, electronic device 600 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 602 or a program loaded from storage device 608 into random access memory (RAM) 603. The RAM 603 also stores various programs and data required for the operation of electronic device 600. The processing unit 601, ROM 602, and RAM 603 are interconnected via bus 604. An input / output (I / O) interface 605 is also connected to bus 604.

[0071] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic device 600 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 An electronic device 600 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0072] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 609, or installed from storage device 608, or installed from ROM 602. When the computer program is executed by processing device 601, it performs the functions defined in the connection management method for a service node cluster according to embodiments of this disclosure.

[0073] It should be noted that the computer-readable medium described above in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. 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, a random access memory, a read-only memory, an electrically erasable programmable read-only memory (EPROM), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this disclosure, 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 disclosure, 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. The transmitted data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, 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: wires, optical fibers, radio frequency (RF), etc., or any suitable combination thereof.

[0074] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol, such as Hypertext Transfer Protocol (HTTP), and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include Local Area Networks (LANs), Wide Area Networks (WANs), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.

[0075] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0076] The aforementioned computer-readable medium carries one or more programs. When the electronic device executes the one or more programs, the electronic device causes the following actions: 1) to detect whether each service node in the service node cluster meets the migration triggering condition; 2) if a first service node in the service node cluster meets the migration triggering condition, 3) to determine a second service node from the idle service nodes in the service node cluster, and 4) to control the first service node to acquire the migration lock corresponding to the service node cluster, wherein the migration lock is acquired by one service node at the same time; 5) in response to the first service node successfully acquiring the migration lock, 6) to control the second service node to acquire the connection status information of the first service node for the Transmission Control Protocol (TCP), and 7) to add a TCP connection to the local connection pool based on the connection status information; 8) to modify the routing rules of the service node cluster to change the first service node to the second service node, so as to migrate client access requests to the first service node to the second service node based on the routing rules and the TCP connection.

[0077] Computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof, including but not limited to object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including local area networks (LANs) or wide area networks (WANs), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0078] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. 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 consecutively indicated blocks may actually be executed substantially in parallel, and 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 function or operation, or using a combination of dedicated hardware and computer instructions.

[0079] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not, in some cases, intended to limit the specific unit.

[0080] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field-Programmable Gate Array (FPGA), Application Specific Integrated Circuit (ASIC), Application Specific Standard Parts (ASSP), System on Chip (SOC), Complex Programmable Logic Device (CPLD), and so on.

[0081] In the context of this document, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory, read-only memory, erasable programmable read-only memory, flash memory, optical fiber, portable compact disk read-only memory, optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0082] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0083] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure 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 above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0084] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0085] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. A connection management method for a service node cluster, characterized in that, include: Check whether each service node in the service node cluster meets the migration trigger conditions; If the first service node in the service node cluster is detected to meet the migration triggering condition, a second service node is determined from the idle service nodes in the service node cluster, and the first service node is controlled to acquire the migration lock corresponding to the service node cluster, wherein the migration lock is acquired by a service node at the same time. In response to the first service node successfully acquiring the migration lock, the second service node is controlled to acquire the connection status information of the first service node for the transmission control protocol, and add a transmission control protocol connection to the local connection pool according to the connection status information; The first service node in the routing rules of the service node cluster is modified to the second service node, so that, based on the routing rules and the transmission control protocol connection, the client's access request to the first service node is migrated to the second service node.

2. The method according to claim 1, characterized in that, The detection that the first service node in the service node cluster meets the migration triggering condition includes: Obtain the test information of the first service node, wherein the test information includes at least one of the following: the number of node health check failures, node load, and number of connections; If the information to be tested satisfies at least one of the following: the number of node health check failures is greater than a threshold, the node load is greater than a threshold, or the number of connections is greater than a threshold, then the first service node is determined to meet the migration triggering conditions.

3. The method according to claim 1, characterized in that, The first service node successfully acquired the migration lock, including: In response to the control that the first service node successfully writes its node identifier into the migration lock, it is determined that the first service node has successfully acquired the migration lock, wherein the migration lock includes a key and a value, the key including a unique identifier of the migration lock, and the value including the node identifier of the first service node.

4. The method according to claim 1 or 3, characterized in that, The method further includes: If the first service node fails to write to the migration lock, a message indicating that the migration lock is occupied is displayed.

5. The method according to claim 1, characterized in that, The method further includes: The migration lock is released when the first service node has held the migration lock for a preset period of time or when it receives a migration completion instruction.

6. The method according to claim 1, characterized in that, Controlling the second service node to obtain the connection status information of the first service node for the Transmission Control Protocol, including: The second service node is controlled to retrieve the connection status information of the first service node for the transmission control protocol from its local storage space. If the local storage space of the second service node does not include the connection status information of the first service node for the transmission control protocol, then the connection status information of the first service node for the transmission control protocol is written to the shared memory through the data manager, and the connection status information of the first service node for the transmission control protocol is synchronized to the second service node through the shared memory.

7. The method according to claim 1, characterized in that, The connection status information for the Transmission Control Protocol (TCP) includes at least one of the following: connection identifier, connection status, time information, and parameter information.

8. A connection management device for a service node cluster, characterized in that, include: The detection module is used to detect whether each service node in the service node cluster meets the migration trigger conditions; The triggering module is used to determine a second service node from the idle service nodes in the service node cluster if the first service node in the service node cluster is detected to meet the migration triggering condition, and to control the first service node to acquire the migration lock corresponding to the service node cluster, wherein the migration lock is acquired by a service node at the same time. The first migration module is configured to, in response to the first service node successfully acquiring the migration lock, control the second service node to acquire the first service node's connection status information for the Transmission Control Protocol (TCP) and add a TCP connection to the local connection pool based on the connection status information. The second migration module is used to modify the first service node in the routing rules of the service node cluster to the second service node, so as to migrate the client's access request to the first service node to the second service node based on the routing rules and the transmission control protocol connection.

9. An electronic device, characterized in that, The electronic device includes: processor; Memory used to store the processor's executable instructions; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the method described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program for performing the method described in any one of claims 1-7.