CN113259476B - Message pushing method and system - Google Patents

Message pushing method and system Download PDF

Info

Publication number
CN113259476B
CN113259476B CN202110647966.4A CN202110647966A CN113259476B CN 113259476 B CN113259476 B CN 113259476B CN 202110647966 A CN202110647966 A CN 202110647966A CN 113259476 B CN113259476 B CN 113259476B
Authority
CN
China
Prior art keywords
message
node
cloud
push
local
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110647966.4A
Other languages
Chinese (zh)
Other versions
CN113259476A (en
Inventor
包增辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Tencent Information Technology Co Ltd
Original Assignee
Shenzhen Tencent Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Tencent Information Technology Co Ltd filed Critical Shenzhen Tencent Information Technology Co Ltd
Priority to CN202110647966.4A priority Critical patent/CN113259476B/en
Publication of CN113259476A publication Critical patent/CN113259476A/en
Application granted granted Critical
Publication of CN113259476B publication Critical patent/CN113259476B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/55Push-based network services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]

Abstract

The application provides a message pushing system, a message pushing method, a message pushing device, electronic equipment and a storage medium; the system comprises: the system comprises a cloud node, a routing node and a local node corresponding to at least one geographical partition; the routing node is used for storing the association relationship between the partition identification of the geographical partition and the local node; the local node is used for responding to a message pushing request aiming at the target object and sending a pushing message aiming at the target object to the cloud node; the cloud node is used for forwarding the push message to a client of the target object and receiving a response message returned by the client based on the push message, wherein the response message comprises a target partition identifier; calling the routing node to find a target local node associated with the target partition identifier based on the association relation; sending a response message to the target local node to complete the pushing aiming at the pushing message; through the method and the device, the dependence of the cloud node on storage can be reduced, the storage space of the cloud node is saved, and the information processing efficiency is improved.

Description

Message pushing method and system
Technical Field
The present application relates to the field of information processing and block chaining technologies, and in particular, to a message pushing system, a message pushing method, a message pushing device, an electronic device, and a storage medium.
Background
When the message is pushed, the internal machine room mainly pushes the push message to the user side through the cloud machine room, the user side receives the push message and returns corresponding ACK to the cloud machine room, and the cloud machine room needs to return the ACK to the source internal machine room which sends the push message to achieve message pushing.
In the related technology, mapping information of each push message and the source internal machine room is mainly stored in the cloud machine room, and when the cloud machine room forwards the ACK, the corresponding source internal machine room can be found through the message ID. However, according to the scheme, the dependence of the cloud machine rooms on storage is increased, and the cloud machine rooms for message pushing and ACK forwarding are possibly not the same machine room due to the fact that the cloud machine rooms are multiple, the mapping information needs to be stored in all the cloud machine rooms at the moment, so that the method is more complex, and the dependence on storage is larger.
Disclosure of Invention
The embodiment of the application provides a message pushing system, a message pushing method, a message pushing device, an electronic device and a storage medium, dependence of a cloud node on storage can be reduced, storage space of the cloud node is saved, and information processing efficiency is improved.
The technical scheme of the embodiment of the application is realized as follows:
an embodiment of the present application provides a message push system, including: the system comprises a cloud node, a routing node and a local node corresponding to at least one geographic partition; the routing node is used for storing the association relation between the partition identification of the geographical partition and the local node;
the local node is used for responding to a message pushing request aiming at a target object and sending a pushing message aiming at the target object to the cloud end node;
the cloud node is configured to forward the push message to a client of the target object, and receive a response message returned by the client based on the push message, where the response message includes a target partition identifier corresponding to a local node that sent the push message;
based on the response message, calling the routing node to find a target local node associated with the target partition identification based on the association relation;
and sending the response message to the target local node to complete the pushing aiming at the push message.
The embodiment of the application also provides a message pushing method, which is applied to a message pushing system comprising a cloud node, a routing node and at least one local node corresponding to a geographical partition; the routing node is used for storing the association relation between the partition identification of the geographical partition and the local node; the method comprises the following steps:
the cloud node receives a push message aiming at a target object, wherein the push message is sent by the local node in response to a message push request aiming at the target object;
forwarding the push message to a client of the target object, and receiving a response message returned by the client based on the push message, wherein the response message comprises a target partition identifier corresponding to a local node sending the push message;
based on the response message, calling the routing node to find a target local node associated with the target partition identifier based on the association relation;
and sending the response message to the target local node to complete the pushing aiming at the push message.
The embodiment of the application further provides a message pushing device, which is arranged on the cloud node, wherein the cloud node is located in a message pushing system, and the message pushing system further comprises a routing node and at least one local node corresponding to the geographical partition; the routing node is used for storing the association relation between the partition identification of the geographical partition and the local node; the method comprises the following steps:
a receiving module, configured to receive a push message for a target object, where the push message is sent by the local node in response to a message push request for the target object;
the forwarding module is configured to forward the push message to a client of the target object, and receive a response message returned by the client based on the push message, where the response message includes a target partition identifier corresponding to a local node that sends the push message;
a calling module, configured to call the routing node based on the response message, and find a target local node associated with the target partition identifier based on the association relationship;
and the sending module is used for sending the response message to the target local node so as to complete the pushing aiming at the pushing message.
An embodiment of the present application further provides an electronic device, including:
a memory for storing executable instructions;
and the processor is used for realizing the message pushing method provided by the embodiment of the application when the executable instructions stored in the memory are executed.
The embodiment of the present application further provides a computer-readable storage medium, which stores executable instructions, and when the executable instructions are executed by a processor, the message pushing method provided by the embodiment of the present application is implemented.
The embodiment of the application has the following beneficial effects:
providing a message pushing system comprising a cloud node, a routing node and a local node corresponding to at least one geographical partition, wherein the routing node stores an association relation between a partition identifier of the geographical partition and the local node; when the message is pushed, when the cloud end node receives a response message returned by the push message pushed by the client end based on the local node, because the response message contains a target partition identification corresponding to the local node which sends the push message, the cloud end node searches a target local node which is associated with the target partition identification based on the response message by calling the routing node based on the stored association relation, the target local node is a source local node which sends the push message, and the push aiming at the push message is finished when the response message is sent to the target local node; therefore, the dependence of the cloud node on storage is reduced, the storage space of the cloud node is saved, and the information processing efficiency is improved.
Drawings
Fig. 1 is a schematic architecture diagram of a message pushing system provided in an embodiment of the present application;
fig. 2 is a schematic structural diagram of an electronic device 500 implementing a message pushing method according to an embodiment of the present application;
fig. 3 is a schematic view illustrating an interaction flow between nodes in a message pushing system according to an embodiment of the present application;
fig. 4 is a schematic architecture diagram of a message pushing system provided in an embodiment of the present application;
FIG. 5 is a process diagram of a routing information replication component provided by an embodiment of the present application;
fig. 6 is a flowchart illustrating a message push method according to an embodiment of the present application;
fig. 7 is a processing diagram of a message pushing method provided in an embodiment of the present application;
fig. 8 is a schematic diagram of a message push method provided in the related art;
fig. 9 is a schematic diagram of user online and offline routing information provided in an embodiment of the present application.
Detailed Description
In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be described in further detail with reference to the attached drawings, the described embodiments should not be considered as limiting the present application, and all other embodiments obtained by a person of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
In the following description, reference is made to "some embodiments" which describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict.
In the following description, references to the terms "first \ second \ third" are only to distinguish similar objects and do not denote a particular order, but rather the terms "first \ second \ third" are used to interchange specific orders or sequences, where appropriate, so as to enable the embodiments of the application described herein to be practiced in other than the order shown or described herein.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of the present application only and is not intended to be limiting of the application.
Before further detailed description of the embodiments of the present application, terms and expressions referred to in the embodiments of the present application will be described, and the terms and expressions referred to in the embodiments of the present application will be used for the following explanation.
1) The terminal comprises a client and an application program running in the terminal and used for providing various services, such as an instant messaging client and a video playing client.
2) In response to the condition or state on which the performed operation depends, one or more of the performed operations may be in real-time or may have a set delay when the dependent condition or state is satisfied; there is no restriction on the order of execution of the operations performed unless otherwise specified.
3) Message push service: refers to the active message pushing of the user mobile equipment by the operator through the own product or third-party tool. The user can see the push message notification on the mobile device lock screen and the notification bar, and the notification bar can call the client and go to the corresponding page when clicked. For example, WeChat messages and the like which are seen on a lock screen at ordinary times belong to message pushing ranks of the client. Push (Push) is a technical concept, which refers to sending information from a server to a client in real time. Typical Push services are APNS (apple Push Notification service), GCM (Google Cloud messaging), and other services.
4) Remote Procedure Calls (RPCs), client/server mode computing, combine Remote Procedure calls with other technologies (e.g., message passing) as a mechanism for intersystem communication. Clients perform their tasks, but rely on the server to provide back-end file services. RPC provides a communication mechanism for clients to apply for services from a backend server. If you think of the client/server application as a separate program, the server can run the data access part because it is closest to the data, and the client can run the data presentation and the front end part of the interaction with the user. Thus, a remote procedure call may be viewed as a component that reassembles a split program over a network.
5) Kafka, an open source message queue, uses a production-consumption model to deliver messages, and is a high-throughput distributed publish-subscribe messaging system.
6) Remote Dictionary service (Redis) is an open source log-type and Key-Value database written in ANSI C language, supporting network, based on memory and persistent, and provides API of multiple languages.
Based on the above explanations of terms and terms involved in the embodiments of the present application, the message push system provided by the embodiments of the present application is explained below. Referring to fig. 1, fig. 1 is a schematic structural diagram of a message pushing system provided in the embodiment of the present application, in order to support an exemplary application, a terminal (exemplarily showing a terminal 400-1 and a terminal 400-2), a local node 100, a cloud node 200, and a routing node 300 are connected through a network 600;
the terminal 400-1 is a sender of a push message and may be installed with a message push application, the terminal 400-2 (i.e., a terminal where a client of a target object is located) is a receiver of the push message and may be installed with a client (e.g., an instant messaging client, a media information client, a video playing client, etc.) for receiving the push message, and the network 600 may be a wide area network or a local area network, or a combination of the two, and implements data transmission using a wireless or wired link.
The terminal 400-1 is configured to send a message push request for the target object to the local node 100 in response to the message push instruction for the target object;
the local node 100 is configured to receive and respond to a message push request for a target object, and send a push message for the target object to the cloud node 200;
the cloud node 200 is used for forwarding the push message to the terminal 400-2;
the terminal 400-2 is configured to receive and return a response message for the push message to the cloud node 200;
the cloud node 200 is further configured to receive a response message returned by the terminal 400-2 based on the push message (here, the response message includes a target partition identifier corresponding to the local node that sent the push message); based on the response message, calling the routing node to find a target local node associated with the target partition identifier based on the association relation; sending a response message to the target local node, i.e., local node 100;
the local node 100 is further configured to receive a response message sent by the cloud end node 200, to determine that pushing for the push message is completed.
In practical applications, each node in the message pushing system may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a network service, cloud communication, a middleware service, a domain name service, a security service, a CDN, a big data and artificial intelligence platform, and the like. The terminals (e.g., terminal 400-1 and terminal 400-2) may be, but are not limited to, a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart television, a smart watch, and the like. The terminals (e.g., the terminal 400-1 and the terminal 400-2) and the nodes in the message push system may be directly or indirectly connected through wired or wireless communication, and the application is not limited herein.
Referring to fig. 2, fig. 2 is a schematic structural diagram of an electronic device 500 implementing a message pushing method according to an embodiment of the present application. In practical applications, the electronic device 500 may be a node or a terminal shown in fig. 1, and the electronic device 500 is taken as a cloud node shown in fig. 1 as an example to explain an electronic device implementing the message pushing method according to the embodiment of the present application, where the electronic device 500 provided in the embodiment of the present application includes: at least one processor 510, memory 550, at least one network interface 520, and a user interface 530. The various components in the electronic device 500 are coupled together by a bus system 540. It is understood that the bus system 540 is used to enable communications among the components of the connection. The bus system 540 includes a power bus, a control bus, and a status signal bus in addition to a data bus. For clarity of illustration, however, the various buses are labeled as bus system 540 in fig. 2.
The Processor 510 may be an integrated circuit chip having Signal processing capabilities, such as a general purpose Processor, a Digital Signal Processor (DSP), or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like, wherein the general purpose Processor may be a microprocessor or any conventional Processor, or the like.
The user interface 530 includes one or more output devices 531 that enable presentation of media content, including one or more speakers and/or one or more visual display screens. The user interface 530 also includes one or more input devices 532, including user interface components to facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
The memory 550 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid state memory, hard disk drives, optical disk drives, and the like. Memory 550 optionally includes one or more storage devices physically located remote from processor 510.
The memory 550 may comprise volatile memory or nonvolatile memory, and may also comprise both volatile and nonvolatile memory. The nonvolatile Memory may be a Read Only Memory (ROM), and the volatile Memory may be a Random Access Memory (RAM). The memory 550 described in embodiments herein is intended to comprise any suitable type of memory.
In some embodiments, memory 550 can store data to support various operations, examples of which include programs, modules, and data structures, or subsets or supersets thereof, as exemplified below.
An operating system 551 including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;
a network communication module 552 for communicating to other computing devices via one or more (wired or wireless) network interfaces 520, exemplary network interfaces 520 including: bluetooth, wireless compatibility authentication (WiFi), and Universal Serial Bus (USB), etc.;
a presentation module 553 for enabling presentation of information (e.g., a user interface for operating peripherals and displaying content and information) via one or more output devices 531 (e.g., a display screen, speakers, etc.) associated with the user interface 530;
an input processing module 554 to detect one or more user inputs or interactions from one of the one or more input devices 532 and to translate the detected inputs or interactions.
In some embodiments, the message pushing apparatus provided by the embodiments of the present application may be implemented in software, and fig. 2 shows a message pushing apparatus 555 stored in a memory 550, which may be software in the form of programs and plug-ins, and includes the following software modules: the receiving module 5551, the forwarding module 5552, the invoking module 5553 and the sending module 5554 are logical modules, and thus may be arbitrarily combined or further split according to the implemented functions, and the functions of the respective modules will be described below.
In other embodiments, the message pushing apparatus provided in this embodiment of the present Application may be implemented by a combination of hardware and software, and for example, the message pushing apparatus provided in this embodiment of the present Application may be a processor in the form of a hardware decoding processor, which is programmed to execute the message pushing method provided in this embodiment of the present Application, for example, the processor in the form of the hardware decoding processor may be one or more Application Specific Integrated Circuits (ASICs), DSPs, Programmable Logic Devices (PLDs), Complex Programmable Logic Devices (CPLDs), Field Programmable Gate Arrays (FPGAs), or other electronic components.
Based on the above, the message pushing system provided in the embodiment of the present application is described in detail. The message pushing system provided by the embodiment of the application comprises: the system comprises a cloud node, a routing node and a local node corresponding to at least one geographical partition; the routing node is used for storing the association relation between the partition identification of the geographical partition and the local node. Referring to fig. 3, fig. 3 is a schematic view of an interaction flow between nodes in the message push system according to the embodiment of the present application, where the interaction flow includes:
step 101: and the local node responds to the message pushing request aiming at the target object and sends the pushing message aiming at the target object to the cloud node.
Here, the message push system includes: the system comprises a cloud node, a routing node and a local node corresponding to at least one geographic partition. In the embodiment of the application, the geographical area is divided into a plurality of geographical partitions according to the geographical location, for example, beijing and tianjin are divided into one geographical partition, shanghai and jiangsu are divided into one geographical partition, and the like; and respectively setting corresponding partition identification for each geographical partition, wherein the partition identification is globally unique and unchangeable and is used for identifying the corresponding geographical partition.
Further, each geographic partition corresponds to a corresponding local node, which may be one or more, for supporting the message push service of the geographic partition. In the embodiment of the present application, the message pushing system includes a routing node, where the routing node is configured to store an association relationship between a partition identifier of a geographic partition and a local node, for example, the partition identifier of the geographic partition is Shard1, and the associated local node is node 1; the partition of the geographic partition is identified as Shard2, the associated local node is node 2, and so on.
In practical applications, in this embodiment of the present application, the association relationship between the partition identifier of the geographic partition and the local node is stored in the routing node, and in some other embodiments, the association relationship may also be stored in a block chain.
In practical application, after receiving a message pushing request, a local node pushes a corresponding message to be pushed to a user side through a cloud node, and after receiving the message to be pushed, the user side returns a response message, namely a response message ACK, for identifying the user side to confirm that the message to be pushed is received. The response message also needs to be forwarded by the cloud node to the source local node of the message to be pushed (i.e., the local node that pushes the message to be pushed), so that when the source local node receives the response message, it is determined that the message to be pushed is pushed successfully, and thus, the pushing is not repeated.
Based on this, in the embodiment of the present application, the message push end may set a message push task for the target object, for example, the message push task may be set on a message push application program run by the message push terminal; when receiving a task execution instruction for a message push task triggered by a message pusher, a message push terminal sends a message push request for a target object to a local node, where the local node may include a push server supporting a push service.
The local node receives and responds to the message pushing request aiming at the target object, and sends the pushing message aiming at the target object to the cloud node.
In practical applications, the local node may perform message pushing to the user side, and the forwarding is required by the cloud end node, that is, the local node may perform message pushing in a state where a communication connection is established between the client end of the user side and the cloud end node, and therefore, in some embodiments, the message pushing system further includes: a domain name resolution service node; the domain name resolution service node is used for responding to a connection request of a client and sending the connection request of the corresponding client to a cloud end node matched with geographical position information based on the geographical position information corresponding to the client;
correspondingly, the cloud node is further configured to receive the connection request, and select a local node corresponding to the geographic partition matched with the geographic location information from local nodes corresponding to the at least one geographic partition; and executing interactive verification of remote procedure call with the selected local node, and establishing communication connection with the client after the interactive verification is successful.
Here, the message pushing system further includes a domain name resolution service node, and the client of the target object may establish a communication connection, such as a TCP connection, with the cloud node through the domain name resolution service node. Specifically, in response to a client-side online operation triggered by a target object, the client-side sends a connection request to a domain name resolution service node; the domain name resolution service node receives and responds to a connection request of a client, acquires geographic position information corresponding to the client, namely the geographic position information of a terminal where the client is located, and accordingly selects a cloud node matched with the geographic position information.
After selecting a cloud node matched with the geographic position information corresponding to the client, the domain name resolution service node sends a connection request corresponding to the client to the selected cloud node.
Correspondingly, after receiving the connection request, the cloud node responds to the connection request and selects a local node corresponding to the geographical partition matched with the geographical location information from local nodes corresponding to at least one geographical partition. Here, in the embodiment of the present application, the geographic area is divided into a plurality of geographic areas according to the geographic location, for example, beijing and tianjin are divided into one geographic area, shanghai and jiangsu are divided into one geographic area, and the like; and respectively setting corresponding partition identification for each geographical partition, wherein the partition identification is globally unique and unchangeable and is used for identifying the corresponding geographical partition. Based on the geographical location information of the client, it may be determined which target geographical partition the terminal where the client is located (i.e., the geographical partition matching the geographical location information), so as to select the local node corresponding to the target geographical partition.
After the cloud node selects a local node corresponding to a geographical partition matched with the geographical position information from local nodes corresponding to at least one geographical partition, the cloud node performs interactive verification of remote procedure call with the selected local node, namely the cloud node initiates an RPC call with the selected local node, performs RPC interaction with the selected local node, and the RPC interaction comprises authentication, connection state storage, routing information and the like. After the local node interactive verification passes, namely the authentication is successful, returning corresponding interactive verification success information to the cloud node; and after receiving the information of successful interactive verification, the cloud node determines that the interactive verification is successful, and establishes and maintains the communication connection with the client at the moment.
By way of example, referring to fig. 4, fig. 4 is a schematic architecture diagram of a message pushing system provided in an embodiment of the present application. Here, the message push system includes two cloud nodes (i.e., cloud equipment room 1 and cloud equipment room 2), a domain name resolution Service node (i.e., DNS Service), three local nodes (i.e., local equipment rooms 1, 2, and 3), and a routing node (i.e., GZS, Global Zone Service).
When a client of a user sends a connection request, the DNS service selects a nearby cloud machine room 1 based on the geographical location information of the user, and sends the connection request to the selected cloud machine room 1; the cloud machine room 1 selects the local machine room 3 of the geographical partition where the user is located according to the geographical position information of the user, and initiates RPC calling, so that after authentication is successful, the cloud machine room 1 establishes and maintains communication connection with the client of the user.
In some embodiments, the local node is further configured to respond to a message push request for the target object, and obtain, based on an object identifier of the target object carried in the message push request, routing information corresponding to the target object; and when the client and the cloud node are determined to be in a communication connection state based on the routing information, sending a push message aiming at the target object to the cloud node.
Here, in practical applications, the message push request for the target object carries an object identifier of the target object. The local node responds to a message pushing request aiming at a target object, and acquires routing information corresponding to the target object according to an object identifier of the target object carried in the message pushing request, wherein the routing information can comprise an association relation among a client of the target object, a cloud node establishing communication connection with the client and a local node executing message pushing to the client, so that the selection process of a middle transmission node is represented by the routing information when the pushing message is sent to the receiving node and the corresponding response message is returned to the local node.
After the routing information corresponding to the target object is obtained, whether the client side and the cloud side node are in a communication connection state or not is determined based on the routing information; and when the client and the cloud node are determined to be in a communication connection state based on the routing information, sending a push message aiming at the target object to the cloud node.
In some embodiments, when there are at least two local nodes, each local node stores the routing information of the target object, and each local node includes a routing information replication component;
the routing information copying component is used for subscribing routing update information of routing information in other local nodes except the node where the routing information copying component is positioned; when the route updating message represents that the route information of other local nodes has updating content, acquiring a first updating time point of the route information of other local nodes; when the first updating time point is later than a second updating time point of the routing information of the node where the first updating time point is located, the updating content is copied to the node where the first updating time point is located, and the second updating time point is updated.
Here, when the user is online, the user can be connected with a certain cloud node, the cloud node selects a nearby local node to communicate with the local node according to the geographical position information of the user, and authentication and storage of connection state and routing information are carried out on the local node. Therefore, in the embodiment of the present application, each local node needs to store the routing information of the user, for example, the routing information may be stored in a Redis database, so that the corresponding cloud node can be found during pushing to push the message to the user.
In practical applications, when the routing information of a local node is updated, the updated routing information needs to be synchronized to other local nodes. Here, a corresponding routing information replication component is provided for each local node.
The routing information replication component may subscribe to a routing update message of routing information in a local node other than the node where the routing information replication component is located, for example, by subscribing to a Kafka message; when the route update message indicates that the route information of other local nodes has the update content, for example, an operation data corresponding to an online operation is newly written, a first update time point of the route information of other local nodes and a second update time point corresponding to the route information of the node where the first update time point is obtained, and in actual implementation, the first update time point is the write time point of the update content. And comparing the first updating time point with the second updating time point, copying the updating content to the node where the updating content is located when the first updating time point is later than the second updating time point, and updating the second updating time point.
By way of example, referring to fig. 5, fig. 5 is a processing diagram of a routing information replication component according to an embodiment of the present application. Here, the local node includes a local node 1 and a local node 2, and each local node stores therein the routing information of the user through the Redis cluster, and each local node includes therein a routing information replication component (i.e., a Replicator component); and realizing the routing update message for subscribing the routing information in other local nodes by subscribing the Kafka message. Illustratively, when a user corresponding to the local node 1 performs an online and offline operation in an application, writing update content (i.e., corresponding operation data) to the Redis cluster of the local node 1 to update a routing message stored therein, and recording a corresponding first update time point; simultaneously writing the operation data in the Kafka to trigger the sending of the Kafka message;
at this time, when it is determined that the second update time point of the routing information of the node where the local node is located is earlier than the first update time point, the information copying component (i.e., the Replicator component) of the local node 2 copies the update content (i.e., the written operation data) of the routing information in the local node 1 to the Redis cluster of the local node 2, so as to update the stored routing information therein, and update the second update time point at the same time.
In some embodiments, the routing information may also be stored on a blockchain.
Step 102: the cloud node forwards the push message to the client of the target object and receives a response message returned by the client based on the push message.
The response message includes a target partition identifier corresponding to the local node sending the push message.
Step 103: based on the response message, the routing node is called to find out the target local node associated with the target partition identification based on the association relation.
Here, after the cloud node receives a push message for the target object sent by the local node, the push message is forwarded to the client of the target object. After receiving the push message, the client needs to return a response message, i.e., an acknowledgement message ACK, based on the push message, so as to confirm that the push message has been received to the cloud node (further, the local node may also be included) based on the response message.
In this embodiment of the application, the response message carries a target partition identifier corresponding to the local node that sends the push message, that is, a partition identifier corresponding to a source local node of the push message. In practical application, the target partition identifier is consistent with a partition identifier carried by a push message received by the client, and is determined by the client based on the partition identifier carried by the received push message. When receiving a response message aiming at the push message, the cloud end node can quickly determine the partition identifier corresponding to the source local node of the push message, so that the source local node of the push message can be quickly determined, the response message can be forwarded to the source local node, and the source local node can confirm that the push message is successfully pushed when receiving the response message, so that the push message is not repeatedly pushed.
After receiving a response message returned by the client based on the push message, the cloud node calls the routing node through a corresponding interface based on the target partition identification carried in the response message, so that the routing node finds the target local node associated with the target partition identification based on the stored association relationship between the partition identification of the geographical partition and the local node.
In some embodiments, the response message carries a corresponding first message identifier, so that the target partition identifier is carried by the first message identifier; correspondingly, the cloud node is further configured to parse the first message identifier of the response message based on the response message to obtain the target partition identifier included in the response message, and to invoke the routing node based on the target partition identifier to find the target local node associated with the target partition identifier based on the association relationship.
In practical application, the response information carries a corresponding first message identifier, and the target partition identifier is embedded in the first message identifier. The first message identifier is consistent with a message identifier carried by a push message received by the client and is determined by the client based on the message identifier carried by the received push message.
After receiving a response message returned by the client based on the push message, the cloud node analyzes the first message identifier of the response message based on the response message to obtain a target partition identifier contained in the response message, so that the routing node is called through a corresponding interface, and the routing node finds a target local node associated with the target partition identifier based on the stored association relationship between the partition identifier of the geographical partition and the local node.
In some embodiments, the local node further comprises: a message identifier generation component; the message identifier generation component is used for generating a first message identifier corresponding to the push message based on the partition identifier corresponding to the local node, the object identifier of the target object and the current time;
and the message identifier generating component is further used for regenerating a second message identifier corresponding to the push message when the first message identifier is determined to conflict with the historical message identifier, and using the second message identifier as the first message identifier corresponding to the push message.
Here, the first message identifier is a message identifier of a push message received by the client, that is, in the embodiment of the present application, when the local node performs message pushing, for each push message, a corresponding first message identifier is configured. In practical applications, the first message identifier is generated by a message identifier generating component, and the message identifier generating component is disposed in a corresponding local node. Specifically, the message identifier generating component generates a first message identifier corresponding to the push message based on the partition identifier corresponding to the local node, the object identifier of the target object, and the current time.
In actual implementation, the generated first message identification may conflict with the historical message identification, such as occurrence of duplication. Therefore, when the first message identification is determined to conflict with the historical message identification, the second message identification corresponding to the push message is regenerated, and the second message identification is used as the first message identification corresponding to the push message. Specifically, when the message identifier generating component generates the first message identifier for the first time, the first message identifier is stored in the Redis database, the Redis database judges whether the first message identifier conflicts with the historical message identifier, if the conflict is determined, the preset sleep duration (for example, 1us) is set, that is, the preset sleep duration is entered, so that after the sleep state is finished, the second message identifier corresponding to the push message is generated again, and the second message identifier is used as the first message identifier corresponding to the push message.
Step 104: and sending a response message to the target local node to complete the pushing aiming at the push message.
Here, after determining the target local node, that is, after determining the source local node corresponding to the push message, the cloud node sends the response message to the target local node, so as to complete the push for the push message. And after receiving the response message, the target local node confirms that the push message is successfully pushed, so that the push is not repeated.
In some embodiments, the local node is further configured to determine, after sending the push message, whether a response message to the push message is received within a preset time period; when the fact that the response message is not received within the preset time length and the client side and the cloud side node are in a communication connection state is determined, the push message aiming at the target object is sent to the cloud side node again; and the cloud node is also used for forwarding the push message to the client of the target object again.
Here, after sending the push message, the local node starts timing to determine whether a response message for the push message is received within a preset time period, and when determining that the response message is received within the preset time period, it is determined that the push message is successfully pushed, so that the push is not repeated. When the response message is determined not to be received within the preset time, whether the client side and the cloud side node are in a communication connection state is detected, and if the client side and the cloud side node are in the communication connection state, the push message for the target object is sent to the cloud side node again, so that the cloud side node forwards the push message to the client side of the target object again, and the push for the push message is pushed again. In practical applications, the local node may store a message list of the push messages which have not received the response messages, so as to sequentially re-push each push message which has not received the response message according to a first-in first-out sequence.
In practical applications, when the local node performs message pushing, if the client of the user is not in a communication connection state with the cloud node, compensation pushing may be performed through a third-party vendor channel, that is, a terminal vendor channel (such as APNS, OPPO Push, XiaoMi Push, and the like).
In practical application, after receiving the push message and sending a response message for the push message, the client stores a message identifier of the push message which has sent the response message, if the storage fails, it is indicated that the client network is abnormal, so that the response message is sent unsuccessfully, at this time, the client can reestablish the communication connection with the cloud node, and then, after the communication connection is established successfully, the client resends the response message.
In some embodiments, when the number of the local nodes is at least two, the routing node is further configured to, when it is determined that the current local node fails, select another local node that does not fail from the at least two local nodes, and modify the association relationship between the stored partition identifier and the current local node into the association relationship between the partition identifier and the other local node, so as to switch the local node to the other local node.
In practical applications, the number of local nodes included in the message push system may be multiple, so as to ensure that the local node is switched when a certain local node fails. Specifically, the routing node may select, when it is determined that the current local node has a failure, another local node that has not failed from the plurality of local nodes, and modify the stored association relationship between the partition identifier and the current local node into an association relationship between the partition identifier and another local node, so as to switch the local node to another local node. Therefore, the user flow can be uniformly partitioned to different local nodes, a plurality of local nodes can be linearly expanded, and the switching of a certain local node when a fault occurs can be supported.
In some embodiments, when there are at least two cloud nodes, the message pushing system further includes: a domain name resolution service node; the domain name resolution service node is used for selecting other cloud nodes which do not have faults from the at least two cloud nodes when the current cloud node is determined to have faults, and switching the current cloud node into other cloud nodes; correspondingly, the local node is further configured to send a push message for the target object to other cloud nodes in response to the message push request for the target object.
In practical applications, the number of the cloud nodes included in the message pushing system may also be multiple, so as to ensure that the cloud nodes are switched when a certain cloud node fails. Specifically, the method can be implemented through a domain name resolution service node in the message pushing system, and when the domain name resolution service node determines that the current cloud node fails, other cloud nodes which do not fail are selected from the plurality of cloud nodes, and the current cloud node is switched to other cloud nodes. At this time, when receiving the message pushing request for the target object, the local node sends the pushing message for the target object to the other switched cloud nodes.
By applying the embodiments of the present application, a message pushing system is provided, which includes a cloud node, a routing node, and at least one local node corresponding to a geographic partition, where the routing node stores an association relationship between a partition identifier of the geographic partition and the local node; when the message is pushed, when the cloud end node receives a response message returned by a push message pushed by the client end based on the local node, because the response message contains a target partition identification corresponding to the local node for sending the push message, the cloud end node searches a target local node associated with the target partition identification based on the response message by calling the routing node based on the stored association relation, wherein the target local node is a source local node for sending the push message, so that the push for the push message is finished when the response message is sent to the target local node; therefore, the dependence of the cloud node on storage is reduced, the storage space of the cloud node is saved, and the information processing efficiency is improved.
Next, a message pushing method provided in the embodiment of the present application is described in detail. The message pushing method provided by the embodiment of the application is applied to a message pushing system comprising a cloud node, a routing node and a local node corresponding to at least one geographical partition; the routing node is used for storing the association relation between the partition identification of the geographical partition and the local node. Referring to fig. 6, fig. 6 is a schematic flowchart of a message pushing method provided in an embodiment of the present application, where the message pushing method provided in the embodiment of the present application includes:
step 201: and the cloud node receives a push message aiming at the target object.
The push message is sent by the local node in response to a message push request for the target object.
Here, the message push system includes: the system comprises a cloud node, a routing node and a local node corresponding to at least one geographic partition. In the embodiment of the application, the geographical area is divided into a plurality of geographical partitions according to the geographical location, for example, beijing and tianjin are divided into one geographical partition, shanghai and jiangsu are divided into one geographical partition, and the like; and respectively setting corresponding partition identification for each geographical partition, wherein the partition identification is globally unique and unchangeable and is used for identifying the corresponding geographical partition.
Further, each geographic partition corresponds to a corresponding local node, which may be one or more, for supporting the message push service of the geographic partition. In the embodiment of the present application, the message pushing system includes a routing node, where the routing node is configured to store an association relationship between a partition identifier of a geographic partition and a local node, for example, the partition identifier of the geographic partition is Shard1, and the associated local node is node 1; the partition of the geographic partition is identified as Shard2, the associated local node is node 2, and so on.
In the embodiment of the present application, the message push end may set a message push task for the target object, for example, the message push task may be set on a message push application program run by the message push terminal; when receiving a task execution instruction for a message pushing task triggered by a message pusher, a message pushing terminal sends a message pushing request for a target object to a local node, where the local node may include a push server supporting a push service. The local node receives and responds to the message pushing request aiming at the target object, and sends the pushing message aiming at the target object to the cloud node.
Step 202: and forwarding the push message to a client of the target object, and receiving a response message returned by the client based on the push message.
The response message includes a target partition identifier corresponding to the local node sending the push message.
Here, after the cloud node receives a push message for the target object sent by the local node, the push message is forwarded to the client of the target object. After receiving the push message, the client needs to return a response message, i.e., an acknowledgement message ACK, based on the push message, so as to confirm that the push message has been received to the cloud node (further including the local node) based on the response message.
In this embodiment of the application, the response message carries a target partition identifier corresponding to the local node that sends the push message, that is, a partition identifier corresponding to a source local node of the push message. In practical application, the target partition identifier is consistent with a partition identifier carried in a push message received by the client, and is determined by the client based on the partition identifier carried in the received push message. When receiving a response message aiming at the push message, the cloud end node can quickly determine the partition identifier corresponding to the source local node of the push message, so that the source local node of the push message can be quickly determined, the response message can be forwarded to the source local node, and the source local node can confirm that the push message is successfully pushed when receiving the response message, so that the push message is not repeatedly pushed.
Step 203: based on the response message, the routing node is called to find out the target local node associated with the target partition identification based on the association relation.
After receiving a response message returned by the client based on the push message, the cloud node calls the routing node through a corresponding interface based on the target partition identification carried in the response message, so that the routing node finds the target local node associated with the target partition identification based on the stored association relationship between the partition identification of the geographical partition and the local node.
Step 204: and sending a response message to the target local node to complete the pushing aiming at the push message.
Here, after determining the target local node, that is, after determining the source local node corresponding to the push message, the cloud node sends the response message to the target local node, so as to complete the push for the push message. And after receiving the response message, the target local node confirms that the push message is successfully pushed, so that the push is not repeated.
For example, referring to fig. 7, fig. 7 is a processing schematic diagram of a message pushing method provided in an embodiment of the present application. Here, the local node (i.e., the internal machine room 1) pushes the push message to the cloud node (i.e., the cloud machine room 2), and the cloud node (i.e., the cloud machine room 2) pushes the push message to the client of the user; the client returns a response message ACK to the cloud node (namely the cloud machine room 2) based on the push message, the cloud node (namely the cloud machine room 2) searches a target local node (namely the internal machine room 1) corresponding to the target partition identification carried by the response message ACK by calling the routing node (namely GZS) based on the stored incidence relation, and therefore the response message ACK is sent to the target local node (namely the internal machine room 1).
By applying the embodiment of the present application, a message pushing method applied to a message pushing system is provided, where the message pushing system includes a cloud node, a routing node, and at least one local node corresponding to a geographic partition, and the routing node stores an association relationship between a partition identifier of the geographic partition and the local node; when the message is pushed, when the cloud end node receives a response message returned by a push message pushed by the client end based on the local node, because the response message contains a target partition identification corresponding to the local node for sending the push message, the cloud end node searches a target local node associated with the target partition identification based on the response message by calling the routing node based on the stored association relation, wherein the target local node is a source local node for sending the push message, so that the push for the push message is finished when the response message is sent to the target local node; therefore, the dependence of the cloud node on storage is reduced, the storage space of the cloud node is saved, and the information processing efficiency is improved.
An exemplary application of the embodiments of the present application in a practical application scenario will be described below.
Before explaining a message pushing system provided in an embodiment of the present application, terms referred to in the embodiment of the present application are first explained, and include:
1) message push service: refers to the active message pushing of the user mobile equipment by the operator through the own product or third-party tool. The user can see push message notification on a mobile device lock screen and a notification bar, and the notification bar can be clicked to call the APP and go to a corresponding page. For example, WeChat messages and the like which are usually seen on a lock screen belong to APP message pushing ranks. Push (Push) is a technical concept, which refers to sending information from a server to a client in real time.
2) Remote multi-activity: refers to a deployment scheme of the background. Since one machine room cannot carry all traffic or the delay is too large, background services need to be deployed to multiple regions, and users visit nearby.
3) Shard (i.e., the aforementioned geographical partition): and (4) slicing the flow and the data under the multi-activity environment. The nearby service entities are generally divided into the same Shard according to service characteristics to reduce delay.
4) Message routing: the message is sent to the receiving end and returned to the internal machine room, and the selection process of the intermediate transmission node is carried out.
5) Message Push (i.e. message Push) a message is pushed to the client App.
6) Message Ack (i.e. the response message corresponding to the above push message): and the client returns a return receipt after receiving the push message pushed by the server.
7) Cloud computer lab (i.e., the cloud node): a facilitator that provides a public cloud.
8) Internal machine room (i.e., the local node): the machine rooms built by each business company are used for running the common core business in the internal machine rooms.
9) Kafka: is an open source message queue that uses a production-consumption model to deliver messages.
10) Redis Rereplicator: the Redis replication component (namely, the routing information replication component) is used for Redis synchronization of routing information of the internal machine room crossing the ground domain.
In a common remote multi-activity scheme, more consideration is given to processing requests sent by a client in different machine rooms in a partitioned manner, while message push service is driven by a server, the requests of the server are partitioned, and the problem of routing of messages in a multi-machine room scene is also considered. In the related art, as shown in fig. 8, fig. 8 is a schematic diagram of a message pushing method provided in the related art, where a message pushing task is received in an internal room, and then a push message is pushed to a user side through an access stratum, and the user side receives and returns a corresponding ACK, at this time, it is expected to return to a source internal room (i.e., an internal room that sends the push message).
Therefore, a mechanism is needed to find the source internal machine room of the push message in the cloud machine room. The scheme mainly adopted in the related technology is that mapping information of each push message and the source internal machine room, namely message ID-source internal machine room, is stored in the cloud machine room, so that the cloud can find the corresponding source internal machine room through the message ID when the ACK is forwarded. Firstly, in the design principle, the cloud computer room only deploys the access layer gateway to reduce the dependence on storage, and the scheme increases the dependence on storage; secondly, since there are a plurality of cloud computer rooms, the cloud computer rooms for pushing and forwarding the Ack message may not be the same computer room, and in this case, mapping information (message ID — source internal computer room) needs to be synchronized to all the cloud computer rooms, which is more complicated and depends on storage.
Based on this, embodiments of the present application provide a message pushing system to solve at least the above existing problems, and the following detailed description is provided.
As shown in fig. 4, the incoming or outgoing traffic of the user is partitioned and split into each internal machine room. The internal machine room zone is a complete business service unit, and contains a set of services and databases required by a complete business, including push services, Redis databases, and the like, and the complete business logic of user activities can be completed in one internal machine room zone.
Partitioning of user traffic: the request is routed to the appropriate room using a three-level mapping (including user geographical location- > partition identification shardd- > local room zone). First, according to the boundaries of provinces, some provinces are combined into a geographical partition Shard, the whole country is divided into a plurality of geographical partitions Shard, for example, Beijing and Tianjin are divided into a geographical partition, Shanghai and Jiangsu are divided into a geographical partition, and the like. As an example, if the location corresponding to the user/merchant/order is in a province, the traffic is attributed to the geographical partition Shard corresponding to the province, and the data generated by the traffic also belongs to the geographical partition Shard. The principle of the Shard splitting of the geographical partitions is that the traffic split by each geographical partition Shard is uniform and merged nearby. Each geographical partition Shard is attributed to one internal machine room zone for processing.
ShardID: each geographic partition Shard corresponds to a globally unique, unchanging shardd that uniquely identifies a geographic partition Shard. In practical implementation, the shardidd may be an integer of 5 bits, and the value ranges from 0 to 31. As shown in table 1:
Figure BDA0003110599920000221
TABLE 1
In practical application, the main business process of message pushing includes:
firstly, a user is online at a client: the client establishes TCP connection with a nearby cloud machine room through DNS service, the cloud machine room finds a corresponding internal machine room zone according to the geographical position information of a user, and then performs RPC interaction (including authentication, connection state storage, routing information and the like) with the push service of the internal machine room. And returning after the authentication is successful, and the cloud computer room keeps TCP connection with the client.
Second, push (push) messages to the client: and receiving a message pushing task aiming at the target user by the internal machine room, and confirming whether the target user is online or not according to the user identifier in the message pushing task and the routing information stored corresponding to the target user. And if the client side is online, transmitting the push message to an access layer of the cloud machine room, and pushing the push message to the client side by the access layer of the cloud machine room.
Third, the client replies (ACK) to the push message: the method comprises the steps that a client receives a push message sent by an access layer of a cloud computer room, and returns a response message ACK aiming at the push message to the access layer of the cloud computer room; and the access layer of the cloud computer room searches the source internal computer room of the push message, and transmits a response message ACK to the source internal computer room for ACK operation.
In practical applications, an exception may occur in a message pushing process, such as a client network exception, an internal component exception, and the like, and at this time, a message pushing problem caused by an exception condition needs to be handled, including:
firstly, when the client network is abnormal and the sending of the ACK fails, the message identification of the push message which has sent the ACK is stored in the client, if the sending of the ACK fails, the connection with the cloud computer room is reestablished, and then the ACK message is sent again.
Secondly, when message pushing fails due to the fact that an internal component is abnormal or a user network is unstable, the server side stores a message list of pushing messages which do not receive ACK, and pushes the pushing messages which fail to be pushed again, specifically, the pushing messages which do not receive ACK are pushed again after the client side and the cloud machine room are in communication connection again; or in case the user is not online, the compensation Push is performed through a third-party vendor channel (such as APNS, OPPO Push, XiaoMi Push).
In practical application, a machine room fault may occur in the message pushing process, and at this time, in order to avoid influencing the user message pushing experience, the fault machine room is switched to other machine rooms without faults. In actual implementation, because the failure rate of the cloud computer room is low, the flow switching when the internal computer room fails is guaranteed firstly, and then the flow switching when the cloud computer room fails is guaranteed. Specifically, when the current internal machine room fails, multi-active switching is performed, that is, the mapping relation between shardd- > zones is modified, and the traffic is switched from the current failed internal machine room to another internal machine room which is not failed. When the current cloud computer room fails, the region mapping in the DNS service is switched, and the flow is switched from the cloud computer room with the current failure to another cloud computer room without the failure through the DNS service. Therefore, the user traffic can be uniformly partitioned to different zones, a plurality of zones can be linearly expanded, and the fault switching of a certain zone is supported.
In the process that the client responds (ACK) to the push message, the access layer of the cloud computer room needs to search the source internal computer room of the push message, so that the response message ACK is transmitted to the source internal computer room to perform ACK operation. As shown in fig. 7, the message push system provided in this embodiment of the present application further includes a routing node (i.e., GZS, Global Zone Service), where the GZS is a Global Zone and is used to store and synchronize Global routing information (including an association between a geographic location and a partition identifier shardd, and an association between the partition identifier shardd and an internal machine room Zone). The push service of the internal machine room and the access layer of the cloud machine room are both accessed to the GZS SDK so as to acquire the latest global routing information.
Based on this, when message pushing is performed, for each pushed message, a corresponding global message identifier MsgID is set, where the message identifier MsgID may be a 64-bit number symbol, and a partition identifier shardidd corresponding to a source internal machine room that sends the pushed message is embedded in the MsgID.
After the access layer of the cloud computer room forwards the push message carrying the message identifier MsgID to the client, the client returns a response message ACK corresponding to the push message to the access layer of the cloud computer room, and the response message ACK also carries the message identifier MsgID. When receiving the response message ACK, the access layer of the cloud computer room extracts the target partition identification ShardID from the message identification MsgID carried by the access layer, calls GZS through a GZS interface based on the stored association relation, inquires the source internal computer room zone corresponding to the target partition identification ShardID, and then sends the response message ACK to the inquired source internal computer room zone for corresponding ACK service.
Here, the Global unique message identifier MsgID of the push message is generated by a Global Storage (i.e., the above-mentioned message identifier generating component) located in the internal machine room. The Global Storage generates a globally unique MsgID according to the incoming partition identification ShardID, the user identification userID/tagID/alias. The composition of MsgID is as follows:
MsgID=1bit(sign)+48bit(seed)+5bit(ShardID)+10bit(hash)。
wherein, 10bit (hash)% hash 1024; 48 bits (seed) is the number of microseconds of the current time, and a 48-bit time can represent 2^48/(365 ^ 24 ^ 3600 ^ 1000) time of 8.9 years. Since the pushed messages will be inventoried at intervals, 8.9 years can be guaranteed to suffice.
In practical application, a situation that a newly generated message identifier conflicts with a historical message identifier may also occur, for the situation, Global Storage stores a message identifier MsgID generated in a last period of time (for example, 10s) in a Redis database, the Redis database determines whether the message identifier MsgID conflicts, if so, sleep presets a duration (for example, 1us), and a new MsgID is regenerated after sleep ends.
The embodiment of the application also relates to a synchronization scheme of the routing information. As shown in fig. 9, fig. 9 is a schematic diagram of the user online and offline routing information provided in the embodiment of the present application. Here, when the user is online, the access layer of a certain cloud computer room is connected, the access layer of the cloud computer room selects a nearby internal computer room to communicate with the access layer according to the geographical position information of the user, the internal computer room performs authentication and connection state storage, and the information describing the process is routing information, wherein the routing information can comprise a client of the user, the cloud computer room establishing communication connection with the client, and a communication connection relation between the internal computer rooms executing message pushing to the client, so that the selection process of a middle transmission node is represented by the routing information when a pushing message is sent to a receiving terminal and a corresponding response message returns to a local node. The routing information shown in fig. 9 may include, for example, the user client 1, the cloud server room 1, the internal server room 1, the user client 2, the cloud server room 2, the internal server room 2, and the like.
Therefore, when pushing messages, each internal machine room is required to store routing information of all users, and the access layer of the cloud machine room can be found to push messages to the users. Therefore, the embodiment of the present application further relates to a routing information synchronization scheme, so as to synchronize the total amount of routing information to all internal machine rooms, including: firstly, the MySQL stored in the internal machine room is synchronized to each other internal machine room by the MySQL DRC component, but considering that the online and offline of the user are very frequent, the QPS for routing information access is large during pushing, and the MySQL cannot be supported. Second, storage to a Redis-like cache system, but since the open source/corporate cache system does not support multi-room synchronization, a push service is required to synchronize routing information to multiple rooms, but it is not feasible because it needs to be considered whether other internal rooms fail, and a failure or restart of a component of the push service may cause synchronization failure.
Based on this, an embodiment of the present application further provides a method for synchronizing routing information, so as to solve at least the existing problems, as shown in fig. 5, routing information of an online and offline of a user is stored in a Redis, and the routing information needs to be synchronized to each internal machine room in real time. Since the open-source Redis does not support multi-chassis synchronization, in this embodiment of the present application, a Redis Replicator component (i.e. the above routing information replication component) is provided, where the demand that can be met by the Redis Replicator component includes: 1) high reliability and no data loss; 2) low coupling to applications; 3) second-level synchronization; 4) conflict handling during the same key (for identifying the same operation data) operation; 5) redis is not changed as much as possible, and subsequent maintenance and updating are facilitated.
The flow of the method for synchronizing routing information provided by the embodiment of the application comprises the following steps:
1. the Replicator component of each internal room subscribes to Kafka messages (i.e., the route update messages described above) of other internal rooms.
2. When an online and offline operation behavior occurs in application, writing corresponding operation data to a Redis in the internal machine room, and simultaneously writing a timestamp for recording operation in the Redis; then writes a piece of operation data (i.e., the updated content of the above-mentioned routing information) to the local internal machine room Kafka.
3. After the repeater component of the different computer room (namely other computer rooms) receives the Kafka message, if the keys are the same and are compared with the operation time of the operation record of the computer room, the operation time is earlier than that of the Kafka message, the copying operation is executed (in addition, a timestamp of the recording operation is written in Redis), and otherwise, the copying operation is discarded.
Here, whether the Redis multi-machine-room synchronization can be achieved inside the Redis cluster is considered first, but since the operation log of the Redis does not have a time stamp and the synchronization mode (full synchronization + incremental synchronization) of the Redis cannot guarantee low delay, if the operation log needs to be supported, a large amount of reformation needs to be performed on the Redis, and the complexity is high. The scheme provided by the embodiment of the application has certain invasiveness to the application program, but does not need to modify Redis, and the complexity is moderate. In practical applications, the multi-room synchronization of the distributed cache may also consider other options, such as the commercial version of aerospike, or the use of Yahoo! The Pnuts model stores routing information.
By applying the embodiment of the application, linear expansion of a plurality of machine rooms and flow migration in case of machine room failure can be supported, and a source internal machine room of a message can be found without storing massive historical message routes in an access layer of a cloud machine room; meanwhile, a multi-machine room synchronization scheme based on routing information of Redis is realized, complexity is moderate, and implementation is easy.
Continuing to describe the message pushing device provided in the embodiment of the present application, the message pushing device provided in the embodiment of the present application is disposed in a cloud node, the cloud node is located in a message pushing system, and the message pushing system further includes a routing node and a local node corresponding to at least one geographic partition; the routing node is used for storing the association relation between the partition identification of the geographical partition and the local node.
An exemplary structure of the message pushing device 555 provided by the embodiment of the present application implemented as a software module is described below, and in some embodiments, as shown in fig. 2, the software module stored in the message pushing device 555 in the memory 550 may include:
a receiving module 5551, configured to receive a push message for a target object, where the push message is sent by the local node in response to a message push request for the target object;
a forwarding module 5552, configured to forward the push message to the client of the target object, and receive a response message returned by the client based on the push message, where the response message includes a target partition identifier corresponding to a local node that sends the push message;
a calling module 5553, configured to call, based on the response message, the routing node to find, based on the association relationship, a target local node associated with the target partition identifier;
a sending module 5554, configured to send the response message to the target local node to complete the pushing for the push message.
By applying the embodiments of the present application, a message pushing system is provided, which includes a cloud node, a routing node, and at least one local node corresponding to a geographic partition, where the routing node stores an association relationship between a partition identifier of the geographic partition and the local node; when the message is pushed, when the cloud end node receives a response message returned by a push message pushed by the client end based on the local node, because the response message contains a target partition identification corresponding to the local node for sending the push message, the cloud end node searches a target local node associated with the target partition identification based on the response message by calling the routing node based on the stored association relation, wherein the target local node is a source local node for sending the push message, so that the push for the push message is finished when the response message is sent to the target local node; therefore, the dependence of the cloud node on storage is reduced, the storage space of the cloud node is saved, and the information processing efficiency is improved.
An embodiment of the present application further provides an electronic device, where the electronic device includes:
a memory for storing executable instructions;
and the processor is used for realizing the message pushing method provided by the embodiment of the application when the executable instructions stored in the memory are executed.
Embodiments of the present application also provide a computer program product or a computer program comprising computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, so that the computer device executes the message pushing method provided by the embodiment of the application.
The embodiment of the present application further provides a computer-readable storage medium, which stores executable instructions, and when the executable instructions are executed by a processor, the message pushing method provided by the embodiment of the present application is implemented.
In some embodiments, the computer-readable storage medium may be memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash, magnetic surface memory, optical disk, or CD-ROM; or may be various devices including one or any combination of the above memories.
In some embodiments, executable instructions may be written in any form of programming language (including compiled or interpreted languages), in the form of programs, software modules, scripts or code, and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
By way of example, executable instructions may correspond, but do not necessarily have to correspond, to files in a file system, and may be stored in a portion of a file that holds other programs or data, such as in one or more scripts in a hypertext Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files that store one or more modules, sub-programs, or portions of code).
By way of example, executable instructions may be deployed to be executed on one computing device or on multiple computing devices at one site or distributed across multiple sites and interconnected by a communication network.
The above description is only an example of the present application, and is not intended to limit the scope of the present application. Any modification, equivalent replacement, and improvement made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims (10)

1. A message push system, the system comprising: the system comprises a cloud node, a routing node and a local node corresponding to at least one geographical partition; the routing node is used for storing the association relation between the partition identification of the geographical partition and the local node;
the local node is used for responding to a message pushing request aiming at a target object and sending a pushing message aiming at the target object to the cloud end node;
the cloud node is configured to forward the push message to a client of the target object, and receive a response message returned by the client based on the push message, where the response message includes a target partition identifier corresponding to a local node that sent the push message;
based on the response message, calling the routing node to find a target local node associated with the target partition identifier based on the association relation;
and sending the response message to the target local node to complete the pushing aiming at the push message.
2. The system of claim 1, wherein the system further comprises: a domain name resolution service node;
the domain name resolution service node is used for responding to a connection request of the client and sending the connection request corresponding to the client to a cloud end node matched with the geographical position information based on the geographical position information corresponding to the client;
the cloud node is further configured to receive the connection request, and select a local node corresponding to the geographic partition matched with the geographic location information from local nodes corresponding to the at least one geographic partition;
and executing interactive verification for remote procedure call with the selected local node, and establishing communication connection with the client after the interactive verification is successful.
3. The system of claim 1,
the local node is further configured to respond to a message push request for a target object, and obtain, based on an object identifier of the target object carried in the message push request, routing information corresponding to the target object;
and when the client and the cloud node are determined to be in a communication connection state based on the routing information, sending a push message aiming at the target object to the cloud node.
4. The system of claim 1, wherein when the number of the local nodes is at least two, each of the local nodes stores routing information for the target object, and each of the local nodes includes a routing information replication component;
the routing information copying component is used for subscribing the routing updating information of the routing information in other local nodes except the node where the routing information copying component is positioned;
when the route updating message represents that the route information of other local nodes has updating contents, acquiring a first updating time point of the route information of other local nodes;
when the first updating time point is later than a second updating time point of the routing information of the node where the first updating time point is located, copying the updating content to the node where the first updating time point is located, and updating the second updating time point.
5. The system of claim 1,
the local node is further configured to determine whether a response message to the push message is received within a preset time after the push message is sent;
when it is determined that the response message is not received within a preset time length and the client and the cloud node are in a communication connection state, resending a push message for the target object to the cloud node;
the cloud node is further configured to forward the push message to the client of the target object again.
6. The system of claim 1, wherein when the number of the local nodes is at least two, the routing node is further configured to select, when it is determined that the current local node fails, other local nodes that do not fail from the at least two local nodes, and
and modifying the association relation between the stored partition identification and the current local node into the association relation between the partition identification and the other local nodes so as to switch the local node into the other local nodes.
7. The system of claim 1, wherein when the cloud nodes are at least two, the system further comprises: a domain name resolution service node;
the domain name resolution service node is used for selecting other cloud nodes which do not have faults from the at least two cloud nodes when the current cloud node is determined to have faults, and switching the current cloud node to the other cloud nodes;
the local node is further configured to send, in response to a message push request for a target object, a push message for the target object to the other cloud nodes.
8. The system of claim 1, wherein the response message carries a corresponding first message identification, the first message identification including the target partition identification;
the cloud node is further configured to parse a first message identifier of the response message based on the response message to obtain the target partition identifier included in the response message, and obtain the target partition identifier included in the response message
Based on the target partition identification, calling the routing node to find the target local node associated with the target partition identification based on the association relation.
9. The system of claim 8, wherein the local node further comprises: a message identifier generation component;
the message identifier generating component is configured to generate a first message identifier corresponding to the push message based on the partition identifier corresponding to the local node, the object identifier of the target object, and the current time;
and the message identifier generating component is further configured to regenerate a second message identifier corresponding to the push message when it is determined that the first message identifier conflicts with the historical message identifier, and use the second message identifier as the first message identifier corresponding to the push message.
10. The message pushing method is characterized by being applied to a message pushing system comprising a cloud node, a routing node and at least one local node corresponding to a geographical partition; the routing node is used for storing the association relation between the partition identification of the geographical partition and the local node; the method comprises the following steps:
the cloud node receives a push message aiming at a target object, wherein the push message is sent by the local node in response to a message push request aiming at the target object;
forwarding the push message to a client of the target object, and receiving a response message returned by the client based on the push message, wherein the response message comprises a target partition identifier corresponding to a local node sending the push message;
based on the response message, calling the routing node to find a target local node associated with the target partition identifier based on the association relation;
and sending the response message to the target local node to complete the pushing aiming at the push message.
CN202110647966.4A 2021-06-10 2021-06-10 Message pushing method and system Active CN113259476B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110647966.4A CN113259476B (en) 2021-06-10 2021-06-10 Message pushing method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110647966.4A CN113259476B (en) 2021-06-10 2021-06-10 Message pushing method and system

Publications (2)

Publication Number Publication Date
CN113259476A CN113259476A (en) 2021-08-13
CN113259476B true CN113259476B (en) 2022-09-30

Family

ID=77187407

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110647966.4A Active CN113259476B (en) 2021-06-10 2021-06-10 Message pushing method and system

Country Status (1)

Country Link
CN (1) CN113259476B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114338792A (en) * 2021-12-29 2022-04-12 掌阅科技股份有限公司 Application message pushing method, electronic equipment and storage medium
CN115118772A (en) * 2022-06-21 2022-09-27 壹沓科技(上海)有限公司 Message communication system and method

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105389219A (en) * 2015-10-15 2016-03-09 北京乐动卓越科技有限公司 Cross-computer room communication method and system
CN108093094A (en) * 2017-12-08 2018-05-29 腾讯科技(深圳)有限公司 Database instance access method, device, system, storage medium and equipment
CN111818131A (en) * 2020-06-17 2020-10-23 天津异乡好居网络科技有限公司 Message pushing and scheduling system and method

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110020902B (en) * 2018-12-27 2021-01-08 创新先进技术有限公司 Cross-link certificate storage method, access method, device and electronic equipment
CN110401706A (en) * 2019-07-19 2019-11-01 北京大米科技有限公司 Service request processing method, device, storage medium and terminal
US11847171B2 (en) * 2019-08-20 2023-12-19 International Business Machines Corporation Facilitating blockchain transactions with an Internet of Things (IoT) device
CN110753096A (en) * 2019-10-12 2020-02-04 北京达佳互联信息技术有限公司 Message pushing method and system and electronic equipment
CN111222034B (en) * 2019-12-31 2023-05-16 湖南华菱涟源钢铁有限公司 Data mobile display method and device and cloud server
CN111343237B (en) * 2020-02-07 2022-11-29 广州亚美信息科技有限公司 Server cluster communication method, communication device and computer storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105389219A (en) * 2015-10-15 2016-03-09 北京乐动卓越科技有限公司 Cross-computer room communication method and system
CN108093094A (en) * 2017-12-08 2018-05-29 腾讯科技(深圳)有限公司 Database instance access method, device, system, storage medium and equipment
CN111818131A (en) * 2020-06-17 2020-10-23 天津异乡好居网络科技有限公司 Message pushing and scheduling system and method

Also Published As

Publication number Publication date
CN113259476A (en) 2021-08-13

Similar Documents

Publication Publication Date Title
US11445019B2 (en) Methods, systems, and media for providing distributed database access during a network split
US20150019491A1 (en) Replication of Data Between Mirrored Data Sites
CN113259476B (en) Message pushing method and system
JP5548829B2 (en) Computer system, data management method, and data management program
KR20080068110A (en) A method for processing data synchronization and client terminal, server and data synchronization system thereof
CN107623703B (en) Synchronization method, device and system for Global Transaction Identifier (GTID)
CN113268472B (en) Distributed data storage system and method
CN111404628B (en) Time synchronization method and device
US20230385244A1 (en) Facilitating immediate performance of volume resynchronization with the use of passive cache entries
CN111600794B (en) Server switching method, terminal, server and storage medium
CN111865632A (en) Switching method of distributed data storage cluster and switching instruction sending method and device
US20130185329A1 (en) Distributed database
CN113411363A (en) Uploading method of image file, related equipment and computer storage medium
JP5973237B2 (en) Database management apparatus and database management method
CN115517009B (en) Cluster management method, cluster management device, storage medium and electronic equipment
CN112069152B (en) Database cluster upgrading method, device, equipment and storage medium
CN108881452B (en) Data synchronization method, device and storage medium
CN109992447B (en) Data copying method, device and storage medium
CN116560904A (en) NAS data backup disaster recovery method, system, terminal and storage medium
CN115827316A (en) Data backup method, device, equipment and storage medium
CN110321322B (en) Data reconstruction method, device, equipment and computer readable storage medium
CN115189931A (en) Distributed key management method, device, equipment and storage medium
CN114625566A (en) Data disaster tolerance method and device, electronic equipment and storage medium
CN106897365B (en) Data processing method and device
CN110572459A (en) storage device control method and device, electronic device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40052193

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant