A message dissemination method, device, apparatus and storage medium
By dividing the first network into a second network, the problem of redundant messages in the Gossip protocol is solved, and more efficient data synchronization is achieved.
Patent Information
- Application Number
- CN202210001931.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-04
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2042-01-04
AI Technical Summary
The existing Gossip protocol generates a large number of redundant messages and reduces data synchronization efficiency because it selects target nodes with a fixed probability when distributing messages. Furthermore, existing improvement methods, such as using auxiliary tools or additional broadcast mechanisms, are gradually becoming less effective in large networks.
By dividing the first network into at least two second networks, and distributing messages within each second network, redundant messages are reduced while efficiency is improved.
Dissemination within a second network reduces redundant messages and improves data synchronization efficiency.
Smart Images

Figure CN116436880B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data synchronization technology in distributed databases, and in particular to a message dissemination method, apparatus, device, and storage medium. Background Technology
[0002] The Gossip protocol selects target nodes with a fixed probability when disseminating messages. Therefore, a large number of redundant messages are generated during the actual data synchronization process, which reduces the efficiency of data synchronization.
[0003] In related technologies, auxiliary tools and additional broadcast mechanisms are used to address the problems that exist in the Gossip protocol when distributing messages. However, regardless of whether auxiliary tools or additional broadcast mechanisms are used, since the target network is fixed, the negative impact caused by the traditional mode will continue to increase as the distribution progresses, while the positive effect of reducing redundant messages will continue to decrease. This trend will become more and more obvious as the number of network nodes increases. Summary of the Invention
[0004] To address the aforementioned technical problems, embodiments of this application provide a message dissemination method, apparatus, device, and storage medium. By dividing a first network, at least two second networks are obtained, and the message to be disseminated is disseminated within each second network, thereby reducing redundant messages and improving dissemination efficiency.
[0005] To achieve the above objectives, the technical solution of this application is implemented as follows:
[0006] This application provides a message dissemination method, the method comprising:
[0007] Obtain the first network;
[0008] Determine the period during which nodes in the first network broadcast the message to be broadcast;
[0009] Based on the period, the nodes in the first network are divided to obtain at least two second networks;
[0010] The message to be disseminated is disseminated based on nodes in at least two of the second networks.
[0011] This application embodiment provides a message dissemination device, the device comprising:
[0012] The module retrieves the first network.
[0013] The determination module is used to determine the period during which nodes in the first network broadcast the message to be broadcast.
[0014] The processing module is used to divide the nodes in the first network based on the period to obtain at least two second networks;
[0015] The transmission module is used to distribute the message to be distributed based on nodes in the at least two second networks.
[0016] This application also provides an electronic device, which includes: a processor, a memory, and a communication bus; wherein the communication bus is used to realize a communication connection between the processor and the memory;
[0017] The processor is used to execute the program in the memory to implement any of the above message dissemination methods.
[0018] Accordingly, embodiments of this application also provide a computer-readable storage medium storing one or more programs that can be executed by one or more processors to implement any of the message dissemination methods described above.
[0019] The message dissemination method, apparatus, device, and storage medium provided in this application embodiment firstly acquire a first network; secondly, determine the period for nodes in the first network to disseminate messages to be disseminated; thirdly, divide the nodes in the first network based on the period to obtain at least two second networks; finally, disseminate the messages to be disseminated based on the nodes in the at least two second networks. In this way, the messages to be disseminated are disseminated in at least two second networks, which can reduce redundant messages and improve dissemination efficiency. Attached Figure Description
[0020] Figure 1 A schematic diagram illustrating the implementation process of a message dissemination method provided in this application embodiment;
[0021] Figure 2 A schematic diagram illustrating the implementation process of a message dissemination method provided in this application embodiment;
[0022] Figure 3 A schematic diagram illustrating the implementation process of a message dissemination method provided in this application embodiment;
[0023] Figure 4 A schematic diagram illustrating the implementation process of a message dissemination method provided in this application embodiment;
[0024] Figure 5 A schematic diagram illustrating the implementation process of a message dissemination method provided in this application embodiment;
[0025] Figure 6 A schematic diagram illustrating the implementation process of a message dissemination method provided in this application embodiment;
[0026] Figure 7 This is a schematic diagram illustrating the implementation process of the Gossip protocol in related technologies.
[0027] Figure 8 A schematic diagram illustrating the implementation process of the Gossip protocol based on target network contraction, provided for an embodiment of this application;
[0028] Figure 9 A schematic diagram illustrating the implementation process of the Gossip protocol based on target network contraction, provided for an embodiment of this application;
[0029] Figure 10A A schematic diagram illustrating the implementation process of the Gossip protocol based on target network contraction, provided for an embodiment of this application;
[0030] Figure 10B A schematic diagram illustrating the implementation process of the Gossip protocol based on target network contraction, provided for an embodiment of this application;
[0031] Figure 11 This is a schematic diagram of the composition structure of a message dissemination device provided in an embodiment of this application;
[0032] Figure 12 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0033] To facilitate understanding of the technical solutions of the embodiments of this application, the relevant technologies of the embodiments of this application will be described below.
[0034] The Gossip protocol is an important protocol in distributed networks, mainly used for data interaction between nodes in distributed networks. Its biggest advantage is eventual consistency, which can guarantee data synchronization among cluster nodes in a distributed network system. At the same time, due to its simplicity, efficiency, and strong fault tolerance, it has been widely used in the fields of distributed systems and big data.
[0035] Apache's open-source distributed database system, Cassandra, internally employs the Gossip protocol. Cassandra uses Gossip to exchange location and status information among nodes in the cluster. The Gossip process runs once per second, exchanging information with up to three other nodes, allowing all nodes to quickly learn about the information of other nodes in the cluster. The blockchain distributed ledger platform (Hyperledger Fabric) also uses the Gossip protocol at its underlying level. The distributed ledger nodes disseminate the block information they pull to every node in their channel via the Gossip protocol, ensuring that the ledger data on each node remains consistent and up-to-date.
[0036] Although the Gossip protocol is widely used in the distributed field, the existing Gossip protocol selects target nodes with a fixed probability when distributing messages. Therefore, a large number of redundant messages are generated during the actual data synchronization process, which reduces the efficiency of data synchronization.
[0037] To address the aforementioned issues, numerous researchers have proposed improved Gossip algorithms based on different network environments, primarily through the following methods:
[0038] 1) By using data structures as an auxiliary tool, calculations can be performed to increase the probability of new nodes being selected as target nodes, thereby reducing message redundancy and improving the efficiency of data synchronization.
[0039] 2) By using additional broadcast mechanisms, the probability of sending messages to duplicate nodes is reduced, the generation of redundant messages is reduced, and the efficiency of data synchronization is improved.
[0040] However, for 1), using data structures as auxiliary tools such as queues and linked lists increases additional storage space. Furthermore, some schemes distribute these data structures as part of the message, causing the data structure size to increase continuously as the message is distributed, thus affecting the message transmission rate. For 2), the additional broadcast mechanism generates a large number of broadcast messages during message distribution. Although broadcast messages only store a small amount of information, a large number of broadcast messages may increase network load and affect network performance.
[0041] In summary, regardless of whether auxiliary tools or additional broadcast mechanisms are used, since the target network is fixed, the negative impact will continuously increase as the dissemination progresses, while the positive effect of reducing redundant messages will continuously decrease. This trend will become more and more obvious as the number of network nodes increases.
[0042] Therefore, the following technical solutions of the embodiments of this application are proposed. In order to understand the features and technical content of the embodiments of this application in more detail, the implementation of the embodiments of this application will be described in detail below with reference to the accompanying drawings. The accompanying drawings are for reference only and are not intended to limit the embodiments of this application.
[0043] This application provides a message dissemination method applied to a distributed database system. Figure 1 This is a schematic diagram illustrating the implementation process of a message dissemination method provided in an embodiment of this application, as shown below. Figure 1 As shown, the method includes:
[0044] Step S101: Obtain the first network.
[0045] In some embodiments, the first network may be the current network, which includes multiple nodes; wherein data in at least one node has been updated, while data in the remaining nodes has not been updated. The message dissemination method provided in this application is applied to a distributed database system, where nodes interact with each other via the Gossip protocol. Therefore, the first network may be an unstructured network, and the nodes in the first network may be peer nodes.
[0046] In some embodiments, there may be one or more first networks. When there is only one first network, it is the initial network. When data from a seed node in the initial network needs to be updated to other nodes in the network, the seed node interacts with other nodes in the network via the Gossip protocol. When there are multiple first networks, each first network is a sub-network of the initial network. Updated nodes in each first network interact with other nodes in that network via the Gossip protocol. Data interactions in each first network occur in parallel, are independent of each other, and do not affect each other. For example, updated nodes in first network A interact with other nodes in that network via the Gossip protocol; updated nodes in first network B interact with other nodes in that network via the Gossip protocol; data interactions in first network A and first network B occur in parallel, are independent of each other, and do not affect each other.
[0047] In some embodiments, obtaining the first network is mainly for obtaining the number of unupdated nodes in the first network. Then, the unupdated nodes in the first network can be divided using the partitioning strategy provided in this application, thereby realizing the partitioning of the first network so that data interaction can be carried out in the partitioned network and the networks do not interfere with each other, reducing redundancy and improving dissemination efficiency.
[0048] Step S102: Determine the period during which nodes in the first network broadcast the message to be broadcast.
[0049] In some embodiments, nodes in the first network are used to receive messages to be disseminated and to disseminate the messages to be disseminated, so as to keep the information of each node in the first network consistent.
[0050] In some embodiments, the information to be disseminated can be information to be updated, which can be understood as data that a seed node in the initial network needs to update to other nodes in the network; such as location information, status information, etc.
[0051] In some embodiments, the time taken to broadcast the message to be broadcast in one round is defined as a period; for example, 1 second, 2 seconds, etc. Accordingly, if the first round broadcasts the message in the 1st second when the period is 1 second, then the second round broadcasts the message in the 2nd second when the period is 2 seconds; if the first round broadcasts the message in the 1st second when the period is 2 seconds, then the second round broadcasts the message in the 3rd second when the period is 2 seconds.
[0052] In some embodiments, the period during which a node in the first network broadcasts the message to be broadcast can be understood as the current period in which the node in the first network is currently located. Here, the current period in which the node in the first network is currently located can be determined based on the relationship between time and period. For example, if the period is 1 second and the time is 2.5 seconds, then the current period in which the node in the first network is located is the 3rd period, that is, the first network is a network obtained by shrinking the initial network twice.
[0053] Step S103: Divide the nodes in the first network based on the period to obtain at least two second networks.
[0054] In some embodiments, partitioning the nodes in the first network may involve partitioning the nodes in the first network that have not been updated; wherein, an unupdated node may be a node that has not received the information to be disseminated. Further, partitioning the nodes in the first network based on the period is achieved through the following process: First, determining how many times the initial network was shrunk based on the period; second, determining the number of unupdated nodes in the first network based on the number of shrunk cycles; finally, partitioning the nodes in the first network based on a partitioning strategy; wherein, each node in the second network is a subset of the unupdated nodes in the first network.
[0055] Step S104: Distribute the message to be distributed based on the nodes in the at least two second networks.
[0056] In some embodiments, after dividing the unupdated nodes in the first network into at least two second networks, the message to be disseminated is disseminated through nodes within the at least two second networks; here, the first network can be understood as the preceding network, and the second network can be understood as the following network; in this way, the message to be disseminated is disseminated in each of the at least two second networks, reducing redundancy and improving dissemination efficiency.
[0057] In this embodiment, firstly, a first network is obtained; secondly, the period for nodes in the first network to broadcast messages to be broadcast is determined; thirdly, the nodes in the first network are divided based on the period to obtain at least two second networks; finally, the messages to be broadcast are broadcast based on the nodes in the at least two second networks. In this way, the messages to be broadcast are broadcast in at least two second networks, which can reduce redundant messages and improve broadcasting efficiency.
[0058] In some embodiments, it is necessary to determine the number of cycles required for the initial network to broadcast the message to be broadcast, so as to determine how many times the initial network is divided to obtain the first network as a sub-network. Figure 2 This is a schematic diagram illustrating the implementation process of a message dissemination method provided in an embodiment of this application, as shown below. Figure 2 As shown, prior to step S102, the method includes:
[0059] Step S201: Determine the number of nodes in the initial network.
[0060] In some embodiments, the initial network includes one master node and multiple replica nodes; wherein the master node is the node where the message to be disseminated resides, and the replica nodes are nodes that have not been updated. Therefore, determining the number of nodes in the initial network can be understood as determining the number of nodes that have not been updated in the initial network; for example, if the initial network has n+1 nodes, and the master node O is the node where the message to be disseminated resides, then the number of nodes that have not been updated is n.
[0061] Step S202: Determine the number of nodes that each node can send the message to be disseminated in each cycle.
[0062] In some embodiments, the number of nodes that each node can send the message to be disseminated in each cycle can be determined based on the node's performance. Here, the larger the number of nodes that each node can send the message to be disseminated in each cycle, the better, so that the dissemination of the message to be disseminated can be completed in a shorter time.
[0063] In some embodiments, the number of nodes that each node can send the message to be disseminated in each period can be understood as the number of nodes k that each node in the nodes that were updated in the previous period can disseminate the message to be disseminated in this period; that is, each node in the nodes that were updated in the previous period can disseminate the message to be disseminated to k nodes in this period.
[0064] Step S203: Based on the number of nodes in the initial network and the number of nodes, determine the number of cycles for each node in the initial network to broadcast the message to be broadcast.
[0065] In some embodiments, since the period is preset, the number of periods for each node in the initial network to distribute the message to be distributed can be determined based on the number of nodes in the initial network and the number of nodes each node can send the message to be distributed in each period; that is, how many periods are needed to complete the distribution of the message to be distributed in the initial network. For example, if the initial network includes 15 nodes, of which 1 node is the master node and the remaining 14 nodes are replica nodes, and each node can send the message to be distributed to 2 nodes in each period; then, in the first period, the master node can distribute the message to be distributed to 2 nodes; in the second period, each of these 2 nodes can distribute the message to 2 nodes, for a total of 4 nodes; in the third period, each of these 4 nodes can distribute the message to 2 nodes, for a total of 8 nodes; the distribution of the message to be distributed can be completed in the initial network of 15 nodes in three periods. In summary, when the number of nodes each node can send the message to be distributed to in each period is 2, the distribution process of the message to be distributed is similar to a binary tree.
[0066] In some embodiments, if there are n+1 nodes in the initial network, the master node O is the node where the message to be disseminated is located, and the number of unupdated nodes is n, then determining the number of cycles i required to complete the dissemination of the message to be disseminated is to solve the following formula:
[0067]
[0068] Where k is the number of nodes that each node can send the message to be disseminated in each cycle.
[0069] In this embodiment of the application, firstly, the number of nodes in the initial network is determined; secondly, the number of nodes that each node can send the message to be disseminated in each cycle is determined; finally, based on the number of nodes in the initial network and the number of nodes, the number of cycles in which the nodes in the initial network disseminate the message to be disseminated is determined; thus, the number of cycles required to complete the dissemination of the message to be disseminated in the initial network can be determined.
[0070] In some embodiments, before determining the number of unupdated nodes in the first network, it is necessary to first determine the current cycle of the first network; Figure 3 This is a schematic diagram illustrating the implementation process of a message dissemination method provided in an embodiment of this application, as shown below. Figure 3 As shown, step S102 includes:
[0071] Step S301: Based on the number of cycles, determine that the current cycle of a node in the first network is the i-th cycle.
[0072] In some embodiments, the current period of a node in the first network is determined to be the i-th period based on the number of periods. This is achieved through the following process: Based on the period and time, the current period of a node in the first network is determined to be the i-th period from the number of periods. For example, if the period is 1 second, it takes 10 periods to complete the dissemination of the message to be disseminated in the initial network, and the current time since the start of the dissemination of the message to be disseminated is 2.5 seconds, then the current period of a node in the first network is the 3rd period.
[0073] In this embodiment of the application, based on the number of cycles, the current cycle of a node in the first network is determined to be the i-th cycle; thus, the current cycle of a node in the first network can be determined.
[0074] In some embodiments, after determining the current period of a node in the first network, the nodes in the first network are divided. Figure 4 This is a schematic diagram illustrating the implementation process of a message dissemination method provided in an embodiment of this application, as shown below. Figure 4 As shown, step S103 includes:
[0075] Step S401: In the i-th period, determine the number of nodes in the first network that have not been updated.
[0076] In some embodiments, the dissemination of the message to be disseminated is carried out on unupdated nodes. Therefore, after determining the period in which the first network is located, the first thing to determine is the number of unupdated nodes in the first network. When the first network is the initial network, all nodes except the master node are unupdated nodes. When the first network is not the initial network, all nodes except the node updated in the i-th period are unupdated nodes.
[0077] In some embodiments, the initial network has n+1 nodes, with the master node 0 being the node where the message resides, and the message to be disseminated being disseminated among the remaining n nodes; then, the number of unupdated nodes in the initial network is f(0) = n; assuming that each node can send the message to be disseminated to k nodes in each cycle, then the number of unupdated nodes in the first network is f(i) = n+1 - (k i +k i-1 ...+k 0 ).
[0078] Step S402: If the number of unupdated nodes is greater than or equal to a preset threshold, determine the number of target nodes constituting each sub-network based on the number of unupdated nodes, a preset interference value, and the number of nodes that each node can send the message to be disseminated in the i-th period.
[0079] In some embodiments, step S402 is the partitioning strategy, which includes a constraint and a method for determining the number of target nodes that make up each sub-network; wherein, the formula for determining the number of target nodes that make up each sub-network is as follows:
[0080]
[0081] Where f(i) is the number of nodes that have not been updated in the first network; x is the interference value; and k is the number of nodes that each node can send the message to be disseminated in each cycle.
[0082] Meanwhile, f(i) needs to satisfy the following constraints:
[0083] f(i)>m (3);
[0084] That is, if f(i) > m, the first network is partitioned; otherwise, the partitioning is stopped.
[0085] Step S403: Based on the number of target nodes, divide the nodes in the first network to obtain at least two second networks.
[0086] In some embodiments, the nodes in the first network are divided based on the number of target nodes to obtain at least two second networks, such that the number of nodes in each second network is the same as the number of target nodes; for example, if the number of target nodes is determined to be 10 and the number of unupdated nodes in the first network is 30, then each second network consists of 10 nodes, resulting in three second networks.
[0087] In some embodiments, the first network can be understood as the previous network and the second network can be understood as the next network. Then, in the next cycle, the nodes in each second network that have not been updated are divided according to the partitioning strategy, resulting in at least four third networks. In this way, the message to be disseminated is disseminated in the partitioned networks, which reduces message redundancy and improves dissemination efficiency.
[0088] In this embodiment, firstly, in the i-th period, the number of unupdated nodes in the first network is determined; secondly, if the number of unupdated nodes is greater than or equal to a preset threshold, based on the number of unupdated nodes, a preset interference value, and the number of nodes that each node can send the message to be disseminated in the i-th period, the number of target nodes constituting each sub-network is determined; finally, based on the number of target nodes, the nodes in the first network are divided to obtain at least two second networks; thus, by dividing the first network according to the division strategy, the message to be disseminated is spread within each of the divided second networks, reducing redundant messages while improving dissemination efficiency.
[0089] In some embodiments, after dividing the first network into at least two second networks, it is necessary to determine which nodes to distribute the message to. Figure 5 This is a schematic diagram illustrating the implementation process of a message dissemination method provided in an embodiment of this application, as shown below. Figure 5 As shown, step S104 includes:
[0090] Step S501: In each second network, determine the node to be updated.
[0091] In some embodiments, the general execution process of the Gossip protocol is as follows: when a seed node has state that needs to be updated to other nodes in the network, it randomly selects several surrounding nodes to spread the message. The nodes that receive the message will repeat this process until all nodes in the network have received the message. Here, after dividing the first network according to the partitioning strategy, the node to be updated is determined in each second network. Due to the number of target nodes constituting each sub-network... Therefore, when the interference value is small enough (ideally negligible), the number of second networks obtained is equal to k, and the number of nodes that each node can send the message to be disseminated in each cycle is k. In this case, one node to be updated is randomly determined in each second network. When the interference value is large (not negligible), the number of second networks obtained is less than k. In this case, at least one node to be updated is randomly determined in each second network.
[0092] In some embodiments, the interference value can be understood as an error value, which can be taken as the error between the actual situation and the ideal situation.
[0093] Step S502: Distribute the message to be distributed based on the node to be updated.
[0094] In some embodiments, the message to be disseminated is disseminated based on the node to be updated; that is, the message to be disseminated is disseminated to the node to be updated.
[0095] In this embodiment of the application, firstly, in each second network, a node to be updated is determined; secondly, the message to be disseminated is disseminated based on the node to be updated; thus, a node to be updated can be determined in the divided second network, and the message to be disseminated can be disseminated to that node.
[0096] In some embodiments, the dissemination of the message to be disseminated includes the process of the updated node sending the message to be disseminated and the updated node receiving the message to be disseminated. Figure 6 This is a schematic diagram illustrating the implementation process of a message dissemination method provided in an embodiment of this application, as shown below. Figure 6 As shown, step S502 includes:
[0097] Step S601: Send the message to be disseminated to the node to be updated based on the updated nodes in the first network.
[0098] In some embodiments, if the first network is the initial network, the updated node is the seed node, i.e., the node where the message is located. If the first network is not the initial network, the updated node is the node that received the message to be disseminated in the previous cycle.
[0099] In some embodiments, to achieve the dissemination of the message to be disseminated, the node receiving the message to be disseminated in the i-th period first needs to update its data based on the message to be disseminated, and then send the message to be disseminated to the node to be updated in the (i+1)-th period.
[0100] In some embodiments, sending the message to be disseminated to the node to be updated based on the updated node in the first network is achieved through the following process: using the updated node in the first network, the message to be disseminated is spread to the node to be updated via a preset communication protocol. The preset communication protocol may be the Goosip protocol.
[0101] Step S602: Based on the updated data carried in the message to be disseminated, update the data of the node to be updated so that the updated node to be updated can disseminate the message to be disseminated.
[0102] In some embodiments, at least two steps are required to achieve the dissemination of the message to be disseminated: First, after the node receiving the message to be disseminated in the i-th period updates its data based on the message to be disseminated, it sends the message to be disseminated to the node to be updated in the (i+1)-th period; Second, the node to be updated receives the message to be disseminated and updates its data based on the updated data carried in the message to be disseminated, so that the updated node to be updated can disseminate the message to be disseminated.
[0103] In this embodiment of the application, firstly, the message to be disseminated is sent to the node to be updated based on the updated node in the first network; secondly, the node to be updated is updated based on the updated data carried in the message to be disseminated, so that the updated node to be updated can disseminate the message to be disseminated; thus, the dissemination of the message to be disseminated is realized between nodes.
[0104] The following will describe an exemplary application of the embodiments of this application in a real-world application scenario, taking intent recognition based on keyword matching as an example.
[0105] like Figure 7As shown, in the first Gossip cycle, node O spreads the message to A and D. In the second Gossip cycle, node A repeatedly spreads the message to O, and node D repeatedly spreads the message to A, causing unnecessary message redundancy and affecting the message spreading rate.
[0106] This application provides a Gossip protocol based on target network shrinkage. As the propagation period increases, the target network is continuously divided according to the shrinkage strategy, thereby continuously narrowing the selection range of target nodes, reducing redundant messages, and improving the efficiency of data synchronization. Figure 8 A schematic diagram illustrating the implementation process of the Gossip protocol based on target network contraction, as provided in this application embodiment, is shown below. Figure 8 As shown, the method includes:
[0107] Step S801: Determine whether the number of target networks in Gossip cycle 1 satisfies equation 3.
[0108] In some embodiments, if Equation 3 is satisfied, proceed to step S802; if Equation 3 is not satisfied, proceed to step S806.
[0109] Step S802: Shrink the network according to Equation 2.
[0110] Step S803: Determine whether the number of target networks in Gossip cycle 2 satisfies equation 3.
[0111] In some embodiments, if equation 3 is satisfied, proceed to step S804; if equation 3 is not satisfied, proceed to step S806.
[0112] Step S804: Shrink the network according to Equation 2.
[0113] Step S805: Repeat steps S801 to S804 above until the Gossip cycle n.
[0114] Step S806: The target network stops shrinking.
[0115] In some embodiments, during the propagation process, the node that has the latest data sends a message containing the data to other nodes via the Gossip protocol. Figure 9 A schematic diagram illustrating the implementation process of the Gossip protocol based on target network contraction, as provided in this application embodiment, is shown below. Figure 9 As shown, the method includes:
[0116] First, in the discovery module 901, the old target network 93 is shrunk into a new target network 94 according to the shrinkage strategy 91 and the traditional strategy 92, and the target network forms a network node list 95 which is passed to the filtering module 902.
[0117] Secondly, select several nodes in the filtering module 902 and form a target node list 96 from these nodes, which is then sent to the sending module 903;
[0118] Next, the sending module 903 sends the sending message 97 containing the latest data to the receiving modules 904 of each target node in the target node list 96 through the sending end 98;
[0119] Next, the target node receiving module 904 receives the message through the receiving end 99 and updates the local data 100 according to the data in the message;
[0120] Finally, repeat steps one through four to continue forwarding messages with the latest data to other nodes in the cluster until all nodes in the cluster have consistent and up-to-date data.
[0121] In some embodiments, such as Figure 10A and 10B As shown, node O is the master node, and the value of k is 2. In the first Gossip cycle, node O propagates the message to A and B. According to the shrinking strategy, the entire network is divided into network 1 and network 2. Node A is only responsible for disseminating the message to nodes in network 1, and node B is only responsible for disseminating the message to nodes in network 2. Network 1 and network 2 do not affect each other at the dissemination level. Similarly, in the second Gossip cycle, according to the shrinking strategy, networks 1 and 2 are further divided into smaller target networks, thereby further narrowing the selection range of target nodes and maintaining effective propagation.
[0122] This application provides a message dissemination device. Figure 11 This is a schematic diagram of the composition structure of a message dissemination device provided in an embodiment of this application, as shown below. Figure 11 As shown, the message dissemination device 1100 includes:
[0123] Module 1101 is used to obtain the first network;
[0124] The determining module 1102 is used to determine the period during which nodes in the first network broadcast the message to be broadcast.
[0125] Processing module 1103 is used to divide the nodes in the first network based on the period to obtain at least two second networks;
[0126] The transmission module 1104 is used to distribute the message to be distributed based on nodes in the at least two second networks.
[0127] In some embodiments, the message dissemination device further includes:
[0128] The first determining submodule is used to determine the number of nodes in the initial network;
[0129] The second determining submodule is used to determine the number of nodes that each node can send the message to be disseminated in each cycle;
[0130] The third determining submodule is used to determine the number of cycles for the nodes in the initial network to broadcast the message to be broadcast, based on the number of nodes in the initial network and the number of nodes.
[0131] In some embodiments, the determining module 1102 includes:
[0132] The fourth determining submodule is used to determine, based on the number of cycles, the current cycle of a node in the first network as the i-th cycle.
[0133] In some embodiments, the fourth determining submodule includes:
[0134] The fifth determining submodule is used to determine the number of unupdated nodes in the first network during the i-th period;
[0135] The sixth determining submodule is used to determine the number of target nodes constituting each subnetwork based on the number of unupdated nodes, a preset interference value, and the number of nodes that each node can send the message to be disseminated in the i-th period when the number of unupdated nodes is greater than or equal to a preset threshold.
[0136] The first processing submodule is used to divide the nodes in the first network based on the number of target nodes to obtain the at least two second networks.
[0137] In some embodiments, the processing module 1103 includes:
[0138] The seventh determination submodule is used to determine the node to be updated in each second network;
[0139] The second processing submodule is used to spread the message to be spread based on the node to be updated.
[0140] In some embodiments, the second processing submodule described above includes:
[0141] The first transmission submodule is used to send the message to be disseminated to the node to be updated based on the updated node in the first network;
[0142] The third processing submodule is used to update the data of the node to be updated based on the update data carried in the message to be disseminated, so that the updated node to be updated can disseminate the message to be disseminated.
[0143] In some embodiments, the first transmission submodule includes:
[0144] The second transmission submodule is used to use the updated nodes in the first network to spread the message to be spread to the nodes to be updated via an epidemic protocol.
[0145] This application provides an electronic device. Figure 12 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application, such as... Figure 12 As shown, the electronic device 1200 includes:
[0146] The processor 1201, the memory 1202, and the communication bus 1203 are provided; wherein, the communication bus 1203 is used to realize the communication connection between the processor 1201 and the memory 1202.
[0147] The processor 1201 is used to execute the program in the memory 1202 to implement the message dissemination method as described above.
[0148] This application provides a computer-readable storage medium storing one or more programs thereon, which can be executed by one or more processors to implement any of the above-described message dissemination methods.
[0149] It should be noted that the aforementioned computer-readable storage media can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic random access memory (FRAM), flash memory, magnetic surface memory, optical disc, or compact disc read-only memory (CD-ROM), etc.; it can also be various processors that include one or any combination of the above-mentioned memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc.
[0150] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0151] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0152] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0153] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0154] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0155] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0156] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A message dissemination method, characterized in that, The method includes: Obtain the first network; Determine the number of nodes in the initial network; Determine the number of nodes that each node can send the message to be disseminated in each cycle; Based on the number of nodes in the initial network and the number of nodes, determine the number of cycles during which the nodes in the initial network will broadcast the message to be broadcast. Based on the number of cycles, the current cycle of a node in the first network is determined to be the i-th cycle. In the i-th period, determine the number of nodes in the first network that have not been updated; If the number of unupdated nodes is greater than or equal to a preset threshold, the number of target nodes constituting each sub-network is determined based on the number of unupdated nodes, a preset interference value, and the number of nodes that each node can send the message to be disseminated in the i-th period; if the number of unupdated nodes is less than the preset threshold, the division of nodes in the first network is stopped. Based on the number of target nodes, the nodes in the first network are divided to obtain at least two second networks; The message to be disseminated is disseminated based on nodes in at least two of the second networks.
2. The method according to claim 1, characterized in that, The dissemination of the message to be disseminated based on nodes in the at least two second networks includes: In each second network, identify the node to be updated; The message to be disseminated is disseminated based on the node to be updated.
3. The method according to claim 2, characterized in that, The dissemination of the message to be disseminated based on the node to be updated includes: The message to be disseminated is sent to the node to be updated based on the updated node in the first network; Based on the updated data carried in the message to be disseminated, the node to be updated is updated so that the updated node can disseminate the message to be disseminated.
4. The method according to claim 3, characterized in that, The step of sending the message to be disseminated to the node to be updated based on the updated node in the first network includes: The message to be disseminated is spread to the node to be updated using the updated node in the first network through a preset communication protocol.
5. A message dissemination device, characterized in that, The device includes: The module retrieves the first network. The first determining submodule is used to determine the number of nodes in the initial network; The second determining submodule is used to determine the number of nodes that each node can send the message to be disseminated in each cycle; The third determining submodule is used to determine the number of cycles for the nodes in the initial network to broadcast the message to be broadcast based on the number of nodes in the initial network and the number of nodes. The fourth determining submodule in the determining module is used to determine the current period of a node in the first network as the i-th period based on the number of periods; The fifth determining submodule in the fourth determining submodule is used to determine the number of unupdated nodes in the first network during the i-th period; The sixth determining submodule in the fourth determining submodule is used to determine the number of target nodes constituting each subnetwork based on the number of unupdated nodes, a preset interference value, and the number of nodes that each node can send the message to be disseminated in the i-th period when the number of unupdated nodes is greater than or equal to a preset threshold; and to stop dividing the nodes in the first network when the number of unupdated nodes is less than the preset threshold. The first processing submodule in the fourth determining submodule is used to divide the nodes in the first network based on the number of target nodes to obtain at least two second networks; The transmission module is used to distribute the message to be distributed based on nodes in the at least two second networks.
6. An electronic device, characterized in that, The electronic device includes: a processor, a memory, and a communication bus; wherein the communication bus is used to realize a communication connection between the processor and the memory; The processor is used to execute the program in the memory to implement the message dissemination method as described in any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs that can be executed by one or more processors to implement the message dissemination method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Information sharing method for Ad Hoc network
CN103581838A