High-concurrency global gateway implementation method and device

By registering the channel corresponding to threads in the global gateway and processing request and response messages, the problem of insufficient and excessive processes during high-concurrent transactions in the existing technology is solved, and the service processing performance of the global gateway is improved.

CN113590296BActive Publication Date: 2025-02-18BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110885361.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-03
Publication Date
2025-02-18
Estimated Expiration
2041-08-03

AI Technical Summary

Technical Problem

When the existing global gateway handles high concurrent transactions, insufficient number of processes leads to transaction accumulation and waiting, and excessive number of processes leads to memory management and context switching problems.

Method used

By establishing a connection with the target system, register the channel corresponding to the thread, and the thread corresponds to the channel one by one. Based on the activated channel, the request message is obtained, the corresponding thread is called to process the request message, the back-end system is determined, and the response message is processed through the corresponding thread to complete the sending of the request and response.

Benefits of technology

The business processing performance improvement of high-concurrency global gateways is achieved, avoiding the overhead caused by excessive multi-thread development and reducing the cost of thread switching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113590296B_ABST
    Figure CN113590296B_ABST
Patent Text Reader

Abstract

The present invention provides a high-concurrency global gateway implementation method and device. After registering the channel corresponding to the thread of the target system, when the front-end system initiates a request message, the request message can be obtained based on the activated first channel, and then the corresponding first thread is called to process the request message. After determining the back-end system, the second channel of the back-end system can be determined, and the corresponding second thread is called to continue to process the request message, thereby completing the sending of the request message to the back-end system. After obtaining the response message returned by the back-end system through the second channel, the second thread can be called to process the response message, the first channel is determined, and the first thread is called to process the response message again, thereby completing the sending of the response message to the front-end system. Based on the present invention, the management of all connections by threads can be established, avoiding excessive multi-threaded development, reducing the overhead caused by thread switching, and improving the business processing performance of the global gateway.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of software technology, and more specifically, to a method and device for implementing a high-concurrency global gateway. Background Art

[0002] In the banking system, connecting channels and transaction processing systems generally requires a global gateway for transaction distribution, which plays the role of interface specification, routing selection, load balancing, etc. With the development of banking business, the types of channels and transaction processing systems have become more diversified, and the transaction throughput requirements are getting higher and higher, which has extremely high requirements for the concurrency of the gateway.

[0003] At present, the design of the global gateway adopts the master-subprocess method. This method requires that each system has a master process and multiple subprocesses. At the same time, multiple processes use a blocking method when processing message requests. Once a high concurrency is required, many subprocesses must be created to handle it. If the number of processes is insufficient, a large number of transactions may be piled up and waiting while the gateway is waiting for the back-end system to process. If the number of processes is too large, there will be problems with memory management and context switching. Summary of the invention

[0004] In view of this, in order to solve the above problems, the present invention provides a high-concurrency global gateway implementation method and device, and the technical solution is as follows:

[0005] On the one hand, the present invention provides a method for implementing a high-concurrency global gateway, which is applied to a global gateway and includes:

[0006] Establish a connection with the target system, and register a channel corresponding to the connection based on the thread of the target system, with threads and channels corresponding one to one;

[0007] Acquire a request message initiated by the front-end system based on the activated first channel, and call a first thread corresponding to the first channel to process the request message to determine the back-end system;

[0008] Determine a second channel of the backend system, call a second thread corresponding to the second channel to process the request message after the first processing, and send the request message after the second processing to the backend system;

[0009] Obtaining a response message returned by the backend system through the second channel, and calling the second thread to process the response message;

[0010] The first channel is determined, the first thread is called to process the response message after the first processing, and the response message processed for the second time is sent to the front-end system.

[0011] Preferably, establishing a connection with the target system includes:

[0012] Establishing a persistent connection with a first target system, wherein a thread of the first target system is pre-specified;

[0013] A designated port is configured for the second target system, and a short connection is actively established with the second target system by monitoring the designated port, wherein the thread of the second target system is designated by the designated port.

[0014] Preferably, determining the second channel of the backend system includes:

[0015] Obtaining connection properties of the backend system;

[0016] When the connection attribute is a short connection, establish a short connection with the backend system, select a channel from the channels registered by the backend system as the second channel, and cache link information, wherein the link information includes the first channel, the second channel and the identification number of the request message;

[0017] In the case where the connection attribute is a long connection, selecting a channel from the channels registered in the backend system as the second channel, and caching link information, the link information including the first channel, the second channel and the identification number of the request message;

[0018] Accordingly, determining the first channel includes:

[0019] The cached link information is retrieved, and the first channel corresponding to the second channel is determined based on the identification number of the request message.

[0020] Preferably, the selecting a channel from the channels registered in the backend system as the second channel comprises:

[0021] A channel is selected from the channels registered with the backend system as the second channel based on a load balancing strategy.

[0022] Preferably, the method further comprises:

[0023] When the connection attribute is a long connection, a heartbeat detection is performed on the long connection established with the backend system.

[0024] Another aspect of the present invention provides a high-concurrency global gateway implementation device, the device comprising:

[0025] A registration module, used to establish a connection with a target system and register a channel corresponding to the connection based on a thread of the target system, wherein threads correspond to channels one by one;

[0026] A request module, configured to obtain a request message initiated by a front-end system based on an activated first channel, and call a first thread corresponding to the first channel to process the request message to determine a back-end system; determine a second channel of the back-end system, call a second thread corresponding to the second channel to process the request message after the first processing, and send the request message after the second processing to the back-end system;

[0027] The response module is used to obtain the response message returned by the back-end system through the second channel, call the second thread to process the response message; determine the first channel, call the first thread to process the response message after the first processing, and send the second processed response message to the front-end system.

[0028] Preferably, the registration module for establishing a connection with the target system is specifically used for:

[0029] A long connection is established with a first target system, and a thread of the first target system is pre-specified; a designated port is configured for a second target system, and a short connection is actively established with the second target system by monitoring the designated port, and the thread of the second target system is specified by the designated port.

[0030] Preferably, the request module for determining the second channel of the backend system is specifically used for:

[0031] Obtaining a connection attribute of the backend system; when the connection attribute is a short connection, establishing a short connection with the backend system, selecting a channel from the channels registered by the backend system as the second channel, and caching link information, wherein the link information includes the first channel, the second channel, and an identification number of the request message; when the connection attribute is a long connection, selecting a channel from the channels registered by the backend system as the second channel, and caching link information, wherein the link information includes the first channel, the second channel, and an identification number of the request message;

[0032] Accordingly, the response module for determining the first channel is specifically configured to:

[0033] The cached link information is retrieved, and the first channel corresponding to the second channel is determined based on the identification number of the request message.

[0034] Preferably, the request module for selecting a channel from the channels registered in the backend system as the second channel is specifically used for:

[0035] A channel is selected from the channels registered with the backend system as the second channel based on a load balancing strategy.

[0036] Preferably, the request module is further used for:

[0037] When the connection attribute is a long connection, a heartbeat detection is performed on the long connection established with the backend system.

[0038] Compared with the prior art, the present invention has the following beneficial effects:

[0039] The present invention provides a high-concurrency global gateway implementation method and device. After registering the channel corresponding to the thread of the target system, when the front-end system initiates a request message, the request message can be obtained based on the activated first channel, and then the corresponding first thread is called to process the request message. After determining the back-end system, the second channel of the back-end system can be determined, and the corresponding second thread is called to continue to process the request message, thereby completing the sending of the request message to the back-end system. After obtaining the response message returned by the back-end system through the second channel, the second thread can be called to process the response message, the first channel is determined, and the first thread is called to process the response message again, thereby completing the sending of the response message to the front-end system. Based on the present invention, the management of all connections by threads can be established, avoiding excessive multi-threaded development, reducing the overhead caused by thread switching, and improving the business processing performance of the global gateway. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0041] Figure 1 A method flow chart of a method for implementing a high-concurrency global gateway provided by an embodiment of the present invention;

[0042] Figure 2 A partial method flow chart of a method for implementing a high-concurrency global gateway provided by an embodiment of the present invention;

[0043] Figure 3 A schematic diagram of the structure of a high-concurrency global gateway implementation device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0044] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0045] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0046] To facilitate understanding of the present invention, the following first describes the two connection modes of long connection and short connection:

[0047] A long connection means that multiple data packets can be sent continuously on a connection. If no data packets are sent during the connection, both parties need to send link detection packets.

[0048] A short connection is a connection established only when the two parties have data exchange. After the data packet is sent, the connection is disconnected, that is, each connection only completes the sending of one business.

[0049] The high-concurrency global gateway implementation scheme of the present invention is implemented based on Netty. Netty is a Java open source framework provided by JBOSS and is now an independent project on Github. Netty provides an asynchronous, event-driven network application framework and tools for quickly developing high-performance, high-reliability network servers and client programs.

[0050] See also Figure 1 As shown in the method flow chart, an embodiment of the present invention provides a method for implementing a high-concurrency global gateway, and the method global gateway comprises the following steps:

[0051] S10, establishing a connection with the target system, and registering a channel corresponding to the connection based on the thread of the target system, with the thread corresponding to the channel one by one.

[0052] In the embodiment of the present invention, the target system is a plurality of systems that require a global gateway for transaction distribution, and its connection with the global network is divided into a long connection and a short connection. For the first target system that establishes a long connection, its thread is pre-specified; for the second target system that establishes a short connection, it is necessary to configure a designated port for it, and the designated port specifies its thread. Moreover, the short connection between the global gateway and the second target system is actively established by the global gateway listening to the designated port. In addition, a designated port can correspond to one or more second target systems, and a second target system can also correspond to one or more designated ports, which is not limited in the embodiment of the present invention.

[0053] In the Netty framework, the global gateway establishes a ServerBootstrap in the gateway service to listen to the specified port, and establishes a Bootstrap on the gateway service to actively connect to the second target system. According to the connection properties in the routing and connection property configuration, after the gateway service is started, it establishes a long connection with some key systems (i.e., the first target system), and listens to the specified port to receive short connection requests from other systems (i.e., the second target system). The specified port specifies different Handlers (i.e., threads) for business processing for the second target system it faces. After the connection is established, the corresponding Channel (i.e., channel) of the connection is uniformly registered in a global Channel manager.

[0054] Furthermore, based on the advantages of Netty framework in IO and thread management, the present invention can establish two working thread pools to manage all connections, avoid excessive multi-thread development, reduce the overhead caused by thread switching, and reduce the problem of CPU overload or thread task load imbalance caused by manual thread allocation. More attention will be paid to business functions such as routing rules, load balancing, grouping / unpacking, etc.

[0055] Subsequently, after establishing connections with the front-end and back-end systems, the Channel encapsulated by Netty is used to uniformly manage the connections, reducing the overhead caused by frequent connection creation. The routing rules and recorded request link information can ensure load balancing to a large extent.

[0056] S20, obtaining a request message initiated by the front-end system based on the activated first channel, and calling a first thread corresponding to the first channel to process the request message to determine the back-end system.

[0057] In the embodiment of the present invention, the front-end system activates a channel when initiating a request message, and selects the channel to transmit its request message. Therefore, after the global gateway detects the activated first channel, since there is a one-to-one correspondence between threads and channels, the first thread corresponding to the first channel can be called to perform business processing such as unpacking the request message.

[0058] Furthermore, for the domain information obtained by unpacking the request message, the backend system that responds to the request message can be selected according to the routing information in the routing and connection attribute configuration. It should be noted that the routing information contains the routing relationship between systems. For example, if the system 1 has a routing relationship with system 2, system 3 and system 4, then assuming that system 1 is the front-end system, it is necessary to determine whether the system indicated by the domain information is one or more of system 2, system 3 and system 4. If so, the system indicated by the domain information is used as the back-end system.

[0059] S30, determining a second channel of the backend system, calling a second thread corresponding to the second channel to process the request message after the first processing, and sending the request message after the second processing to the backend system.

[0060] In the embodiment of the present invention, after the backend system is determined, a channel can be selected from the channels registered for the backend system as the second channel. Since the thread and the channel have a one-to-one correspondence, the second thread corresponding to the second channel can be called to perform business processing such as reassembly of the request message. Further, the request message after the second processing is written into the port number of the second channel by calling the second thread, and the request message is sent to the backend system. When selecting the second channel, it can be implemented by random selection or specified selection according to the scene requirements, and the embodiment of the present invention does not limit this.

[0061] In the specific implementation process, the "determining the second channel of the backend system" in step S30 can adopt the following steps, and the method flow chart is as follows: Figure 2 As shown:

[0062] S301, obtaining connection properties of a backend system.

[0063] S302, when the connection attribute is a short connection, establish a short connection with the backend system, select a channel from the registered channels of the backend system as the second channel, and cache link information, the link information includes the identification numbers of the first channel, the second channel and the request message.

[0064] S303, when the connection attribute is a long connection, a channel is selected from the channels registered in the backend system as the second channel, and link information is cached, where the link information includes identification numbers of the first channel, the second channel and the request message.

[0065] In the embodiment of the present invention, the connection attribute of the backend system is divided into two types: short connection and long connection. If the connection attribute is a short connection, since the connection between the global gateway and the backend system is disconnected after the last business is sent, the global gateway needs to establish a short connection with the backend system, and after the short connection is established, select the second channel from the channels registered by the backend system, that is, return Channel. If the connection attribute is a long connection, since the global gateway and the backend system are already in the connection maintenance period, the global gateway can directly select the second channel from the channels registered by the backend system, that is, return Channel.

[0066] In addition, since there is more than one channel between the target system and the global gateway, in order to ensure business performance, no matter whether the connection attribute of the backend system is a short connection or a long connection, when selecting the second channel, the global gateway can select a channel from the channels registered by the backend system as the second channel based on the load balancing strategy. Specifically, the second channel can be selected in a polling manner. For example, assuming that the backend system has three registered channels, channel 1, channel 2, and channel 3, when the global gateway processes the first request message to the backend system, it will assign the first request message to channel 1 (select channel 1 as the channel for processing the first request message, that is, the second channel), and when processing the second request message to the backend system, it will assign the second request message to channel 2 (select channel 2 as the channel for processing the second request message, that is, the second channel), and so on, the third request message to the backend system is assigned to channel 3, and the fourth request message to the backend system is assigned to channel 1...

[0067] Of course, the second channel can also be selected by specifying a proportional allocation method, which is not limited in the embodiment of the present invention. Continuing with the above-mentioned channel 1, channel 2 and channel 3 as an example, assuming that the specified ratio of channel 1, channel 2 and channel 3 is 1:2:3, the global gateway will allocate the first request message for the backend system to channel 1, the second to third request messages for the backend system to channel 2, the fourth to sixth request messages for the backend system to channel 3, and the seventh request message for the backend system to channel 1, and so on...

[0068] In addition, regardless of whether the connection attribute of the back-end system is a short connection or a long connection, after determining its second channel, it is necessary to cache link information, which includes the identification numbers of the first channel, the second channel and the request message, and the identification number is the unique mark of the request message. Accordingly, when the subsequent S50 global gateway determines the first channel, the link information can be retrieved to determine the first channel corresponding to the second channel based on the identification number of the request message. Thus, based on the link information, the response message can be returned along the original path of the request message, that is, the path of the request message is the first channel → the second channel, and the return path of the response message is the second channel → the first channel.

[0069] In some other embodiments, for a backend system whose connection attribute is a long connection, the global gateway may also perform a heartbeat detection on the long connection to determine whether the long connection between the global gateway and the backend system is disconnected, and re-establish the connection in time if it is disconnected.

[0070] S40, obtaining a response message returned by the backend system through the second channel, and calling the second thread to process the response message.

[0071] In the embodiment of the present invention, after the backend system obtains the request message, it performs business processing based on the request message to generate a response message, and the backend system returns the response message through the channel (ie, the second channel) through which the request message was received.

[0072] For the global gateway, after receiving the response message returned through the second channel, since the only thread corresponding to the second channel is the second thread, the global gateway calls the second thread to perform business processing such as unpacking the response message.

[0073] S50, determining a first channel, calling a first thread to process the response message after the first processing, and sending the response message after the second processing to the front-end system.

[0074] In the embodiment of the present invention, after determining that the channel through which the front-end system transmits its request message is the first channel, the global gateway calls the thread that only corresponds to the first channel, that is, the first thread, to perform business processing such as reassembly of the response message. Further, by calling the first display, the response message after the second processing is written into the port number of the first channel, and the response message is sent to the front-end system, so that the response message is returned along the original path of the request message. At this point, the front-end system completes a request processing to the back-end system.

[0075] It should be noted that the front-end system in the embodiment of the present invention is the target system that initiates the request, and the back-end system is the target system that responds to the request. For a target system, it can be used as a front-end system and a back-end system in different businesses.

[0076] The high-concurrency global gateway implementation method provided by the embodiment of the present invention can obtain the request message based on the activated first channel when the front-end system initiates the request message after registering the channel corresponding to its thread to the target system, and then call the corresponding first thread to process the request message. After determining the back-end system, it can determine the second channel of the back-end system, and call the corresponding second thread to continue processing the request message, thereby completing the sending of the request message to the back-end system. After obtaining the response message returned by the back-end system through the second channel, it can call the second thread to process the response message, determine the first channel, call the first thread to process the response message again, and complete the sending of the response message to the front-end system. Based on the present invention, it is possible to establish thread management of all connections, avoid excessive multi-threaded development, reduce the overhead caused by thread switching, and improve the business processing performance of the global gateway.

[0077] Based on the high-concurrency global gateway implementation method provided in the above embodiment, the embodiment of the present invention provides a device for executing the above high-concurrency global gateway implementation method. The structural diagram of the device is as follows: Figure 3 As shown, including:

[0078] A registration module 10 is used to establish a connection with a target system and register a channel corresponding to the connection based on a thread of the target system, where threads correspond to channels one by one;

[0079] The request module 20 is used to obtain the request message initiated by the front-end system based on the activated first channel, and call the first thread corresponding to the first channel to process the request message to determine the back-end system; determine the second channel of the back-end system, call the second thread corresponding to the second channel to process the request message after the first processing, and send the request message after the second processing to the back-end system;

[0080] The response module 30 is used to obtain the response message returned by the backend system through the second channel, call the second thread to process the response message; determine the first channel, call the first thread to process the response message after the first processing, and send the second processed response message to the front-end system.

[0081] Optionally, the registration module 10 for establishing a connection with the target system is specifically used for:

[0082] A long connection is established with the first target system, and the thread of the first target system is pre-specified; a designated port is configured for the second target system, and a short connection is actively established with the second target system by monitoring the designated port, and the thread of the second target system is specified by the designated port.

[0083] Optionally, the request module 20 for determining the second channel of the backend system is specifically used to:

[0084] Obtain the connection attribute of the backend system; when the connection attribute is a short connection, establish a short connection with the backend system, select a channel from the channels registered by the backend system as the second channel, and cache the link information, which includes the identification numbers of the first channel, the second channel, and the request message; when the connection attribute is a long connection, select a channel from the channels registered by the backend system as the second channel, and cache the link information, which includes the identification numbers of the first channel, the second channel, and the request message;

[0085] Accordingly, the response module 30 for determining the first channel is specifically configured to:

[0086] The cached link information is retrieved, and the first channel corresponding to the second channel is determined based on the identification number of the request message.

[0087] Optionally, the request module 20 for selecting a channel from the channels registered in the backend system as the second channel is specifically used for:

[0088] Based on the load balancing strategy, a channel is selected from the channels registered in the backend system as the second channel.

[0089] Optionally, the request module 20 is further configured to:

[0090] When the connection attribute is a long connection, a heartbeat detection is performed on the long connection established with the backend system.

[0091] It should be noted that the detailed functions of each module in the embodiment of the present invention can be found in the corresponding public part of the above-mentioned high-concurrency global gateway implementation method embodiment, and will not be repeated here.

[0092] Based on the high-concurrency global gateway implementation method provided in the above embodiment, an embodiment of the present invention correspondingly provides a global gateway, which includes: at least one memory and at least one processor; the memory stores a program, the processor calls the program stored in the memory, and the program is used to implement the high-concurrency global gateway implementation method.

[0093] Based on the high-concurrency global gateway implementation method provided in the above embodiment, an embodiment of the present invention provides a storage medium correspondingly, in which computer executable instructions are stored, and the computer executable instructions are used to execute the high-concurrency global gateway implementation method.

[0094] The above is a detailed introduction to a high-concurrency global gateway implementation method and device provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

[0095] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.

[0096] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device that includes a series of elements is inherent to the elements, or also includes elements inherent to these processes, methods, articles or devices. In the absence of further restrictions, the elements defined by the sentence "including a..." do not exclude the presence of other identical elements in the process, method, article or device that includes the elements.

[0097] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A high-concurrency global gateway implementation method, characterized in that: The method is applied to a global gateway, and the method comprises: Establish a connection with the target system, and register a channel corresponding to the connection based on the thread of the target system, with threads and channels corresponding one to one; Acquire a request message initiated by the front-end system based on the activated first channel, and call a first thread corresponding to the first channel to process the request message to determine the back-end system; Determine a second channel of the backend system, call a second thread corresponding to the second channel to process the request message after the first processing, and send the request message after the second processing to the backend system; Obtaining a response message returned by the backend system through the second channel, and calling the second thread to process the response message; Determine the first channel, call the first thread to process the response message after the first processing, and send the response message processed for the second time to the front-end system; The determining the second channel of the backend system includes: Obtaining connection properties of the backend system; When the connection attribute is a short connection, establish a short connection with the backend system, select a channel from the channels registered by the backend system as the second channel, and cache link information, wherein the link information includes the first channel, the second channel and the identification number of the request message; In the case where the connection attribute is a long connection, selecting a channel from the channels registered in the backend system as the second channel, and caching link information, the link information including the first channel, the second channel and the identification number of the request message; Accordingly, determining the first channel includes: The cached link information is retrieved, and the first channel corresponding to the second channel is determined based on the identification number of the request message.

2. The method according to claim 1, characterized in that The establishing a connection with the target system includes: Establishing a persistent connection with a first target system, wherein a thread of the first target system is pre-specified; A designated port is configured for the second target system, and a short connection is actively established with the second target system by monitoring the designated port, wherein the thread of the second target system is designated by the designated port.

3. The method according to claim 1, characterized in that: The selecting a channel from the channels registered in the backend system as the second channel includes: A channel is selected from the channels registered with the backend system as the second channel based on a load balancing strategy.

4. The method according to claim 1, characterized in that The method further comprises: When the connection attribute is a long connection, a heartbeat detection is performed on the long connection established with the backend system.

5. A high-concurrency global gateway implementation device, characterized in that: The device comprises: A registration module, used to establish a connection with a target system and register a channel corresponding to the connection based on a thread of the target system, wherein threads correspond to channels one by one; A request module, configured to obtain a request message initiated by a front-end system based on an activated first channel, and call a first thread corresponding to the first channel to process the request message to determine a back-end system; determine a second channel of the back-end system, call a second thread corresponding to the second channel to process the request message after the first processing, and send the request message after the second processing to the back-end system; A response module, configured to obtain a response message returned by the backend system through the second channel, and call the second thread to process the response message; determine the first channel, call the first thread to process the response message after the first processing, and send the second processed response message to the front-end system; The request module for determining the second channel of the backend system is specifically used to: Obtaining a connection attribute of the backend system; when the connection attribute is a short connection, establishing a short connection with the backend system, selecting a channel from the channels registered by the backend system as the second channel, and caching link information, wherein the link information includes the first channel, the second channel, and an identification number of the request message; when the connection attribute is a long connection, selecting a channel from the channels registered by the backend system as the second channel, and caching link information, wherein the link information includes the first channel, the second channel, and an identification number of the request message; Accordingly, the response module for determining the first channel is specifically configured to: The cached link information is retrieved, and the first channel corresponding to the second channel is determined based on the identification number of the request message.

6. The device according to claim 5, characterized in that A registration module used to establish a connection with the target system, specifically for: A long connection is established with a first target system, and a thread of the first target system is pre-specified; a designated port is configured for a second target system, and a short connection is actively established with the second target system by monitoring the designated port, and the thread of the second target system is specified by the designated port.

7. The device according to claim 5, characterized in that The request module for selecting a channel from the channels registered in the backend system as the second channel is specifically used for: A channel is selected from the channels registered with the backend system as the second channel based on a load balancing strategy.

8. The device according to claim 5, characterized in that The request module is also used for: When the connection attribute is a long connection, a heartbeat detection is performed on the long connection established with the backend system.

Citation Information

Patent Citations

  • Method for realizing asynchronous gateway in distributed real-time service system

    CN113037875A

  • Task processing method and network card

    WO2018018611A1