A message broadcasting method, apparatus, device, and storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-04
- Publication Date
- 2026-08-14
AI Technical Summary
[0005]随机选择节点的方式会导致选中高延迟节点或者故障节点,使得节点需要较长时间才能接收到消息,延缓了后续消息广播操作,降低了消息广播效率,进而也降低了消息广播的可靠性
[0023]通过确定结构化的目标对等网络和目标对等网络中每个节点对应的节点路由信息。其中,每个节点对应的节点路由信息包括除该节点之外的每个其他节点对应的广播优先级信息和所属于的桶序号。目标对等网络中发起广播的第一节点的消息广播过程为:根据第一节点对应的第一节点路由信息中的广播优先级信息,从属于每个第一桶序号的第一其他节点中确定出每个第一桶序号对应的第二节点,并将第二节点所属于的第一桶序号和待广播的目标消息发送至第二节点。第二节点的消息广播过程为:根据第二节点接收到的第一桶序号和第二节点对应的第二节点路由信息中的广播优先级信息,从属于每个第二桶序号的第二其他节点中确定出每个第二桶序号对应的第三节点,并将第三节点所属于的第二桶序号和接收到的所述目标消息发送至第三节点,依次进行消息广播,直到当前节点接收到的当前桶序号满足预设广播停止条件时,停止当前节点的消息广播,完成全网节点的消息广播。通过发起广播的第一节点和接收消息的第二节点均根据广播优先级信息进行节点选择,从而可以选择最优的节点进行消息广播,使得其他节点可以更快地接收到消息,提高了消息在目标对等网络中的广播效率,从而也提高了消息广播的可靠性。
Smart Images

Figure CN116489169B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to Internet technology, and more particularly to a message broadcasting method, apparatus, device, and storage medium. Background Technology
[0002] Peer-to-peer (P2P) networks are a type of peer-to-peer network. They are a crucial component of blockchain systems, supporting their normal operation. Blocks, transactions, and consensus messages within a blockchain system are all broadcast through the peer-to-peer network; therefore, an efficient and reliable network broadcasting method is essential for the stability and performance of the blockchain system.
[0003] Currently, when a node in a peer-to-peer network broadcasts a message, it sends the message to a randomly selected other node. The receiving node then randomly selects another node to broadcast the message, thus completing the broadcast to all nodes in the network.
[0004] However, in the process of realizing this invention, the inventors discovered at least the following problems in the prior art:
[0005] Randomly selecting nodes can lead to the selection of high-latency or faulty nodes, causing nodes to take longer to receive messages. This delays subsequent message broadcasting operations, reduces message broadcasting efficiency, and consequently reduces the reliability of message broadcasting. Summary of the Invention
[0006] This invention provides a message broadcasting method, apparatus, device, and storage medium to improve message broadcasting efficiency and, consequently, the reliability of message broadcasting.
[0007] In a first aspect, embodiments of the present invention provide a message broadcasting method, including:
[0008] Determine the structured target peer-to-peer network and the node routing information corresponding to each node in the target peer-to-peer network. The node routing information includes the broadcast priority information and the bucket number to which each other node belongs.
[0009] Based on the routing information of the first node corresponding to the first node that initiates the broadcast in the target peer-to-peer network, the second node is determined from the first other nodes belonging to each first bucket number, and the first bucket number to which the second node belongs and the target message to be broadcast are sent to the second node.
[0010] Based on the first bucket sequence number received by the second node and the second node routing information corresponding to the second node, a third node is determined from the second other nodes belonging to each second bucket sequence number, and the second bucket sequence number to which the third node belongs and the received target message are sent to the third node;
[0011] If the current bucket sequence number received by the current node meets the preset broadcast stop condition, then the message broadcast of the current node is stopped.
[0012] Secondly, embodiments of the present invention also provide a message broadcasting device, comprising:
[0013] The target peer-to-peer network determination module is used to determine the structured target peer-to-peer network and the node routing information corresponding to each node in the target peer-to-peer network. The node routing information includes the broadcast priority information and the bucket number to which each other node belongs.
[0014] The first node message broadcasting module is used to determine the second node from the first other nodes belonging to each first bucket number according to the first node routing information corresponding to the first node that initiates the broadcast in the target peer-to-peer network, and send the first bucket number to which the second node belongs and the target message to be broadcast to the second node.
[0015] The second node message broadcasting module is used to determine the third node from the second other nodes belonging to each second bucket number based on the first bucket sequence number received by the second node and the second node routing information corresponding to the second node, and send the second bucket sequence number to which the third node belongs and the received target message to the third node;
[0016] The message broadcast stop module is used to stop the message broadcast of the current node if the current bucket sequence number received by the current node meets the preset broadcast stop condition.
[0017] Thirdly, embodiments of the present invention also provide an electronic device, the electronic device comprising:
[0018] One or more processors;
[0019] Memory, used to store one or more programs;
[0020] When the one or more programs are executed by the one or more processors, the one or more processors implement the message broadcasting method provided in any embodiment of the present invention.
[0021] Fourthly, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the message broadcasting method as provided in any embodiment of the present invention.
[0022] One embodiment of the above invention has the following advantages or beneficial effects:
[0023] The target peer-to-peer network is structured, and the node routing information for each node within it is determined. The node routing information for each node includes the broadcast priority information and bucket number for each other node. The message broadcasting process of the first node initiating the broadcast in the target peer-to-peer network is as follows: Based on the broadcast priority information in the first node's routing information, the second node corresponding to each first bucket number is determined from the first other nodes belonging to each first bucket number, and the first bucket number to which the second node belongs, along with the target message to be broadcast, is sent to the second node. The message broadcasting process of the second node is as follows: Based on the first bucket number received by the second node and the broadcast priority information in the second node's routing information, the third node corresponding to each second bucket number is determined from the second other nodes belonging to each second bucket number, and the second bucket number to which the third node belongs, along with the received target message, is sent to the third node. This message broadcasting continues until the current node's received current bucket number meets a preset broadcast stop condition, at which point the current node's message broadcasting stops, completing the message broadcasting for all nodes in the network. By selecting nodes based on broadcast priority information for both the first node initiating the broadcast and the second node receiving the message, the optimal node can be chosen for message broadcasting. This allows other nodes to receive the message faster, improving the efficiency of message broadcasting in the target peer-to-peer network and thus enhancing the reliability of message broadcasting. Attached Figure Description
[0024] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0025] Figure 1 This is a flowchart of a message broadcasting method provided in one embodiment of the present invention;
[0026] Figure 2 This is an example diagram of the topology of a target peer-to-peer network according to an embodiment of the present invention;
[0027] Figure 3 This is a flowchart of another message broadcasting method provided in one embodiment of the present invention;
[0028] Figure 4 This is an example diagram illustrating a node message sending order according to an embodiment of the present invention;
[0029] Figure 5 This is a flowchart of another message broadcasting method provided in one embodiment of the present invention;
[0030] Figure 6 This is a schematic diagram of the structure of a message broadcasting device according to an embodiment of the present invention;
[0031] Figure 7 This is a schematic diagram of the structure of an electronic device provided in one embodiment of the present invention. Detailed Implementation
[0032] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.
[0033] Figure 1 This is a flowchart illustrating a message broadcasting method according to an embodiment of the present invention. This embodiment is applicable to message broadcasting in structured peer-to-peer networks. The method can be executed by a message broadcasting device, which can be implemented in software and / or hardware and integrated into an electronic device. Figure 1 As shown, the method specifically includes the following steps:
[0034] S110. Determine the structured target peer-to-peer network and the node routing information corresponding to each node in the target peer-to-peer network. The node routing information includes the broadcast priority information and the bucket number to which each other node belongs.
[0035] The broadcast priority information is determined based on the historical transmission information between this node and other nodes, and the bucket number is determined based on the distance between this node and other nodes.
[0036] The target peer-to-peer network can refer to a structured peer-to-peer network. Nodes in the target peer-to-peer network have logical relationships. Each node corresponds to node routing information. Node routing information is used to represent the routing information when a node broadcasts messages. Node routing information can be a K-bucket routing table. Each node corresponds to the same number of buckets, i.e., K buckets. Each bucket corresponds to a unique bucket number, for example, the first bucket has a bucket number of 0, the second bucket has a bucket number of 1, and so on. Each node's node identification information, i.e., node ID, can be represented using a fixed-length binary number. K is equal to the number of binary bits in the node identification information. Other nodes can refer to all nodes in the target peer-to-peer network other than the current node. Broadcast priority information refers to the priority information of other nodes as message recipients for this node. Broadcast priority information can be represented numerically. The higher the broadcast priority of other nodes, the better the performance of those other nodes as message recipients for this node. The bucket number to which another node belongs can refer to which bucket that other node is in. For example, Table 1 provides an example of node routing information for node A (node ID 3) in the target peer-to-peer network. As shown in Table 1, the node routing information for node A may include node information (such as node ID, node IP address, and node port number) for each other node B in the target peer-to-peer network besides node A, broadcast priority information, and the bucket number it belongs to. The same bucket number can correspond to one or more nodes, meaning that there can be one or more nodes in the same bucket.
[0037] Table 1 shows the node routing information corresponding to node A.
[0038] Node ID Node IP address Node port number Broadcast priority information Bucket number to which it belongs 0 Node0_IP Node0_port 90 0 1 Node1_IP Node1_port 75 1 2 Node2_IP Node2_port 85 1 4 Node4_IP Node4_port 80 2 5 Node5_IP Node5_port 85 2 6 Node6_IP Node6_port 75 2 …… …… …… …… ……
[0039] It should be noted that the node routing information corresponding to node A includes information about every other node B except node A itself, but does not include node A's information. Different nodes correspond to different node routing information.
[0040] Specifically, unstructured peer-to-peer networks can be structured to obtain the target peer-to-peer network. For each node in the target peer-to-peer network, the bucket number of each other node can be determined based on the distance between that node and every other node. Based on the historical transmission information between that node and every other node, at least one transmission performance indicator can be determined. These performance indicators can be weighted and summed to obtain the broadcast priority information of each other node as a message recipient, thus obtaining the node routing information corresponding to that node. It should be noted that using historical transmission information to determine broadcast priority information allows for a more accurate measurement of the performance of other nodes as message recipients, thereby improving message broadcasting efficiency.
[0041] For example, "determining a structured target peer-to-peer network" in S110 may include: performing structuring processing on the initial peer-to-peer network based on the network transport protocol Kademlia, mapping each node in the initial peer-to-peer network to a leaf node of a binary tree, and obtaining a structured target peer-to-peer network.
[0042] The initial peer-to-peer network can refer to an unstructured peer-to-peer network. The initial and target peer-to-peer networks have the same nodes, but different network topologies. Specifically, Figure 2 An example topology diagram of a target peer-to-peer network is given. For example... Figure 2 As shown, the initial peer-to-peer network has 16 nodes. After structuring the initial peer-to-peer network using the Kademlia algorithm of the network transport protocol, each node in the initial peer-to-peer network is mapped to a leaf node of a binary tree, thereby obtaining the structured target peer-to-peer network.
[0043] S120. Based on the routing information of the first node corresponding to the first node that initiates the broadcast in the target peer-to-peer network, determine the second node from the first other nodes belonging to each first bucket number, and send the first bucket number to which the second node belongs and the target message to be broadcast to the second node.
[0044] Specifically, the optimal second node can be determined from the first other nodes belonging to each first bucket number based on the broadcast priority information in the routing information of the first node.
[0045] For example, the step of "determining the second node from the first other nodes belonging to each first bucket number according to the first node routing information corresponding to the first node that initiates the broadcast in the target peer-to-peer network" in S120 may include: determining the first other nodes belonging to each first bucket number and the first broadcast priority information corresponding to the first other nodes according to the first node routing information corresponding to the first node that initiates the broadcast in the target peer-to-peer network; and determining the second node corresponding to each first bucket number from the first other nodes corresponding to each first bucket number based on the first broadcast priority information.
[0046] In this context, "first node" refers to the node in the target peer-to-peer network that initiates the broadcast, i.e., the node that first broadcasts the message. "First node routing information" refers to the node routing information corresponding to the first node. "First bucket number" can refer to the bucket number from which the first node selects a node as the message recipient. When the first node sends a message, it can use the bucket number of each bucket as the first bucket number to select a node from each bucket and send the message to the selected node. "First other node" can refer to every other node in the target peer-to-peer network besides the first node. "First other node belonging to the first bucket number" can refer to the first other node in the bucket corresponding to the first bucket number. "First broadcast priority information" can refer to the broadcast priority information corresponding to the first other node. "Second node" can refer to the message recipient of the first node. "Second node" can refer to the first other node selected from the bucket corresponding to the first bucket number, i.e., the representative node. "Target message" can refer to the message generated by the first node that needs to be broadcast across the entire network.
[0047] Specifically, the message broadcasting process of the first node initiating the broadcast in the target peer-to-peer network is as follows: Based on the routing information of the first node, all first other nodes belonging to each first bucket number and the first broadcast priority information corresponding to each first other node can be determined. For each first bucket number, the first broadcast priority information corresponding to each first other node belonging to that first bucket number can be compared. The first other node with the highest first broadcast priority information is determined as the second node corresponding to that first bucket number. That is, the first other node with the best performance is selected as the message sending target from the bucket corresponding to that first bucket number, and the first bucket number and the target message to be broadcast are sent to the second node. The first node can select the second node with the best performance from the buckets corresponding to each first bucket number to send the message, so that the second node can receive the message more quickly, thereby improving the message broadcasting efficiency.
[0048] S130. Based on the first bucket sequence number received by the second node and the second node routing information corresponding to the second node, determine the third node from the second other nodes belonging to each second bucket sequence number, and send the second bucket sequence number to which the third node belongs and the received target message to the third node.
[0049] Specifically, the optimal third node can be determined from the other second nodes belonging to each second bucket number based on the broadcast priority information in the routing information of the second node.
[0050] For example, the step of "determining a third node from the second other nodes belonging to each second bucket number based on the first bucket sequence number received by the second node and the second node routing information corresponding to the second node" in S130 may include: determining the second other nodes belonging to each second bucket number and the second broadcast priority information corresponding to the second other nodes based on the first bucket sequence number received by the second node and the second node routing information corresponding to the second node; and determining the third node corresponding to each second bucket number from the second other nodes corresponding to each second bucket number based on the second broadcast priority information.
[0051] In this context, the second node refers to the node in the target peer-to-peer network that receives the message sent by the first node. Second node routing information refers to the node routing information corresponding to the second node. The second bucket sequence number can be the bucket number from which the second node needs to select a node as the message recipient. When the second node sends a message, it can determine each second bucket sequence number based on the received first bucket sequence number, so that a node can be selected from the bucket corresponding to each second bucket sequence number, and the message can be sent to the selected node. The second other node can refer to every other node in the target peer-to-peer network besides the second node. The second other node belonging to the second bucket sequence number can be the second other node located in the bucket corresponding to the second bucket sequence number. The second broadcast priority information can be the broadcast priority information corresponding to the second other node. The third node can be the message recipient of the second node. The third node can be the second other node selected from the bucket corresponding to the second bucket sequence number, i.e., the representative node.
[0052] Specifically, the message broadcasting process of the second node that receives the message is as follows: Based on the received first bucket sequence number, the sequence numbers of each second bucket can be determined. For example, each bucket sequence number less than the first bucket sequence number can be designated as a second bucket sequence number. Based on the second node's routing information, all other second nodes belonging to each second bucket sequence number and their corresponding second broadcast priority information can be determined. For each second bucket sequence number, the second broadcast priority information of each other second node belonging to that second bucket sequence number can be compared. The second other node with the highest second broadcast priority information is designated as the third node corresponding to that second bucket sequence number. In other words, the second other node with the best performance is selected as the message sending target from the bucket corresponding to that second bucket sequence number, and the second bucket sequence number and the received target message are sent to the third node. The second node can select the third node with the best performance from the buckets corresponding to each second bucket sequence number for message sending, allowing the third node to receive messages more quickly, thereby improving message broadcasting efficiency.
[0053] It should be noted that the message broadcasting process of the third node that receives the message is the same as that of the second node, and will not be repeated here. Each node that receives the broadcast message can broadcast it based on the message broadcasting method of the second node in step S130, until the message broadcasting of the entire network is completed.
[0054] S140. If the current bucket sequence number received by the current node meets the preset broadcast stop condition, then stop the message broadcast of the current node.
[0055] Here, "current node" can refer to every node in the target peer-to-peer network that receives messages. For example, "current node" can refer to every other node except the first node. "Current bucket number" can refer to the bucket number received by the current node from other nodes besides the current node. The preset broadcast stop condition can be a condition used to stop a node from continuing to broadcast. Specifically, when the current node receives the current bucket number from other nodes, it can check whether the received current bucket number meets the preset broadcast stop condition to determine whether the current node still needs to continue broadcasting messages. If the current bucket number meets the preset broadcast stop condition, for example, if the bucket number is 0, it indicates that the node branch corresponding to the current node has completed broadcasting, and the current node can stop broadcasting messages. When every node that received the bucket number has stopped broadcasting messages, it indicates that the entire target peer-to-peer network's message broadcasting is complete.
[0056] The technical solution of this embodiment determines a structured target peer-to-peer network and node routing information corresponding to each node in the target peer-to-peer network. The node routing information for each node includes broadcast priority information and the bucket number to which it belongs for each other node. The message broadcasting process of the first node initiating the broadcast in the target peer-to-peer network is as follows: based on the broadcast priority information in the first node routing information corresponding to the first node, the second node corresponding to each first bucket number is determined from the first other nodes belonging to each first bucket number, and the first bucket number to which the second node belongs and the target message to be broadcast are sent to the second node. The message broadcasting process of the second node is as follows: based on the first bucket number received by the second node and the broadcast priority information in the second node routing information corresponding to the second node, the third node corresponding to each second bucket number is determined from the second other nodes belonging to each second bucket number, and the second bucket number to which the third node belongs and the received target message are sent to the third node. Message broadcasting is performed sequentially until the current bucket number received by the current node meets the preset broadcast stop condition, at which point the message broadcasting of the current node stops, completing the message broadcasting of all nodes in the network. By selecting nodes based on broadcast priority information for both the first node initiating the broadcast and the second node receiving the message, the optimal node can be chosen for message broadcasting. This allows other nodes to receive the message faster, improving the efficiency of message broadcasting in the target peer-to-peer network and thus enhancing the reliability of message broadcasting.
[0057] Based on the above technical solution, determining the broadcast priority information corresponding to each other node based on the historical transmission information between other nodes and this node can include: for each other node, determining the historical communication frequency, historical transmission delay, and historical connection duration between other nodes and this node based on the historical transmission information between other nodes and this node; and performing a weighted summation of the historical communication frequency, historical transmission delay, and historical connection duration to obtain the broadcast priority information corresponding to this other node.
[0058] Historical communication frequency can be used to characterize the activity level of other nodes. Higher historical communication frequency indicates higher activity, resulting in higher broadcast priority. This allows for the selection of nodes with stable network environments for message broadcasting, avoiding the selection of nodes prone to failure. Historical transmission latency refers to the end-to-end delay of data transmission between this node and other nodes. Lower historical transmission latency results in higher broadcast priority, allowing for the selection of nodes with short latency for message broadcasting. Historical connection duration refers to the online duration of a connection established between this node and other nodes. A longer historical connection duration results in higher broadcast priority, allowing for the selection of nodes with stable connections for message broadcasting, while also avoiding attacks such as Sybil attacks.
[0059] Specifically, for each other node B corresponding to node A, the historical transmission information between node B and node A, such as historical PING commands and historical broadcast data, can be statistically analyzed to determine three transmission performance indicators between node B and node A: historical communication frequency, historical transmission delay, and historical connection duration. These three transmission performance indicators can be weighted and summed to obtain the broadcast priority information corresponding to node B. This allows for a more comprehensive measurement of the broadcast performance of each other node B as a message recipient of node A, thereby improving the message broadcasting effect.
[0060] Based on the above technical solution, determining the bucket number of each other node based on the distance between the other nodes and the current node can include: for each other node, determining the target distance between the other nodes and the current node based on the node identification information of the other nodes and the current node; matching the distance range corresponding to each bucket number with the target distance to determine the target distance range in which the target distance is located, and determining the bucket number corresponding to the target distance range as the bucket number to which the other node belongs.
[0061] Each bucket number corresponds to a different distance range. If the bucket number is positively correlated with the node distance, then the larger the bucket number, the farther the node distance; that is, the bucket with the larger bucket number stores other nodes B that are farther away from node A. For example, the distance range corresponding to bucket number 0 is [1, 2), the distance range corresponding to bucket number 1 is [2, 4), and the distance range corresponding to bucket number j is [2, 4). j ,2 j+1 Conversely, if the bucket number is negatively correlated with the node distance, then the smaller the bucket number, the farther the node distance. In other words, the bucket with the smaller bucket number stores other nodes B that are farther away from node A.
[0062] Specifically, for each other node B corresponding to node A, the node identifier information of node B and the node identifier information of node A can be XORed bit by bit to obtain the target distance between node B and node A. For example, if the node identifier information corresponding to node B and node A are 11101 and 11000 respectively, then the target distance between these two nodes is 00101, or 5. The target distance can be matched with the distance range corresponding to each pre-determined bucket number to determine the target distance range in which the target distance falls, and the bucket number corresponding to the target distance range is determined as the bucket number to which node B belongs. Thus, each other node B of node A can be assigned to its corresponding bucket.
[0063] Figure 3This is a flowchart illustrating another message broadcasting method provided by an embodiment of the present invention. Based on the above embodiments, this embodiment describes in detail the message broadcasting order of the first node initiating the broadcast and the message broadcasting order of the second node receiving the message. Explanations of terms that are the same as or corresponding to those in the above embodiments are not repeated here.
[0064] See Figure 3 Another message broadcasting method provided in this embodiment specifically includes the following steps:
[0065] S310. Determine the structured target peer-to-peer network and the node routing information corresponding to each node in the target peer-to-peer network.
[0066] S320. Based on the routing information of the first node corresponding to the first node that initiates the broadcast in the target peer-to-peer network, determine the first other node belonging to each first bucket number and the first broadcast priority information corresponding to the first other node.
[0067] Specifically, when there are 16 nodes in the target peer-to-peer network, with node IDs ranging from 0 to 15, and each node corresponding to 4 buckets with bucket numbers ranging from 0 to 3, if the first node to initiate a broadcast in the target peer-to-peer network is node 0, then the bucket information corresponding to node 0 can be determined based on the node routing information corresponding to node 0, as shown in Table 2. Each bucket number can be designated as the first bucket number. The first other nodes belonging to the first bucket number 0 include: node 1; the first other nodes belonging to the second bucket number 1 include: nodes 2 and 3; the first other nodes belonging to the second bucket number 2 include: nodes 4, 5, 6, and 7; and the first other nodes belonging to the second bucket number 3 include: nodes 8 through 15. The bucket numbers in Table 2 are positively correlated with the node distance.
[0068] Table 2 shows the bucket information corresponding to node 0.
[0069] Bucket number Node ID in the bucket 0 1 1 2,3 2 4,5,6,7 3 8,9,10,11,12,13,14,15
[0070] S330. When the bucket number is positively correlated with the node distance, in reverse order of the bucket number, based on the first broadcast priority information, determine the second node corresponding to each first bucket number from the first other nodes corresponding to each first bucket number, and send the first bucket number to which the second node belongs and the target message to be broadcast to the second node.
[0071] Specifically, when the bucket number is positively correlated with the node distance, the second node is selected sequentially from each bucket in descending order of bucket number. That is, the second node is first selected from the bucket with the furthest distance for message sending, and finally from the bucket with the closest distance. Conversely, when the bucket number is negatively correlated with the node distance, the second node is selected sequentially from each bucket in ascending order of bucket number. Again, the second node is first selected from the bucket with the furthest distance for message sending, and finally from the bucket with the closest distance. Since there are many nodes in the furthest bucket, broadcasting the message first to the nodes in the furthest bucket reduces the number of sending stages, further improving message broadcasting efficiency. It should be noted that sending messages serially to each first bucket number improves bandwidth utilization, further shortens the time for nodes to receive messages, and further improves message broadcasting efficiency.
[0072] For example, S330 can be implemented through the following steps S331-S334:
[0073] S331. Set the maximum bucket number as the current first bucket number.
[0074] The bucket corresponding to the largest bucket number contains the farthest node. The current first bucket number can refer to the first bucket number where a node needs to be selected to send a message at the current moment.
[0075] Specifically, the maximum bucket number, such as number 3 in the example above, can be determined as the current first bucket number so that the second node can be selected from the bucket with the furthest distance to send the message.
[0076] S332. Based on the first broadcast priority information corresponding to each current first other node belonging to the current first bucket number, determine the second node corresponding to the current first bucket number from each current first other node.
[0077] Specifically, each current first other node in the bucket corresponding to the current first bucket number can be obtained. For example, when the current first bucket number is 3, the current first other nodes are nodes 8 to 15. The first broadcast priority information corresponding to each current first other node is compared, and the current first other node with the highest priority can be determined as a second node corresponding to the current first bucket number. Alternatively, a preset number of high-priority current first other nodes can be determined as multiple second nodes corresponding to the current first bucket number, thereby achieving node redundancy backup, avoiding situations where nodes fail to receive messages, and further improving the reliability of message broadcasting.
[0078] S333: Send the current first bucket sequence number and the target message to be broadcast to the second node.
[0079] Specifically, the first node can send the current first bucket sequence number and the target message to be broadcast to each second node, thereby completing the node sending operation for the current first bucket sequence number.
[0080] S334. Decrement the current first bucket number by 1 and return to step S332 until the updated current first bucket number is less than 0.
[0081] Specifically, after the node with the current first bucket number completes its sending operation, the current first bucket number can be decremented by 1, and the decremented bucket number becomes the updated current first bucket number. For example, if the current bucket number is 3, the updated current first bucket number is 2. Based on the updated current first bucket number, operations S332-S234 are executed, thus completing the sending operation for the next first bucket number. This process is repeated until the updated current first bucket number is less than 0, indicating that all buckets have completed their node sending operations. At this point, the message broadcasting of the first node can be terminated.
[0082] For example, Figure 4 An example diagram illustrating the message sending order of nodes is provided. Figure 4 As shown, node 0 selects node 8 as the second node in bucket 3 of the first bucket. Therefore, in the first sending phase, node 0 sends the message and bucket number 3 to node 8. Node 0 selects node 4 as the second node in bucket 2 of the first bucket. Therefore, in the second sending phase, node 0 sends the message and bucket number 2 to node 4. Node 0 selects node 2 as the second node in bucket 1 of the first bucket. Therefore, in the third sending phase, node 0 sends the message and bucket number 1 to node 2. Node 0 selects node 1 as the second node in bucket 0 of the first bucket. Therefore, in the fourth sending phase, node 0 sends the message and bucket number 0 to node 1. The message broadcasting of the first node can be completed in four sending phases. Compared to the method of ascending bucket number order, this greatly reduces the number of sending phases and further improves the message broadcasting efficiency of the first node.
[0083] S340. Determine the sequence numbers of each bucket that are less than the sequence number of the first bucket received by the second node as the sequence numbers of each second bucket.
[0084] Specifically, after receiving the first bucket sequence number sent by the first node, the second node can determine the bucket sequence numbers that are less than the first bucket sequence number as the respective second bucket sequence numbers. For example, if the received first bucket sequence number is 3, then the determined second bucket sequence numbers are 0, 1, and 2.
[0085] S350. Based on the second node routing information corresponding to the second node, determine the second other node belonging to each second bucket number and the second broadcast priority information corresponding to the second other node.
[0086] Specifically, continuing the example above, if node 0 sends the message with bucket number 3 to node 8, then the bucket information corresponding to node 8 can be determined based on the node routing information corresponding to node 8, as shown in Table 3. Bucket numbers 0, 1, and 2 can be determined as the second bucket numbers. Other nodes belonging to the second bucket number 0 include node 9; other nodes belonging to the second bucket number 1 include nodes 10 and 11; and other nodes belonging to the second bucket number 2 include nodes 12, 13, 14, and 15. The bucket numbers in Table 3 are positively correlated with the node distance.
[0087] Table 3 shows the bucket information corresponding to node 8.
[0088] Bucket number Node ID in the bucket 0 9 1 10,11 2 12,13,14,15 3 0,1,2,3,4,5,6,7
[0089] S360. When the bucket number is positively correlated with the node distance, the third node corresponding to each second bucket number is determined from the second other nodes corresponding to each second bucket number in reverse order of the bucket number, based on the second broadcast priority information, and the second bucket number to which the third node belongs and the received target message are sent to the third node.
[0090] Specifically, when the bucket number is positively correlated with the node distance, the second node selects the third node from each second bucket in reverse order of bucket number. That is, it first selects the third node from the farthest second bucket for message sending, and finally selects the third node from the closest second bucket for message sending. Conversely, when the bucket number is negatively correlated with the node distance, the second node selects the third node from each second bucket in ascending order of bucket number. Again, it first selects the third node from the farthest second bucket for message sending, and finally selects the third node from the closest second bucket for message sending. Since there are many nodes in the farthest bucket, broadcasting the message first to the nodes in the farthest bucket can shorten the number of sending stages and further improve message broadcasting efficiency. It should be noted that sending messages serially to each second bucket number can improve bandwidth resource utilization, further shorten the node message receiving time, and further improve message broadcasting efficiency.
[0091] For example, S360 can be implemented through the following steps S361-S364:
[0092] S361. Determine the largest second bucket number as the current second bucket number.
[0093] The largest second bucket sequence number contains the node furthest from the second node. The current second bucket sequence number can refer to the second bucket sequence number where a node needs to be selected to send a message at the current moment.
[0094] Specifically, the largest second bucket sequence number, such as sequence number 2 in the example above, can be determined as the current second bucket sequence number. Alternatively, the sequence number obtained by subtracting 1 from the first bucket sequence number received by the second node can be determined as the current second bucket sequence number, so that the third node can be selected from the second bucket sequence number that is furthest away to send the message.
[0095] S362. Based on the second broadcast priority information corresponding to each current second other node belonging to the current second bucket number, determine the third node corresponding to the current second bucket number from each current second other node.
[0096] Specifically, each of the current second other nodes in the current second bucket sequence number can be obtained. For example, when the current second bucket sequence number is 2, the current second other nodes are nodes 12, 13, 14, and 15. The second broadcast priority information corresponding to each current second other node is compared, and the current second other node with the highest priority can be determined as a third node corresponding to the current second bucket sequence number. Alternatively, a predetermined number of high-priority current second other nodes can be determined as multiple third nodes corresponding to the current second bucket sequence number, thereby achieving node redundancy backup, avoiding situations where nodes fail to receive messages, and further improving the reliability of message broadcasting.
[0097] S363. Send the current second bucket sequence number and the received target message to the second node.
[0098] Specifically, the second node can send the current second bucket sequence number and the received target message to each third node, thereby completing the node sending operation for the current second bucket sequence number.
[0099] S364. Decrement the current second bucket number by 1 and return to step S362 until the updated current second bucket number is less than 0.
[0100] Specifically, after the node with the current first bucket sequence number completes its sending operation, the current first bucket sequence number can be decremented by 1, and the decremented bucket sequence number becomes the updated current first bucket sequence number. For example, if the current bucket sequence number is 3, the updated current first bucket sequence number is 2. Based on the updated current first bucket sequence number, operations S362-S264 are executed, thus completing the sending operation for the node with the next second bucket sequence number. This process is repeated until the updated current second bucket sequence number is less than 0, indicating that all buckets have completed their node sending operations. At this point, the message broadcasting for the second node can be terminated.
[0101] For example, such as Figure 4As shown, in the first sending phase, node 0 sends the message and the first bucket number 3 to node 8. Node 8 selects node 12 from the bucket with second bucket number 2, so in the second sending phase, node 8 sends the message and the second bucket number 2 to node 12. Node 12 selects node 14 from the bucket with first bucket number 1, so in the third sending phase, node 12 sends the message and bucket number 1 to node 14. Node 14 selects node 15 from the bucket with second bucket number 0, so in the fourth sending phase, node 14 sends the message and bucket number 0 to node 15. Message broadcasting by the nodes can be completed in four sending phases, which greatly reduces the number of sending phases compared to the ascending bucket number method, further improving the message broadcasting efficiency of the first node.
[0102] S370. If the current bucket sequence number received by the current node meets the preset broadcast stop condition, then stop the message broadcast of the current node.
[0103] For example, S370 may include: if the current bucket sequence number received by the current node is 0, then stop the message broadcasting of the current node.
[0104] Specifically, when the bucket number is positively correlated with the node distance, each node that receives the message broadcasts the message in reverse order of the bucket number. Therefore, when the current node receives a bucket number of 0, the bucket number cannot be decremented by 1 again, and there is no matching bucket number. Thus, it can be determined that the current node does not need to continue broadcasting the message, and the message broadcasting of the current node can be stopped, thus completing the message broadcasting of the entire network.
[0105] The technical solution of this embodiment achieves serial message transmission of each second bucket number by broadcasting the first node that initiates the broadcast and the second node that receives the message in reverse order of the bucket number when the bucket number is positively correlated with the node distance. This reduces the number of transmission stages, improves the utilization of bandwidth resources, and further improves the efficiency of message broadcasting.
[0106] Figure 5 This is a flowchart of another message broadcasting method provided by an embodiment of the present invention. Based on the above embodiments, this embodiment optimizes the step "determining the second node corresponding to each first bucket number from the first other nodes corresponding to each first bucket number based on the first broadcast priority information," and correspondingly optimizes the step "determining the third node corresponding to each second bucket number from the second other nodes corresponding to each second bucket number based on the second broadcast priority information." Explanations of terms that are the same as or corresponding to those in the above embodiments are not repeated here.
[0107] See Figure 5Another message broadcasting method provided in this embodiment specifically includes the following steps:
[0108] S510. Determine the structured target peer-to-peer network and the node routing information corresponding to each node in the target peer-to-peer network.
[0109] S520. Based on the routing information of the first node corresponding to the first node that initiates the broadcast in the target peer-to-peer network, determine the first other node belonging to each first bucket number and the first broadcast priority information corresponding to the first other node.
[0110] S530. For each first bucket number, determine the total number of nodes belonging to the first other node of that first bucket number.
[0111] Specifically, for each first bucket number, the total number of nodes corresponding to the first other node can be calculated. When the bucket number is positively correlated with the node distance, the larger the first bucket number, the greater the total number of nodes corresponding to the first other node.
[0112] S540. Determine the broadcast redundancy corresponding to the first bucket number based on the total number of nodes.
[0113] Specifically, the total number of nodes can be divided by a value greater than or equal to 2, and the result can be rounded up or down. This rounded result is used as the broadcast redundancy number corresponding to the first bucket number. The broadcast redundancy number is proportional to the total number of nodes. The more nodes there are, the more broadcast redundancy there will be.
[0114] S550. Based on the broadcast redundancy quantity corresponding to the first bucket number and the first broadcast priority information corresponding to each first other node belonging to the first bucket number, determine the second node corresponding to the first bucket number from the first other nodes corresponding to the first bucket number. The number of second nodes corresponding to the first bucket number is the corresponding broadcast redundancy quantity.
[0115] Specifically, the first broadcast priority information corresponding to each first other node belonging to the first bucket sequence number can be sorted in descending order to obtain a node sequence with progressively increasing priorities. The first other nodes with the highest broadcast redundancy in this sequence are then identified as second nodes, thus obtaining second nodes with dynamically changing numbers. For example, when the bucket sequence number is positively correlated with the node distance, in the latter half of the message broadcasting phase, i.e., when the bucket sequence number is smaller, messages can be sent using second nodes with less redundancy, thereby avoiding unnecessary resource waste caused by excessive redundancy in the latter half of the phase.
[0116] S560: Send the first bucket number to which each second node belongs and the target message to be broadcast to the second node.
[0117] Specifically, due to the complexity of network environments in practical applications, redundant messages need to be sent to improve the reliability of the first node's broadcast messages. Compared to using a fixed amount of broadcast redundancy, this embodiment can use a dynamic amount of broadcast redundancy for message sending. That is, when there are many nodes in the bucket, a larger amount of broadcast redundancy is used, while when there are many nodes in the bucket, a smaller amount of broadcast redundancy is used or no redundancy transmission is used. This can further avoid resource waste and improve resource utilization.
[0118] S570. Based on the first bucket sequence number received by the second node and the second node routing information corresponding to the second node, determine the second other node belonging to each second bucket sequence number and the second broadcast priority information corresponding to the second other node.
[0119] S580. For each second bucket number, determine the total number of other nodes belonging to that second bucket number.
[0120] Specifically, for each second bucket number, the total number of other nodes corresponding to that second bucket number can be calculated. When the bucket number is positively correlated with the node distance, the larger the second bucket number, the greater the total number of other nodes corresponding to that second bucket number.
[0121] S590. Determine the broadcast redundancy corresponding to the second bucket number based on the total number of nodes.
[0122] Specifically, the total number of nodes can be divided by a value greater than or equal to 2, and the result can be rounded up or down. This rounded result is used as the broadcast redundancy number corresponding to the first bucket number. The broadcast redundancy number is proportional to the total number of nodes. The more nodes there are, the more broadcast redundancy there will be.
[0123] S591. Based on the broadcast redundancy quantity corresponding to the second bucket number and the first broadcast priority information corresponding to each second other node belonging to the second bucket number, determine the third node corresponding to the second bucket number from the second other nodes corresponding to the second bucket number. The number of third nodes corresponding to the second bucket number is the corresponding broadcast redundancy quantity.
[0124] Specifically, the second broadcast priority information corresponding to each second other node belonging to the second bucket sequence number can be sorted in descending order to obtain a node sequence with progressively increasing priorities. The second other nodes with the highest broadcast redundancy in this sequence are then identified as third nodes, resulting in a dynamically changing number of third nodes. For example, when the bucket sequence number is positively correlated with the node distance, in the latter half of the message broadcasting phase, i.e., when the bucket sequence number is smaller, messages can be sent using third nodes with less redundancy, thus avoiding excessive redundancy and unnecessary resource waste in the latter half of the phase.
[0125] S592. Send the second bucket sequence number to which each third node belongs and the received target message to the third node.
[0126] Specifically, due to the complexity of network environments in practical applications, redundant messages need to be sent to improve the reliability of broadcast messages from the second node. Instead of using a fixed amount of broadcast redundancy, this embodiment can use a dynamic amount of broadcast redundancy for message sending. That is, when there are many nodes in the bucket, a larger amount of broadcast redundancy is used, while when there are many nodes in the bucket, a smaller amount of broadcast redundancy is used or redundant transmission is not used. This further avoids resource waste and improves resource utilization.
[0127] It should be noted that the broadcast redundancy method is the same for each node that receives the message, which will not be elaborated here.
[0128] S593. If the current bucket sequence number received by the current node meets the preset broadcast stop condition, then stop the message broadcast of the current node.
[0129] The technical solution of this embodiment dynamically determines the broadcast redundancy based on the number of nodes in each bucket sequence number by both the first node initiating the broadcast and the second node receiving the message. This dynamically achieves redundant message transmission, further avoiding resource waste and improving resource utilization.
[0130] The following are embodiments of the message broadcasting device provided in this invention. This device and the message broadcasting methods in the above embodiments belong to the same inventive concept. For details not described in detail in the embodiments of the message broadcasting device, please refer to the embodiments of the above message broadcasting methods.
[0131] Figure 6 This is a schematic diagram of a message broadcasting device provided in an embodiment of the present invention. This embodiment is applicable to situations where messages are broadcast to a pre-trained model, especially in fine-tuning scenarios where the downstream task is a cross-language task such as translation. Figure 6As shown, the device specifically includes: a target peer-to-peer network determination module 610, a first node message broadcasting module 620, a second node message broadcasting module 630, and a message broadcasting stop module 640.
[0132] The target peer-to-peer network determination module 610 is used to determine the structured target peer-to-peer network and the node routing information corresponding to each node in the target peer-to-peer network. The node routing information includes the broadcast priority information and the bucket number to which each other node belongs. The first node message broadcasting module 620 is used to determine the second node from the first other nodes belonging to each first bucket number according to the first node routing information corresponding to the first node that initiates the broadcast in the target peer-to-peer network, and send the first bucket number to which the second node belongs and the target message to be broadcast to the second node. The second node message broadcasting module 630 is used to determine the third node from the second other nodes belonging to each second bucket number according to the first bucket number received by the second node and the second node routing information corresponding to the second node, and send the second bucket number to which the third node belongs and the received target message to the third node. The message broadcasting stop module 640 is used to stop the message broadcasting of the current node if the current bucket number received by the current node meets the preset broadcasting stop condition.
[0133] The technical solution of this embodiment selects the optimal node for message broadcasting by having both the first node initiating the broadcast and the second node receiving the message select nodes based on broadcast priority information. This allows other nodes to receive the message faster, improving the broadcast efficiency of the message in the target peer-to-peer network and thus enhancing the reliability of message broadcasting.
[0134] Optionally, the broadcast priority information is determined based on the historical transmission information between other nodes and this node; the bucket number is determined based on the distance between other nodes and this node.
[0135] Optionally, the target peer network determination module 610 includes:
[0136] The broadcast priority information determination unit is used to determine, for each other node, the historical communication frequency, historical transmission delay, and historical connection duration between the other nodes and the current node based on the historical transmission information between the other nodes and the current node; and to obtain the broadcast priority information corresponding to the other node by weighted summation of the historical communication frequency, the historical transmission delay, and the historical connection duration.
[0137] Optionally, the target peer network determination module 610 further includes:
[0138] The bucket number determination unit is used to determine the target distance between other nodes and the node for each other node based on the node identification information of other nodes and the node identification information of the current node; match the distance range corresponding to each bucket number with the target distance to determine the target distance range in which the target distance is located, and determine the bucket number corresponding to the target distance range as the bucket number to which the other node belongs.
[0139] Optionally, the first node message broadcast module 620 includes:
[0140] The first broadcast priority information determination unit is used to determine the first other node belonging to each first bucket number and the first broadcast priority information corresponding to the first other node based on the first node routing information corresponding to the first node that initiates the broadcast in the target peer-to-peer network.
[0141] The second node determination unit is used to determine the second node corresponding to each first bucket number from the first other nodes corresponding to each first bucket number based on the first broadcast priority information.
[0142] Optionally, the second node determines the unit, specifically for:
[0143] When the bucket number is positively correlated with the node distance, the second node corresponding to each first bucket number is determined sequentially from the first other nodes corresponding to each first bucket number, based on the first broadcast priority information, in reverse order of the bucket number.
[0144] Optionally, the second node determines the unit, specifically for:
[0145] The maximum bucket number is determined as the current first bucket number; based on the first broadcast priority information corresponding to each current first other node belonging to the current first bucket number, the second node corresponding to the current first bucket number is determined from each current first other node; after sending the current first bucket number and the target message to be broadcast to the second node, the current first bucket number is decremented by 1 and updated, and the operation of determining the second node corresponding to the current first bucket number from each current first other node based on the first broadcast priority information corresponding to each current first other node belonging to the current first bucket number is returned, until the updated current first bucket number is less than 0.
[0146] Optionally, the second node message broadcast module 630 includes:
[0147] The second broadcast priority information determination unit is used to determine the second other node belonging to each second bucket number and the second broadcast priority information corresponding to the second other node based on the first bucket sequence number received by the second node and the second node routing information corresponding to the second node.
[0148] The third node determination unit is used to determine the third node corresponding to each second bucket number from the second other nodes corresponding to each second bucket number based on the second broadcast priority information.
[0149] Optionally, the second broadcast priority information determination unit is specifically used for:
[0150] Each bucket number less than the first bucket number received by the second node is determined as a second bucket number; based on the second node routing information corresponding to the second node, the second other nodes belonging to each second bucket number and the second broadcast priority information corresponding to the second other nodes are determined.
[0151] Optionally, the third node determines the unit, specifically for:
[0152] When the bucket number is positively correlated with the node distance, the third node corresponding to each second bucket number is determined sequentially from the second other nodes corresponding to each second bucket number, based on the second broadcast priority information, in reverse bucket order.
[0153] Optionally, the message broadcasting stop module 640 is specifically used to: stop the message broadcasting of the current node if the current bucket sequence number received by the current node is 0.
[0154] Optionally, the second node determines the unit, specifically for:
[0155] For each first bucket sequence number, determine the total number of first other nodes belonging to that first bucket sequence number; determine the broadcast redundancy number corresponding to that first bucket sequence number based on the total number of nodes; based on the broadcast redundancy number corresponding to that first bucket sequence number and the first broadcast priority information corresponding to each first other node belonging to that first bucket sequence number, determine the second node corresponding to that first bucket sequence number from the first other nodes corresponding to that first bucket sequence number, and the number of second nodes corresponding to that first bucket sequence number is the broadcast redundancy number.
[0156] Optionally, the target peer network determination module 610 is specifically used for:
[0157] Based on the Kademlia network transmission protocol, the initial peer-to-peer network is structured by mapping each node in the initial peer-to-peer network to a leaf node of a binary tree, thus obtaining a structured target peer-to-peer network.
[0158] The message broadcasting device provided in the embodiments of the present invention can execute the message broadcasting method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the message broadcasting method.
[0159] It is worth noting that in the embodiments of the above-mentioned message broadcasting device, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of the present invention.
[0160] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Figure 7 A block diagram is shown of an exemplary electronic device 12 suitable for implementing embodiments of the present invention. Figure 7 The electronic device 12 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.
[0161] like Figure 7 As shown, the electronic device 12 is represented in the form of a general-purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, system memory 28, and bus 18 connecting different system components (including system memory 28 and processing unit 16).
[0162] Bus 18 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0163] Electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by electronic device 12, including volatile and non-volatile media, removable and non-removable media.
[0164] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. Electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media (… Figure 7 Not shown; usually referred to as a "hard drive"). Although Figure 7Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.
[0165] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods described in the embodiments of the present invention.
[0166] Electronic device 12 can also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), and with one or more devices that enable a user to interact with electronic device 12, and / or with any device that enables electronic device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 22. Furthermore, electronic device 12 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 20. As shown, network adapter 20 communicates with other modules of electronic device 12 via bus 18. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0167] Processing unit 16 executes various functional applications and data processing by running programs stored in system memory 28, such as implementing a message broadcasting method provided in this embodiment, the method including:
[0168] Determine the structured target peer-to-peer network and the node routing information corresponding to each node in the target peer-to-peer network. The node routing information includes the broadcast priority information and the bucket number to which each other node belongs.
[0169] Based on the routing information of the first node corresponding to the first node that initiates the broadcast in the target peer-to-peer network, the second node is determined from the first other nodes belonging to each first bucket number, and the first bucket number to which the second node belongs and the target message to be broadcast are sent to the second node.
[0170] Based on the first bucket sequence number received by the second node and the second node routing information corresponding to the second node, a third node is determined from the second other nodes belonging to each second bucket sequence number, and the second bucket sequence number to which the third node belongs and the received target message are sent to the third node;
[0171] If the current bucket sequence number received by the current node meets the preset broadcast stop condition, then the message broadcast of the current node is stopped.
[0172] Of course, those skilled in the art will understand that the processor can also implement the technical solutions of the message broadcasting method provided in any embodiment of the present invention.
[0173] This embodiment provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the message broadcasting method steps provided in any embodiment of the present invention, the method comprising:
[0174] Determine the structured target peer-to-peer network and the node routing information corresponding to each node in the target peer-to-peer network. The node routing information includes the broadcast priority information and the bucket number to which each other node belongs.
[0175] Based on the routing information of the first node corresponding to the first node that initiates the broadcast in the target peer-to-peer network, the second node is determined from the first other nodes belonging to each first bucket number, and the first bucket number to which the second node belongs and the target message to be broadcast are sent to the second node.
[0176] Based on the first bucket sequence number received by the second node and the second node routing information corresponding to the second node, a third node is determined from the second other nodes belonging to each second bucket sequence number, and the second bucket sequence number to which the third node belongs and the received target message are sent to the third node;
[0177] If the current bucket sequence number received by the current node meets the preset broadcast stop condition, then the message broadcast of the current node is stopped.
[0178] The computer storage medium of this invention can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. For example, a computer-readable storage medium can be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0179] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0180] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0181] Computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages—such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0182] Those skilled in the art will understand that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby allowing them to be stored in a storage device for execution by a computing device, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0183] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.
Claims
1. A message broadcasting method, characterized in that, include: Determine the structured target peer-to-peer network and the node routing information corresponding to each node in the target peer-to-peer network. The node routing information includes the broadcast priority information and the bucket number to which each other node belongs. Based on the routing information of the first node corresponding to the first node that initiates the broadcast in the target peer-to-peer network, the second node is determined from the first other nodes belonging to each first bucket number, and the first bucket number to which the second node belongs and the target message to be broadcast are sent to the second node; the first bucket number refers to the bucket number of each bucket; Based on the first bucket sequence number received by the second node and the second node routing information corresponding to the second node, a third node is determined from the second other nodes belonging to each second bucket sequence number, and the second bucket sequence number to which the third node belongs and the received target message are sent to the third node; the second bucket sequence number refers to each bucket sequence number that is less than the first bucket sequence number; If the current bucket sequence number received by the current node meets the preset broadcast stop condition, then the message broadcast of the current node is stopped.
2. The method according to claim 1, characterized in that, The broadcast priority information is determined based on the historical transmission information between this node and other nodes; the bucket number is determined based on the distance between this node and other nodes.
3. The method according to claim 2, characterized in that, The broadcast priority information for each other node is determined based on the historical transmission information between this node and other nodes, including: For each other node, based on the historical transmission information between other nodes and this node, the historical communication frequency, historical transmission delay, and historical connection duration between other nodes and this node are determined; The broadcast priority information corresponding to the other node is obtained by weighted summing of the historical communication frequency, the historical transmission delay, and the historical connection duration.
4. The method according to claim 2, characterized in that, The bucket number to which each other node belongs is determined based on the distance between this node and other nodes, including: For each other node, the target distance between the other nodes and the current node is determined based on the node identification information of the other nodes and the node identification information of the current node. Match the distance range corresponding to each bucket number with the target distance to determine the target distance range in which the target distance is located, and determine the bucket number corresponding to the target distance range as the bucket number to which the other node belongs.
5. The method according to claim 1, characterized in that, Based on the routing information of the first node corresponding to the first node that initiates the broadcast in the target peer-to-peer network, the second node is determined from the first other nodes belonging to each first bucket number, including: Based on the first node routing information corresponding to the first node that initiates broadcasting in the target peer-to-peer network, determine the first other node belonging to each first bucket number and the first broadcast priority information corresponding to the first other node; Based on the first broadcast priority information, the second node corresponding to each first bucket number is determined from the first other nodes corresponding to each first bucket number.
6. The method according to claim 5, characterized in that, Based on the first broadcast priority information, the second node corresponding to each first bucket number is determined from the first other nodes corresponding to each first bucket number, including: When the bucket number is positively correlated with the node distance, the second node corresponding to each first bucket number is determined sequentially from the first other nodes corresponding to each first bucket number, based on the first broadcast priority information, in reverse order of the bucket number.
7. The method according to claim 6, characterized in that, Following the reverse order of bucket numbers, and based on the first broadcast priority information, the second node corresponding to each first bucket number is determined sequentially from the first other nodes corresponding to each first bucket number, including: Set the maximum bucket number as the current first bucket number; Based on the first broadcast priority information corresponding to each current first other node belonging to the current first bucket number, determine the second node corresponding to the current first bucket number from each current first other node; After sending the current first bucket sequence number and the target message to be broadcast to the second node, the current first bucket sequence number is decremented by 1 and updated. Then, the operation of determining the second node corresponding to the current first bucket sequence number from each current first other node based on the first broadcast priority information corresponding to the current first bucket sequence number is performed until the updated current first bucket sequence number is less than 0.
8. The method according to claim 1, characterized in that, Based on the first bucket sequence number received by the second node and the second node routing information corresponding to the second node, the third node is determined from the second other nodes belonging to each second bucket sequence number, including: Based on the first bucket sequence number received by the second node and the second node routing information corresponding to the second node, determine the second other node belonging to each second bucket sequence number and the second broadcast priority information corresponding to the second other node; Based on the second broadcast priority information, the third node corresponding to each second bucket number is determined from the second other nodes corresponding to each second bucket number.
9. The method according to claim 8, characterized in that, Based on the first bucket sequence number received by the second node and the second node routing information corresponding to the second node, determine the second other nodes belonging to each second bucket sequence number and the second broadcast priority information corresponding to the second other nodes, including: Each bucket number less than the first bucket number received by the second node is determined as the second bucket number; Based on the second node routing information corresponding to the second node, determine the second other nodes belonging to each second bucket sequence number and the second broadcast priority information corresponding to the second other nodes.
10. The method according to claim 8, characterized in that, Based on the second broadcast priority information, the third node corresponding to each second bucket number is determined from the second other nodes corresponding to each second bucket number, including: When the bucket number is positively correlated with the node distance, the third node corresponding to each second bucket number is determined sequentially from the second other nodes corresponding to each second bucket number, based on the second broadcast priority information, in reverse bucket order.
11. The method according to claim 10, characterized in that, If the current bucket sequence number received by the current node meets the preset broadcast stop condition, then the message broadcast of the current node is stopped, including: If the current node receives a current bucket sequence number of 0, then the current node stops broadcasting messages.
12. The method according to claim 5, characterized in that, Based on the first broadcast priority information, the second node corresponding to each first bucket number is determined from the first other nodes corresponding to each first bucket number, including: For each first bucket number, determine the total number of nodes belonging to the first other node of that first bucket number; The broadcast redundancy quantity corresponding to the first bucket number is determined based on the total number of nodes. Based on the broadcast redundancy quantity corresponding to the first bucket number and the first broadcast priority information corresponding to each first other node belonging to the first bucket number, the second node corresponding to the first bucket number is determined from the first other nodes corresponding to the first bucket number, and the number of second nodes corresponding to the first bucket number is the broadcast redundancy quantity.
13. The method according to any one of claims 1-12, characterized in that, Determine the structured target peer-to-peer network, including: Based on the Kademlia network transmission protocol, the initial peer-to-peer network is structured by mapping each node in the initial peer-to-peer network to a leaf node of a binary tree, thus obtaining a structured target peer-to-peer network.
14. A message broadcasting device, characterized in that, include: The target peer-to-peer network determination module is used to determine the structured target peer-to-peer network and the node routing information corresponding to each node in the target peer-to-peer network. The node routing information includes the broadcast priority information and the bucket number to which each other node belongs. The first node message broadcasting module is used to determine the second node from the first other nodes belonging to each first bucket number according to the first node routing information corresponding to the first node that initiates the broadcast in the target peer-to-peer network, and send the first bucket number to which the second node belongs and the target message to be broadcast to the second node; the first bucket number refers to the bucket number of each bucket; The second node message broadcast module is used to determine a third node from the second other nodes belonging to each second bucket number based on the first bucket sequence number received by the second node and the second node routing information corresponding to the second node, and to send the second bucket sequence number to which the third node belongs and the received target message to the third node; the second bucket sequence number refers to each bucket sequence number that is less than the first bucket sequence number; The message broadcast stop module is used to stop the message broadcast of the current node if the current bucket sequence number received by the current node meets the preset broadcast stop condition.
15. An electronic device, characterized in that, The electronic device includes: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the message broadcasting method as described in any one of claims 1-13.
16. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the message broadcasting method as described in any one of claims 1-13.
Citation Information
Patent Citations
System and method for broadcasting message in structural peer-to-peer network
CN102055655A