CN111262773A - Message synchronization method and data center - Google Patents

Message synchronization method and data center Download PDF

Info

Publication number
CN111262773A
CN111262773A CN202010072710.0A CN202010072710A CN111262773A CN 111262773 A CN111262773 A CN 111262773A CN 202010072710 A CN202010072710 A CN 202010072710A CN 111262773 A CN111262773 A CN 111262773A
Authority
CN
China
Prior art keywords
message
synchronized
long connection
server
data center
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.)
Pending
Application number
CN202010072710.0A
Other languages
Chinese (zh)
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.)
Zhuomi Private Ltd
Original Assignee
Hong Kong LiveMe Corp 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 Hong Kong LiveMe Corp Ltd filed Critical Hong Kong LiveMe Corp Ltd
Priority to CN202010072710.0A priority Critical patent/CN111262773A/en
Publication of CN111262773A publication Critical patent/CN111262773A/en
Pending legal-status Critical Current

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/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/46Interconnection of networks
    • H04L12/4641Virtual LANs, VLANs, e.g. virtual private networks [VPN]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the invention provides a message synchronization method and a data center. The scheme is as follows: a long connection server in a target data center receives a service message sent by a client and routes the service message to the target service server, the target service server preprocesses the service message to obtain a first message to be synchronized and stores the first message to be synchronized into a first message queue, so that other data centers obtain the first message to be synchronized from the first message queue; and the target data center and other data centers are in the same virtual local area network. Through the technical scheme provided by the embodiment of the invention, when the service server in the target data center stores the message to be synchronized into the message queue, other data centers can synchronously acquire the message to be synchronized from the message queue, so that the synchronization of the messages in different data centers is realized, the problem of inconsistency of the messages stored in different data centers is solved, and the consistency of the messages among different data centers is improved.

Description

Message synchronization method and data center
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a message synchronization method and a data center.
Background
With the continuous development of communication technology, the construction and use of global data centers are receiving wide attention.
Currently, each data center in a global data center processes messages sent by various clients in the area according to the area in which the data center is located. When any data center is completely stopped or down, other data centers which are close to the area where the client is located or have better network performance bear all services of the data center, so that normal operation of communication is guaranteed. Therefore, in order to ensure that messages sent by the client can be processed in time, how to ensure the consistency of the messages stored in each data center in the global data center becomes an important prerequisite for other data centers to take over all services of the data centers with full-line outage or downtime.
Disclosure of Invention
The embodiment of the invention aims to provide a message synchronization method and a data center so as to improve the consistency of messages among different data centers. The specific technical scheme is as follows:
the embodiment of the invention provides a message synchronization method, which is applied to a target data center in a global data center, wherein the target data center comprises a long connection server and a service server, and the method comprises the following steps:
after establishing long connection with a client, the long connection server receives a service message sent by the client and routes the service message to a corresponding target service server;
the target service server preprocesses the service message to obtain a first message to be synchronized, and stores the first message to be synchronized into a first message queue, so that other data centers in the global data center obtain the first message to be synchronized from the first message queue; and the target data center and the other data centers are in the same virtual local area network.
Optionally, the target data center further includes a message storage device;
the method further comprises the following steps:
and when the service server monitors that a second message to be synchronized exists in a second message queue of the other data center, acquiring the second message to be synchronized from the second message queue, and storing the second message to be synchronized into the message storage device.
Optionally, the method further includes:
and the service server pushes the acquired second message to be synchronized to the client through the long connection server.
Optionally, the step of pushing, by the service server, the obtained second to-be-synchronized message to the client through the long connection server includes:
after the long connection between the client and the long connection server is disconnected, if the client establishes long connection with the long connection server again within a preset time length, the service server pushes third to-be-synchronized messages obtained from other data centers within a target time period to the client through the long connection server; the target time period is a time period corresponding to the time period from the disconnection of the long connection between the client and the long connection server to the reestablishment of the long connection server.
Optionally, the first message queue is a kaffk KAFKA message queue;
the method further comprises the following steps:
if the first message to be synchronized in the KAFKA message queue is synchronized to every other data center, then the traffic server discards the first message to be synchronized in the KAFKA message queue.
Optionally, the target data center further includes a task server;
the method further comprises the following steps:
and when the processing time of the service server to the target message is greater than a preset time threshold, the task server processes the target message, wherein the target message comprises the service message and the message to be synchronized.
The embodiment of the invention also provides a data center, which comprises a long connection server and a service server:
the long connection server is used for receiving the service message sent by the client after long connection is established with the client, and routing the service message to a corresponding target service server;
the target service server is used for preprocessing the service message to obtain a first message to be synchronized and storing the first message to be synchronized into a first message queue so that other data centers in the global data center can obtain the first message to be synchronized from the first message queue; and the data center and the other data centers are in the same virtual local area network.
Optionally, the data center further includes a message storage device;
and the service server is configured to, when it is monitored that a second to-be-synchronized message exists in a second message queue of the other data center, acquire the second to-be-synchronized message from the second message queue, and store the second to-be-synchronized message in the message storage device.
Optionally, the service server is further configured to push the obtained second to-be-synchronized message to the client through the long connection server.
Optionally, the service server is specifically configured to, after the long connection between the client and the long connection server is disconnected, if the client re-establishes the long connection with the long connection server within a preset time duration, push, by the service server, a third to-be-synchronized message obtained from the other data center within a target time period to the client through the long connection server; the target time period is a time period corresponding to the time period from the disconnection of the long connection between the client and the long connection server to the reestablishment of the long connection server.
Optionally, the first message queue is a kaffk KAFKA message queue;
the service server is further configured to discard the first message to be synchronized in the KAFKA message queue if the first message to be synchronized in the KAFKA message queue is synchronized to each of the other data centers.
Optionally, the data center further includes a task server;
and the task server is used for processing the target message when the processing time of the service server on the target message is greater than a preset time threshold, wherein the target message comprises the service message and the message to be synchronized.
The embodiment of the invention has the following beneficial effects:
according to the message synchronization method and the data center provided by the embodiment of the invention, because each data center in the global data center is in the same virtual local area network, when the service server in the target data center stores the message to be synchronized into the message queue, other data centers can synchronously obtain the message to be synchronized from the message queue, so that the synchronization of the messages in different data centers is realized, the problem of inconsistent messages stored in different data centers is solved, and the consistency of the messages among different data centers is improved.
Of course, not all of the advantages described above need to be achieved at the same time in the practice of any one product or method of the invention.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a first flowchart of a message synchronization method according to an embodiment of the present invention;
fig. 2 is a second flowchart of a message synchronization method according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a third flowchart of a message synchronization method according to an embodiment of the present invention;
fig. 4 is a fourth flowchart illustrating a message synchronization method according to an embodiment of the present invention;
fig. 5 is a schematic flowchart of a fifth message synchronization method according to an embodiment of the present invention;
FIG. 6 is a schematic structural diagram of a global data center according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a data center according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to solve the problem of inconsistency of messages stored in different data centers, embodiments of the present invention provide a message synchronization method. The method can be applied to a target data center in the global data center, wherein the target data center is any one of the global data centers and has no limiting function. In the method provided by the embodiment of the invention, after a long connection server in a target data center establishes long connection with a client, a service message sent by the client is received and routed to a corresponding target service server, the target service server preprocesses the service message to obtain a first message to be synchronized, and stores the first message to be synchronized into a first message queue, so that other data centers in a global data center obtain the first message to be synchronized from the first message queue; and the target data center and other data centers are in the same virtual local area network.
According to the method provided by the embodiment of the invention, each data center in the global data center is in the same virtual local area network, when the service server in the target data center stores the message to be synchronized into the message queue, other data centers can synchronously acquire the message to be synchronized from the message queue, so that the synchronization of the messages in different data centers is realized, the problem of inconsistency of the messages stored in different data centers is solved, and the consistency of the messages among different data centers is improved.
The following examples illustrate the present invention.
As shown in fig. 1, fig. 1 is a first flowchart of a message synchronization method according to an embodiment of the present invention. The method is applied to a target data center in a global data center, wherein the target data center comprises a long connection server and a business server, and the method specifically comprises the following steps.
Step S101, after the long connection server establishes the long connection with the client, the long connection server receives the service message sent by the client and routes the service message to the corresponding target service server.
In this step, the client in the management area corresponding to the target data center may establish a long connection with the long connection server in the target data center. After the client establishes the long connection with the long connection server, the long connection server can receive the service message sent by the client. The long connection server may route the received service message to a corresponding target service server according to the service category corresponding to the received service message.
In an optional embodiment, the process of establishing the long connection between the client and the long connection server may be specifically represented as: the client may send an Internet Protocol (IP) address acquisition request to the data center according to an area where the client is located, where the data center is generally a data center with the best performance determined according to a physical distance and a network transmission rate, and the data center may send an IP address list to the client after receiving the IP address acquisition request. The IP address list includes IP addresses corresponding to long connection servers in the plurality of data centers, and each IP address may be sorted according to performance corresponding to the long connection server. The client accesses the IP address with the best performance in the IP address list preferentially, so that long connection is established with the long connection server corresponding to the IP address.
In the long connection establishing process, when the data center with the best performance cannot access, if the data center is down, the client can access the next IP address, so that the long connection is established with the long connection server corresponding to the IP address. That is, when the data center with the best performance is abnormal, the data center with the next performance takes over all the services of the abnormal data center.
In an embodiment of the present invention, each data center of the global data center may include a plurality of service servers. Taking the application scenario as a global data center for instant messaging as an example, each data center may at least include a live service server, a single chat service server, and a group chat service center. And the service servers of different service types respectively process the corresponding service messages. For example, a live service server may handle various live messages in a live process. The single chat service server may be a single chat message generated by chat software or the like in the client. The group chat service server can be used for group chat messages generated by chat software in the client.
The long connection server may route the received service message to a corresponding target service server, which may specifically be represented as: the long connection service may send the service message to a target service server of a corresponding service class according to the service class corresponding to the service message. For example, the long connection server may route the live message to the live service server, in which case the target service server is the live service server.
In an optional embodiment, the service message received by the long connection server may carry a service category identifier corresponding to the service message. The long connection server may route to the target service server according to the service class identifier.
The service message may also carry other information, such as font color and format of the service message.
Step S102, a target service server preprocesses a service message to obtain a first message to be synchronized, and stores the first message to be synchronized into a first message queue, so that other data centers in a global data center obtain the first message to be synchronized from the first message queue; and the target data center and other data centers are in the same virtual local area network.
In this step, after receiving the service message, the target service server may pre-process the received service message to obtain a first message to be synchronized. The target service server may store the first message to be synchronized in the first message queue. Each other data center in the global data center may listen to the first message queue of the target data center in real-time. When it is monitored that there is a message to be synchronized in the first message queue, i.e., the first message to be synchronized, each of the other data centers can obtain the message to be synchronized from the first message queue.
The specific process of the other data center obtaining the first to-be-synchronized message from the first message queue may refer to the following description, and is not specifically described here.
In an alternative embodiment, the preprocessing process may be a sensitive word check, a non-civilized word check, or the like. Taking the sensitive word check as an example, after receiving the service message, the service server may check whether the service message contains a preset sensitive word. And if the service message contains the preset sensitive words, shielding the sensitive words in the service message. And if the service message does not contain the preset sensitive words, processing the service message. The pretreatment process may be set according to specific requirements, and is not particularly limited herein.
In the embodiment of the present invention, after the preprocessing, the first message to be synchronized may be the same as the service message or different from the service message.
In an alternative embodiment, the first message queue may be a KAFKA message queue. Besides, the first Message Queue may also be a Message Queue such as a RabbitMQ (RabbitMessage Queue) or an Active MessageQueue. The RabbitMQ is open source message agent software which realizes an Advanced Message Queuing Protocol (AMQP), and the ActiveMQ is open source code message middleware developed by an Apache software foundation. Here, the first message queue is not particularly limited.
In this embodiment of the present invention, the target data center and the other data centers are in the same virtual local area network, which may be specifically expressed as: high-speed channels (Express connections) or network lines are built between each data center of the global data center, so that each data center is in the same virtual local area network.
By adopting the method shown in fig. 1, because each data center in the global data center is in the same virtual local area network, when the service server in the target data center stores the message to be synchronized into the message queue, other data centers can synchronously obtain the message to be synchronized from the message queue, thereby realizing the synchronization of the messages in different data centers, solving the problem of inconsistent messages stored in different data centers and improving the consistency of the messages among different data centers.
In an optional embodiment, the target data center may further include a message storage device. After obtaining the first message to be synchronized, the target service server may store the first message to be synchronized in the message storage device.
In an alternative embodiment, the message storage device may include a first storage device and a second storage device. And the storage duration of the first storage device is less than that of the second storage device. For example, the first storage device may be a message storage device corresponding to a Remote Dictionary service (REDIS) database. The second storage device is a message storage device corresponding to the MONGO database. The MONGO database is a database based on distributed file storage.
Each service server may store the first message to be synchronized in the first storage device, or may store the first message to be synchronized in the second storage device.
In an optional embodiment, based on the method shown in fig. 1, an embodiment of the present invention further provides a message synchronization method. As shown in fig. 2, fig. 2 is a second flowchart of a message synchronization method according to an embodiment of the present invention. The method comprises the following steps.
Step S201, after the long connection server establishes the long connection with the client, the long connection server receives the service message sent by the client, and routes the service message to the corresponding target service server.
Step S202, a target service server preprocesses a service message to obtain a first message to be synchronized, and stores the first message to be synchronized into a first message queue, so that other data centers in the global data center obtain the first message to be synchronized from the first message queue; and the target data center and other data centers are in the same virtual local area network.
The above steps S201 to S202 are the same as the above steps S101 to S102.
Step S203, the service server monitors whether a second message queue of another data center has a second message to be synchronized. If yes, go to step S204.
In this step, each business server in the target data center may listen for the presence of a second to-be-synchronized message in the second message queue of each other data center in the global data center.
The generation manner of the second message to be synchronized is the same as that of the first message to be synchronized, and will not be described in detail here.
Step S204, the service server obtains the second message to be synchronized from the second message queue, and stores the second message to be synchronized in the message storage device.
In this step, when it is monitored that the second to-be-synchronized message exists in the second message queues of the other data centers, the service server may obtain the second to-be-synchronized message from the second message queues, and store the obtained to-be-synchronized message in the message storage device of the target data center.
In an optional embodiment, when it is monitored that the second message to be synchronized does not exist in the second message queue of the other data center, the service server does not perform the acquisition process of the message to be synchronized. I.e. the service server does not perform the message synchronization procedure.
The process of the other data center obtaining the first message to be synchronized from the first message queue in step S102 may refer to steps S203 to S204, which are not described in detail herein.
By the method shown in fig. 2, the target data center can timely and accurately synchronize the messages to be synchronized in other data centers locally, so that the synchronization of the messages in different data centers is realized, the timeliness and the accuracy of the message synchronization are improved, and the consistency of the messages in different data centers is ensured.
In an optional embodiment, according to the method shown in fig. 2, an embodiment of the present invention further provides a message synchronization method. As shown in fig. 3, fig. 3 is a third flowchart illustrating a message synchronization method according to an embodiment of the present invention. The method comprises the following steps.
Step S301, after the long connection server establishes the long connection with the client, the long connection server receives the service message sent by the client, and routes the service message to the corresponding target service server.
Step S302, a target service server preprocesses a service message to obtain a first message to be synchronized, and stores the first message to be synchronized into a first message queue, so that other data centers in the global data center obtain the first message to be synchronized from the first message queue; and the target data center and other data centers are in the same virtual local area network.
Step S303, the service server monitors whether a second message queue of another data center has a second message to be synchronized. If yes, go to step S304.
Step S304, the service server obtains the second message to be synchronized from the second message queue, and stores the second message to be synchronized in the message storage device.
The above steps S301 to S304 are the same as the above steps S201 to S204.
Step S305, the service server pushes the acquired second message to be synchronized to the client through the long connection server.
In this step, after the service server obtains the second message to be synchronized from the other data center, the service server may push the second message to be synchronized to the client through the long connection server. That is, the service server sends the second message to be synchronized to the long connection server. And the long connection server forwards the received second message to be synchronized to the client.
In an optional embodiment, after receiving the second message to be synchronized, the client may display the second message to be synchronized. For example, the second synchronization message is a live message. When the client receives the live broadcast message, the live broadcast message can be displayed in a display interface of live broadcast software in the client.
By adopting the method shown in fig. 3, the service server sends the second data to be synchronized to the client through the long connection server, so that the client can receive and display messages sent by other clients in the management area corresponding to other data centers in time, and message transmission between clients in different areas is realized.
In an alternative embodiment, during the long connection process between the client and the long connection server, the connection between the client and the long connection server may be disconnected due to network problems or operation problems of the client user. In order to ensure the stability and accuracy of message transmission, in step S303, the service server pushes the obtained second to-be-synchronized message to the client through the long connection server, which may specifically be represented as:
after the long connection between the client and the long connection server is disconnected, if the client establishes long connection with the long connection server again within a preset time length, the service server pushes third to-be-synchronized messages obtained from other data centers within a target time period to the client through the long connection server; the target time period is the time period corresponding to the time period from the disconnection of the long connection between the client and the long connection server to the reestablishment.
The preset duration may be set according to a user requirement, an application scenario, and the like, and is not specifically limited herein.
In the embodiment of the invention, the service server pushes the message to be synchronized in the target time period to the client, so that the client can receive the message to be synchronized sent by other clients in the target time period, the probability that the client does not receive the lost message to be synchronized in the target time period is reduced, and the communication stability is improved.
In an alternative embodiment, when the first message queue is the KAFKA message queue, a message synchronization method is further provided according to the method shown in fig. 1. As shown in fig. 4, fig. 4 is a fourth flowchart illustrating a message synchronization method according to an embodiment of the present invention. The method comprises the following steps.
Step S401, after the long connection server establishes the long connection with the client, the long connection server receives the service message sent by the client and routes the service message to the corresponding target service server.
Step S402, the target service server preprocesses the service message to obtain a first message to be synchronized, and stores the first message to be synchronized into a first message queue, so that other data centers in the global data center obtain the first message to be synchronized from the first message queue; and the target data center and other data centers are in the same virtual local area network.
The above-described steps S401 to S402 are the same as the above-described steps S101 to S102.
In step S403, if the first message to be synchronized in the KAFKA message queue is synchronized to each other data center, the service server discards the first message to be synchronized in the KAFKA message queue.
In this step, the service server may discard the first message to be synchronized in the KAFKA message queue after the target data center determines that the first message to be synchronized in the KAFKA message queue has been synchronized to each of the other data centers of the global data center. I.e., dequeue the first message to be synchronized in the KAFKA message queue.
In the embodiment of the present invention, the KAFKA message queue may automatically record the status of each message in the message queue, that is, record whether each message is consumed, and the service server may determine whether the first message to be synchronized is synchronized to each other data center according to the status of the first message to be synchronized. If so, the first message to be synchronized may be discarded.
In the existing data synchronization process, data inconsistency may be caused due to network instability and transmission link jitter, and in order to solve the problem of data inconsistency, an Acknowledgement Character (ACK) mechanism is adopted in the existing data synchronization process, that is, after a receiving end receives data sent by a sending end, the receiving end sends an ACK message to the sending end, so that the sending end confirms that the receiving end has received the data, and the time consumption of the data synchronization process is too long. Compared with the ACK mechanism adopted in the existing data synchronization process, in the embodiment of the invention, the synchronization of the messages in different data centers is realized by utilizing the characteristic that the messages in the KAFKA message queue are not consumed and disappear, the time consumed by message synchronization is effectively shortened, and the message synchronization efficiency is improved.
The RabbitMQ message queue and the ActiveMQ message queue also have the characteristic that messages are not consumed and disappear, and are not specifically described herein.
In an optional embodiment, the target data center may further include a task server. According to the method shown in fig. 1, an embodiment of the present invention further provides a message synchronization method. As shown in fig. 5, fig. 5 is a fifth flowchart illustrating a message synchronization method according to an embodiment of the present invention. The method comprises the following steps.
Step S501, after the long connection server establishes the long connection with the client, the long connection server receives the service message sent by the client and routes the service message to the corresponding target service server.
Step S502, the target service server preprocesses the service message to obtain a first message to be synchronized, and stores the first message to be synchronized into a first message queue, so that other data centers in the global data center obtain the first message to be synchronized from the first message queue; and the target data center and other data centers are in the same virtual local area network.
The above steps S501 to S502 are the same as the above steps S101 to S102.
In step S503, the task server determines whether the processing time of the service server on the target message is greater than a preset time threshold. If yes, go to step S504.
In this step, the task server in the data center may compare the processing time of the service server on the target message with a preset time threshold, so as to determine whether the processing time of the target message is greater than the preset time threshold.
The processing time length may be a real time length for the service server to process the target message, or an estimated time length for the service server to process the target message. The estimated duration can be estimated according to the data size, the service type and the like of the target message. Here, the processing time is not particularly limited.
The target message may include the service message and a message to be synchronized, such as the first message to be synchronized and the second message to be synchronized.
Step S504, the task server processes the target message.
In this step, when the processing time of the service server on the target message is greater than the preset time threshold, the task server may process the target message. That is, the task server can receive the service of the service server and process the target message.
For example, when the target message is the service message, the task server may pre-process the service message to obtain the first data to be synchronized, and store the first data to be synchronized in the message storage device or the first message queue. For another example, when the target message is the second to-be-synchronized message, the task server may obtain the second to-be-synchronized message from the second message queue of the other data center, and store or push the second to-be-synchronized message. Here, the processing procedure of the target message by the task server is not specifically described.
In the embodiment of the invention, the task server receives the work which takes longer time of the service server, thereby relieving the pressure of the service server, improving the working efficiency of the service server and ensuring the normal operation of the data center.
For ease of understanding, the message synchronization method provided by the present invention will be described below with reference to fig. 6. Fig. 6 is a schematic structural diagram of a global data center according to an embodiment of the present invention. A plurality of data centers may be included in the global data center, and in the schematic diagram shown in fig. 6, only the data center 1 and the data center 2 are shown for convenience of description. Wherein, the data center 1 and the data center 2 are located in the same virtual local area network. The client 1 is in long connection with the long connection server 1, and the client 2 is in long connection with the long connection server 2. The service server 1 and the service server 3 are single chat service servers, and the service server 2 and the service server 4 are group chat service servers. Suppose that user 1 of client 1 chats with user 2 of client 2 through the same chat software.
User 1 enters message 1 in the chat interface of client 1. The client 1 may send a message 1 to the long connection server 1. After receiving the message 1, the long connection server 1 may determine that the service category corresponding to the message 1 is the single chat service, and the long connection server 1 may route the message 1 to the service server 1. The service server 1 may preprocess the message 1. It is assumed that the message obtained after the preprocessing is still message 1, i.e. the first message to be synchronized is message 1. The service server 1 may store the message 1 in the message storage device 1 as well as in the first message queue. When the processing time of the service server 1 to the message 1 is greater than the preset time threshold, the task server 1 may process the message 1. For example, the task server 1 may store the message 1 in the message storage device 1 and the first message queue.
When the service server 3 or the task server 2 monitors that there is a message to be synchronized in the first message queue, that is, when it monitors that there is a message 1 in the first message queue, the message 1 may be obtained from the first message queue. The service server 3 or the task server 2 may store the message 1 in the message storage device 2 and transmit the message 1 to the long connection server 2. The long connection server 2 forwards the message 1 to the client 2. The client 2 displays the message 1 in the chat interface, so that the user 2 can receive the message 1 sent by the user 1 to realize the transmission of the message. By analogy, the user 2 can send the message 2 to the client 1 by using a similar method, and complete message synchronization in the data center 1 and the data center 2 and a message interaction process between the client 1 and the client 2.
Based on the same inventive concept, according to the message synchronization method provided by the embodiment of the invention, the embodiment of the invention also provides a data center. As shown in fig. 7, fig. 7 is a schematic structural diagram of a data center according to an embodiment of the present invention. The data center may include long connection servers 701 and business servers 702.
The long connection server 701 is used for receiving the service message sent by the client after establishing long connection with the client and routing the service message to a corresponding target service server;
the target service server is used for preprocessing the service message to obtain a first message to be synchronized and storing the first message to be synchronized into a first message queue so that other data centers in the global data center can obtain the first message to be synchronized from the first message queue; and the data center and other data centers are in the same virtual local area network.
Optionally, the data center may further include a message storage device;
the service server 702 may be further configured to, when it is monitored that a second to-be-synchronized message exists in a second message queue of another data center, obtain the second to-be-synchronized message from the second message queue, and store the second to-be-synchronized message in the message storage device.
Optionally, the service server 702 may be further configured to push the obtained second to-be-synchronized message to the client through the long connection server 701.
Optionally, the service server 702 may be specifically configured to, after a long connection between the client and the long connection server 701 is disconnected, if the client re-establishes a long connection with the long connection server 701 within a preset time duration, push, by the service server 702, a third to-be-synchronized message obtained from another data center within a target time period to the client through the long connection server 701; the target time period is a time period corresponding to the time period from the time when the long connection between the client and the long connection server 701 is disconnected to the time when the connection is reestablished.
Optionally, the first message queue may be a KAFKA message queue;
the service server 702 may be further configured to discard the first to-be-synchronized message in the KAFKA message queue if the first to-be-synchronized message in the KAFKA message queue is synchronized to each of the other data centers.
Optionally, the data center may further include a task server;
the task server is configured to process the target message when a processing time of the service server 702 for the target message is greater than a preset time threshold, where the target message includes the service message and a message to be synchronized.
According to the data center provided by the embodiment of the invention, because each data center in the global data center is in the same virtual local area network, when the service server in the target data center stores the message to be synchronized into the message queue, other data centers can synchronously acquire the message to be synchronized from the message queue, so that the synchronization of the messages in different data centers is realized, the problem of inconsistency of the messages stored in different data centers is solved, and the consistency of the messages among different data centers is improved.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for embodiments such as data centers, since they are substantially similar to the method embodiments, the description is relatively simple, and reference may be made to some descriptions of the method embodiments for relevant points.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. A message synchronization method applied to a target data center in a global data center, the target data center including a long connection server and a service server, the method comprising:
after establishing long connection with a client, the long connection server receives a service message sent by the client and routes the service message to a corresponding target service server;
the target service server preprocesses the service message to obtain a first message to be synchronized, and stores the first message to be synchronized into a first message queue, so that other data centers in the global data center obtain the first message to be synchronized from the first message queue; and the target data center and the other data centers are in the same virtual local area network.
2. The method of claim 1, wherein the target data center further comprises a message storage device;
the method further comprises the following steps:
and when the service server monitors that a second message to be synchronized exists in a second message queue of the other data center, acquiring the second message to be synchronized from the second message queue, and storing the second message to be synchronized into the message storage device.
3. The method of claim 2, further comprising:
and the service server pushes the acquired second message to be synchronized to the client through the long connection server.
4. The method according to claim 3, wherein the step of the service server pushing the obtained second message to be synchronized to the client through the long connection server comprises:
after the long connection between the client and the long connection server is disconnected, if the client establishes long connection with the long connection server again within a preset time length, the service server pushes third to-be-synchronized messages obtained from other data centers within a target time period to the client through the long connection server; the target time period is a time period corresponding to the time period from the disconnection of the long connection between the client and the long connection server to the reestablishment of the long connection server.
5. The method of claim 1, wherein the first message queue is a kaffk KAFKA message queue;
the method further comprises the following steps:
if the first message to be synchronized in the KAFKA message queue is synchronized to every other data center, then the traffic server discards the first message to be synchronized in the KAFKA message queue.
6. The method of any of claims 1-5, wherein the target data center further comprises a task server;
the method further comprises the following steps:
and when the processing time of the service server to the target message is greater than a preset time threshold, the task server processes the target message, wherein the target message comprises the service message and the message to be synchronized.
7. A data center, characterized in that the data center comprises a long connection server and a service server:
the long connection server is used for receiving the service message sent by the client after long connection is established with the client, and routing the service message to a corresponding target service server;
the target service server is used for preprocessing the service message to obtain a first message to be synchronized and storing the first message to be synchronized into a first message queue so that other data centers in the global data center can obtain the first message to be synchronized from the first message queue; and the data center and the other data centers are in the same virtual local area network.
8. The data center of claim 7, further comprising a message storage device;
and the service server is configured to, when it is monitored that a second to-be-synchronized message exists in a second message queue of the other data center, acquire the second to-be-synchronized message from the second message queue, and store the second to-be-synchronized message in the message storage device.
9. The data center according to claim 8, wherein the service server is further configured to push the obtained second message to be synchronized to the client through the long connection server.
10. The data center according to claim 9, wherein the service server is specifically configured to, after a long connection between the client and the long connection server is disconnected, if the client re-establishes a long connection with the long connection server within a preset time duration, push, by the service server, a third to-be-synchronized message obtained from the other data centers within a target time duration to the client through the long connection server; the target time period is a time period corresponding to the time period from the disconnection of the long connection between the client and the long connection server to the reestablishment of the long connection server.
CN202010072710.0A 2020-01-21 2020-01-21 Message synchronization method and data center Pending CN111262773A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010072710.0A CN111262773A (en) 2020-01-21 2020-01-21 Message synchronization method and data center

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010072710.0A CN111262773A (en) 2020-01-21 2020-01-21 Message synchronization method and data center

Publications (1)

Publication Number Publication Date
CN111262773A true CN111262773A (en) 2020-06-09

Family

ID=70954369

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010072710.0A Pending CN111262773A (en) 2020-01-21 2020-01-21 Message synchronization method and data center

Country Status (1)

Country Link
CN (1) CN111262773A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111988427A (en) * 2020-08-31 2020-11-24 湖南快乐阳光互动娱乐传媒有限公司 Distributed local cache processing method and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105095364A (en) * 2015-06-26 2015-11-25 车智互联(北京)科技有限公司 Data synchronizing system and method
CN108712332A (en) * 2018-05-17 2018-10-26 华为技术有限公司 A kind of communication means, system and device
CN109040179A (en) * 2018-06-22 2018-12-18 北京奇艺世纪科技有限公司 A kind of message treatment method and device
CN109660584A (en) * 2017-10-12 2019-04-19 阿里巴巴集团控股有限公司 A kind of method and communication means and communication system of client and the long connection of server foundation

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105095364A (en) * 2015-06-26 2015-11-25 车智互联(北京)科技有限公司 Data synchronizing system and method
CN109660584A (en) * 2017-10-12 2019-04-19 阿里巴巴集团控股有限公司 A kind of method and communication means and communication system of client and the long connection of server foundation
CN108712332A (en) * 2018-05-17 2018-10-26 华为技术有限公司 A kind of communication means, system and device
CN109040179A (en) * 2018-06-22 2018-12-18 北京奇艺世纪科技有限公司 A kind of message treatment method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111988427A (en) * 2020-08-31 2020-11-24 湖南快乐阳光互动娱乐传媒有限公司 Distributed local cache processing method and system

Similar Documents

Publication Publication Date Title
US8364804B2 (en) Using presence in a system management environment
US6178453B1 (en) Virtual circuit switching architecture
US20100281169A1 (en) Presence-awareness for wireless devices
CN111030784A (en) Information synchronization method and device
CA2557145A1 (en) System, apparatus and method for communicating asynchronously with synchronous web services using a mediator service
US10834033B2 (en) Method and system for transferring messages between messaging systems
US7801959B1 (en) Method and system for pushing electronic messages to a wireless portable device using a standard mail server interface
US9935861B2 (en) Method, system and apparatus for detecting instant message spam
CN111277483B (en) Multi-terminal message synchronization method, server and storage medium
WO2023221452A1 (en) Packet processing system and method, device, and storage medium
US9037655B2 (en) Maintaining instant messaging conversations when a recipient is not at their primary workstation
WO2012031511A1 (en) Message management method and device
CN104901865B (en) A kind of mobile terminal instant messaging signal synchronizing method based on global monotonic sequence number
CN110798495B (en) Method and server for end-to-end message push in cluster architecture mode
CN111262773A (en) Message synchronization method and data center
CN107483628B (en) DPDK-based one-way proxy method and system
US8755397B2 (en) Asynchronous communication in an unstable network
CN111913817A (en) Data transmission method, system and equipment and computer readable storage medium
CN115865886B (en) HTTP-based cross-network data interaction method and device
CN111711675A (en) Solution for concurrent message transmission in local area network
CN114050986B (en) Signaling tracking method, device, equipment and storage medium
US8060568B2 (en) Real time messaging framework hub to intercept and retransmit messages for a messaging facility
CN115277649A (en) Method and device for collaboratively editing document in multimedia conference scene
CN114844847A (en) High-reliability real-time message distribution method and device
CN106487890A (en) A kind of cross-node communication network requesting method based on XMPP

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20210602

Address after: 25, 5th floor, shuangjingfang office building, 3 frisha street, Singapore

Applicant after: Zhuomi Private Ltd.

Address before: Room 1101, Santai Commercial Building, 139 Connaught Road, Hong Kong, China

Applicant before: HONG KONG LIVE.ME Corp.,Ltd.

RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200609