Network long connection method and device based on port dynamic binding and related equipment

By dynamically binding the internal listening ports of the gateway cluster, the load balancing devices in the external and internal network zones select long-connection and short-connection gateways respectively, which solves the problem of increased system complexity in the gateway cluster, achieves efficient data transmission and resource utilization, and reduces system maintenance costs.

CN119544722BActive Publication Date: 2025-12-19AGRICULTURAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411742136.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-12-19
Estimated Expiration
2044-11-29

AI Technical Summary

Technical Problem

In a gateway cluster architecture, the simultaneous opening of external listening ports and internal communication ports by each server in the gateway cluster increases system complexity, and the message queue becomes a bottleneck or a single point of failure, resulting in data backlog, delays or loss.

Method used

By dynamically binding the internal listening port of the gateway cluster, the external network load balancer selects a long-connection gateway based on the system status and load balancing strategy, and establishes an internal listening port. The internal network load balancer establishes a short connection to forward transaction requests, avoiding reliance on message queues.

Benefits of technology

It reduces system complexity and maintenance costs, provides a plug-and-play solution, improves system stability and resource utilization, and reduces points of failure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119544722B_ABST
    Figure CN119544722B_ABST
Patent Text Reader

Abstract

The application provides a network long connection method and device for port dynamic binding and related equipment. When a load balancing device in an external connection area receives a long connection request sent by a third party system, the load balancing device selects a long connection gateway from a gateway cluster according to a current system state and a preset load balancing strategy, and sends an opening request to activate an internal listening port of the gateway. Once the internal listening port of the long connection gateway is opened, the load balancing device in an internal network area can forward a received transaction request to the gateway and then to the third party system. Meanwhile, the load balancing device in the internal network area is responsible for establishing a short connection with the selected long connection gateway to receive and forward the transaction request. By dynamically binding the internal listening port of the gateway cluster, a plug-and-play solution without an additional complex system such as a message queue is provided. The solution effectively reduces system complexity and maintenance cost by using a simple module design and relying only on a gateway communication process.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of network communication, and in particular to a network long connection method and device for port dynamic binding and related equipment. BACKGROUND

[0002] In the process of directly connecting and interacting with financial business messages between financial institutions and third-party institutions through a network, a gateway cluster architecture is often used to process a large number of concurrent requests and data transmission. In order to ensure high availability and load balancing, each server in the gateway cluster will usually simultaneously open an external listening port and an internal communication port, and maintain data interaction with the third-party institution through a long connection. However, in the cluster architecture, although only one server actually holds a long connection with the outside, other servers still need to receive and process messages to be forwarded to the third-party institution. In order to achieve this function, a message queue is usually used as a caching mechanism to facilitate the transfer of pending messages within the cluster. The server holding the long connection reads the messages from the message queue and forwards them to the third-party institution, thereby ensuring timely transmission and processing of data.

[0003] However, this architecture design increases the complexity of the system, especially when the message queue fails, the recovery of the entire system becomes more difficult. The message queue can become a bottleneck or single point of failure of the system, causing data backlog, delay or loss. SUMMARY

[0004] Therefore, the embodiments of the present application provide a network long connection method and device for port dynamic binding and related equipment to solve the problem of increased system complexity and data backlog caused by the simultaneous opening of an external listening port and an internal communication port in each server in the gateway cluster.

[0005] To achieve the above object, the embodiments of the present application provide the following technical solutions:

[0006] The first aspect of the present application discloses a network long connection method for port dynamic binding, applied to an external connection area load balancing device, the method comprising:

[0007] When receiving a long connection request sent by a third-party system, obtaining a current system state;

[0008] According to the current system state and a load balancing strategy, determining a long connection gateway from a plurality of gateways in a gateway cluster, and sending an opening request to the long connection gateway to open an internal listening port of the long connection gateway; wherein the external listening port of each gateway in the gateway cluster is in an open state;

[0009] When receiving a transaction request sent by the long connection gateway, sending the transaction request to the third-party system.

[0010] Preferably, the method further comprises:

[0011] When receiving the long connection disconnection request sent by the third party system, a closing request is sent to the long connection gateway to close the internal monitoring port of the long connection gateway.

[0012] Preferably, the long connection gateway is determined from a plurality of gateways in the gateway cluster according to the current system state and a load balancing strategy, comprising:

[0013] The resource usage, current health state, connection number and response time of each gateway in the gateway cluster contained in the current system state are obtained;

[0014] The load balancing strategy is dynamically adjusted according to the resource usage, current health state, connection number and response time of each gateway;

[0015] The long connection gateway is determined from the gateway cluster according to the adjusted load balancing strategy.

[0016] The second aspect of the application discloses a network long connection method of dynamic port binding, applied to an internal network area load balancing device, comprising:

[0017] When receiving a transaction request sent by an internal network transaction system, a long connection gateway is searched from a gateway cluster, wherein the long connection gateway is a gateway with both the internal monitoring port and the external monitoring port in an open state;

[0018] A short connection request is sent to the long connection gateway to establish a TCP short connection with the long connection gateway;

[0019] The transaction request is sent to the long connection gateway based on the TCP short connection, so that the long connection gateway sends the transaction request to a third party system through an external network area load balancing device.

[0020] The third aspect of the application discloses a network long connection device of dynamic port binding, applied to an external network area load balancing device, comprising:

[0021] A first obtaining unit is configured to obtain a current system state when receiving a long connection request sent by a third party system;

[0022] A determining unit is configured to determine a long connection gateway from a plurality of gateways in a gateway cluster according to the current system state and a load balancing strategy, and send an opening request to the long connection gateway to open the internal monitoring port of the long connection gateway; wherein the external monitoring port of each gateway in the gateway cluster is in an open state;

[0023] The first sending unit is configured to send the transaction request to the third-party system when receiving the transaction request sent by the long connection gateway.

[0024] Preferably, the device further comprises:

[0025] The second sending unit is configured to send a closing request to the long connection gateway to close the internal listening port of the long connection gateway when receiving a long connection disconnection request sent by the third-party system.

[0026] Preferably, the determining unit is specifically configured to:

[0027] Obtain the resource usage, current health status, connection number and response time of each gateway in the gateway cluster contained in the current system state; dynamically adjust the load balancing strategy according to the resource usage, current health status, connection number and response time of each gateway; and determine the long connection gateway from the gateway cluster according to the adjusted load balancing strategy.

[0028] The fourth aspect of the present application discloses a network long connection device with dynamic port binding, applied to an internal network area load balancing equipment, and the device comprises:

[0029] The finding unit is configured to find a long connection gateway from a gateway cluster when receiving a transaction request sent by an internal network transaction system, wherein the long connection gateway is a gateway with both an internal listening port and an external listening port in an open state;

[0030] The third sending unit is configured to send a short connection request to the long connection gateway to establish a TCP short connection with the long connection gateway.

[0031] The fourth sending unit is configured to send the transaction request to the long connection gateway based on the TCP short connection, so that the long connection gateway sends the transaction request to a third-party system through an external network area load balancing equipment.

[0032] The fifth aspect of the present application discloses an electronic device, comprising a memory and a processor.

[0033] The memory is configured to store a program.

[0034] The processor is configured to execute the program, and when the program is executed, it is specifically configured to implement the network long connection method with dynamic port binding disclosed in the first aspect of the present application, or the network long connection method with dynamic port binding disclosed in the second aspect of the present application.

[0035] The sixth aspect of the present application discloses a computer storage medium for storing a computer program, which, when executed, implements the network long connection method of the first aspect of the present application or the network long connection method of the second aspect of the present application.

[0036] Based on the network long connection method, the device and the related equipment of the present application, when the load balancing device in the external connection area receives the long connection request sent by the third party system, the long connection gateway is selected from the gateway cluster according to the current system state and the preset load balancing strategy, and the opening request is sent to activate the internal listening port of the gateway. Once the internal listening port of the long connection gateway is opened, the load balancing device in the internal network area can forward the received transaction request to the gateway and then to the third party system. At the same time, the load balancing device in the internal network area is responsible for establishing a short connection with the selected long connection gateway to receive and forward the transaction request. By dynamically binding the internal listening port of the gateway cluster, a plug-and-play solution without additional complex systems such as message queues is provided. It has a simple module design and only relies on the gateway communication process, which effectively reduces the system complexity and maintenance cost. BRIEF DESCRIPTION OF DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiments or the prior art description will be briefly introduced below. Obviously, the drawings in the following description are only embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of the provided drawings.

[0038] Figure 1 The schematic diagram of the network long connection scheme of the non-dynamic port binding provided by the embodiment of the present application;

[0039] Figure 2 The application environment schematic diagram provided by the embodiment of the present application;

[0040] Figure 3 The first flowchart of the network long connection method of the dynamic port binding provided by the embodiment of the present application;

[0041] Figure 4 The first schematic diagram of the network long connection scheme of the dynamic port binding provided by the embodiment of the present application;

[0042] Figure 5 The flowchart of determining the long connection gateway provided by the embodiment of the present application;

[0043] Figure 6 The second schematic diagram of the network long connection scheme of the dynamic port binding provided by the embodiment of the present application;

[0044] Figure 7 The third schematic diagram of the network long connection scheme of the port dynamic binding provided by the embodiment of the present application;

[0045] Figure 8 The second flow chart of the network long connection method of the port dynamic binding provided by the embodiment of the present application;

[0046] Figure 9 The first structural block diagram of the network long connection device of the port dynamic binding provided by the embodiment of the present application;

[0047] Figure 10 The second structural block diagram of the network long connection device of the port dynamic binding provided by the embodiment of the present application;

[0048] Figure 11 The structural schematic diagram of the electronic device provided by the embodiment of the present application. DETAILED DESCRIPTION

[0049] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by those skilled in the art without any creative work fall within the protection scope of the present application.

[0050] In the present application, the term “comprising”, “containing” or any other variant thereof is intended to cover the non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the sentence “including a…” does not exclude the existence of other same elements in the process, method, article or device including the element.

[0051] As known from the background, in order to ensure high availability and load balancing, each server in the gateway cluster will usually start an external listening port and an internal communication port at the same time, such as Figure 1As shown, each server (Gateway 1 and Gateway 2) simultaneously opens both the external listening port 8107 and the internal communication port 8018. They interact with third-party organizations via persistent connections. Although only one server actually maintains the persistent connection to the outside world, the other servers also need to process and forward messages to the third-party organization. To achieve this functionality, a message queue is typically used as a caching mechanism. Specifically, after receiving transaction requests, all gateways cache these requests in a message queue. The gateway holding the persistent connection continuously polls the message queue to retrieve transaction requests and forwards them to the external third-party system. However, while introducing a message queue improves the system's processing capacity, it also increases the system's complexity and maintenance costs.

[0052] Therefore, embodiments of the present invention provide a method, apparatus, and related devices for dynamically binding network long-connections. When the load balancing device in the external network receives a long-connection request from a third-party system, it selects a long-connection gateway from the gateway cluster based on the current system state and a preset load balancing strategy, and sends an activation request to activate the internal listening port of that gateway. Once the internal listening port of the long-connection gateway is activated, the load balancing device in the internal network can forward the received transaction requests to that gateway, and then send them to the third-party system. Simultaneously, the load balancing device in the internal network is responsible for establishing short connections with the selected long-connection gateway to receive and forward transaction requests. By dynamically binding the internal listening ports of the gateway cluster, a plug-and-play solution is provided that eliminates the need for additional complex systems such as message queues. With its simple modular design, relying solely on the gateway communication process, it effectively reduces system complexity and maintenance costs.

[0053] See Figure 2 The diagram illustrates an application environment suitable for embodiments of the present invention. Figure 2 The interactive system 100 shown includes an external network load balancer 101 and an internal network load balancer 102.

[0054] The external load balancer 101 is connected to the third-party system 103. The internal load balancer 102 is connected to the internal transaction system 105. The external load balancer 101 is connected to the internal load balancer 102 through the gateway cluster 104.

[0055] Specifically, when the external load balancing device 101 receives a long connection request initiated by the third-party system 103, it establishes a TCP long connection with a gateway server in the gateway cluster 104 according to a certain load balancing strategy.

[0056] It can be understood that the full name of TCP long connection is "Transmission Control Protocol (TCP) long connection". TCP is a connection-oriented, reliable, byte-stream-based transport layer communication protocol that provides packet sequential transmission, error detection and retransmission mechanism to ensure data integrity and reliability. In TCP long connection, once the connection is established, the connection will be maintained until one of the communication parties explicitly closes it, instead of closing the connection after each communication as in short connection. Long connection can reduce the overhead of frequently establishing and closing connections, and is suitable for scenarios that require continuous communication.

[0057] In addition, when the intranet area load balancing device 102 receives a transaction request initiated by the intranet transaction system 105, it establishes a TCP short connection with the gateway server in the gateway cluster 104 that has established a TCP long connection according to a certain load balancing strategy.

[0058] It can be understood that the full name of TCP short connection is "Transmission Control Protocol (TCP) short connection". In TCP short connection, the communication parties will close the connection after each data transmission is completed, instead of maintaining the connection state. This method is suitable for scenarios that do not require continuous communication or have long communication intervals.

[0059] Based on the application scenarios disclosed in the above embodiments of the present application, as shown in FIG. 1, a first flowchart of a port dynamic binding network long connection method provided by the embodiments of the present application can be applied to the extranet area load balancing device 101 in the above application scenarios, mainly including the following steps: Figure 3

[0060] Step S301: When receiving a long connection request sent by a third-party system, obtain the current system state.

[0061] In the process of implementing step S301, when the extranet area load balancing device receives a long connection request sent by a third-party system, the current state in the system is obtained in order to determine the long connection gateway subsequently.

[0062] It can be understood that the extranet area load balancing device intelligently distributes traffic by monitoring CPU and memory usage according to the load balancing strategy, ensuring that no single gateway fails due to overload. At the same time, the extranet area load balancing device will periodically perform health checks to determine which gateways are in active state and can handle requests. Only the gateways that pass the health check will be selected as long connection gateways, thereby ensuring that traffic is reasonably distributed to gateways that can stably provide services. The specific process of determining the long connection gateway is shown in step S302.

[0063] ​Step S302: determining a long connection gateway from the plurality of gateways of the gateway cluster according to the current system state and the load balancing strategy, and sending an opening request to the long connection gateway to open an internal listening port of the long connection gateway.

[0064] It can be understood that the external listening port is a network access port provided to an external third party institution. The internal listening port is a network access port provided to an internal business system of the institution.

[0065] It should be noted that the external listening port of each gateway in the gateway cluster is in an open state. That is, when no long connection is established with the third party system, and after the long connection is established with the third party system, all gateway servers in the gateway cluster permanently open the external listening port for the third party system, as shown in FIG. 8. Figure 4 As shown in FIG. 8, the external listening ports 8107 of all gateway servers are in an open state.

[0066] In the process of specifically implementing step S302, the external connection area load balancing device determines the long connection gateway from the plurality of gateways of the gateway cluster according to the obtained current system state and the load balancing strategy. The specific determination process is detailed in the content of the embodiment of the present application Figure 5 Based on this, the external connection area load balancing device sends an opening request to the long connection gateway to open the internal listening port of the long connection gateway.

[0067] It can be understood that the embodiment of the present application Figure 5 specifically includes:

[0068] Step S501: obtaining the resource usage, current health state, connection number and response time of each gateway in the gateway cluster included in the current system state.

[0069] In the process of specifically implementing step S501, the external connection area load balancing device obtains the resource usage, current health state, connection number and response time of each gateway in the gateway cluster included in the current system state by monitoring the CPU and memory usage.

[0070] Step S502: dynamically adjusting the load balancing strategy according to the resource usage, current health state, connection number and response time of each gateway.

[0071] In the process of specifically implementing step S502, the external connection area load balancing device dynamically adjusts the load balancing strategy according to the resource usage, current health state, connection number and response time of each gateway.

[0072] It can be understood that the load balancing device of the external connection area can dynamically adjust the load balancing strategy by monitoring the resource usage, health status, connection number and response time of each gateway in real time, so as to ensure that the traffic is efficiently and evenly distributed to each gateway. This intelligent adjustment mechanism helps to optimize resource utilization, improve the overall performance and reliability of the system.

[0073] Step S503: Determine the long connection gateway from the gateway cluster according to the adjusted load balancing strategy.

[0074] In the process of implementing step S503, the load balancing device of the external connection area intelligently selects the most suitable gateway from the gateway cluster as the long connection gateway according to the adjusted load balancing strategy, taking into account factors such as resource usage, health status, connection number and response time of the gateway.

[0075] It should be particularly noted that the long connection gateway is not fixed, but is dynamically determined by the load balancing device according to the current system state. Only the gateway selected to establish a long connection will open the internal listening port 8108.

[0076] For example Figure 6 As shown in the figure, the load balancing device of the external connection area selects gateway 2 from the gateway cluster as the long connection gateway, and gateway 2 opens the internal listening port 8108; since gateway 1 is not selected as the long connection gateway, gateway 1 only opens the external listening port 8107.

[0077] It can be understood that such a selection mechanism ensures efficient distribution of traffic while improving the stability and response speed of the service.

[0078] Step S303: When receiving the transaction request sent by the long connection gateway, send the transaction request to the third-party system.

[0079] In the process of implementing step S303, the load balancing device of the external connection area sends the transaction request to the third-party system when receiving the transaction request sent by the long connection gateway.

[0080] For example Figure 7 As shown in the figure, gateway 2 receives the transaction request through the internal listening port 8108 and then sends the transaction request to the third-party system.

[0081] It can be understood that this process ensures that the transaction request can be smoothly passed from the gateway to the required service end, maintaining the smooth operation of the system and the continuity of data.

[0082] It's important to note that if the gateway fails to close its internal listening port 8108 after a long-lived connection is broken, it can lead to resource waste, reduced service availability, compromised system stability, increased security risks, and traffic allocation issues. It also makes monitoring and troubleshooting more difficult. Therefore, ensuring that the internal listening port is closed promptly after a long-lived connection is broken is crucial for maintaining system efficiency, stability, and security.

[0083] Based on this, in some specific embodiments, when the load balancing device in the external connection area receives a request to disconnect the long connection from a third-party system, it sends a close request to the long connection gateway to close the internal listening port of the long connection gateway.

[0084] Understandably, in combination Figure 7 As shown, if the long-lived connection is broken, Gateway 2 will close its internal listening port 8108, but will continue to retain its external listening port 8107 to maintain external services. This dynamic management mechanism ensures the rational allocation of resources and the efficient operation of the system.

[0085] In this embodiment of the invention, dynamic binding of listening ports within the gateway cluster is implemented without relying on complex system auxiliary functions such as message queues, providing a plug-and-play solution. The solution features a simple module design, requiring only the gateway communication process, making it suitable for business scenarios with moderate transaction volumes and the need for rapid restarts to resolve issues. By reducing system complexity, it also helps reduce system maintenance costs.

[0086] Based on the application scenarios disclosed in the above embodiments of the present invention, such as Figure 8 The diagram shown is a second flowchart of a method for dynamically binding a network long connection using ports, provided in an embodiment of the present invention. This method can be applied to the intranet load balancing device 102 in the above-mentioned application scenario, and mainly includes the following steps:

[0087] Step S801: When a transaction request is received from the intranet transaction system, the long-connection gateway is searched from the gateway cluster.

[0088] It is understandable that a long-connection gateway is a gateway where both the internal and external listening ports are open.

[0089] In the specific implementation of step S801, when the intranet load balancing device receives a transaction request sent by the intranet transaction system, it selects a gateway from the gateway cluster to establish a short TCP connection according to the load balancing strategy.

[0090] In practical applications, since only the long-connection gateway has its internal listening port open, the load balancing device in the intranet area can find the long-connection gateway from the gateway cluster.

[0091] Step S802: Send a short connection request to the long connection gateway to establish a TCP short connection with the long connection gateway.

[0092] In the specific implementation of step S802, after the intranet load balancing device finds the long connection gateway, it sends a short connection request to the long connection gateway to establish a TCP short connection with the long connection gateway.

[0093] It should be noted that the process by which the load balancer in the intranet zone initiates a short connection request to the long connection gateway to establish a short TCP connection allows for rapid data exchange between the intranet zone and the long connection gateway, while maintaining the efficiency and stability of network communication. In this way, the intranet zone can effectively manage communication with the long connection gateway, ensuring the continuity and reliability of data transmission.

[0094] Step S803: Send the transaction request to the long connection gateway based on the TCP short connection, so that the long connection gateway can send the transaction request to the third-party system through the external connection area load balancer.

[0095] In the specific implementation step S803, the intranet load balancer uses a short TCP connection to forward transaction requests initiated by the intranet transaction system to the long connection gateway. In this way, the long connection gateway receives these requests and, through the external load balancer, further forwards them to third-party systems.

[0096] Understandably, this process ensures that transaction requests can be transmitted efficiently and securely from the internal network to the external system, while utilizing load balancing equipment to optimize resource allocation and improve system responsiveness.

[0097] In this embodiment of the invention, this solution enables dynamic binding of listening ports within the gateway cluster, eliminating the need for complex system auxiliary functions such as message queues, making it a plug-and-play solution. The solution features a simple module design, requiring only the gateway communication process, making it suitable for business scenarios with moderate transaction volumes and the need for rapid restarts to resolve issues. By reducing system complexity, it also helps reduce system maintenance costs.

[0098] Compared with the above embodiments of the present invention Figure 3 The method shown corresponds to a long-lived network connection with dynamic port binding; see [link to relevant documentation]. Figure 9 This diagram illustrates a first structural block diagram of a network long-connection device with dynamic port binding according to an embodiment of the present invention, applied to an external connection area load balancing device. The device includes: a first acquisition unit 901, a determination unit 902, and a first sending unit 903.

[0099] The first acquisition unit 901 is used to acquire the current system status when a long connection request is received from a third-party system.

[0100] The determining unit 902 is used to determine the long-connection gateway from multiple gateways in the gateway cluster according to the current system status and load balancing strategy, and send an enable request to the long-connection gateway to enable the internal listening port of the long-connection gateway; wherein, the external listening port of each gateway in the gateway cluster is in the enabled state.

[0101] The determining unit 902 is specifically used to: obtain the resource usage, current health status, number of connections, and response time of each gateway in the gateway cluster included in the current system status; dynamically adjust the load balancing strategy based on the resource usage, current health status, number of connections, and response time of each gateway; and determine the long-connection gateway from the gateway cluster based on the adjusted load balancing strategy.

[0102] The first sending unit 903 is used to send the transaction request to a third-party system when it receives a transaction request from the long-connection gateway.

[0103] In this embodiment of the invention, dynamic binding of listening ports within the gateway cluster is implemented without relying on complex system auxiliary functions such as message queues, providing a plug-and-play solution. The solution features a simple module design, requiring only the gateway communication process, making it suitable for business scenarios with moderate transaction volumes and the need for rapid restarts to resolve issues. By reducing system complexity, it also helps reduce system maintenance costs.

[0104] Combination Figure 9 As shown, the device also includes a second sending unit, used to send a close request to the long connection gateway when a disconnect request is received from a third-party system, so as to close the internal listening port of the long connection gateway.

[0105] Compared with the above embodiments of the present invention Figure 8 The method shown corresponds to a long-lived network connection with dynamic port binding; see [link to relevant documentation]. Figure 10 This diagram illustrates a second structural block diagram of a network long-connection device with dynamic port binding according to an embodiment of the present invention, applied to an intranet load balancing device. The device includes: a lookup unit 1001, a third sending unit 1002, and a fourth sending unit 1003.

[0106] The lookup unit 1001 is used to look up the long-connection gateway from the gateway cluster when it receives a transaction request from the intranet transaction system. The long-connection gateway is a gateway whose internal listening port and external listening port are both open.

[0107] The third sending unit 1002 is configured to send a short connection request to the long connection gateway, so as to establish a TCP short connection with the long connection gateway.

[0108] The fourth sending unit 1003 is configured to send a transaction request to the long connection gateway based on the TCP short connection, so that the long connection gateway sends the transaction request to the third-party system through the external connection area load balancing device.

[0109] In the embodiment of the application, the dynamic binding of the listening port inside the gateway cluster is achieved without relying on complex system auxiliary functions such as message queues, and it is a plug-and-play solution. The module design of the solution is simple, and only the gateway communication process is needed to achieve it, which is suitable for business scenarios with moderate transaction volume and the need for rapid restart to solve problems. By reducing the complexity of the system, it also helps to reduce the maintenance cost of the system.

[0110] Another embodiment of the application provides an electronic device, such as Figure 11 As shown in the figure, it comprises a memory 1101 and a processor 1102.

[0111] The memory 1101 is configured to store a program.

[0112] The processor 1102 is configured to execute the program, and when the program is executed, it is specifically configured to implement the network long connection method of dynamic port binding provided by any one of the above embodiments.

[0113] Another embodiment of the application provides a computer storage medium for storing a computer program, and when the computer program is executed, it is used to implement the network long connection method of dynamic port binding provided by any one of the above embodiments.

[0114] The computer storage medium includes permanent and non-permanent, removable and non-removable media, which can be realized by any method or technology to store information. The information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition in this paper, computer readable medium does not include transitory computer readable medium such as modulated data signals and carriers.

[0115] The various embodiments described in this specification are described in progressive order, with each embodiment building on the previous one. The same or similar elements in each embodiment are denoted by the same or similar reference signs. For each embodiment, the differences between that embodiment and the preceding ones are described in more detail. In particular, the system or system embodiments are described more briefly than the method embodiments, since they are substantially similar to the method embodiments. The system and system embodiments described above are merely illustrative, and the units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e. can be located at one place or distributed over multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the embodiments. Those skilled in the art can understand and implement without creative labor.

[0116] The person skilled in the art will further appreciate that the units and algorithm steps of the examples described in connection with the embodiments disclosed herein can be realized in electronic hardware, computer software, or a combination of both. The disclosure has been presented in the form of functional generalizations so as to clearly illustrate the interchangeability of hardware and software. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. The person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0117] The above description of the disclosed embodiments enables a person skilled in the art to implement or use the application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the scope of the application. Therefore, the present application is not to be limited to the embodiments shown herein, but is to be consistent with the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A network long connection method of port dynamic binding, characterized in that, The method is applied to an external area load balancing device, and the method comprises: When receiving a long connection request sent by a third party system, obtaining a current system state; According to the current system state and a load balancing strategy, determining a long connection gateway from a plurality of gateways in a gateway cluster, and sending an opening request to the long connection gateway to open an internal listening port of the long connection gateway; wherein an external listening port of each gateway in the gateway cluster is in an open state; When receiving a transaction request sent by the long connection gateway, sending the transaction request to the third party system.

2. The method of claim 1, wherein, The method further comprises: When receiving a long connection disconnection request sent by the third party system, sending a closing request to the long connection gateway to close the internal listening port of the long connection gateway.

3. The method of claim 1, wherein, The determining of the long connection gateway according to the current system state and the load balancing strategy comprises: Obtaining resource usage, a current health state, a connection number and a response time of each gateway in the gateway cluster contained in the current system state; According to the resource usage, the current health state, the connection number and the response time of each gateway, dynamically adjusting the load balancing strategy; According to the adjusted load balancing strategy, determining the long connection gateway from the gateway cluster.

4. A network long connection method of port dynamic binding, characterized in that, The method is applied to an internal network area load balancing device, and the method comprises: When receiving a transaction request sent by an internal network transaction system, searching for a long connection gateway from a gateway cluster, wherein the long connection gateway is a gateway with an internal listening port and an external listening port in an open state; Sending a short connection request to the long connection gateway to establish a TCP short connection with the long connection gateway; Based on the TCP short connection, sending the transaction request to the long connection gateway, so that the long connection gateway sends the transaction request to a third party system through an external area load balancing device.

5. A network long connection device with port dynamic binding, characterized in that, The device is applied to an external area load balancing device, and the device comprises: A first obtaining unit is configured to, when receiving a long connection request sent by a third party system, obtain a current system state; A determining unit is configured to, according to the current system state and a load balancing strategy, determine a long connection gateway from a plurality of gateways in a gateway cluster, and send an opening request to the long connection gateway to open an internal listening port of the long connection gateway; wherein an external listening port of each gateway in the gateway cluster is in an open state; A first sending unit is configured to, when receiving a transaction request sent by the long connection gateway, send the transaction request to the third party system.

6. The apparatus of claim 5, wherein, The device further comprises: A second sending unit is configured to, when receiving a long connection disconnection request sent by the third party system, send a closing request to the long connection gateway to close the internal listening port of the long connection gateway.

7. The apparatus of claim 5, wherein, The determining unit is specifically configured to: Obtaining resource usage, current health status, connection number and response time of each gateway in a gateway cluster contained in the current system state; dynamically adjusting a load balancing strategy according to the resource usage, current health status, connection number and response time of each gateway; determining a long connection gateway from the gateway cluster according to the adjusted load balancing strategy.

8. A network long connection device with port dynamic binding, characterized in that, The device is applied to an intranet area load balancing equipment, and comprises: A searching unit is configured to search for a long connection gateway from a gateway cluster when a transaction request sent by an intranet transaction system is received, wherein the long connection gateway is a gateway with both an internal monitoring port and an external monitoring port in an open state; A third sending unit is configured to send a short connection request to the long connection gateway to establish a TCP short connection with the long connection gateway; A fourth sending unit is configured to send the transaction request to the long connection gateway based on the TCP short connection, so that the long connection gateway sends the transaction request to a third party system through an extranet area load balancing equipment.

9. An electronic device, comprising: Comprise: A memory and a processor; The memory is configured to store a program; The processor is configured to execute the program, and the program is configured to implement the network long connection method with dynamic port binding according to any one of claims 1 to 3 or the network long connection method with dynamic port binding according to claim 4 when executed.

10. A computer storage medium, characterized in that, A computer program is stored, and the computer program is configured to implement the network long connection method with dynamic port binding according to any one of claims 1 to 3 or the network long connection method with dynamic port binding according to claim 4 when executed.

Citation Information

Patent Citations

  • Method for solving multi-layer long connection load balance of Internet of Things

    CN110098987A

  • Stateless TCP (Transmission Control Protocol) long connection server side method based on micro-service architecture

    CN118075268A