Message broadcasting system, method, device, storage medium and electronic device

By constructing a tree structure among broadcast clients and dynamically adjusting it using a collaborative server, low-cost and efficient message broadcasting was achieved in large-scale message reception scenarios, solving the bandwidth pressure problem and improving the system's transmission and consumption efficiency.

CN120301721BActive Publication Date: 2025-10-28ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510741512.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-05
Publication Date
2025-10-28
Estimated Expiration
2045-06-05

AI Technical Summary

Technical Problem

In scenarios with a large number of message receivers, how can messages be broadcast to all receivers at low cost, especially when synchronizing model parameters between training devices and service devices, and how can the bandwidth pressure on the broadcast server be effectively reduced?

Method used

The broadcast client is organized using a tree structure. Through the collaborative work of the message server, broadcast server and broadcast client, the broadcast server only sends messages to the root node of the tree structure. The broadcast client consumes the messages after receiving them and distributes them to the child nodes. The GRPC-Stream mode is used to improve transmission efficiency, and the tree structure is dynamically adjusted by the collaborative server to optimize bandwidth and timeliness.

Benefits of technology

It effectively alleviated the pressure of message transmission, reduced the bandwidth requirements of the broadcast server, improved the efficiency of message transmission and consumption, and ensured the timeliness and scalability of the overall system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120301721B_ABST
    Figure CN120301721B_ABST
Patent Text Reader

Abstract

This specification discloses a message broadcasting system. The communication connections between the broadcasting clients in the system form at least one tree structure. The message server sends the message to be synchronized to the broadcasting server, which then only sends the message to be synchronized to the broadcasting client corresponding to the root node of each tree structure. After receiving the message to be synchronized, any broadcasting client consumes the message and sends it to the broadcasting clients corresponding to its child nodes. This allows the broadcasting clients to share the burden of message transmission and reduces the bandwidth required by the broadcasting server to transmit messages.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of computer technology, and in particular to a message broadcasting system, method, apparatus, storage medium, and electronic device. Background Technology

[0002] With the explosive growth of large-scale models, the industry has generated more demand and scenarios for the infrastructure of model training and inference. For example, the training equipment for training models is in one computer room, while the service equipment for using the models for inference and providing services to users is in another computer room.

[0003] To handle high user traffic, multiple service devices are often needed to provide services to users, such as thousands of servers all deploying the same large model. Since the training devices are constantly optimizing and adjusting the model parameters while the service devices are providing services, it is necessary for the training devices to synchronize the optimized and updated model parameters to the service devices in real-time or periodically via message broadcasting.

[0004] When a message sender needs to deal with a large number of message receivers and send a large number of messages, how to broadcast messages to all message receivers at low cost is an urgent problem to be solved. Summary of the Invention

[0005] This specification provides a message broadcasting system, method, apparatus, storage medium, and electronic device to partially solve the problems existing in the prior art.

[0006] The embodiments in this specification adopt the following technical solutions:

[0007] This specification provides a message broadcasting system, which includes: a message server, a broadcast server, and a broadcast client; wherein:

[0008] The communication connections between the broadcast clients form at least one tree structure, with each broadcast client acting as a node in the tree structure.

[0009] The message server is used to send the message to be synchronized to the broadcast server;

[0010] The broadcast server is used to receive the message to be synchronized, determine the broadcast client corresponding to the root node of each tree structure, and send the message to be synchronized to the broadcast client corresponding to each root node.

[0011] Any broadcast client is configured to receive the message to be synchronized sent by the broadcast server or the parent node of the broadcast client, consume the message to be synchronized, and send the message to the broadcast client corresponding to the child node of the broadcast client.

[0012] This specification provides a message broadcasting method, which is applied to a broadcast server, and the method includes:

[0013] Receive messages to be synchronized from the message server;

[0014] Determine the broadcast client corresponding to the root node of each tree structure; wherein the communication connection relationship between each broadcast client constitutes at least one tree structure, and each broadcast client is a node in the tree structure;

[0015] The message to be synchronized is sent to the broadcast client corresponding to each root node, so that the broadcast client corresponding to each root node consumes the message to be synchronized and sends the message to the broadcast client corresponding to the child node of each root node.

[0016] This specification provides a message broadcasting method, which is applied to any broadcasting client. The communication connections between broadcasting clients constitute at least one tree structure, and each broadcasting client is a node in the tree structure. The method includes:

[0017] The broadcast client receives a message to be synchronized from the message sender. When the broadcast client is the broadcast client corresponding to the root node, the message sender is the broadcast server. When the broadcast client is the broadcast client corresponding to a non-root node, the message sender is the broadcast client corresponding to the parent node of the broadcast client.

[0018] Consume the message to be synchronized and send the message to be synchronized to the broadcast client corresponding to the child node of the broadcast client.

[0019] This specification provides a message broadcasting method, which is applied to a collaborative server, and the method includes:

[0020] Identify each broadcast client;

[0021] Determine at least one tree structure with each broadcast client as a node and consisting of the communication connection relationships between each broadcast client;

[0022] Each tree structure is sent to the broadcast server, which then sends the message to be synchronized from the message server to the broadcast client corresponding to each root node according to the tree structure. For each broadcast client, the parent node in the tree structure is determined, and the identifier of the parent node is sent to the broadcast client. This allows the broadcast client to establish a communication connection with the broadcast client corresponding to the parent node, enabling it to receive the message to be synchronized from the message sender and send the message to the broadcast clients corresponding to its child nodes. Specifically, when the broadcast client is the broadcast client corresponding to the root node, the message sender is the broadcast server; when the broadcast client is the broadcast client corresponding to a non-root node, the message sender is the broadcast client corresponding to the parent node of that broadcast client.

[0023] This specification provides a message broadcasting device, which is applied to a broadcast server, and the device includes:

[0024] The receiving module is used to receive messages to be synchronized sent by the message server;

[0025] The determination module is used to determine the broadcast client corresponding to the root node of each tree structure; wherein the communication connection relationship between each broadcast client constitutes at least one tree structure, and each broadcast client is a node in the tree structure;

[0026] The sending module is used to send the message to be synchronized to the broadcast client corresponding to each root node, so that the broadcast client corresponding to each root node consumes the message to be synchronized and sends the message to the broadcast client corresponding to the child node of each root node.

[0027] This specification provides a message broadcasting device, which is applied to any broadcasting client. The communication connections between the broadcasting clients form at least one tree structure, with each broadcasting client acting as a node in the tree structure. The device includes:

[0028] The receiving module is used to receive the message to be synchronized sent by the message sender. When the device is the root node, the message sender is the broadcast server. When the device is not the root node, the message sender is the broadcast client corresponding to the parent node of the device.

[0029] The consumption module is used to consume the messages to be synchronized.

[0030] The sending module is used to send the message to be synchronized to the broadcast client corresponding to the child node of the device.

[0031] This specification provides a message broadcasting device, which is applied to a collaborative server, and the device includes:

[0032] The first determination module is used to determine each broadcast client;

[0033] The second determining module is used to determine at least one tree structure consisting of the communication connection relationships between each broadcast client, with each broadcast client as a node.

[0034] The sending module is used to send each tree structure to the broadcast server, so that the broadcast server sends the message to be synchronized sent by the message server to the broadcast client corresponding to each root node according to each tree structure; and, for each broadcast client, determines the parent node of the broadcast client in the tree structure, sends the identifier of the parent node of the broadcast client to the broadcast client, so that the broadcast client establishes a communication connection with the broadcast client corresponding to the parent node according to the identifier, so that the broadcast client receives the message to be synchronized sent by the message sender and sends the message to be synchronized to the broadcast client corresponding to the child node of the broadcast client; wherein, when the broadcast client is the broadcast client corresponding to the root node, the message sender is the broadcast server, and when the broadcast client is the broadcast client corresponding to the parent node of the broadcast client, the message sender is the broadcast client corresponding to the parent node of the broadcast client.

[0035] This specification provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described message broadcasting method.

[0036] This specification provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the aforementioned message broadcasting method.

[0037] The above-described at least one technical solution adopted in the embodiments of this specification can achieve the following beneficial effects:

[0038] This specification discloses a message broadcasting system. The communication connections between the broadcasting clients in the system form at least one tree structure. The message server sends the message to be synchronized to the broadcasting server, which then only sends the message to be synchronized to the broadcasting client corresponding to the root node of each tree structure. After receiving the message to be synchronized, any broadcasting client consumes the message and sends it to the broadcasting clients corresponding to its child nodes. This allows the broadcasting clients to share the burden of message transmission and reduces the bandwidth required by the broadcasting server to transmit messages. Attached Figure Description

[0039] The accompanying drawings, which are included to provide a further understanding of this specification and form part of this specification, illustrate exemplary embodiments and are used to explain this specification, but do not constitute an undue limitation thereof. In the drawings:

[0040] Figure 1 A schematic diagram of a message broadcasting system provided in the embodiments of this specification;

[0041] Figure 2 A flowchart illustrating a method for organizing broadcast clients into a tree structure using a collaborative server, as provided in the embodiments of this specification.

[0042] Figure 3 A schematic diagram of the tree structure of each broadcast client created by the collaborative server provided in the embodiments of this specification;

[0043] Figure 4 This is a schematic diagram illustrating how the collaborative server adjusts the tree structure according to the consumption progress, as provided in the embodiments of this specification.

[0044] Figure 5 A schematic diagram of the split tree structure provided in the embodiments of this specification;

[0045] Figure 6 This is a schematic diagram illustrating the deletion of non-leaf nodes in a tree structure, provided as an embodiment of this specification.

[0046] Figure 7 A schematic diagram of a message broadcasting device provided in the embodiments of this specification;

[0047] Figure 8 This is a schematic diagram of a second message broadcasting device provided in the embodiments of this specification;

[0048] Figure 9 This is a schematic diagram of a third message broadcasting device provided in the embodiments of this specification;

[0049] Figure 10 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this specification. Detailed Implementation

[0050] Generally, a message sender needs to establish connections with all message receivers simultaneously and broadcast the message to all receivers for consumption. However, in many practical application scenarios, including synchronizing model parameters of a large model to all service devices deployed with that model to serve users, the message sender often faces thousands or even larger number of message receivers, and the number of messages to be sent is also large, leading to a sharp increase in bandwidth pressure on the message sender. Therefore, embodiments of this specification provide a message broadcasting system, method, apparatus, storage medium, and electronic device to broadcast messages to all message receivers at low cost.

[0051] To make the objectives, technical solutions, and advantages of this specification clearer, the technical solutions of this specification will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this specification, and not all of them. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this specification.

[0052] The technical solutions provided in the various embodiments of this specification are described in detail below with reference to the accompanying drawings.

[0053] Figure 1 This is a schematic diagram of a message broadcasting system provided in an embodiment of this specification. The system includes a message server, a broadcast server, and a broadcast client.

[0054] In this context, the message server is used to generate messages to be synchronized. In scenarios where the model parameters of a large model are synchronized to various service devices that deploy the large model to serve users, the message server can be the training device used to train the large model, and the message to be synchronized can be the model parameters of the large model adjusted by the training device.

[0055] A broadcast server is a message middleware used to send messages to be synchronized by a message server to various broadcast clients. The number of broadcast servers is less than the number of broadcast clients.

[0056] A broadcast client is a device used to receive and consume messages to be synchronized. In the embodiments of this specification, consumption refers to processing the messages to be synchronized, using them to complete a certain operation. In scenarios where model parameters of a large model are synchronized to various service devices that deploy the large model to serve users, the broadcast client is a service device that deploys the large model and provides services to users through it. Consuming the model parameters as messages to be synchronized refers to the process by which the broadcast client uses these model parameters to update the deployed large model. The number of broadcast clients exceeds the number of broadcast servers.

[0057] As a message producer, the message server can send the produced message to the broadcast server as a message to be synchronized.

[0058] As a message middleware, the broadcast server can send the message to be synchronized to each broadcast client after receiving it.

[0059] Because of the large number of broadcast clients, in order to reduce the bandwidth required for the broadcast server to send the synchronization messages to each broadcast client, the embodiments in this specification can organize the numerous broadcast clients into several tree structures, such as... Figure 1 As shown. The broadcast client corresponding to the root node communicates with the broadcast server and also with the broadcast clients corresponding to its child nodes. Broadcast clients corresponding to other nodes communicate with the broadcast clients corresponding to their parent and child nodes, respectively. Broadcast clients corresponding to leaf nodes only communicate with the broadcast client corresponding to their parent node. The tree structure described in this specification can be any tree structure with parent-child relationships; this specification does not limit the specific form of the tree structure. Figure 1 The following text will use binary trees as an example for illustration only.

[0060] Therefore, after receiving the synchronization message, the broadcast server can determine the broadcast client corresponding to the root node of each tree structure, and only send the synchronization message to the broadcast client corresponding to each root node.

[0061] For any broadcast client, it can receive synchronization messages sent by the message sender. When the broadcast client is the broadcast client corresponding to the root node, the message sender in this specification is the broadcast server; when the broadcast client is not the broadcast client corresponding to the root node, the message sender in this specification is the broadcast client corresponding to its parent node. After receiving the synchronization message, the broadcast client can consume the synchronization message and also send it to the broadcast clients corresponding to its child nodes.

[0062] Using the above method, the broadcast client can send the synchronization message only to the broadcast client corresponding to the root node in each tree structure, without sending it to other broadcast clients. After the synchronization message reaches the broadcast client corresponding to the root node, it can spread from the root node to the leaf node through the broadcast clients corresponding to the parent and child nodes with communication connection in the tree structure. This way, part of the bandwidth pressure of sending the synchronization message can be transferred to each broadcast client.

[0063] Furthermore, in the embodiments of this specification, the message to be synchronized starts from the message server, passes through the broadcast server and the broadcast clients in each tree structure, and the entire transmission process is carried out according to the message queue in which it belongs. Specifically, after the message server produces the message to be synchronized, it can determine the message queue in which the message to be synchronized belongs, add the message to be synchronized to the message queue, and then send at least one message to be synchronized in the message queue to the broadcast server. The broadcast server receives at least one message to be synchronized from each message queue and caches it. When sending the message to be synchronized to the broadcast client corresponding to the root node, it also sends at least one message to be synchronized from each cached message queue to the broadcast client corresponding to the root node. For any broadcast client, when the broadcast client sends the message to be synchronized to other broadcast clients corresponding to the child nodes in the tree structure in which the broadcast client belongs, it will also send at least one message to be synchronized from each message queue.

[0064] In this process, when determining the message queue where the message to be synchronized resides, the message server can identify the topic corresponding to the message and then designate the message queue corresponding to that topic as the message queue where the message to be synchronized resides. For example, in a scenario where model parameters of a large model are synchronized to various service devices that deploy the large model to serve users, the model parameters of each processing layer in the large model can be preset to the same topic, and a corresponding message queue can be set for each topic. When the message server produces model parameters as messages to be synchronized, it can determine the topic corresponding to the model parameters based on the processing layer where the model parameters reside, and then designate the message queue corresponding to that topic as the message queue where the model parameters reside.

[0065] Since the number of message queues may also be large, therefore, Figure 1 In the system shown, there are multiple broadcast servers, each responsible for transmitting messages to be synchronized from different message queues, in order to share the burden of message transmission.

[0066] As can be seen from the above method, the communication connection relationships between various broadcast clients are organized as follows: Figure 1 The tree structures shown are one of the important elements in this specification. Therefore, in the embodiments of this specification, a collaborative server is introduced into the message middleware ( Figure 1(Not shown in the image), the communication connection relationship between each broadcast client is organized by the collaboration server.

[0067] In the embodiments described in this specification, both the collaboration server and the broadcast server are components of the message middleware. The collaboration server can be a separate server independent of the broadcast server, or it can be on the same server as a broadcast server, and they are configured through methods such as... Figure 2 The method shown organizes the broadcast clients into several tree structures.

[0068] Figure 2 The flowchart of the method for organizing broadcast clients into several tree structures by the collaborative server provided in the embodiments of this specification specifically includes the following steps:

[0069] S200: The coordination server identifies each broadcast client.

[0070] In step S200, the collaboration server can first determine the entire Figure 1 The system shown contains all broadcast clients. Specifically, each broadcast client can report a heartbeat message to the coordination server at a set period, and this heartbeat message carries the broadcast client's own identifier. The coordination server can then identify each broadcast client based on the broadcast client identifier carried in each received heartbeat message.

[0071] S202: Determine at least one tree structure consisting of communication connections between broadcast clients, with each broadcast client as a node.

[0072] In the embodiments of this specification, since the broadcast server needs to send the messages to be synchronized to the broadcast clients corresponding to the root nodes in each tree structure, the more tree structures there are, the more broadcast clients corresponding to the root nodes that communicate directly with the broadcast server, and the greater the bandwidth required by the broadcast server. Simultaneously, for each tree structure, the deeper the tree structure, the greater the latency for the broadcast clients corresponding to the leaf nodes to receive and consume the messages to be synchronized, and the worse the overall timeliness of all broadcast clients receiving and consuming the messages to be synchronized. Therefore, it is necessary to balance the bandwidth required by the broadcast server with the overall timeliness of the broadcast clients receiving and consuming the messages to be synchronized.

[0073] Therefore, the correspondence between the number of broadcast clients and the maximum depth of the tree structure can be pre-defined. Generally, the more broadcast clients there are, the greater the maximum depth of the tree structure. For example, assuming the tree structure is a binary tree, when the number of broadcast clients does not exceed 32, the maximum depth of each tree structure can be set to 3, that is, the maximum number of nodes in each tree structure is 7, requiring a maximum of 5 tree structures. When the number of broadcast clients exceeds 32, the maximum depth of each tree structure can be set to 6, that is, the maximum number of nodes in each tree structure is 63, to ensure the timeliness of all broadcast clients receiving and consuming the messages to be synchronized.

[0074] Therefore, the collaboration server can determine the maximum depth of the tree structure based on the number of all broadcast clients determined in step S200, then determine the maximum number of nodes in each tree structure based on the maximum depth of each tree structure, and finally determine the required number of tree structures as the target number based on the number of broadcast clients and the maximum number of nodes in each tree structure, and create the target number of tree structures. Finally, for each tree structure, the corresponding node for each broadcast client in the tree structure is determined.

[0075] When determining the correspondence between broadcast clients and nodes in the created tree structure, the collaboration server can, for each tree structure, take the root node of the tree structure as the target node, determine the broadcast client corresponding to the target node among the broadcast clients that do not correspond to any node, and then re-determine the broadcast client corresponding to the re-determined target node by taking the child nodes of the target node as the target node, until each broadcast client corresponds to at least one node.

[0076] After the collaborative server creates the target number of tree structures and determines the correspondence between each broadcast client and the nodes in the tree structure, it has logically completed the organization of each broadcast client. It is also necessary to notify the broadcast server and each broadcast client of the organized tree structures, that is, to execute the subsequent steps S204 and S206. The execution order of steps S204 and S206 is not important.

[0077] S204: Send each tree structure to the broadcast server.

[0078] The collaborative server sends the tree structure organized in step S202 to the broadcast server. Based on the received tree structures, the broadcast server can determine the broadcast client corresponding to the root node of each tree structure and establish a communication connection with the determined broadcast client corresponding to the root node of each tree structure. Subsequently, it can send each message to be synchronized in each message queue to the broadcast client corresponding to the root node of each tree structure.

[0079] In this context, the communication connection established between the broadcast server and the broadcast client corresponding to the root node of each tree structure can be a GRPC-Stream communication connection. Through the GRPC-Stream communication connection, each message to be synchronized in the message queue can be continuously transmitted from the broadcast server to the broadcast client corresponding to the root node of each tree structure in a streaming manner, without having to perform a transmission request and transmission response interaction for each transmission, which can improve message transmission efficiency.

[0080] S206: For each broadcast client, determine the parent node of the broadcast client in the tree structure, and send the identifier of the parent node of the broadcast client to the broadcast client.

[0081] Based on the tree structure organized in step S202, the collaboration server determines the parent node of each broadcast client within the tree structure and sends the identifier of its parent node to each broadcast client. Upon receiving the identifier of its parent node, the broadcast client can establish a communication connection with the broadcast client corresponding to that parent node. Similarly, the communication connection established between broadcast clients can also be a GRPC-Stream communication connection to improve the efficiency of transmitting messages to be synchronized between the broadcast clients.

[0082] At this point, the tree structure organized by the collaborative servers is no longer limited to the logical level. Instead, by sending the logical tree structure to the broadcast server and each broadcast client, the broadcast server and each broadcast client establish communication connections with each other according to the communication connection relationships in each tree structure.

[0083] After the broadcast server and each broadcast client establish communication connections according to the tree structure organized by the coordinating server, messages to be synchronized can be transmitted based on these communication connections. In the embodiments of this specification, regardless of where each message to be synchronized originates or is transmitted, it must be sent in order according to the order in its message queue, and the broadcast client must also consume each message to be synchronized in order according to the order in its message queue.

[0084] Specifically, the broadcast server can send each message queue to the broadcast client corresponding to the root node of each tree structure, according to the order of the messages to be synchronized in that message queue. Correspondingly, the broadcast client receives the messages to be synchronized from the message sender in that message queue, and on the one hand, consumes the messages to be synchronized in that message queue according to their order; on the other hand, it sends the messages to be synchronized to the broadcast clients corresponding to the child nodes of the broadcast client according to their order. To ensure that the broadcast client consumes the messages to be synchronized in the message queue in an orderly manner according to their order, in this embodiment, the broadcast client can use the same thread to consume the messages to be synchronized in a single message queue.

[0085] Since each message to be synchronized must be transmitted and consumed sequentially according to the order in the message queue, and in each broadcast client, the messages to be synchronized gradually spread from the root node of the tree structure to the leaf nodes, ideally, assuming that each broadcast client has the same ability to consume messages to be synchronized, the consumption progress of broadcast clients closer to the leaf nodes will be slower than that of broadcast clients closer to the root node.

[0086] To improve the transmission and consumption efficiency of messages to be synchronized across all broadcast clients, the coordination server can arrange broadcast clients with faster consumption progress closer to the root node and broadcast clients with slower consumption progress closer to the leaf nodes when constructing the tree structure.

[0087] Specifically, in step S200, the heartbeat message reported by the broadcast client to the coordination server carries not only the broadcast client's identifier but also the broadcast client's consumption progress. Here, the consumption progress described in this embodiment refers to the number of messages to be synchronized that the broadcast client has consumed sequentially in each message queue, according to the order of the messages to be synchronized in each message queue. Although the messages to be synchronized differ in different message queues, and the number of messages to be synchronized consumed by a broadcast client in different message queues may vary, since all messages to be synchronized consumed by all broadcast clients (regardless of which message queue) originate from messages sent from the message server to the broadcast server, considering all message queues, different broadcast clients can still compare the overall consumption progress of all message queues.

[0088] Therefore, in step S202, after creating the target number of tree structures, the collaborative server, for each tree structure, determines the node corresponding to each broadcast client in the tree structure. It can use the root node of the tree structure as the target node. Among the broadcast clients that do not correspond to any node, it determines the broadcast client with the fastest consumption progress as the broadcast client corresponding to the target node. Then, it re-determines the broadcast clients corresponding to the newly determined target nodes, using the child nodes of the target node as the target nodes, until each broadcast client corresponds to at least one node. Figure 3 As shown.

[0089] Figure 3 This is a schematic diagram of the tree structure of the broadcast clients created by the collaborative server provided in the embodiments of this specification. The collaborative server has created, as shown below... Figure 3 After establishing two binary trees with a maximum depth of 3, based on the consumption progress of each broadcast client carried in their respective heartbeat messages reported by broadcast clients 1-10, the consumption progress can be determined to be ordered from fastest to slowest as broadcast clients 1-10. Therefore, for the first binary tree, broadcast client 1 with the fastest consumption progress can be taken as the root node of the first binary tree, and broadcast clients 2 and 3 can be taken as the left and right child nodes of the root node, and so on, until the correspondence between all broadcast clients and the nodes of the two binary trees is determined, resulting in the following... Figure 3 The two binary trees shown demonstrate that, for any given tree structure, the condition that the parent node's consumption progress is faster than that of its child nodes is satisfied.

[0090] Furthermore, although the consumption progress of each broadcast client may differ, ideally, the consumption progress of each broadcast client should advance synchronously. However, in practical applications, as the messages to be synchronized progress... Figure 1 The system shown continuously transmits and consumes messages from the message server to each broadcast client. If the consumption progress of a broadcast client falls behind the overall consumption progress, the broadcast client with the lagging consumption progress needs to be demoted in the tree structure.

[0091] Specifically, the collaboration server can adjust the flow of data in real time based on the consumption progress in the heartbeat messages reported by each broadcast client. Figure 2 The created tree structure, and the adjusted tree structure, were also passed through... Figure 2 The steps S204 and S206 shown are sent to the broadcast server and each broadcast client.

[0092] When adjusting the tree structure based on consumption progress, the collaboration server can, for any node, determine whether the consumption progress of that node is faster than that of its child nodes, and whether the difference between the consumption progress of the node and its child nodes is greater than a preset progress threshold. If so, it means that the consumption progress of the child node has fallen behind that of the node, and therefore, the positions of the child node and its child nodes in the tree structure can be swapped. Specifically, the position of the child node can be swapped with the child node with the fastest consumption progress among its child nodes.

[0093] For example, as messages to be synchronized continue to appear Figure 3 In the two tree structures shown, data is transmitted and consumed. The coordinating server determines, based on the consumption progress in the heartbeat messages reported by each broadcast client, that node 1's consumption progress is faster than node 2's. Furthermore, if the difference between node 1's and node 2's consumption progress is greater than a preset progress threshold, it indicates that node 2's consumption progress is gradually catching up with node 1's, and node 2 is gradually decoupling from the consumption progress of all broadcast clients. If node 2's position in the tree structure is maintained, it will inevitably affect the consumption progress of all nodes in the subtree rooted at node 2. Therefore, to maintain the overall consumption progress of all broadcast clients, the positions of node 2 and its child nodes (i.e., node 4 or node 5) in the tree structure can be swapped. Specifically, node 2 can be swapped with the node with the fastest consumption progress among nodes 4 and 5. Assuming node 4's consumption progress is faster than node 5, the adjusted tree structure is as follows: Figure 4 As shown, Figure 4 Only shown in Figure 3 The adjusted structure of the first binary tree; the second binary tree is not shown.

[0094] Of course, besides adjusting the tree structure due to a broadcast client's consumption progress lagging behind the overall structure, the tree structure also needs to be adjusted as the number of broadcast clients changes, for example, when it is necessary to scale down or up the broadcast clients used to serve users. The following sections will describe in detail the two scenarios of increasing and decreasing the number of broadcast clients.

[0095] Scenario 1: The number of broadcast clients increases.

[0096] When the collaborative server determines that a new broadcast client has appeared based on the heartbeat messages reported by each broadcast client, it can determine the first target tree structure in each tree structure created in step S202 where the number of nodes has not reached the maximum number, and directly create a leaf node in the first target tree structure to establish the correspondence between the new broadcast client and the created leaf node, which serves as the adjusted first target tree structure.

[0097] If the collaboration server has not determined any first target tree structure, that is, the number of nodes in all tree structures has reached the maximum number, then it determines whether the number of newly added broadcast clients has reached that maximum number.

[0098] If the number of newly added broadcast clients reaches the maximum number, it indicates that the broadcast clients are undergoing large-scale expansion. The collaborative server can directly add new tree structures and determine the first target tree structure in each of the newly added tree structures. Then, according to the rule that the consumption progress of the parent node is faster than that of the child node, the correspondence between each newly added broadcast client and the node in the first target tree structure is determined.

[0099] If the number of newly added broadcast clients does not reach the maximum number, it means that the broadcast client capacity has not been expanded on a large scale, but only a small number of broadcast clients have been added. Since the number of nodes in all tree structures has reached the maximum number, the existing tree structure can be split.

[0100] Specifically, the collaborative server can randomly select one tree structure from the various tree structures as the second target tree structure. Within this second target tree structure, it determines the subtrees rooted at each child node of the root node of the second target tree structure, which are then designated as first subtrees. Each of these first subtrees is then used as a tree structure split from the second target tree structure. The broadcast client corresponding to the root node of the second target tree structure is also added as a new broadcast client. Finally, the second target tree structure is deleted. In this way, each new tree structure split from the second target tree structure is a first target tree structure whose number of nodes has not reached the maximum. Therefore, the collaborative server can determine the first target tree structure from the split tree structures, and then add leaf nodes to each new broadcast client (including the broadcast client corresponding to the root node of the original second target tree structure) within the first target tree structure, establishing a correspondence between the new broadcast clients and the added leaf nodes.

[0101] Still with Figure 3 Let's take the first binary tree as an example. Assume that at this point... Figure 3 If both binary trees are full (meaning they have reached their maximum number of nodes), then the first binary tree is chosen as the second target tree structure. Since the root node of the second target tree is node 1, and node 1's children are nodes 2 and 3, therefore, we can... Figure 5 The two subtrees rooted at node 2 and node 3, respectively, are both considered as first subtrees. These first subtrees are then treated as new tree structures split from the second target tree structure. However, the broadcast client corresponding to node 1 needs to be treated as a newly added broadcast client. At this point, neither of the two newly split tree structures is full; leaf nodes can be added to accommodate all the newly added broadcast clients.

[0102] Scenario 2: The number of broadcast clients decreases.

[0103] When the collaboration server determines that a broadcast client has gone offline based on the heartbeat messages reported by each broadcast client, it can check whether the number of offline broadcast clients exceeds a preset threshold. If it does, it indicates that a large-scale restart or scaling down of broadcast clients has occurred. To avoid an overly fragmented tree structure, the collaboration server can directly re-establish a connection based on the currently online broadcast clients. Figure 2 The steps S200~S202 shown reconstruct all tree structures, that is, delete all existing tree structures and recreate tree structures based on the currently online broadcast clients.

[0104] If the number of offline broadcast clients does not exceed a preset threshold, the collaboration server can determine the tree structure where the offline broadcast clients are located, and use it as the third target tree structure.

[0105] If the node corresponding to the offline broadcast client in the third target tree structure is a leaf node, then the node corresponding to the offline broadcast client can be directly deleted from the third target tree structure.

[0106] If the node corresponding to the offline broadcast client in the third target tree structure is not a leaf node, then each subtree rooted at the child nodes of the node corresponding to the offline broadcast client in the third target tree structure can be determined as a second subtree. Within each second subtree, the largest subtree is determined, and its root node is replaced with the node corresponding to the offline broadcast client, maintaining the parent-child relationships between nodes in the largest subtree. The node corresponding to the offline broadcast client and all other subtrees in each second subtree except the largest subtree are deleted. The broadcast clients corresponding to nodes in these other subtrees are then treated as newly added broadcast clients, and processed using the method described in Case 1 above. Figure 6 As shown.

[0107] exist Figure 6 In the tree structure, broadcast clients 1-6 are included. When the collaboration server detects that the broadcast client corresponding to node 1 is offline, since node 1 is not a leaf node, the subtrees rooted at the child nodes of node 1, namely nodes 2 and 3, are determined as the second subtrees. Figure 6In the tree structure shown, the subtree rooted at node 2 is the largest subtree. Therefore, node 2 can be replaced with node 1, while maintaining the parent-child relationships between all nodes in the largest subtree rooted at node 2. Node 1 and the subtree rooted at node 3 are deleted. All nodes in the subtree rooted at node 3 (i.e., the broadcast clients corresponding to nodes 3 and 6) are then treated as new broadcast clients and processed using the method described in Case 1 above. After processing, the tree structure becomes a tree structure rooted at node 2.

[0108] The above describes the method by which the collaborative server adjusts the existing tree structure. Regardless of the adjustments made, the adjusted tree structure must be sent to the broadcast server. The broadcast server then uses the adjusted tree structure to redetermine the broadcast client corresponding to the root node of each tree and establish a communication connection with it. This allows the server to send the synchronization data to the newly determined broadcast client corresponding to each root node. Furthermore, for each broadcast client, the identifier of its parent node is redetermined based on the adjusted tree structure and sent to the client. The broadcast client uses this received identifier as an update identifier and establishes a communication connection with the newly determined broadcast client corresponding to its parent node.

[0109] When a broadcast client consumes messages in a message queue, it needs to consume them sequentially according to their order in the message queue. If the broadcast client fails to consume a message—for example, if updating a locally deployed large model based on updated model parameters from the message server fails—it can continue consuming other messages in the same message queue according to their order. That is, it can temporarily skip the failed message and continue consuming messages in other message queues. At preset retry times, the failed message will be reconsidered until it expires. The time interval between any two adjacent retry times can be the same (non-backoff retry) or the time interval between any two adjacent retry times can become progressively longer (backoff retry). Of course, a combination of backoff and non-backoff can also be used, where the time interval between any two adjacent retry times is the same in the first specified number of retry times, and the time interval between any two adjacent retry times becomes longer and longer in other retry times.

[0110] Correspondingly, broadcast clients can also report the number of retries for failed synchronization messages to their own consumption progress to the coordination server. The coordination server can then identify abnormal clients among the broadcast clients based on their consumption progress of the messages to be synchronized in each message queue. Specifically, broadcast clients with more than a preset retry threshold can be identified as abnormal clients.

[0111] Once an abnormal client is identified, the collaboration server can, on the one hand, treat the abnormal client as an offline broadcast client and adjust the existing tree structure using the method described in Scenario 2 above; on the other hand, it can notify the abnormal client and the broadcast server to establish a communication connection between the abnormal client and the broadcast server.

[0112] In response to the notification from the coordination server, the abnormal client and the broadcast server establish a communication connection. Based on this communication connection, the abnormal client can directly pull the message to be synchronized from the broadcast server, and the broadcast server can also directly send the message to be synchronized to the abnormal client.

[0113] In other words, in the embodiments of this specification, the broadcast clients directly connected to the broadcast server include not only the broadcast clients corresponding to the root nodes in each tree structure, but also broadcast clients that have been identified as abnormal clients.

[0114] In the embodiments described in this specification, when a broadcast client receives messages to be synchronized from a message sender (including a broadcast server or a broadcast client corresponding to the parent node of the broadcast client), it continuously receives the messages in a streaming manner. The message sender does not need to send these messages only after the broadcast client requests several messages to be synchronized each time. Correspondingly, when sending messages to be synchronized, the message sender can send several messages from the same message queue each time.

[0115] However, since the broadcast client has an upper limit to its ability to consume synchronization messages, the message sender needs to know exactly how many synchronization messages to send to the broadcast client each time. Therefore, the broadcast client can maintain its own message transmission window and send the message transmission window to the message sender. The message sender can then use the message transmission window to know the number of synchronization messages that the broadcast client currently needs and send that number of synchronization messages to the broadcast client.

[0116] Specifically, the broadcast client determines its message transmission window based on its maximum consumption limit and the number of unconsumed messages awaiting synchronization, and then sends this window to the message sender. The message sender, in turn, sends the corresponding number of messages awaiting synchronization to the broadcast client based on the received message transmission window. The broadcast client's maximum consumption limit depends on its own processing capacity and can be a manually preset value. The difference between this maximum consumption limit and the number of unconsumed messages awaiting synchronization is the aforementioned message transmission window. By sending the message transmission window to the message sender, the sender knows the maximum number of messages awaiting synchronization that the broadcast client can currently handle, and can therefore send no more than this number of messages to the broadcast client.

[0117] In addition, in the embodiments of this specification, the broadcast server may also record the sending progress of messages to be synchronized in each message queue at each specified time, and record the correspondence between the timestamp corresponding to the specified time and the sending progress.

[0118] Correspondingly, if it is necessary to reset the consumption progress of all broadcast clients to a certain target time, the broadcast client corresponding to the root node of each tree structure can send a query request carrying the target timestamp corresponding to the target time to the broadcast server according to the target time specified by the user. When the broadcast server receives a query request carrying the target timestamp from the broadcast client corresponding to any root node, it sends the recorded target transmission progress corresponding to the target timestamp to the broadcast client corresponding to the root node. This allows the broadcast client corresponding to the root node to pull the messages to be synchronized from each queue of the broadcast server according to the target transmission progress. Subsequently, all broadcast clients will start consuming from the messages to be synchronized corresponding to the target transmission progress, thus achieving the synchronization reset of all broadcast clients.

[0119] Furthermore, since any broadcast client may continue to send the received synchronization message to the broadcast clients corresponding to its own child nodes, even the broadcast client corresponding to the current leaf node may become the parent node through subsequent adjustments to the tree structure, after receiving any synchronization message, the broadcast client needs to cache the synchronization message for a preset time period. When sending the synchronization message to the broadcast clients corresponding to its own child nodes, the broadcast client needs to search for the synchronization message in the cached messages and send the found synchronization message to the broadcast clients corresponding to its own child nodes.

[0120] If the cache time of the message to be synchronized has exceeded the preset time length and it has been deleted, the broadcast client can try to pull these messages from its own message sender (including the broadcast client or broadcast server corresponding to its parent node) and then send them to the broadcast client corresponding to its child node, or directly notify the broadcast client corresponding to its child node to pull them from the broadcast server.

[0121] To address the possibility of losing consumption progress due to a restart of the broadcast client itself, each broadcast client in this embodiment can also persist its consumption progress of messages to be synchronized in each queue to the local disk. When the broadcast client restarts, it can determine the messages to be synchronized from each message queue based on the locally persisted consumption progress, and then retrieve these messages from the message sender.

[0122] The above describes a message broadcasting system and method provided in the embodiments of this specification. Based on the same idea, this specification also provides corresponding devices, storage media, and electronic devices.

[0123] Figure 7 This is a schematic diagram of a message broadcasting device provided in an embodiment of this specification. The device is applied to a broadcast server and includes:

[0124] The receiving module 701 is used to receive the message to be synchronized sent by the message server;

[0125] The determination module 702 is used to determine the broadcast client corresponding to the root node of each tree structure; wherein the communication connection relationship between each broadcast client constitutes at least one tree structure, and each broadcast client is a node in the tree structure;

[0126] The sending module 703 is used to send the message to be synchronized to the broadcast client corresponding to each root node, so that the broadcast client corresponding to each root node consumes the message to be synchronized and sends the message to be synchronized to the broadcast client corresponding to the child node of each root node.

[0127] Optionally, the receiving module 701 is specifically configured to receive at least one message to be synchronized from each message queue sent by the message server, and cache it;

[0128] The sending module 703 is specifically used to send, for each message queue, each message to be synchronized in the message queue according to the order of each message to be synchronized in the message queue to the broadcast client corresponding to the root node of each tree structure.

[0129] Optionally, the receiving module 701 is further configured to receive tree structures sent by the collaborative server, wherein each tree structure is a tree structure determined by the collaborative server based on each broadcast client, with each broadcast client as a node and consisting of the communication connection relationships between each broadcast client;

[0130] The determining module 702 is specifically used to determine the broadcast client corresponding to the root node of each tree structure based on the received tree structures.

[0131] Optionally, the sending module 703 is further configured to establish a communication connection with the abnormal client identified by the collaboration server; and based on the communication connection, push the message to be synchronized to the abnormal client.

[0132] Optionally, the sending module 703 is specifically configured to receive a message transmission window sent by a broadcast client corresponding to each root node; wherein the message transmission window is determined by the broadcast client based on its maximum consumption quantity and the number of unconsumed messages to be synchronized; and send the number of messages to be synchronized corresponding to the received message transmission window to the broadcast client.

[0133] Optionally, the sending module 703 is further configured to: record the sending progress of messages to be synchronized in each message queue at a specified time; record the correspondence between the timestamp corresponding to the specified time and the sending progress; when receiving a query request carrying a target timestamp sent by a broadcast client corresponding to any root node, send the recorded target sending progress corresponding to the target timestamp to the broadcast client corresponding to the root node, so that the broadcast client corresponding to the root node can pull the messages to be synchronized in each queue corresponding to the target sending progress from the broadcast server according to the target sending progress.

[0134] Figure 8 This is a schematic diagram of a second message broadcasting device provided in the embodiments of this specification. The device is applied to any broadcasting client, and the communication connection relationship between the broadcasting clients constitutes at least one tree structure, with each broadcasting client serving as a node in the tree structure. The device includes:

[0135] The receiving module 801 is used to receive a message to be synchronized sent by a message sender, wherein when the device is a root node, the message sender is a broadcast server, and when the device is a non-root node, the message sender is a broadcast client corresponding to the parent node of the device.

[0136] Consumer module 802 is used to consume the messages to be synchronized;

[0137] The sending module 803 is used to send the message to be synchronized to the broadcast client corresponding to the child node of the device.

[0138] Optionally, the receiving module 801 is specifically used to receive, for each message queue, each message to be synchronized in the message queue sent by the message sender according to the order of each message to be synchronized in the message queue;

[0139] The consumption module 802 is specifically used to consume each message to be synchronized in each message queue according to the order of each message to be synchronized in the message queue.

[0140] The sending module 803 is specifically used to send each message to be synchronized in each message queue to the broadcast client corresponding to the child node of the device, according to the order of each message to be synchronized in the message queue.

[0141] Optionally, the receiving module 801 is further configured to receive the identifier of the parent node of the device sent by the coordination server before the sending module 803 sends the message to be synchronized to the broadcast client corresponding to the child node of the device; and establish a communication connection with the broadcast client corresponding to the parent node based on the identifier of the parent node.

[0142] Optionally, the sending module 803 is further configured to report its consumption progress of messages to be synchronized in each message queue to the coordination server, so that the coordination server adjusts the tree structure according to the consumption progress of each broadcast client of messages to be synchronized in each message queue.

[0143] The receiving module 801 is further configured to receive the identifier of the parent node of the device in the adjusted tree structure sent by the collaborative server, as an update identifier; and establish a communication connection with the parent node of the device in the adjusted tree structure according to the update identifier.

[0144] Optionally, the sending module 803 is specifically used to carry its own consumption progress of messages to be synchronized in each message queue in a heartbeat message according to a set period, and report the heartbeat message to the collaborative server.

[0145] Optionally, the receiving module 801 is specifically configured to: receive a notification sent by the collaboration server, the notification being sent by the collaboration server when it determines that the device is an abnormal client based on the consumption progress of the device on the messages to be synchronized in each message queue; in response to the notification, establish a communication connection with the broadcast server; and pull the messages to be synchronized from the broadcast server.

[0146] Optionally, the receiving module 801 is specifically configured to: determine a message transmission window based on its maximum consumption quantity and the number of currently unconsumed messages to be synchronized, and send the message transmission window to the message sender; and receive the number of messages to be synchronized corresponding to the message transmission window sent by the message sender to the device.

[0147] Optionally, the sending module 803 is further configured to send a query request carrying a target timestamp to the broadcast server;

[0148] The receiving module 801 is further configured to receive the target sending progress corresponding to the target timestamp sent by the broadcast server; and according to the target sending progress, pull the messages to be synchronized corresponding to the target sending progress from each queue from the message sender.

[0149] Optionally, the receiving module 801 is further configured to, after receiving the message to be synchronized sent by the message sender, cache the received message to be synchronized within a preset time period;

[0150] The sending module 803 is specifically used to search for the message to be synchronized in the cached messages and send the found message to be synchronized to the broadcast client corresponding to the child node of the device.

[0151] Optionally, the receiving module 801 is further configured to: determine its own consumption progress of messages to be synchronized in each message queue, and persist the consumption progress; when the device restarts, determine the messages to be synchronized that need to be pulled from each message queue based on the persisted consumption progress; and for each message queue, pull the messages to be synchronized that need to be pulled from the message sender.

[0152] Optionally, the consumption module 802 is specifically configured to, when the consumption of the message to be synchronized in the message queue fails, continue to consume other messages to be synchronized in the message queue according to the order of the messages to be synchronized in the message queue, and re-consume the messages to be synchronized that failed to be consumed when the preset retry time arrives, until the messages to be synchronized that failed to be consumed expire.

[0153] Figure 9 This is a schematic diagram of a third message broadcasting device provided in the embodiments of this specification. The device is applied to a collaborative server and includes:

[0154] The first determining module 901 is used to determine each broadcast client;

[0155] The second determining module 902 is used to determine at least one tree structure consisting of the communication connection relationship between each broadcast client, with each broadcast client as a node.

[0156] The sending module 903 is used to send each tree structure to the broadcast server, so that the broadcast server sends the message to be synchronized sent by the message server to the broadcast client corresponding to each root node according to each tree structure; and, for each broadcast client, determines the parent node of the broadcast client in the tree structure, sends the identifier of the parent node of the broadcast client to the broadcast client, so that the broadcast client establishes a communication connection with the broadcast client corresponding to the parent node according to the identifier, so that the broadcast client receives the message to be synchronized sent by the message sender, and sends the message to be synchronized to the broadcast client corresponding to the child node of the broadcast client; wherein, when the broadcast client is the broadcast client corresponding to the root node, the message sender is the broadcast server, and when the broadcast client is the broadcast client corresponding to the parent node of the broadcast client, the message sender is the broadcast client corresponding to the parent node of the broadcast client.

[0157] Optionally, the first determining module 901 is specifically used to receive heartbeat messages reported by each broadcast client; and to determine each broadcast client based on the identifier of the broadcast client carried in the heartbeat message.

[0158] Optionally, the second determining module 902 is specifically configured to: determine the maximum depth of each tree structure based on the determined number of broadcast clients; determine the maximum number of nodes in each tree structure based on the maximum depth of each tree structure; determine the required number of tree structures as the target number based on the number of broadcast clients and the maximum number of nodes in each tree structure; create the target number of tree structures; for each tree structure, taking the root node of the tree structure as the target node, determine the broadcast client corresponding to the target node among the broadcast clients that do not correspond to any node, and continue to determine the broadcast client corresponding to the newly determined target node by taking the child node of the target node as the target node again, until each broadcast client corresponds to at least one node.

[0159] Optionally, the heartbeat message reported by the broadcast client may also include the consumption progress of the broadcast client for the messages to be synchronized in each message queue;

[0160] The second determining module 902 is specifically used to determine, among the broadcast clients that do not correspond to any node, the broadcast client with the fastest consumption progress, and use it as the broadcast client corresponding to the target node.

[0161] Optionally, the heartbeat message reported by the broadcast client may also include the consumption progress of the broadcast client for the messages to be synchronized in each message queue;

[0162] The second determining module 902 is further configured to adjust the tree structure according to the consumption progress;

[0163] The sending module 903 is further configured to send the adjusted tree structure to the broadcast server, and for each broadcast client, determine the identifier of the parent node of the broadcast client in the adjusted tree structure and send it to the broadcast client.

[0164] Optionally, the second determining module 902 is specifically used to, for any node, if the consumption progress of the node is faster than the consumption progress of the node's child nodes, and the difference between the consumption progress of the node and the consumption progress of the child nodes is greater than a preset progress threshold, then swap the positions of the child node and the child nodes of the child node in the tree structure.

[0165] Optionally, the second determining module 902 is further configured to, when it is determined that a new broadcast client has appeared, determine a first target tree structure in each tree structure whose number of nodes has not reached the maximum number; create leaf nodes in the first target tree structure, and establish a correspondence between the new broadcast client and the created leaf nodes as the adjusted first target tree structure.

[0166] Optionally, the second determining module 902 is further configured to, before creating leaf nodes in the first target tree structure, if the number of newly added broadcast clients has not reached the maximum number when the number of nodes in all tree structures has reached the maximum number, select a second target tree structure among the tree structures; determine the subtrees in the second target tree structure with each child node of the root node as the root node, as each first subtree; treat each first subtree as a tree structure split from the second target tree structure, and treat the broadcast client corresponding to the root node of the second target tree structure as a newly added broadcast client, and delete the second target tree structure; and determine the first target tree structure whose number of nodes has not reached the maximum number among the split tree structures.

[0167] Optionally, the second determining module 902 is further configured to: when the number of nodes in all tree structures has reached the maximum number, if the number of newly added broadcast clients reaches the maximum number, add a new tree structure; and determine a first target tree structure in each of the newly added tree structures whose number of nodes has not reached the maximum number.

[0168] Optionally, the second determining module 902 is further configured to: when it is determined that an offline broadcast client has appeared, determine the tree structure in which the offline broadcast client is located as a third target tree structure; if the node corresponding to the offline broadcast client in the third target tree structure is a leaf node, delete the node corresponding to the offline broadcast client in the third target tree structure; if the node corresponding to the offline broadcast client in the third target tree structure is not a leaf node, determine each subtree in the third target tree structure with each child node of the node corresponding to the offline broadcast client as the root node, as each second subtree, determine the largest subtree in each second subtree, replace the root node of the largest subtree with the position of the node corresponding to the offline broadcast client, and keep the parent-child relationship between the nodes in the largest subtree unchanged, delete the node corresponding to the offline broadcast client and other subtrees in each second subtree except for the largest subtree, and treat the broadcast clients corresponding to each node in the other subtrees as newly added broadcast clients.

[0169] Optionally, the second determining module 902 is further configured to, before determining the tree structure where the offline broadcast client is located as the third target tree structure, determine that the number of offline broadcast clients does not exceed a preset number threshold; and when the number of offline broadcast clients exceeds the preset number threshold, reconstruct all tree structures.

[0170] Optionally, the heartbeat message reported by the broadcast client may also include the consumption progress of the broadcast client for the messages to be synchronized in each message queue;

[0171] The sending module 903 is further configured to determine abnormal clients among the broadcast clients based on the consumption progress of each broadcast client of the messages to be synchronized in each message queue; to designate the abnormal client as an offline broadcast client; and to notify the abnormal client to establish a communication connection with the broadcast server, so that the abnormal client establishes a communication connection with the broadcast server and pulls the messages to be synchronized from the broadcast server.

[0172] This specification also provides a computer-readable storage medium storing a computer program that, when executed by a processor, can be used to perform the message broadcasting method provided above.

[0173] Based on the above message broadcasting method, embodiments of this specification also provide Figure 10 The diagram shows the structure of the electronic device. Figure 10At the hardware level, the electronic device includes a processor, internal bus, network interface, memory, and non-volatile storage, and may also include other hardware required for the business logic. The processor reads the corresponding computer program from the non-volatile storage into memory and then runs it to implement the aforementioned message broadcasting method.

[0174] The above description is merely an embodiment of this specification and is not intended to limit this specification. Various modifications and variations can be made to this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims of this specification.

Claims

1. A message broadcasting system, the system comprising: Message server, broadcast server, and broadcast client; among which: The communication connections between the broadcast clients form at least one tree structure, with each broadcast client acting as a node in the tree structure. The message server is used to send the message to be synchronized to the broadcast server; The broadcast server is used to receive the message to be synchronized, determine the broadcast client corresponding to the root node of each tree structure, and send the message to be synchronized to the broadcast client corresponding to each root node. Any broadcast client is configured to receive the message to be synchronized sent by the broadcast server or the parent node of the broadcast client, consume the message to be synchronized, and send the message to be synchronized to the broadcast client corresponding to the child node of the broadcast client; The system also includes: a collaborative server; The collaborative server is used to obtain the consumption progress of each broadcast client for the messages to be synchronized in each message queue, and adjust the tree structure according to the consumption progress; wherein, the consumption includes updating the large model deployed locally by the broadcast client according to the updated model parameters from the message server; the consumption progress refers to the number of messages to be synchronized that the broadcast client has consumed in order in each message queue according to the order of the messages to be synchronized in each message queue. The broadcast client is also used to report its consumption progress of messages to be synchronized in each message queue to the collaboration server. If the broadcast client fails to consume a message to be synchronized, it continues to consume other messages to be synchronized in the message queue according to the order of other messages to be synchronized in the message queue where the failed message to be synchronized is located.

2. The system as described in claim 1, wherein the message server is specifically configured to: determine the message queue where the message to be synchronized is located, add the message to be synchronized to the message queue, and send at least one message to be synchronized in the message queue to the broadcast server; The broadcast server is specifically used to receive at least one message to be synchronized from each message queue sent by the message server, and to cache it.

3. The system of claim 1, further comprising: Collaborative server; The collaborative server is used to determine each broadcast client, and to determine at least one tree structure consisting of the communication connection relationship between each broadcast client as a node, send each tree structure to the broadcast server, and for each broadcast client, determine the parent node of the broadcast client and send the identifier of the parent node of the broadcast client to the broadcast client. The broadcast server is also used to receive the tree structures sent by the collaborative server; The broadcast client is also used to receive the identifier of the parent node of the broadcast client sent by the collaborative server, and establish a communication connection with the broadcast client corresponding to the parent node based on the identifier of the parent node.

4. The system as described in claim 2, wherein the broadcast server is specifically configured to, for each message queue, send each message to be synchronized in the message queue to the broadcast client corresponding to the root node of each tree structure according to the order of each message to be synchronized in the message queue; Any broadcast client is specifically configured to receive each message to be synchronized in the message queue sent by the broadcast server or the parent node of the broadcast client, consume each message to be synchronized in the message queue according to the order of the messages to be synchronized in the message queue, and send each message to be synchronized in the message queue to the broadcast client corresponding to the child node of the broadcast client according to the order of the messages to be synchronized in the message queue.

5. The system as described in claim 4, wherein the collaborative server is configured to send the adjusted tree structure to the broadcast server, and for each broadcast client, determine the identifier of the parent node of the broadcast client in the adjusted tree structure and send it to the broadcast client; The broadcast client is also used to, upon receiving the identifier of the parent node of the broadcast client in the adjusted tree structure sent by the collaborative server, establish a communication connection with the parent node of the broadcast client in the adjusted tree structure based on the identifier.

6. The system as described in claim 5, wherein the broadcast client is specifically configured to, according to a set period, carry its own consumption progress of messages to be synchronized in each message queue in a heartbeat message, and report the heartbeat message to the collaborative server; The collaborative server is specifically used to receive heartbeat messages reported by each broadcast client and to obtain the consumption progress of each broadcast client for messages to be synchronized in each message queue based on the heartbeat messages.

7. The system as described in claim 5, wherein the collaborative server is further configured to, based on the consumption progress of each broadcast client of the messages to be synchronized in each message queue, identify abnormal clients among the broadcast clients, delete the node corresponding to the abnormal client in the tree structure, and notify the abnormal client to establish a communication connection with the broadcast server; The broadcast client is also used to establish a communication connection with the broadcast server and pull messages to be synchronized from the broadcast server when it receives a notification sent by the collaborative server.

8. The system as described in claim 4, wherein any broadcast client is further configured to determine a message transmission window based on its own maximum consumption quantity and the number of currently unconsumed messages awaiting synchronization, and send the message transmission window to the message sender; wherein, When the broadcast client is the broadcast client corresponding to the root node, the message sender is the broadcast server; when the broadcast client is the broadcast client corresponding to the parent node of the broadcast client, the message sender is the broadcast client corresponding to the parent node of the broadcast client. Specifically, the message sender is used to send the number of messages to be synchronized corresponding to the received message transmission window to the broadcast client.

9. The system as described in claim 2, wherein the broadcast server is further configured to record the sending progress of messages to be synchronized in each message queue at a specified time, and record the correspondence between the timestamp corresponding to the specified time and the sending progress; when receiving a query request carrying a target timestamp sent by any broadcast client, the server sends the recorded target sending progress corresponding to the target timestamp to the broadcast client. Any broadcast client is further configured to: send a query request carrying a target timestamp to the broadcast server; receive a target transmission progress corresponding to the target timestamp from the broadcast server; and, based on the target transmission progress, retrieve messages to be synchronized from each queue corresponding to the target transmission progress from the message sender; wherein, When the broadcast client is the broadcast client corresponding to the root node, the message sender is the broadcast server; when the broadcast client is the broadcast client corresponding to the parent node of the broadcast client, the message sender is the broadcast client corresponding to the parent node of the broadcast client.

10. A message broadcasting method, the method being applied to a broadcast server, the method comprising: Receive messages to be synchronized from the message server; Determine the broadcast client corresponding to the root node of each tree structure; wherein the communication connection relationship between each broadcast client constitutes at least one tree structure, and each broadcast client is a node in the tree structure; The message to be synchronized is sent to the broadcast client corresponding to each root node, so that the broadcast client corresponding to each root node consumes the message to be synchronized and sends the message to the broadcast client corresponding to the child node of each root node. The tree structure is adjusted according to the consumption progress of each broadcast client on the messages to be synchronized in each message queue; the consumption includes updating the large model deployed locally by the broadcast client according to the updated model parameters from the message server; the consumption progress refers to the number of messages to be synchronized that the broadcast client has consumed in order in each message queue according to the order of the messages to be synchronized in each message queue. If the broadcast client fails to consume the message to be synchronized, it continues to consume other messages to be synchronized in the message queue according to the order of other messages to be synchronized in the message queue where the failed message was located.

11. The method as described in claim 10, wherein receiving the message to be synchronized sent by the message server specifically includes: Receive at least one message to be synchronized from each message queue sent by the message server, and cache it; Sending the message to be synchronized to the broadcast client corresponding to each root node, specifically including: For each message queue, according to the order of the messages to be synchronized in that message queue, send each message to be synchronized in that message queue to the broadcast client corresponding to the root node of each tree structure.

12. The method of claim 10, further comprising: The system receives tree structures sent by the collaboration server, wherein each tree structure is a tree structure determined by the collaboration server based on each broadcast client, with each broadcast client as a node and consisting of the communication connection relationships between each broadcast client; Determine the broadcast client corresponding to the root node of each tree structure, specifically including: Based on the received tree structures, determine the broadcast client corresponding to the root node of each tree structure.

13. The method of claim 10, further comprising: Establish a communication connection with the abnormal client identified by the collaboration server; Based on the communication connection, the message to be synchronized is pushed to the abnormal client.

14. The method as described in claim 10, wherein sending the message to be synchronized to the broadcast client corresponding to each root node specifically includes: For each root node's corresponding broadcast client, a message transmission window is received from that broadcast client; wherein, the message transmission window is determined by the broadcast client based on its maximum consumption quantity and the number of unconsumed messages to be synchronized. Based on the received message transmission window, send the number of messages to be synchronized corresponding to the message transmission window to the broadcast client.

15. The method of claim 11, further comprising: Record the sending progress of messages to be synchronized in each message queue at a specified time. Record the correspondence between the timestamp corresponding to the specified time and the sending progress; When a query request carrying a target timestamp is received from a broadcast client corresponding to any root node, the target sending progress corresponding to the recorded target timestamp is sent to the broadcast client corresponding to that root node, so that the broadcast client corresponding to that root node can pull the message to be synchronized corresponding to the target sending progress from each queue of the broadcast server according to the target sending progress.

16. A message broadcasting method, wherein the method is applied to any broadcasting client, the communication connection relationship between the broadcasting clients constitutes at least one tree structure, and each broadcasting client is a node in the tree structure; the method includes: The broadcast client receives a message to be synchronized from the message sender. When the broadcast client is the broadcast client corresponding to the root node, the message sender is the broadcast server. When the broadcast client is the broadcast client corresponding to a non-root node, the message sender is the broadcast client corresponding to the parent node of the broadcast client. Consume the message to be synchronized and send the message to be synchronized to the broadcast client corresponding to the child node of the broadcast client; the consumption includes updating the large model deployed locally on the broadcast client according to the updated model parameters from the message server; The tree structure is adjusted according to the consumption progress of each broadcast client on the messages to be synchronized in each message queue; the consumption progress refers to the number of messages to be synchronized that the broadcast client has consumed in order in each message queue according to the order of the messages to be synchronized in each message queue. If the broadcast client fails to consume the message to be synchronized, it continues to consume other messages to be synchronized in the message queue according to the order of other messages to be synchronized in the message queue where the failed message was located.

17. The method as described in claim 16, wherein the broadcast client receives the synchronization message sent by the message sender, specifically including: For each message queue, the broadcast client receives each message to be synchronized in that message queue from the message sender, according to the order in which the messages to be synchronized are sent. Consuming the messages to be synchronized specifically includes: For each message queue, each message to be synchronized in that message queue is consumed according to its order. Sending the message to be synchronized to the broadcast client corresponding to the child node of the broadcast client specifically includes: For each message queue, based on the order of the messages to be synchronized in that message queue, each message to be synchronized in that message queue is sent to the broadcast client corresponding to the child node of that broadcast client.

18. The method of claim 16, wherein before sending the message to be synchronized to the broadcast client corresponding to the child node of the broadcast client, the method further comprises: The broadcast client receives the identifier of its parent node from the coordination server. Based on the identifier of the parent node, establish a communication connection with the broadcast client corresponding to the parent node.

19. The method of claim 18, further comprising: The broadcast client reports its consumption progress of messages to be synchronized in each message queue to the coordination server, so that the coordination server adjusts the tree structure according to the consumption progress of each broadcast client of messages to be synchronized in each message queue. The identifier of the parent node of the broadcast client in the adjusted tree structure, sent by the collaborative server, is received as the update identifier; Based on the updated identifier, establish a communication connection with the parent node of the broadcast client in the adjusted tree structure.

20. The method as described in claim 19, wherein the broadcast client reports its consumption progress of messages to be synchronized in each message queue to the coordination server, specifically including: The broadcast client, according to a set period, carries its consumption progress of messages to be synchronized in each message queue in a heartbeat message, and reports the heartbeat message to the coordination server.

21. The method of claim 19, further comprising: The broadcast client receives a notification sent by the collaboration server. The notification is sent by the collaboration server when it determines that the broadcast client is an abnormal client based on the consumption progress of the messages to be synchronized in each message queue. In response to the notification, a communication connection is established with the broadcast server; Retrieve messages to be synchronized from the broadcast server.

22. The method as described in claim 16, wherein the broadcast client receives the synchronization message sent by the message sender, specifically including: The broadcast client determines the message transmission window based on its maximum consumption limit and the number of unconsumed messages to be synchronized, and sends the message transmission window to the message sender. The message sender receives the number of messages to be synchronized corresponding to the message transmission window sent to the broadcast client.

23. The method of claim 16, further comprising: The broadcast client sends a query request carrying the target timestamp to the broadcast server; Receive the target transmission progress corresponding to the target timestamp sent by the broadcast server; Based on the target sending progress, retrieve the messages to be synchronized corresponding to the target sending progress from each queue of the message sender.

24. The method of claim 16, wherein after the broadcast client receives the synchronization message sent by the message sender, the method further includes: The received messages to be synchronized are cached within a preset time period; Sending the message to be synchronized to the broadcast client corresponding to the child node of the broadcast client specifically includes: The message to be synchronized is searched in the cached messages, and the found message to be synchronized is sent to the broadcast client corresponding to the child node of the broadcast client.

25. The method of claim 17, further comprising: The broadcast client determines its consumption progress of messages to be synchronized in each message queue and persists the consumption progress. When the broadcast client restarts, it determines the messages to be synchronized that need to be pulled from each message queue based on the persistent consumption progress. For each message queue, retrieve the messages to be synchronized from the message sender.

26. The method of claim 16, wherein if the broadcast client fails to consume the synchronization message, the method further comprises: At each preset retry time, the failed messages to be synchronized are consumed again until they expire.

27. A message broadcasting method, the method being applied to a collaborative server, the method comprising: Identify each broadcast client; Determine at least one tree structure with each broadcast client as a node and consisting of the communication connection relationships between each broadcast client; Each tree structure is sent to the broadcast server, which then sends the message to be synchronized sent by the message server to the broadcast client corresponding to each root node according to each tree structure. Furthermore, for each broadcast client, the parent node of that broadcast client in the tree structure is determined, and the identifier of the parent node is sent to that broadcast client. This enables the broadcast client to establish a communication connection with the broadcast client corresponding to the parent node based on the identifier, so that the broadcast client can receive the message to be synchronized sent by the message sender and send the message to be synchronized to the broadcast client corresponding to its child node. Wherein, when the broadcast client is the broadcast client corresponding to the root node, the message sender is the broadcast server; when the broadcast client is the broadcast client corresponding to a non-root node, the message sender is the broadcast client corresponding to the parent node of that broadcast client. The method further includes: The consumption progress of each broadcast client for the messages to be synchronized in each message queue is obtained, and the tree structure is adjusted according to the consumption progress. The consumption includes updating the large model deployed locally by the broadcast client according to the updated model parameters from the message server. The consumption progress refers to the number of messages to be synchronized that the broadcast client has consumed in order in each message queue according to the order of the messages to be synchronized in each message queue. If the broadcast client fails to consume the message to be synchronized, it continues to consume other messages to be synchronized in the message queue according to the order of other messages to be synchronized in the message queue where the failed message was located.

28. The method of claim 27, wherein determining each broadcast client specifically includes: Receive heartbeat messages reported by various broadcast clients; Each broadcast client is identified based on the identifier of the broadcast client carried in the heartbeat message.

29. The method of claim 28, wherein determining at least one tree structure with each broadcast client as a node and consisting of the communication connection relationships between the broadcast clients, specifically includes: Determine the maximum depth of each tree structure based on the number of broadcast clients. Determine the maximum number of nodes in each tree structure based on its maximum depth. The required number of tree structures is determined based on the number of broadcast clients and the maximum number of nodes in each tree structure, and is taken as the target number. Create a tree structure representing the target number; For each tree structure, the root node of the tree structure is taken as the target node. Among the broadcast clients that do not correspond to any node, the broadcast client corresponding to the target node is determined. Then, the child nodes of the target node are taken as the target nodes again, and the broadcast clients corresponding to the newly determined target nodes are determined until each broadcast client corresponds to at least one node.

30. The method of claim 29, wherein the heartbeat message reported by the broadcast client further includes the consumption progress of the broadcast client for messages to be synchronized in each message queue; Among the broadcast clients that do not correspond to any node, the broadcast client corresponding to the target node is determined, specifically including: Among the broadcast clients that do not correspond to any node, the broadcast client with the fastest consumption progress is determined and designated as the broadcast client corresponding to the target node.

31. The method as described in claim 28, wherein the heartbeat message reported by the broadcast client further includes the consumption progress of the broadcast client on the messages to be synchronized in each message queue; The method further includes: The adjusted tree structure is sent to the broadcast server, and for each broadcast client, the identifier of the parent node of that broadcast client in the adjusted tree structure is determined and sent to that broadcast client.

32. The method of claim 31, wherein adjusting the tree structure according to the consumption progress specifically includes: For any given node, if the consumption progress of that node is faster than the consumption progress of its child nodes, and the difference between the consumption progress of that node and the consumption progress of its child nodes is greater than a preset progress threshold, then the positions of that child node and its child nodes in the tree structure are swapped.

33. The method of claim 29, further comprising: When a new broadcast client is identified, the first target tree structure in each tree structure is determined to have a number of nodes that does not reach the maximum number. Leaf nodes are created in the first target tree structure, and a correspondence is established between the newly added broadcast client and the created leaf nodes, which serves as the adjusted first target tree structure.

34. The method of claim 33, wherein before creating leaf nodes in the first target tree structure, the method further comprises: When the number of nodes in all tree structures has reached the maximum number, if the number of newly added broadcast clients has not reached the maximum number, then the second target tree structure is selected from among the tree structures. The subtrees in the second target tree structure that are each rooted at a child node of the root node are identified as the first subtrees. Each first subtree is treated as a tree structure split from the second target tree structure, and the broadcast client corresponding to the root node of the second target tree structure is treated as a newly added broadcast client, and the second target tree structure is deleted. In the split tree structures, determine the first target tree structure whose number of nodes does not reach the maximum number.

35. The method of claim 34, wherein when the number of nodes in all tree structures has reached the maximum number, if the number of newly added broadcast clients reaches the maximum number, the method further includes: Add a tree structure; In the newly added tree structures, identify the first target tree structure whose number of nodes does not reach the maximum number.

36. The method according to any one of claims 33 to 35, wherein the method further comprises: When it is determined that a broadcast client has gone offline, the tree structure in which the offline broadcast client is located is determined as the third target tree structure; If the node corresponding to the offline broadcast client in the third target tree structure is a leaf node, then delete the node corresponding to the offline broadcast client in the third target tree structure. If the node corresponding to the offline broadcast client in the third target tree structure is not a leaf node, then each subtree in the third target tree structure rooted at each child node of the node corresponding to the offline broadcast client is determined as a second subtree. In each second subtree, the largest subtree is determined, and the root node of the largest subtree is replaced with the position of the node corresponding to the offline broadcast client, while keeping the parent-child relationship between the nodes in the largest subtree unchanged. The node corresponding to the offline broadcast client and all other subtrees in each second subtree except the largest subtree are deleted, and the broadcast clients corresponding to each node in the other subtrees are all treated as new broadcast clients.

37. The method of claim 36, before determining the tree structure where the offline broadcast client is located as the third target tree structure, the method further includes: The number of offline broadcast clients is determined to be no more than a preset threshold. When the number of offline broadcast clients exceeds a preset threshold, the method further includes: Rebuild all tree structures.

38. The method of claim 36, wherein the heartbeat message reported by the broadcast client further includes the consumption progress of the broadcast client on the messages to be synchronized in each message queue; The method further includes: Based on the consumption progress of each broadcast client of the messages to be synchronized in each message queue, identify the abnormal clients among the broadcast clients; The abnormal client is designated as an offline broadcast client, and the abnormal client is notified to establish a communication connection with the broadcast server, thereby enabling the abnormal client to establish a communication connection with the broadcast server and pull the messages to be synchronized from the broadcast server.

39. A message broadcasting device, the device being applied to a broadcast server, the device comprising: The receiving module is used to receive messages to be synchronized sent by the message server; The determination module is used to determine the broadcast client corresponding to the root node of each tree structure; wherein the communication connection relationship between each broadcast client constitutes at least one tree structure, and each broadcast client is a node in the tree structure; The sending module is used to send the message to be synchronized to the broadcast client corresponding to each root node, so that the broadcast client corresponding to each root node consumes the message to be synchronized and sends the message to the broadcast client corresponding to the child node of each root node. The tree structure is adjusted according to the consumption progress of each broadcast client on the messages to be synchronized in each message queue; the consumption includes updating the large model deployed locally by the broadcast client according to the updated model parameters from the message server; the consumption progress refers to the number of messages to be synchronized that the broadcast client has consumed in order in each message queue according to the order of the messages to be synchronized in each message queue. If the broadcast client fails to consume the message to be synchronized, it continues to consume other messages to be synchronized in the message queue according to the order of other messages to be synchronized in the message queue where the failed message was located.

40. A message broadcasting device, wherein the device is applied to any broadcasting client, the communication connection relationship between the broadcasting clients constitutes at least one tree structure, and each broadcasting client is a node in the tree structure; the device comprises: The receiving module is used to receive the message to be synchronized sent by the message sender. When the device is the root node, the message sender is the broadcast server. When the device is not the root node, the message sender is the broadcast client corresponding to the parent node of the device. The consumption module is used to consume the messages to be synchronized; the consumption includes updating the large model deployed locally on the broadcast client based on the updated model parameters from the message server; The sending module is used to send the message to be synchronized to the broadcast client corresponding to the child node of the device; The tree structure is adjusted according to the consumption progress of each broadcast client on the messages to be synchronized in each message queue; the consumption progress refers to the number of messages to be synchronized that the broadcast client has consumed in order in each message queue according to the order of the messages to be synchronized in each message queue; if the broadcast client fails to consume a message to be synchronized, it continues to consume other messages to be synchronized in the message queue according to the order of other messages to be synchronized in the message queue where the failed message to be synchronized was located.

41. A message broadcasting device, the device being applied to a collaborative server, the device comprising: The first determination module is used to determine each broadcast client; The second determining module is used to determine at least one tree structure consisting of the communication connection relationships between each broadcast client, with each broadcast client as a node. The sending module is used to send each tree structure to the broadcast server, so that the broadcast server sends the message to be synchronized sent by the message server to the broadcast client corresponding to each root node according to each tree structure. Furthermore, for each broadcast client, the parent node of that broadcast client in the tree structure is determined, and the identifier of the parent node is sent to that broadcast client. This enables the broadcast client to establish a communication connection with the broadcast client corresponding to the parent node based on the identifier, so that the broadcast client can receive the message to be synchronized sent by the message sender and send the message to be synchronized to the broadcast client corresponding to its child node. Wherein, when the broadcast client is the broadcast client corresponding to the root node, the message sender is the broadcast server; when the broadcast client is the broadcast client corresponding to a non-root node, the message sender is the broadcast client corresponding to the parent node of that broadcast client. The second determining module is further configured to obtain the consumption progress of each broadcast client for the messages to be synchronized in each message queue, and adjust the tree structure according to the consumption progress; the consumption includes updating the large model deployed locally by the broadcast client according to the updated model parameters from the message server; the consumption progress refers to the number of messages to be synchronized that the broadcast client has consumed in order in each message queue according to the order of the messages to be synchronized in each message queue. If the broadcast client fails to consume the message to be synchronized, it continues to consume other messages to be synchronized in the message queue according to the order of other messages to be synchronized in the message queue where the failed message was located.

42. A computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in any one of claims 10-38.

43. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described in any one of claims 10-38.

Citation Information

Patent Citations

  • Model updating method and device, electronic equipment and storage medium

    CN110633796A

  • Method and system for transmitting live media streaming in peer-to-peer networks

    US20120170476A1