TCP short connection communication method between plug-in management platform and gateway
By using the TCP short connection communication method between the plug-in management platform and the gateway, the performance pressure and stability problems caused by a large number of TCP long connections are solved, and the effects of resource optimization, system flexibility improvement and scalability enhancement are achieved.
Patent Information
- Application Number
- CN202510302119.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-14
- Publication Date
- 2025-05-30
AI Technical Summary
As the number of gateways increases, the plug-in management platform and cloud pool firewall need to maintain a large number of TCP long connections, resulting in increased performance pressure and reduced system stability.
Using the TCP short connection communication method, the gateway device establishes a TCP connection with the plug-in management platform when it is started, and carries the short connection identification parameters for authentication. The plug-in management platform decides whether to maintain TCP connections based on task requirements, actively closes unwanted connections, and re-establishes the connection through the reverse wake-up mechanism when needed.
Through the short connection mechanism, a large amount of TCP connection resources are avoided for a long time, performance pressure is reduced, system stability and flexibility is improved, maintenance costs are reduced, and system scalability is improved.
Smart Images

Figure CN120075278A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of network communication, and in particular to a TCP short connection communication method between a plug-in management platform and a gateway. Background Art
[0002] The plug-in management platform is an operating platform. After the gateway device is registered on the plug-in management platform in a certain protocol format, the plug-in on the gateway device can be managed on the plug-in management platform, including query, installation, uninstallation and other operations.
[0003] In traditional technology, the gateway and the plug-in management platform maintain communication through TCP long connection. TCP long connection means that after the connection is successfully established, even if there is no data transmission between the two communicating parties, the connection must be maintained so that it does not disconnect. At present, with the increasing number of gateways connected to the plug-in management platform, the number of gateways managed by some plug-in management platforms has exceeded 8 million. In this case, the plug-in management platform and the cloud pool firewall need to maintain more than 8 million TCP sessions, which brings huge performance pressure to both the plug-in management platform and the cloud pool firewall.
[0004] At the same time, such a large number of connections places increasing demands on server resources. Once the plug-in management platform needs to be upgraded and restarted or an exception occurs, causing the TCP long connection to be disconnected, the number of sessions on the firewall will increase rapidly according to the gateway's reconnection mechanism, which will have an impact on other business systems. Summary of the invention
[0005] The technical problem to be solved by the present invention is to propose a TCP short connection communication method between a plug-in management platform and a gateway, reduce the performance pressure of the plug-in management platform and a cloud pool firewall, and improve the stability of the system.
[0006] The technical solution adopted by the present invention to solve the above technical problems is:
[0007] A TCP short connection communication method between a plug-in management platform and a gateway comprises the following steps:
[0008] S1. After the gateway device is started, a TCP connection is established between the gateway device and the plug-in management platform;
[0009] S2. The gateway device initiates an authentication request to the plug-in management platform. The authentication request message carries a short connection identification parameter to inform the plug-in management platform that the current TCP connection supports the short connection mechanism;
[0010] S3. The plug-in management platform authenticates the gateway device and confirms that the gateway device supports the short connection mechanism according to the short connection identification parameter carried in the authentication request message;
[0011] S4. The plug-in management platform checks whether the TCP connection needs to be maintained. If so, the TCP connection is maintained and the plug-in distribution strategy is executed, and the process proceeds to step S5; otherwise, the TCP connection with the gateway device is actively closed;
[0012] S5. The gateway device receives the task issued by the plug-in management platform and executes it. After the execution is completed, it notifies the plug-in management platform and returns to step S4.
[0013] Furthermore, in step S4, the method by which the plug-in management platform checks whether it is currently necessary to maintain a TCP connection includes:
[0014] The plug-in management platform determines whether there is a plug-in distribution task for the gateway device at present. If so, it is determined that the TCP connection needs to be maintained at present; otherwise, it is determined that the TCP connection does not need to be maintained.
[0015] Furthermore, in step S5, after the gateway device completes the task, it notifies the plug-in management platform through the callback interface.
[0016] Furthermore, in step S4, after the plug-in management platform actively closes the TCP connection with the gateway device, the gateway is marked as being in a waiting state, and when a task needs to be issued later, a connection request message with a wake-up identification parameter is generated and sent to the gateway.
[0017] Furthermore, the method further comprises:
[0018] When the plug-in management platform actively closes the TCP connection between it and the gateway device, if the gateway device receives a connection request message from the plug-in management platform, it verifies the wake-up identification parameter in the message. After the verification is passed, it re-establishes the TCP connection with the plug-in management platform and initiates an authentication request to the plug-in management platform.
[0019] Furthermore, in step S4, during the TCP hold period, the gateway device periodically sends heartbeat information to the plug-in management platform, and the plug-in management platform returns a heartbeat response to maintain the active state of the connection.
[0020] The beneficial effects of the present invention are:
[0021] (1) Optimize resource utilization:
[0022] Based on the short connection mechanism, it avoids occupying a large amount of TCP connection resources for a long time, significantly reduces the performance pressure of the plug-in management platform and the cloud pool firewall, and solves the problem of insufficient capacity of the plug-in management platform.
[0023] (2) Enhance system flexibility:
[0024] The plugin management platform can dynamically manage the connection with the gateway according to task requirements, support connection establishment on demand and reverse wake-up functions, improving the flexibility and response speed of the system.
[0025] (3) Improve real-time performance:
[0026] When there is a task to be executed, the gateway can quickly respond to the wake-up request of the plugin management platform, re-establish the connection and execute the task, solving the problem of real-time response of the platform operating the gateway device.
[0027] (4) Reduce maintenance costs:
[0028] By optimizing the connection management mechanism, the consumption of system resources and hardware requirements are reduced, the connection management is simplified, and the maintenance cost of the system is lowered.
[0029] (5) Improve scalability:
[0030] The short connection mechanism in the present invention is applicable to gateways of various specifications and plugin management platforms of different scales, has good scalability and popularizability, and can adapt to application requirements in different scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 It is a flowchart of the TCP short connection communication method between the plugin management platform and the gateway in the embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0032] The present invention aims to provide a TCP short connection communication method between a plug-in management platform and a gateway, reduce the performance pressure of the plug-in management platform and the cloud pool firewall, and improve the stability of the system. The core idea is: in the authentication request initiated by the gateway device to the plug-in management platform, a short connection identification parameter is carried, which clearly informs the plug-in management platform that the current gateway supports the short connection mechanism. This design enables the plug-in management platform to distinguish between gateways that support short connections and gateways that only support traditional long connections. After the plug-in management platform receives the authentication request and makes an authentication response, it determines whether to maintain the TCP connection by checking whether there is a task that needs to be sent to the gateway. If there is currently a task that needs to be sent, the TCP connection is maintained. If there is no task that needs to be sent, the plug-in management platform actively closes the TCP connection and marks the gateway as a wake-up state. This on-demand connection establishment mechanism avoids occupying a large amount of connection resources for a long time, and significantly reduces the performance pressure of the plug-in management platform and the cloud pool firewall; after the plug-in management platform actively closes the TCP connection, when there are subsequent tasks to be issued, the platform will generate a request connection message with special information and send it to the target gateway. After the gateway device receives the request connection message, the gateway verifies the special information in the message. If the verification is successful, it will actively request the plug-in platform to re-establish the TCP connection and initiate a new authentication registration request. This reverse wake-up mechanism realizes flexible connection control, ensures that the gateway device reconnects only when needed, and further optimizes resource utilization.
[0033] The scheme of the present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0034] Example
[0035] The implementation process of the TCP short connection communication method between the plug-in management platform and the gateway provided in this embodiment is shown in Figure 1 , which includes the following implementation process:
[0036] S1. After the gateway is started, a TCP connection is established between the gateway and the plug-in management platform;
[0037] In this step, after the gateway device is started, a TCP connection is established between the gateway device and the plug-in management platform through the TCP protocol.
[0038] S2. The gateway initiates an authentication request with a short connection identification parameter to the plug-in management platform;
[0039] In this step, the gateway device initiates an authentication request message to the plug-in management platform after encapsulating the authentication request parameters. The authentication request message carries a short connection identification parameter, which is used to inform the plug-in management platform that the current TCP connection supports the short connection mechanism, so that the subsequent plug-in management platform can disconnect the TCP connection in time when it determines that the TCP connection does not need to be maintained.
[0040] S3. The plug-in management platform authenticates the gateway device;
[0041] In this step, the plug-in management platform verifies the authentication request parameters of the gateway device based on the authentication process, that is, determines whether the gateway device has the authority to access the platform, and then gives a corresponding authentication response. At the same time, the plug-in management platform can also obtain the short connection identification parameter from the authentication request, thereby confirming that the gateway device supports the short connection mechanism.
[0042] S4. The plug-in management platform determines whether it is necessary to maintain the TCP connection at present;
[0043] In this step, the plug-in management platform determines whether it is necessary to maintain the TCP connection according to the current task situation, that is, whether there is a plug-in distribution task for the gateway device. If so, it is determined that the TCP connection needs to be maintained, and the plug-in instruction is issued according to the original plug-in distribution strategy of the platform, and the process goes to step S5; if there is no plug-in distribution task for the gateway device, it is determined that it is not necessary to maintain the TCP connection, and the TCP connection with the gateway device is actively closed, and the gateway is marked as waiting to be awakened, and the process goes to step S6. In the process of maintaining the TCP connection, according to the keep-alive mechanism, the gateway device regularly sends heartbeat information to the plug-in management platform, and the plug-in management platform returns a heartbeat response to maintain the active state of the connection.
[0044] S5. The gateway device executes the task and notifies the plug-in management platform after completion;
[0045] In this step, the gateway device receives the task issued by the plug-in management platform and executes it. After the execution is completed, it notifies the plug-in management platform through the callback interface. The plug-in management platform again determines whether it is necessary to maintain the TCP connection based on whether there is still a plug-in distribution task for the gateway device. If the TCP connection does not need to be maintained, the TCP connection between the gateway device is actively closed, and the gateway is marked as being in the wake-up state, and the process proceeds to step S6.
[0046] S6. The gateway device monitors the messages of the plug-in management platform;
[0047] In this step, after the plug-in management platform actively closes the TCP connection between it and the gateway device, the gateway device is in a listening state for the plug-in management platform. When the plug-in management platform has a new distribution task to be issued, it generates a connection request message with a wake-up identification parameter and sends it to the gateway. The gateway device verifies the wake-up identification parameter in the message. After the verification is passed, it re-establishes the TCP connection with the plug-in management platform and initiates an authentication request to the plug-in management platform, thereby solving the real-time response problem of the platform operation gateway device.
[0048] Finally, it should be noted that the above embodiments are only preferred embodiments and are not intended to limit the present invention. It should be pointed out that for those of ordinary skill in the art, without departing from the spirit of the present invention and the scope protected by the claims, several modifications, equivalent substitutions, improvements, etc. should all be included within the protection scope of the present invention.
Claims
1. A TCP short connection communication method between a plug-in management platform and a gateway, characterized in that: The following steps are involved: S1. After the gateway device is started, a TCP connection is established between the gateway device and the plug-in management platform; S2. The gateway device initiates an authentication request to the plug-in management platform. The authentication request message carries a short connection identification parameter to inform the plug-in management platform that the current TCP connection supports the short connection mechanism; S3. The plug-in management platform authenticates the gateway device and confirms that the gateway device supports the short connection mechanism according to the short connection identification parameter carried in the authentication request message; S4. The plug-in management platform checks whether the TCP connection needs to be maintained. If so, the TCP connection is maintained and the plug-in distribution strategy is executed, and the process proceeds to step S5; Otherwise, actively close the TCP connection with the gateway device; S5. The gateway device receives the task issued by the plug-in management platform and executes it. After the execution is completed, it notifies the plug-in management platform and returns to step S4.
2. A TCP short connection communication method between a plug-in management platform and a gateway as claimed in claim 1, characterized in that: In step S4, the method by which the plug-in management platform checks whether it is currently necessary to maintain a TCP connection includes: The plug-in management platform determines whether there is a plug-in distribution task for the gateway device at present. If so, it is determined that the TCP connection needs to be maintained at present; otherwise, it is determined that the TCP connection does not need to be maintained.
3. A TCP short connection communication method between a plug-in management platform and a gateway as claimed in claim 1, characterized in that: In step S5, after the gateway device completes the task, it notifies the plug-in management platform through the callback interface.
4. A TCP short connection communication method between a plug-in management platform and a gateway as claimed in claim 1, characterized in that: In step S4, after the plug-in management platform actively closes the TCP connection with the gateway device, the gateway is marked as waiting to be awakened, and when there is a subsequent task to be issued, a connection request message with a wake-up identification parameter is generated and sent to the gateway.
5. A TCP short connection communication method between a plug-in management platform and a gateway as claimed in claim 4, characterized in that: The method further includes: When the plug-in management platform actively closes the TCP connection between it and the gateway device, if the gateway device receives a connection request message from the plug-in management platform, it verifies the wake-up identification parameter in the message. After the verification is passed, it re-establishes the TCP connection with the plug-in management platform and initiates an authentication request to the plug-in management platform.
6. A TCP short connection communication method between a plug-in management platform and a gateway as described in any one of claims 1 to 5, characterized in that: In step S4, during the TCP hold period, the gateway device periodically sends heartbeat information to the plug-in management platform, and the plug-in management platform returns a heartbeat response to maintain the active state of the connection.