Message pushing method and device, electronic equipment, storage medium and program product

By establishing a cluster of persistent connections and service instances between banks and partners, the problem of resource consumption and unreliability of messages caused by frequent connection establishment of message push in the prior art is solved, and efficient and reliable message push is achieved.

CN119743523AActive Publication Date: 2025-04-01INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411906240.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-23
Publication Date
2025-04-01
Estimated Expiration
2044-12-23

AI Technical Summary

Technical Problem

Message push between existing banks and partners is based on short HTTP connections, resulting in frequent connection establishment consumes a large amount of system resources, and network fluctuations and node failures will cause messages to fail to reach customers in a timely or accurate manner.

Method used

Message push is achieved by establishing a persistent connection between the client and the target service instance cluster and using the service instance cluster and load balancing mechanism. Persistent connection avoids the process of rebuilding the connection by multiple handshakes, saves network resources and time, and improves message push efficiency and reliability.

Benefits of technology

It improves the efficiency and reliability of message push, reduces the waste of system resources, enhances the ability to withstand network fluctuations, ensures timely and accurate transmission of messages, and improves the high availability and security of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119743523A_ABST
    Figure CN119743523A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a message pushing method and device, electronic equipment, a storage medium and a program product, and is applied to the technical field of Internet of Things, the message pushing method can be executed by a gateway, the gateway comprises at least two service instance clusters, each service instance cluster comprises at least two service instances, and the service instances are distributed in the service instance clusters. The message pushing method comprises the following steps: establishing persistent connection between a client and a target service instance cluster; selecting a current service instance for the client from the target service instance cluster, and synchronizing the persistent connection to the current service instance; receiving a message which is sent by the application end and needs to be pushed to the client; and pushing a message to the client through the persistent connection by using the current service instance. According to the embodiment of the invention, the message pushing is realized by utilizing the persistent connection and the service instance cluster, and the resource utilization rate, the pushing real-time performance, the system stability, the security and the like are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the technical field of Internet of Things, and in particular to a message pushing method, device, electronic device, storage medium and program product. Background Art

[0002] Hypertext Transfer Protocol (HTTP) short connection, also known as "non-persistent connection". In this connection mode, each HTTP request will establish a new Transmission Control Protocol (TCP) connection, and after the request is completed, the TCP connection will be closed.

[0003] Banks and their partners often need to push messages. The existing message push between banks and their partners is implemented based on HTTP short connection. That is, when business needs, the bank calls the partner's application programming interface (API) to push messages. After the push is completed, the connection is disconnected.

[0004] Pushing messages based on HTTP short connections has the problem of frequent connection establishment resulting in high overhead. Continuous and large-scale message pushes will consume a large amount of system resources, and any network fluctuations, node failures, etc. will cause messages to fail to reach customers in a timely or accurate manner. Summary of the invention

[0005] The embodiments of the present invention provide a message push method, device, electronic device, storage medium and program product, which use persistent connection and service instance cluster to realize message push, and significantly improve resource utilization, push real-time performance, system stability and security.

[0006] In a first aspect, a message push method provided by an embodiment of the present invention is applied to a gateway, the gateway includes at least two service instance clusters, each service instance cluster includes at least two service instances, and the message push method includes:

[0007] Establish a persistent connection between the client and the target service instance cluster;

[0008] Select the current service instance for the client from the target service instance cluster and synchronize the persistent connection to the current service instance;

[0009] Receive messages sent by the application to be pushed to the client;

[0010] Use the current service instance to push messages to the client through a persistent connection.

[0011] In a second aspect, a message push device provided by an embodiment of the present invention is applied to a gateway, the gateway includes at least two service instance clusters, each service instance cluster includes at least two service instances, and the message push device includes:

[0012] A connection establishment module is used to establish a persistent connection between the client and the target service instance cluster;

[0013] The instance selection module is used to select the current service instance for the client from the target service instance cluster and synchronize the persistent connection to the current service instance;

[0014] The message receiving module is used to receive messages sent by the application end and need to be pushed to the client;

[0015] The message push module is used to push messages to the client through a persistent connection using the current service instance.

[0016] In a third aspect, an electronic device provided by an embodiment of the present invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the program, a message push method as in any embodiment of the present invention is implemented.

[0017] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, a message push method as in any embodiment of the present invention is implemented.

[0018] In a fifth aspect, a computer program product provided by an embodiment of the present invention includes a computer program, and when the computer program is executed by a processor, the message pushing method as described in any embodiment of the present invention is implemented.

[0019] In an embodiment of the present invention, a persistent connection is established between a client and a target service instance cluster. Because the connection remains in a continuous state, the process of reestablishing the connection through multiple handshakes is avoided, network resources and time are saved, and the efficiency of message push is improved. The persistent connection ensures that the client is online at any time. Once a message needs to be pushed, the message can be sent immediately through the existing connection, reducing the delay time. The persistent connection has a stronger tolerance to network fluctuations. Once the connection is established, short-term network fluctuations will not affect the stability of the connection, thereby improving the message arrival rate. Based on the message push method of the persistent connection, the entire process from connection establishment to disconnection is executed only once, and the connection maintained for a long time can make better use of the underlying resources, greatly reducing the waste of system resources. The gateway manages the service instance cluster to ensure high system availability. Even if a service instance fails, it can quickly switch to other healthy instances without interrupting the customer connection. Through load balancing within and between clusters, the load between each instance is guaranteed to be evenly distributed to prevent service degradation caused by single-point overload. The service instances are centrally managed by the gateway to improve security monitoring and management capabilities. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solution of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0021] Figure 1 It is a flow chart of a message push method provided by an embodiment of the present invention;

[0022] Figure 2a is an example diagram of a message push framework provided by an embodiment of the present invention;

[0023] Figure 2b is another flow chart of the message push method provided by an embodiment of the present invention;

[0024] Figure 3 is an interactive example diagram of the message push method provided by an embodiment of the present invention;

[0025] Figure 4 It is a structural schematic diagram of a message push device provided by an embodiment of the present invention;

[0026] Figure 5 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0027] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings 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 should fall within the scope of protection of the present invention.

[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0029] Figure 1 This is a flow chart of the message push method provided by an embodiment of the present invention. The message push method provided by an embodiment of the present invention can be applied to the scenario where a large number of messages need to be pushed from the application end to the client end. The message push method can be executed by the message push device provided by an embodiment of the present invention, and the device can be implemented in software and / or hardware. In a specific embodiment, the device can be integrated into an electronic device, and the electronic device can be a gateway, etc. The following embodiment is described by taking the example of integrating the message push device into the gateway. Figure 1 The message push method of this embodiment may include the following steps:

[0030] Step 110: Establish a persistent connection between the client and the target service instance cluster.

[0031] The method of this embodiment is applied to a gateway, and the gateway includes at least two service instance clusters, and each service instance cluster includes at least two service instances. A service instance cluster is a collection of a group of service instances that provide the same service together. The cluster can share traffic through load balancing and provide failover capabilities when an instance fails. A service instance cluster exposes an address to the outside, that is, all service instances in a service instance cluster can share the same address. A service instance is a running instance of a service that provides actual business processing capabilities to the outside. A service instance cluster can be deployed on the same physical or virtual device. Deploying multiple service instances to form different service instance clusters, this architectural design allows the system to not only efficiently handle high-concurrency requests, but also ensure continuous availability of services when some service instances fail, thereby improving the stability and reliability of the overall system.

[0032] The client can be any terminal that accesses the service, such as a browser, mobile application, or other terminal. The target service instance cluster is a specific service instance cluster selected to process client requests. The gateway can select a cluster as the "target" of this request based on factors such as load conditions and health status. A persistent connection refers to a TCP connection that remains open. It is not closed after each request, but is continuously open for reuse. It can maintain a connection between multiple requests, thereby reducing the overhead of establishing and closing connections. Specifically, a persistent connection can be a WebSocket long connection. WebSocket is a full-duplex communication protocol based on TCP connection. It can establish a persistent connection between the client and the server, thereby realizing real-time two-way communication.

[0033] The client (such as a browser or mobile application) can initiate a connection request to the gateway. The gateway selects a target service instance cluster based on the current load, service instance health status and other factors. The gateway establishes a long-lasting TCP connection with the client and directly associates this connection with the target service instance cluster. After that, all messages that need to be pushed can be carried out through this persistent connection, and the communication between the client and the target service instance cluster does not need to re-establish the connection every time.

[0034] Step 120 , select a current service instance for the client from the target service instance cluster, and synchronize the persistent connection to the current service instance.

[0035] The current service instance is a single service instance in the target service instance cluster that is selected to handle a specific client request. This instance will handle the client's request in the current persistent connection. "Synchronize" means updating the state or information of the persistent connection to the selected current service instance so that the instance is aware of and can handle requests through this persistent connection.

[0036] Specifically, in the target service instance cluster, the gateway can select a service instance that is most suitable for processing the current request based on factors such as load balancing strategy and instance health status. This is called the current service instance. The gateway will synchronize the persistent connection information between the client and the client to this current service instance, which means that this service instance will take over the persistent connection and use it to process subsequent requests from the client.

[0037] Through the above design, the system can not only efficiently handle high-concurrency requests, but also keep the service continuously available when the service instance fails, thereby improving the performance and reliability of the overall system.

[0038] Step 130: Receive a message sent by the application to be pushed to the client.

[0039] The application end refers to the application or system that initiates the message push request. In a specific scenario, the application end can be the backend system of a bank. The application end (such as a bank system) can send messages to the gateway that need to be pushed to a client. These messages may contain various types of information, such as transaction notifications, account change reminders, or other important customer notifications.

[0040] Step 140: Use the current service instance to push a message to the client through a persistent connection.

[0041] After receiving the message, the gateway will use the current service instance to send the message to the client through a persistent connection. The client receives the message from the server through a persistent connection and makes corresponding processing, such as pop-up notification, interface update, etc.

[0042] In this embodiment, a persistent connection is established between the client and the target service instance cluster. Because the connection remains in a continuous state, the process of multiple handshakes to reestablish the connection is avoided, network resources and time are saved, and the efficiency of message push is improved; the persistent connection ensures that the client is online at any time. Once a message needs to be pushed, the message can be sent immediately through the existing connection, reducing the delay time; the persistent connection has a stronger tolerance to network fluctuations. Once the connection is established, short-term network fluctuations will not affect the stability of the connection, thereby improving the message arrival rate; based on the message push method of persistent connection, the entire process from connection establishment to disconnection is executed only once, and the connection maintained for a long time can better utilize the underlying resources, greatly reducing the waste of system resources; the gateway manages the service instance cluster to ensure high system availability. Even if a service instance fails, it can quickly switch to other healthy instances without interrupting the customer connection; through load balancing within and between clusters, the load between each instance is guaranteed to be evenly distributed to prevent service degradation caused by single-point overload; the service instance is centrally managed by the gateway to improve security monitoring and management capabilities.

[0043] The following describes a framework used in the message push method of an embodiment of the present invention. A specific example of the message push framework can be as follows: Figure 2a As shown, it includes the partner client, the connection management center (i.e., the connection management device), the push gateway, and the in-line application (i.e., the application end). There can be multiple partner clients, and the push gateway has multiple service instances. A WebSocket persistent connection is established between each client and the corresponding service instance.

[0044] The connection management center is responsible for managing the long connection status, session information and routing information of each WebSocket client. The connection management center includes a connection management module and a load balancing module. The connection management module can use the remote dictionary server (Redis) to store and manage connection information. Redis was chosen because of its advantages: First, Redis has the characteristics of efficient key-value pair storage and memory database, and supports the publish / subscribe mode, which can realize the broadcast or grouping of message push; second, Redis supports cluster mode, which can cope with a large number of connections and high concurrent request scenarios; third, Redis's persistence mechanism ensures the high availability and rapid recovery capabilities of the connection management center. The load balancing module is responsible for the allocation of long connections. By formulating load balancing strategies (such as polling, minimum connection, address hashing, etc.), connections are reasonably distributed to different WebSocket service instance clusters.

[0045] The following is combined with Figure 2a The message push framework shown further illustrates the message push method provided by the embodiment of the present invention. Figure 2b As shown, the method of this embodiment may include:

[0046] Step 201 : reporting the address information and load status of each service instance cluster to a connection management device, so that the connection management device selects a target service instance cluster for a client according to the load status of each service instance cluster and provides the address information of the target service instance cluster to the client.

[0047] The address information may include an Internet Protocol (IP) address and a port number. The load condition refers to the current workload of the service instance cluster, including the number of connections, CPU usage, memory usage, etc. It reflects the current resource usage of the service instance cluster.

[0048] Specifically, after the message push framework is deployed, the gateway can report the address information and load status of each of its service instance clusters to the connection management device in real time or periodically. The connection management device selects a suitable target service instance cluster based on the load status of these clusters, and provides the address information of the selected target service instance cluster to the client so that the client can connect to the cluster. Through this mechanism, the system can not only ensure load balancing and efficient use of resources, but also improve the stability and response speed of the service.

[0049] Step 202: receiving a connection establishment request initiated by a client, the connection establishment request including address information of a target service instance cluster, and establishing a persistent connection between the client and the target service instance cluster based on the address information of the target service instance cluster.

[0050] A connection establishment request is a request initiated by the client to the server to establish a communication connection with the target service instance cluster. The request contains the address information of the target service instance cluster. A persistent connection is a connection that remains open for a long time. It will not be closed after each request is processed, but can be reused to process multiple requests to reduce the overhead of establishing and closing connections.

[0051] The client can generate a connection establishment request that includes the address information of the target service instance cluster (such as IP and port). The gateway receives the connection establishment request sent by the client, parses the cluster address information in the request, identifies the specific network address of the service instance cluster to be connected, and establishes a persistent connection with the target service instance cluster based on the parsed address information.

[0052] For example, the gateway has three service instance clusters: cluster A, cluster B, and cluster C. Assuming that cluster A currently has the lowest load, the address information of cluster A can be provided to the client to establish a persistent connection between the client and cluster A.

[0053] Step 203: Obtain the load status of each service instance in the target service instance cluster.

[0054] The load of a service instance refers to the current resource usage and pressure status of each service instance, including but not limited to CPU usage, memory usage, network traffic, the number of requests currently being processed, etc. This information can help determine the workload of the service instance.

[0055] Step 204 , selecting a current service instance for the client from the target service instance cluster according to the load conditions of each service instance, and synchronizing the persistent connection to the current service instance.

[0056] The gateway can select the service instance with the most appropriate load (for example, the lowest load) as the current service instance to process the client's request based on the load of each service instance in the target service instance cluster. The gateway will then synchronize the client's persistent connection with the selected current service instance to enable smooth communication. For example, the target service instance cluster is cluster A, which includes service instances A1, A2, and A3. At the current moment, the load of service instance A1 is the lowest. In this case, service instance A1 can be determined as the current service instance, and the client's persistent connection can be synchronized to service instance A1. Through this mechanism, the system can achieve efficient load balancing, ensure full utilization of resources, improve the response speed and stability of the system, and ultimately improve user experience and service quality.

[0057] At the same time, in order to achieve high availability, the connection management device can also broadcast the client's persistent connection to the candidate service instances in the target service instance cluster, so that when the current service instance is unavailable, the candidate service instance takes over the current service instance to provide services to the client. Candidate service instances are other service instances in the target service instance cluster except the current service instance. For example, the target service instance cluster is cluster A, which includes service instances A1, A2, and A3, and the current service instance is A1, then the connection management device can also broadcast the client's persistent connection to A2 and A3.

[0058] Step 205: Receive a message sent by the application to be pushed to the client.

[0059] The application end refers to the application or system that initiates the message push request. In a specific scenario, the application end can be the backend system of a bank. The application end (such as a bank system) can send messages to the gateway that need to be pushed to a client. These messages may contain various types of information, such as transaction notifications, account change reminders, or other important customer notifications.

[0060] Step 206, determine whether the current service instance is available, if available, execute step 209, if not available, execute step 207.

[0061] Availability refers to whether a service instance is able to work properly and process requests. Measuring the availability of a service instance usually involves monitoring its health status, response time, load, and connection status.

[0062] Step 207: Select a standby service instance for the client from the candidate service instances in the target service instance cluster based on the load balancing strategy. The standby service instance is persistently connected through broadcast synchronization of the connection management device.

[0063] Load balancing strategy is an algorithm or rule used to distribute requests to different service instances to ensure the most efficient use of system resources and guarantee service performance and stability. A backup service instance is a service instance that is switched to when the current service instance is unavailable or overloaded to ensure service continuity.

[0064] That is, when the current service instance is unavailable, the gateway selects a backup service instance for the client from the candidate service instances in the target service instance cluster according to the load balancing strategy. Since the backup service instance has synchronized the persistent connection through the broadcast of the connection management device, the backup instance can immediately take over the client's request.

[0065] Step 208: Use the standby service instance to push a message to the client through a persistent connection.

[0066] Step 209: Use the current service instance to push a message to the client through a persistent connection.

[0067] Step 210, when the persistent connection between the client and the target service instance cluster is interrupted, report connection interruption notification information to the connection management device, so that the connection management device generates connection failure notification information based on the connection interruption notification information, and the connection failure notification information is broadcast by the connection management device to the candidate service instances in the target service instance cluster.

[0068] The client and the gateway can detect the status of the persistent connection through the heartbeat packets sent periodically. Once the persistent connection is detected to be interrupted, the gateway can report the connection interruption notification information to the connection management device. After receiving the connection interruption notification information, the connection management device determines that the current persistent connection has failed, and broadcasts the connection failure notification information to the candidate service instances in the target service instance cluster, so that the candidate service instances also stop providing services to the client. At this point, the client and the target service instance cluster are successfully disconnected.

[0069] The following describes the interaction process involved in the message push method according to an embodiment of the present invention. The specific interaction example diagram can be shown in FIG. Figure 3 As shown:

[0070] When deploying the message push framework, you can configure the application identity (Application Identity, APP ID), key and other information for the client, connect the software development kit (Software Development Kit, SDK) for message push on the client, initialize the SDK after the client is started, use the SDK to obtain the address information of the service instance cluster with the smallest current load from the connection management device, and initiate a request to establish a WebSocket connection to the push gateway based on the address information of the service instance cluster with the smallest current load.

[0071] The gateway establishes a persistent connection between the client and the service instance cluster with the smallest current load (i.e., the current service instance cluster), selects the service instance with the smallest current load (i.e., the current service instance) from the current service instance cluster, and synchronizes the persistent connection to the current service instance. At the same time, the connection management device can also broadcast and synchronize the persistent connection to other service instances in the current service instance cluster.

[0072] When the gateway receives a message sent by the application to be pushed to the client, it can determine whether the current service instance is available. If the current service instance is available, the current service instance is used to push the message to the client through a persistent connection; if the current service instance is unavailable, another available service instance, namely the backup service instance, is determined from the current service instance cluster through load balancing, and the backup service instance is used to push the message to the client through a persistent connection.

[0073] The gateway and the client can detect the status of the persistent connection through the heartbeat packet. Once the persistent connection is detected to be interrupted, the gateway can report the connection interruption notification information to the connection management device. After receiving the connection interruption notification information, the connection management device determines that the current persistent connection has failed, and broadcasts the connection failure notification information to the candidate service instances in the current service instance cluster, so that the candidate service instances also stop providing services to the client. At this point, the client is successfully disconnected from the current service instance cluster.

[0074] In this embodiment, a persistent connection is established between the client and the target service instance cluster. Because the connection remains in a continuous state, the process of multiple handshakes to reestablish the connection is avoided, network resources and time are saved, and the efficiency of message push is improved; the persistent connection ensures that the client is online at any time. Once a message needs to be pushed, the message can be sent immediately through the existing connection, reducing the delay time; the persistent connection has a stronger tolerance to network fluctuations. Once the connection is established, short-term network fluctuations will not affect the stability of the connection, thereby improving the message arrival rate; based on the message push method of persistent connection, the entire process from connection establishment to disconnection is executed only once, and the connection maintained for a long time can better utilize the underlying resources, greatly reducing the waste of system resources; the gateway manages the service instance cluster to ensure high system availability. Even if a service instance fails, it can quickly switch to other healthy instances without interrupting the customer connection; through load balancing within and between clusters, the load between each instance is guaranteed to be evenly distributed to prevent service degradation caused by single-point overload; the service instance is centrally managed by the gateway to improve security monitoring and management capabilities.

[0075] Figure 4 is a structural diagram of a message push device provided in an embodiment of the present invention, and the device is suitable for executing the message push method provided in an embodiment of the present invention, such as Figure 4As shown, the device is applied to a gateway, the gateway includes at least two service instance clusters, each service instance cluster includes at least two service instances, and the device may specifically include:

[0076] A connection establishment module 401 is used to establish a persistent connection between the client and the target service instance cluster;

[0077] An instance selection module 402 is used to select a current service instance for the client from the target service instance cluster and synchronize the persistent connection to the current service instance;

[0078] The message receiving module 403 is used to receive the message sent by the application end and to be pushed to the client;

[0079] The message push module 404 is used to push messages to the client through a persistent connection using the current service instance.

[0080] In one embodiment, the device further comprises:

[0081] A reporting module, used to report the address information and load status of each service instance cluster to the connection management device, so that the connection management device selects a target service instance cluster for the client according to the load status of each service instance cluster and provides the address information of the target service instance cluster to the client;

[0082] The connection establishment module 401 establishes a persistent connection between the client and the target service instance cluster, including:

[0083] A connection establishment request initiated by a client is received, the connection establishment request including address information of a target service instance cluster, and a persistent connection between the client and the target service instance cluster is established based on the address information of the target service instance cluster.

[0084] In one embodiment, the instance selection module 402 selects a current service instance for the client from the target service instance cluster, including:

[0085] Get the load status of each service instance in the target service instance cluster;

[0086] The current service instance is selected for the client from the target service instance cluster based on the load of each service instance.

[0087] In one embodiment, the device further comprises:

[0088] The judgment module is used to judge whether the current service instance is available;

[0089] If the current service instance is available, the message push module 404 uses the current service instance to push the message to the client through a persistent connection.

[0090] In one embodiment, after the determination module determines whether the current service instance is available, the message push module 404 is further configured to:

[0091] If the current service instance is unavailable, a backup service instance is selected for the client from the candidate service instances in the target service instance cluster based on the load balancing strategy. The backup service instance is persistently connected through broadcast synchronization of the connection management device;

[0092] Use a standby service instance to push messages to clients over a persistent connection.

[0093] In one embodiment, the reporting module is further used for:

[0094] When the persistent connection between the client and the target service instance cluster is interrupted, connection interruption notification information is reported to the connection management device, so that the connection management device generates connection failure notification information based on the connection interruption notification information, and the connection failure notification information is broadcast by the connection management device to the candidate service instances in the target service instance cluster.

[0095] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example for illustration. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the functional modules described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0096] The device of the embodiment of the present invention establishes a persistent connection between the client and the target service instance cluster. Because the connection remains in a continuous state, the process of multiple handshakes to reestablish the connection is avoided, network resources and time are saved, and the efficiency of message push is improved; the persistent connection ensures that the client is online at any time. Once a message needs to be pushed, the message can be sent immediately through the existing connection, reducing the delay time; the persistent connection has a stronger tolerance to network fluctuations. Once the connection is established, short-term network fluctuations will not affect the stability of the connection, thereby improving the message arrival rate; based on the message push method of persistent connection, the entire process from connection establishment to disconnection is executed only once, and the connection maintained for a long time can better utilize the underlying resources, greatly reducing the waste of system resources; the gateway manages the service instance cluster to ensure high system availability. Even if a service instance fails, it can quickly switch to other healthy instances without interrupting the customer connection; through load balancing within and between clusters, the load between each instance is guaranteed to be evenly distributed to prevent service degradation caused by single-point overload; the service instance is centrally managed by the gateway, which improves security monitoring and management capabilities.

[0097] Reference below Figure 5, which shows a schematic diagram of the structure of a computer system 500 of an electronic device suitable for implementing an embodiment of the present invention. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0098] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the computer system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0099] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.

[0100] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present invention are executed.

[0101] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0102] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0103] The modules and / or units involved in the embodiments of the present invention may be implemented in software or hardware. The modules and / or units described may also be arranged in a processor, for example, it may be described as follows: a processor includes a connection establishment module, an instance selection module, a message receiving module, and a message push module. The names of these modules do not, in some cases, constitute limitations on the modules themselves.

[0104] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:

[0105] Establish a persistent connection between the client and the target service instance cluster; select the current service instance for the client from the target service instance cluster and synchronize the persistent connection to the current service instance; receive messages sent by the application to be pushed to the client; use the current service instance to push messages to the client through the persistent connection.

[0106] The technical solution of the embodiment of the present invention establishes a persistent connection between the client and the target service instance cluster. Because the connection remains in a continuous state, the process of multiple handshakes to reestablish the connection is avoided, network resources and time are saved, and the efficiency of message push is improved; the persistent connection ensures that the client is online at any time. Once a message needs to be pushed, the message can be sent immediately through the existing connection, reducing the delay time; the persistent connection has a stronger tolerance to network fluctuations. Once the connection is established, short-term network fluctuations will not affect the stability of the connection, thereby improving the message arrival rate; based on the message push method of persistent connection, the entire process from connection establishment to disconnection is executed only once, and the connection maintained for a long time can better utilize the underlying resources, greatly reducing the waste of system resources; the gateway manages the service instance cluster to ensure high system availability. Even if a service instance fails, it can quickly switch to other healthy instances without interrupting the customer connection; through load balancing within and between clusters, the load between each instance is guaranteed to be evenly distributed to prevent service degradation caused by single-point overload; the service instance is centrally managed by the gateway to improve security monitoring and management capabilities.

[0107] An embodiment of the present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements the message push method provided in any embodiment of the present application.

[0108] In the process of implementation, the computer program product can be written in one or more programming languages ​​or a combination thereof to perform the computer program code of the present invention, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).

[0109] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0110] It should be noted that the collection, use, storage, sharing and transfer of user personal information involved in the technical solution of the present invention are in compliance with the provisions of relevant laws and regulations, and the user needs to be informed and the user's consent or authorization is obtained. When applicable, the user's personal information is de-identified and / or anonymized and / or encrypted. In addition, the corresponding operation entrance is provided for the user to choose to agree or reject the automated decision-making results; if the user chooses to reject, the expert decision-making process will be entered.

[0111] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A message push method, characterized in that: Applied to a gateway, the gateway includes at least two service instance clusters, each service instance cluster includes at least two service instances, and the message push method includes: Establish a persistent connection between the client and the target service instance cluster; Select the current service instance for the client from the target service instance cluster and synchronize the persistent connection to the current service instance; Receive messages sent by the application to be pushed to the client; Use the current service instance to push messages to the client through a persistent connection.

2. The message push method according to claim 1, characterized in that: Before establishing a persistent connection between the client and the target service instance cluster, it also includes: Reporting the address information and load status of each service instance cluster to the connection management device, so that the connection management device selects a target service instance cluster for the client according to the load status of each service instance cluster and provides the address information of the target service instance cluster to the client; Establish a persistent connection between the client and the target service instance cluster, including: A connection establishment request initiated by a client is received, the connection establishment request including address information of a target service instance cluster, and a persistent connection between the client and the target service instance cluster is established based on the address information of the target service instance cluster.

3. The message push method according to claim 1, characterized in that: Select the current service instance for the client from the target service instance cluster, including: Get the load status of each service instance in the target service instance cluster; The current service instance is selected for the client from the target service instance cluster based on the load of each service instance.

4. The message push method according to claim 1, characterized in that: After receiving the message sent by the application to be pushed to the client, it also includes: Determine whether the current service instance is available; If the current service instance is available, the current service instance is used to push messages to the client through a persistent connection.

5. The message push method according to claim 4, characterized in that: After determining whether the current service instance is available, it also includes: If the current service instance is unavailable, a backup service instance is selected for the client from the candidate service instances in the target service instance cluster based on the load balancing strategy. The backup service instance is persistently connected through broadcast synchronization of the connection management device; Use a standby service instance to push messages to clients over a persistent connection.

6. The message push method according to any one of claims 1 to 5, characterized in that: Also includes: When the persistent connection between the client and the target service instance cluster is interrupted, connection interruption notification information is reported to the connection management device, so that the connection management device generates connection failure notification information based on the connection interruption notification information, and the connection failure notification information is broadcast by the connection management device to the candidate service instances in the target service instance cluster.

7. A message push device, characterized in that: Applied to a gateway, the gateway includes at least two service instance clusters, each service instance cluster includes at least two service instances, and the message push device includes: A connection establishment module is used to establish a persistent connection between the client and the target service instance cluster; The instance selection module is used to select the current service instance for the client from the target service instance cluster and synchronize the persistent connection to the current service instance; The message receiving module is used to receive messages sent by the application end and need to be pushed to the client; The message push module is used to push messages to the client through a persistent connection using the current service instance.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the message pushing method as described in any one of claims 1 to 6 is implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the message pushing method according to any one of claims 1 to 6 is implemented.

10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program implements the message pushing method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • FTP service implementation method, system and device and storage medium

    CN114124935A

  • Request processing method and device, equipment, storage medium and program product

    CN117395255A

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

    CN118075268A

  • Techniques for authentication using push notifications

    US20190372959A1