CN112995274B - Method, device and equipment for determining connection node and computer readable storage medium - Google Patents

Method, device and equipment for determining connection node and computer readable storage medium Download PDF

Info

Publication number
CN112995274B
CN112995274B CN202110121426.2A CN202110121426A CN112995274B CN 112995274 B CN112995274 B CN 112995274B CN 202110121426 A CN202110121426 A CN 202110121426A CN 112995274 B CN112995274 B CN 112995274B
Authority
CN
China
Prior art keywords
node
nodes
determining
surviving
connection
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110121426.2A
Other languages
Chinese (zh)
Other versions
CN112995274A (en
Inventor
陈福
霍雨佳
朱建明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Central university of finance and economics
Original Assignee
Central university of finance and economics
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Central university of finance and economics filed Critical Central university of finance and economics
Priority to CN202110121426.2A priority Critical patent/CN112995274B/en
Publication of CN112995274A publication Critical patent/CN112995274A/en
Application granted granted Critical
Publication of CN112995274B publication Critical patent/CN112995274B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • H04L41/0668Management of faults, events, alarms or notifications using network fault recovery by dynamic selection of recovery network elements, e.g. replacement by the most appropriate element after failure
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computing Systems (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application provides a method, a device, equipment and a computer readable storage medium for determining a connection node. The method comprises the following steps: determining at least one target node directly connected with a current transmission node based on the connection state among nodes in the network, wherein the current transmission node is a node for receiving a message sent by a connection node; determining at least one surviving node for message transmission and a weight of at least one surviving node in at least one target node based on the state attribute of at least one target node, wherein one surviving node corresponds to one weight; determining a connecting node among the at least one surviving node based on the weight of the at least one surviving node. The method determines the connection nodes based on the weight of the nodes, avoids the situations of information congestion and even information loss caused by selecting interrupted nodes or crowded nodes due to blind selection to a certain extent, improves the efficiency of message transmission and ensures the quality of message transmission.

Description

Method, device and equipment for determining connection node and computer readable storage medium
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a method, a device and equipment for determining a connection node and a computer-readable storage medium.
Background
The Internet of things (IOT) is a network of interconnected objects, is a network based on the Internet and comprehensively covers all objects, and can realize information exchange and sharing among the objects without manual intervention. Among the various protocols commonly used in the internet of things, the Message Queue Telemetry Transport (MQTT) is a currently competitive communication protocol.
The MQTT protocol is a message protocol based on a publish/subscribe paradigm, and in the communication process, there are three identities in the MQTT protocol: publishers (Publish), brokers (Broker) and subscribers (Subscribe). In the communication process, the publisher sends the message to the proxy, and the proxy sends the message to the corresponding client based on the subscription request of the subscriber.
In the related art, when a node newly joining a network sends a message to a proxy node, a connection node forming a transmission path between the node and the proxy node is obtained by random selection, that is, as long as nodes between the newly joining node and the proxy node are all possibly selected, in the process, a faulty node is selected, which causes congestion of the message, interruption of message transmission, and reduction of message transmission rate, and even causes that part of the message is covered, and abnormal situations such as message loss occur.
Disclosure of Invention
The application provides a method, a device, equipment and a computer readable storage medium for determining a connection node, which ensure the connectivity and effectiveness of the determined connection node.
In a first aspect, a method for determining a connection node is provided, where the method includes:
determining at least one target node directly connected with a current transmission node based on the connection state among nodes in the network, wherein the current transmission node is a node for receiving a message sent by a connection node; determining at least one surviving node for message transmission and a weight of at least one surviving node in at least one target node based on the state attribute of at least one target node, wherein one surviving node corresponds to one weight; determining a connection node among the at least one surviving node based on the weight of the at least one surviving node.
The method determines the connection node based on the weight in the surviving node directly connected with the current transmission node, and avoids the problems of message congestion, message interruption and even message loss caused by determining a fault node.
In one possible implementation manner, determining a connection node among the at least one surviving node based on the weight of the at least one surviving node includes: determining the selection probability of at least one survival node based on the weight of the at least one survival node; determining a connecting node among the at least one surviving node based on the selection probability of the at least one surviving node and the random number value.
In a possible implementation manner, determining the selection probability of the at least one surviving node based on the weight of the at least one surviving node includes: determining the sum of the weights of all the survival nodes based on the weight of each survival node in at least one survival node; and determining the selection probability of each survival node based on the weight of each survival node and the sum of the weights.
In a possible implementation manner, before determining the weight of at least one surviving node, the method further includes: determining the number of direct connection nodes and the number of indirect connection nodes of each node based on the connection state between each node in the network; and determining the weight of each node based on the number of the direct connection nodes and the number of the indirect connection nodes of each node.
In one possible implementation, the method further includes: and based on the connection state among all nodes in the network, responding to the absence of a target node directly connected with the current transmission node, directly connecting the current transmission node with an access node, and determining the access node as a connection node, wherein the access node is a node for sending a message to the target node in the network.
In one possible implementation manner, after determining the access node as the connection node, the method further includes: and outputting the recorded connection nodes according to the connection sequence, and acquiring a transmission path of the message sent by the access node to the target node.
In one possible implementation, the method further includes: and updating the connection state and the weight of each node in the network after the access node is added.
In a second aspect, an apparatus for determining a connection node is provided, the apparatus comprising:
the first determining module is used for determining at least one target node directly connected with a current transmission node based on the connection state among nodes in the network, wherein the current transmission node is a node for receiving a message sent by a connection node; a second determining module, configured to determine, based on a state attribute of at least one target node, at least one surviving node performing message transmission and a weight of the at least one surviving node in the at least one target node, where one surviving node corresponds to one weight; and the third determining module is used for determining the connecting node in the at least one survival node based on the weight of the at least one survival node.
In a possible implementation manner, the third determining module is configured to determine a selection probability of the at least one surviving node based on a weight of the at least one surviving node; determining a connecting node among the at least one surviving node based on the selection probability of the at least one surviving node and the random number value.
In a possible implementation manner, the third determining module is configured to determine, based on the weight of each surviving node in the at least one surviving node, a sum of the weights of the surviving nodes; and determining the selection probability of each survival node based on the weight of each survival node and the sum of the weights.
In a possible implementation manner, the apparatus further includes a fourth determining module, configured to determine, based on a connection state between nodes in the network, a number of direct connection nodes and a number of indirect connection nodes of each node; and determining the weight of each node based on the number of the direct connection nodes and the number of the indirect connection nodes of each node.
In one possible implementation, the apparatus further includes: and the fifth determining module is used for responding to the absence of a target node directly connected with the current transmission node based on the connection state among the nodes in the network, directly connecting the current transmission node with the access node, and determining the access node as a connection node, wherein the access node is a node for sending a message to the target node in the network.
In one possible implementation, the apparatus further includes: and the output module is used for outputting the recorded connection nodes according to the connection sequence after the access node is determined as the connection node, and acquiring a transmission path of the message sent by the access node to the target node.
In one possible implementation, the apparatus further includes: and the updating module is used for updating the connection state and the weight of each node in the network after the access node is added.
In a third aspect, a computer device is provided, the computer device comprising a processor and a memory, the memory having at least one computer program stored therein. The at least one computer program is loaded and executed by one or more processors to implement any of the methods of the first aspect for setting node internal determination of connecting nodes.
In a fourth aspect, a computer-readable storage medium is provided, where at least one program code is stored, and the program code is loaded and executed by a processor to make a computer implement any one of the methods for determining a connection node in the first aspect.
In a fifth aspect, a computer program or a computer program product is provided, in which at least one computer instruction is stored, the at least one computer instruction being loaded and executed by a processor, so as to make a computer implement any one of the methods for determining a connection node in the first aspect.
The embodiment of the application provides a method for determining connecting nodes based on the weight of the nodes, and the connecting nodes are determined in the surviving nodes as evenly as possible. The situation of information congestion and even information loss caused by selecting interrupted nodes or crowded nodes due to blind selection is avoided to a certain extent, the efficiency of message transmission is improved, and the quality of message transmission is ensured.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic diagram of a method for determining nodes at random on average in a twisted (Tangle) network according to an embodiment of the present disclosure;
fig. 2 is a schematic diagram of a method for determining a node in a random walk method without weighting in a Tangle network according to an embodiment of the present disclosure;
fig. 3 is a schematic diagram of a method for selecting a node in a random walk method under a weighted condition in a Tangle network according to an embodiment of the present disclosure;
fig. 4 is a flowchart of a method for determining a connection node according to an embodiment of the present application;
fig. 5 is a diagram of an MQTT network architecture according to an embodiment of the present application;
FIG. 6 is a statistical chart of experimental results provided in the examples of the present application;
FIG. 7 is a statistical chart of another experimental result provided in the examples of the present application;
fig. 8 is a block diagram of an apparatus for determining a connection node according to an embodiment of the present application;
fig. 9 is a block diagram of another apparatus for determining a connection node according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
In order to make the technical method in the present application better understood, some embodiments of the present application will be described below with reference to the accompanying drawings. It is to be understood that, unless otherwise defined, all technical terms used in the embodiments of the present application have the same meaning as commonly understood by one of ordinary skill in the art, and are used only for the purpose of explanation of the embodiments of the present application, and are not intended to limit the present application.
In order to better understand the method for determining the connection node provided in the embodiments of the present application, the following definitions and explanations will be made on the relevant theories applied in the embodiments.
Angstrom (IOTA): the IOTA is a novel digital encryption currency, is focused on solving the transaction problem between machines (Machine to Machine, m2 m), and is specially designed for the micro-payment problem existing in the Internet of things. The IOTA may provide efficient, secure, lightweight, real-time microtransactions, and no transaction fees are incurred.
The Tangle network: the distributed architecture is a new distributed architecture for the IOTA, and the blocks in the block-chain architecture are replaced by Direct Acyclic Graphs (DAGs) selectively, so that the burden in the process of achieving consensus is distributed to each node in the network, and the resource consumption can be reduced.
The process of achieving consensus can be understood as a process of a node becoming a reliable node after multiple verifications. Each node in the Tangle network contains some transactions, and in the process of adding a new transaction to the Tangle network (i.e. adding a new node to the Tangle network), any two nodes in the network can be selected to be verified by the added new node, and when the number of times that one node is successfully authenticated reaches a threshold value, the node becomes a reliable node achieving consensus. The threshold value may be set according to the actual situation of the node in the network.
The node consensus mechanism of the Tangle network: there are three types of nodes in a Tangle network, which have been verified to be in common, have not been in common, and are newly added.
To achieve consensus, each newly joining node randomly selects two nodes in the Tangle network for authentication. There are three ways to select a node: first, a node is uniformly and randomly selected for authentication, as shown in fig. 1; second, random walk without weighting, as shown in FIG. 2; third, random walk in the weighted case, as shown in FIG. 3. In fig. 1 to 3, the nodes with bold frames are the nodes that have achieved consensus, the nodes without bold frames are the nodes that have not achieved consensus, and the gray nodes are the newly added nodes.
It can be seen that in the first case, all nodes in the Tang network have the possibility of being selected, and in this mode, a certain node may be selected multiple times at a certain time, a large amount of transactions may exist in the node, and a large amount of data transmission may be performed, and a very small amount of transactions may exist at a certain time, so that the Tang network may be very busy in a certain time. In the second case, the node in the Tang network selects the nearest node for authentication, so that the newly joined node at the far end of the network has no chance to be authenticated, thereby resulting in the existence of a large number of nodes which are not in consensus. Under the condition that the nodes are not weighted, a class of nodes which directly select the nodes which have achieved the consensus for authentication may appear, and if a large number of the class of nodes exist in the Tangle network, the nodes which have not achieved the consensus and the newly added nodes are not selected and verified all the time, and finally unhealthy development of the whole Tangle network is caused.
Therefore, there is a third case of weighted random walk proposed. The Markov Chain Monte Carlo (MCMC) algorithm introduces a variable α to control the selection of nodes, where the smaller α, the more average the probability of the sampled result obtained based on MCMC among all nodes. The sampling result is the node in the network determined based on the MCMC algorithm.
Each node in the Tangle network is assigned a weight value:
node weight W = number of direct authentication nodes + number of indirect authentication nodes + weight of self node (1)
In this formula (1), the own node weight value is set to 1.
When a new node is added into the Tangle network, the Tangle network selects the node by utilizing the Markov Monte Carlo random walk algorithm from the creation node, and the node is guided to finally reach the designated node. The created node refers to a destination node in the network, namely a node which is newly added and is finally required to communicate.
Markov monte carlo (MCMC) random walk algorithm: the method is a random simulation algorithm and can be applied to a sample selection scene. In the process of achieving consensus of the nodes of the Tangle network, a Markov Monte Carlo (MCMC) random walk algorithm is used, so that the newly added nodes can randomly select two nodes in the network to realize verification, the consensus is achieved, and meanwhile, the whole Tangle network is expanded.
In the Internet of things, when an access node sends a message to a destination node, a new scheme for determining a connection node is provided for the access node to acquire a transmission path. In one possible implementation, the destination node is a Broker node (Broker), and the scheme is applied in a scenario where the access node transmits a message to the Broker.
In an MQTT network, when an access node sends a message to a destination node, a transmission path between the access node and the destination node needs to be determined; the MQTT network has a large number of nodes connected with each other, and the nodes connected with each other can transmit information, so the transmission path can be composed of a plurality of connected nodes or can be directly connected with a destination node through an access node.
In the related technology of the MQTT network, in the process that an access node and a destination node are determined and a connection node forming a transmission path between the two nodes is further determined, the connection node is determined by a random selection method, the random selection process does not use a determined algorithm as a basis, and the determined connection node has uncertainty, so that the random selection cannot guarantee the effectiveness of the determined connection node, and the connectivity of the formed transmission path cannot be guaranteed.
According to the method for determining the connection node, the connection node is determined based on the weight of each node in the network, and smoothness and high efficiency of a transmission path can be guaranteed to a certain extent. Referring to fig. 4, the scheme includes the following steps 101-103.
101. And determining at least one target node directly connected with the current transmission node based on the connection state among the nodes in the network, wherein the current transmission node is a node for receiving the message sent by the connection node.
A plurality of nodes exist in the MQTT network, and the nodes are connected with each other to realize the transmission of messages among the nodes. Determining a current transmission node, and determining at least one target node which is directly connected with the current transmission node based on the connection state between nodes in the network, wherein the target node refers to a node which is directly connected with the transmission node in the MQTT network and transmits messages to the transmission node. Wherein the current transmission node is a node that receives a message sent by the connection node. The current transport node may be a destination node, or a connection node connecting the access node and the destination node, and the current transport node sends a message to the destination node through the connection node.
The connection state between nodes in the network refers to the connection condition between nodes, including the number and name of the nodes directly connected to any node in the network, the message transmission direction between two nodes connected to each other, and whether any node can receive the messages of other nodes.
In this step, after the current transmission node is determined, the connection state information of the current transmission node is obtained based on the connection state of each node in the network, the relationship between the current transmission node and other nodes is determined, and the target node to which the current transmission node is directly connected is determined.
For example, referring to fig. 5, if the current transmission node is set as B, two target nodes directly connected to node B may be determined, that is, node H and node F.
In a possible implementation manner, based on the connection state of each node in the network, if a target node directly connected with the current transmission node does not exist, the current transmission node is directly connected with the access node, and the access node is determined as a connection node; the access node is a node which sends a message to a destination node in the MQTT network through a connecting node but does not currently join the network.
102. And determining at least one alive node for message transmission and a weight value of the at least one alive node in the at least one target node based on the state attribute of the at least one target node, wherein one alive node corresponds to one weight value.
At least one target node directly connected with a current transmission node is determined in step 101, and the determined target node may have two different state attributes of survival or non-survival; the target node with the survival attribute refers to a target node in a survival state, can perform message transmission, and is called as a survival node; the target node having the non-alive attribute refers to a target node in a non-alive state, and cannot perform message transmission, such as a node not on line at the current time or a node that fails.
Determining that only surviving nodes of the at least one determined target node can successfully send the message to the current transmitting node, so that the step determines surviving nodes of the target nodes based on the state attribute of the target node, wherein the number of the surviving nodes is at least one; and acquiring the weight value corresponding to the node to be stored according to the determined nodes to be alive, wherein one surviving node corresponds to one weight value. The method for determining the weight of the surviving node may be to directly obtain the weight corresponding to the surviving node from the storage location; the weight of the surviving node is obtained by calculation based on a relevant formula before this step, and the obtaining process may refer to the following steps 201 to 202, which is not described herein again.
There are various ways to determine whether a target node is a surviving node based on the state attribute of the target node, which is not limited in the embodiments of the present application. Illustratively, 1 represents the survival attribute of the target node, 0 represents the non-survival attribute of the target node, and then the state of the target node is judged according to the numerical value. Wherein the state attribute of the target node changes in real time with the environment and the actual condition of the nodes in the network.
In a possible implementation manner, the current transmission node is directly connected to the access node, and the access node is used as a connection node.
Exemplarily, referring to fig. 5, a current transmission node B has target nodes H and F directly connected to each other, and in a possible implementation, if it is determined that both nodes H and F belong to a surviving node based on a target node state, weights of the nodes H and F are determined respectively; in a possible implementation manner, the node H is determined to be a survival node by judging the state of the target node, and the node F is determined to be an unviable node, so that the weight of the survival node H is determined; in one possible implementation, nodes H and F both belong to non-surviving nodes, and the current transmitting node B is directly connected to the access node X.
103. Determining a connecting node among the at least one surviving node based on the weight of the at least one surviving node.
In a possible implementation manner, determining a connected node in the at least one alive node based on the weight of the at least one alive node includes: determining the selection probability of at least one survival node based on the weight of the at least one survival node; determining a connecting node among the at least one surviving node based on the selection probability of the at least one surviving node and the random number value.
Wherein the process of determining the selection probability of at least one surviving node includes, but is not limited to: based on the surviving nodes determined in step 102 and the weights of the surviving nodes, the weights corresponding to the surviving nodes are added to obtain a sum of the weights, a ratio of the weight of each node to the sum of the weights is calculated, and the calculated ratio is used as a selection probability of each surviving node.
Based on the selection probability of each surviving node, a certain interval can be divided in proportion to obtain a plurality of subintervals with the same number as the surviving nodes, each subinterval can correspond to one surviving node, and the proportion of any subinterval in the interval is the same as the selection probability of the surviving node corresponding to the subinterval. And generating a random value through calculation, determining the survival node corresponding to the subinterval to which the position belongs according to the position of the falling point of the random value when the random value falls in the interval, and determining the survival node as the connecting node.
In a possible implementation manner, after the selection probability of each surviving node is obtained, the selection of the connecting node may be implemented through a random walk algorithm, where the random walk algorithm may implement a process of generating a random number and determining the connecting node based on the random number and the selection probability of each surviving node. Illustratively, the determination of the connection nodes is accomplished using a Markov Monte Carlo (MCMC) random walk algorithm.
In the exemplary embodiment, based on steps 101 and 102, determining the surviving nodes S, Y, and Z in the target node directly connected to the current transmission node R, and determining that the weight values of the surviving nodes S, Y, and Z are 1, 2, and 3 respectively, calculating that the probabilities of the nodes are 1/6,2/6, and 3/6 in turn, dividing the interval [0,1] into 6 parts in equal proportion, and obtaining three subintervals [0,1/6], [1/6,3/6], and [3/6,1] according to the selection probability of the storage node, which correspond to the nodes S, Y, and Z respectively; and generating a random number value of 5/6, wherein the random number value falls into a third subinterval, and if the random number value corresponds to a node Z, determining that the connecting node is Z.
In a possible implementation manner, if the number of the surviving nodes determined in step 102 is 1, the surviving nodes are directly used as the connecting nodes, and the weight is not required to be calculated. For example, referring to fig. 5, when the current transmission node B has target nodes H and F directly connected to each other, and only the node H is determined as a surviving node in step 102, the only surviving node H is directly determined as a connected node in step 103.
Before the above steps are executed to determine the connection node, the weight of each node in the MQTT network needs to be determined. The process of determining the weight includes, but is not limited to, step 201 and step 202.
Step 201, determining the number of direct connection nodes and the number of indirect connection nodes of each node based on the connection state between each node in the network; step 202, determining the weight of each node based on the number of the direct connection nodes and the number of the indirect connection nodes of each node.
Wherein, the self weight of each node is set to be 1, and the following formula (2) is applied in the process to determine the weight of each node:
node weight = number of directly connected nodes + number of indirectly connected nodes + node self weight (this value is 1) (2)
For example, referring to fig. 5, for node G, there are direct connection nodes I, K, L, the number of which is 3; indirect connection nodes M and K exist, and the number of the indirect connection nodes M and K is 2; the weight W of the node G G =3+3+1=6。
In a possible implementation manner, an access node to be added to the network is determined, and then the destination node is used as the current transmission node at the beginning, and the above steps 101 to 103 are executed to determine a connection node; taking the connecting node as the current transmission node, continuing to execute the steps 101-103, and determining the next connecting node; then, the next connection node is used as the current transmission node, and the steps are continuously executed. And in the same way, the method for determining the connecting node is executed circularly from the destination node, the connecting node of each current transmission node is determined, and the following optional steps 104 and/or 105 are executed until the access node is determined to be the connecting node.
104. And outputting the recorded connection nodes according to the connection sequence, and acquiring a transmission path of the message sent by the access node to the transmission node.
In the above steps, the determined name of the connection node is recorded after the connection node is determined each time, and after the access node is determined to be the connection node, the recorded name of the connection node is output according to the recorded connection sequence, so that the transmission path of the message sent by the access node to the target node is obtained.
105. And updating the connection state and the weight of each node in the network after the access node is added.
After the access node is determined as a connection node, the access node is successfully added into the MQTT network, and further, the connection state and the weight of each node in the network are changed, such as the number of direct connection nodes of the node and the number of indirect connection nodes of each node are changed; the weight of each node is updated by adding 1 to the weight of the node determined as the connection node. Illustratively, the current weight of the node R is 3, the determination task of the connection node is completed, and after the transmission path is output, the weight of the node R is increased to 4.
The embodiment of the application provides a method for determining connecting nodes based on the weight of the nodes, and the connecting nodes are determined in the surviving nodes as evenly as possible. The situation of information congestion and even information loss caused by selecting interrupted nodes or crowded nodes due to blind selection is avoided to a certain extent, the efficiency of message transmission is improved, and the quality of message transmission is ensured. Provides a new idea and method for selecting nodes in the MQTT network.
The present application also introduces the provided method for determining a connection node in connection with the following exemplary embodiments. In this exemplary embodiment, an access node and a destination node are determined, the foregoing method of determining a connection node is performed cyclically, thereby selecting a connection node constituting a transmission path, and outputting the constituted transmission path.
Referring to fig. 5, in an exemplary embodiment, there is one Broker node (Broker) and 13 other nodes a-M in the MQTT network. In the network environment, the method for determining the connection node provided by the application is utilized to determine the connection node between the access node X and the Broker node so as to obtain a transmission path between the access node X and the target node Broker, and the access node X is added into the MQTT network and communicates with the Broker.
Referring to the state of each node in the MQTT network shown in fig. 5, the number of directly connected nodes and the number of indirectly connected nodes of each node are obtained, the weight of each node in the nodes a-M is obtained by calculation according to the formula (2), and a node weight table in the network shown in the following table 1 is constructed.
TABLE 1 node weight table in a network
Node name A B C D E F G H I J K L M
Weight value
12 10 16 1 3 8 6 1 3 1 1 1 1
In one possible scenario, the method for determining connected nodes provided herein is performed assuming that all nodes a-M are alive.
Illustratively, from a destination node (Broker), based on the connection state of each node in the network, determining that target nodes directly connected with the Broker node are a, B, and C, respectively; based on the condition setting, if the states of the three target nodes A, B and C are survival states, determining that the target nodes A, B and C are survival nodes, and determining that the weights of the survival nodes A, B and C are 12, 10 and 16 in sequence based on the node weight table in the network; calculating the selection probability of the survival nodes based on the weight values of the three survival nodes, wherein the sum of the probabilities of the three survival nodes is 38, and the selection probabilities of the survival nodes A, B and C are 12/38, 10/38 and 16/38 in sequence; in a possible mode, if the falling point of the generated random numerical value in the interval corresponds to a survival node C, determining the node C as a connection node; recording the name of the node C;
determining target nodes directly connected with the node C as D, I, E and F based on the node C, determining the weight of the surviving node, and determining a connecting node F based on the weight; recording a connection node F;
continuously executing the method for determining the connection nodes based on the node F in a circulating manner, and sequentially determining the connection nodes G, I and J;
based on the connection condition of each node in the network, a target node directly connected with the node J does not exist, so that the node J is directly connected with the access node X, and the access node X is recorded as a connection node.
At this time, in response to the access node becoming the connection node, the determination work for the connection node is completed, and the loop operation is terminated. And sequentially outputting the determined names of the connection nodes according to the recorded connection sequence to obtain a transmission path Broker-C-F-G-I-J-X.
In a possible implementation manner, after the transmission path is output, the weight of the node C, F, G, I, J determined as the connection node is added by 1, and the weight of the node X is set to 1.
In a possible implementation, the above process is implemented in a computer by code programming, the name (NodeName) of the access node is input, and a transmission path is obtained between the access node and the destination node. Illustratively, the name X of the access node is input, and the direct output transmission path Broker-C-F-G-I-J-X is output. The input and output in this implementation are in the form:
Figure BDA0002922394940000121
in this scenario, since the random number generated each time is uncertain, there may be 24 cases as shown in table 2 below for the path of the access node X to send a message to the Broker in the access network.
Table 2 optional transmission paths in all node alive state
Serial number Communication path Serial number Communication path
1 Broker-A-E-J-X 2 Broker-A-E-H-X
3 Broker-A-G-I-J-X 4 Broker-A-G-I-J-X
5 Broker-A-G-K-X 6 Broker-A-G-L-X
7 Broker-A-M-X 8 Broker-A-D-X
9 Broker-B-H-X 10 Broker-B-F-G-I-J-X
11 Broker-B-F-G-I-K-X 12 Broker-B-F-G-K-X
13 Broker-B-F-G-L-X 14 Broker-B-F-L-X
15 Broker-C-D-X 16 Broker-C-I-J-X
17 Broker-C-I-K-X 18 Broker-C-E-J-X
19 Broker-C-E-H-X 20 Broker-C-F-G-I-J-X
21 Broker-C-F-G-I-K-X 22 Broker-C-F-G-K-X
23 Broker-C-F-G-L-X 24 Broker-C-F-L-X
In a possible scenario, assuming that node C and node G are in an alive state and the other nodes are alive nodes, the method for determining a connected node provided by the present application is executed to access an access node X to a network and send a message to a Broker node.
Illustratively, from the Broker node, the target nodes directly connected to the Broker node are determined to be a, B, and C, respectively, based on the connection state of each node in the network. Based on the states of the nodes in the network, if the nodes A and B are in a survival state and the node C is in an non-survival state, determining that the target nodes A and B are survival nodes, and based on the node weight value table 1 in the network, determining that the weights of the survival nodes A and B are 12 and 10 in sequence; the sum of the weights is calculated to be 22 based on the weight of the survival node, and then the selection probabilities of the survival nodes A and B are 12/22 and 10/22 in sequence; in one possible approach, node a is determined to be a connected node by determining a random number; recording a node A;
determining target nodes directly connected with the node A as D, E, G and M based on the node A; circularly executing a method for determining the connecting nodes similar to the above contents, and sequentially determining the connecting nodes E and H;
based on the connection condition of each node in the network, a target node directly connected with the node H does not exist, so that the node H is directly connected with the access node X, and the access node X is recorded as a connection node.
At this time, the access node X is added into the network, the operation of the connection node is determined to be finished, and the recorded connection node is output according to the connection sequence to obtain a path Broker-A-E-H-X.
In this scenario, the path for sending a message to the Broker in the access node X access network may have 6 cases as shown in table 3 below.
TABLE 3 optional transmission paths in node C, G non-surviving State
Serial number Communication path Serial number Communication path
1 Broker-A-E-J-X 2 Broker-A-E-H-X
3 Broker-A-M-X 4 Broker-A-D-X
5 Broker-B-H-X 6 Broker-B-F-L-X
In a possible implementation, the above process is implemented in a computer by code programming, the name (NodeName) of the access node is input, and a transmission path is obtained between the access node and the destination node. Illustratively, the name X of the access node is input, and the transmission path Broker-A-E-H-X is directly output. The input and output in this implementation are in the form:
Figure BDA0002922394940000131
in order to verify the operation effect of the embodiment of the present application, in the exemplary embodiment, 5000 times of experiments are performed respectively for the above two scenarios, and result statistics of each possible transmission path selection number shown in fig. 6 and 7 are respectively obtained, where a horizontal axis in fig. 6 and 7 represents a serial number corresponding to a transmission path that may be output, and a vertical axis represents the number of times that the transmission path is selected in the experiment process. As can be seen from the statistical chart, the method provided in the embodiment of the present application can well achieve the purpose of determining the connection node, and can also provide various transmission path selection schemes.
Referring to fig. 8, an embodiment of the present application further provides an apparatus 800 for determining a connection node, where the apparatus 800 includes:
a first determining module 801, configured to determine, based on a connection state between nodes in a network, at least one target node directly connected to a current transmission node, where the current transmission node is a node that receives a message sent by a connection node;
a second determining module 802, configured to determine, based on a state attribute of at least one target node, at least one surviving node for performing message transmission and a weight of the at least one surviving node in the at least one target node, where one surviving node corresponds to one weight;
a third determining module 803, configured to determine a connecting node among the at least one surviving node based on the weight of the at least one surviving node.
In a possible implementation manner, the third determining module 803 is configured to determine a selection probability of at least one surviving node based on a weight of the at least one surviving node; determining a connecting node among the at least one surviving node based on the selection probability of the at least one surviving node and the random number value.
In a possible implementation manner, the third determining module 803 is configured to determine, based on the weight of each surviving node in the at least one surviving node, a sum of the weights of the surviving nodes; and determining the selection probability of each survival node based on the weight value of each survival node and the sum of the weight values.
Referring to fig. 9, in a possible implementation manner, the apparatus 800 further includes a fourth determining module 804, configured to determine, based on a connection state between nodes in the network, the number of directly connected nodes and the number of indirectly connected nodes of each node; and determining the weight of each node based on the number of the direct connection nodes and the number of the indirect connection nodes of each node.
Referring to fig. 9, in one possible implementation, the apparatus 800 further includes: a fifth determining module 805, configured to, based on a connection state between nodes in the network, respond to that there is no target node directly connected to the current transmission node, directly connect the current transmission node with the access node, and determine the access node as a connection node, where the access node is a node that sends a message to the target node in the network.
Referring to fig. 9, in one possible implementation, the apparatus 800 further includes: an output module 806, configured to, after determining the access node as a connection node, output the recorded connection node according to the connection sequence, and acquire a transmission path through which the access node sends the message to the target node.
Referring to fig. 9, in one possible implementation, the apparatus 800 further includes: an updating module 807, configured to update the connection state and weight of each node in the network after joining the access node.
In the above-mentioned apparatuses provided in fig. 8 and fig. 9, when the functions of the apparatuses are implemented, the division of the above-mentioned functional modules is merely exemplified, and in practical applications, the functions may be distributed by different functional modules according to needs, that is, the internal structure of the apparatus may be divided into different functional modules to implement all or part of the functions described above. In addition, the apparatus and method embodiments provided by the above embodiments belong to the same concept, and specific implementation processes thereof are described in the method embodiments for details, which are not described herein again.
Embodiments of the present application provide a computer-readable storage medium, in which at least one program code is stored, where the program code is loaded and executed by a processor to implement any method for determining a connection node as provided in the method embodiments.
Alternatively, the computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a Compact Disc Read-Only Memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, a computer program or a computer program product is also provided, in which at least one computer instruction is stored, the at least one computer instruction being loaded and executed by a processor to cause a computer to implement any of the above methods for determining a connection node.
In an exemplary embodiment, a computer device is also provided, the computer device comprising a processor and a memory, the memory having at least one computer program stored therein. The at least one computer program is loaded and executed by one or more processors to implement any of the above-described methods of determining a connected node.
Fig. 10 is a schematic structural diagram of a computer device according to an embodiment of the present application, where the computer device 1000 may generate a relatively large difference due to a difference in configuration or performance, and may include one or more processors (CPUs) 1001 and one or more memories 1002, where the one or more memories 1002 store at least one program instruction, and the at least one program instruction is loaded and executed by the one or more processors 1001 to implement the method for determining a connection node according to the method embodiments described above. Certainly, the computer device 1000 may further have components such as a wired or wireless network interface, a keyboard, and an input/output interface, so as to perform input and output, and the computer device 1000 may further include other components for implementing device functions, which are not described herein again.
It should be understood that, in the embodiments of the present application, the size of the serial number of each process does not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
The term "at least one" in this application means one or more, and the term "plurality" in this application means two or more.
It is to be understood that the terminology used in the description of the various described examples herein is for the purpose of describing particular examples only and is not intended to be limiting. As used in the description of the various described examples and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It will be further understood that the terms "comprises," "comprising," "includes," and/or "including," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should be understood that determining B from a does not mean determining B from a alone, but may also be determined from a and/or other information.
It is also to be understood that the terms "if" and "if" may be interpreted to mean "when" ("where" or "upon") or "in response to a determination" or "in response to a detection". Similarly, the phrase "if it is determined," or "if [ a stated condition or event ] is detected," may be interpreted to mean "upon determining," or "in response to determining," or "upon detecting [ a stated condition or event ], or" in response to detecting [ a stated condition or event ] ", depending on the context.
It should also be appreciated that reference throughout this specification to "one embodiment," "an embodiment," "one possible implementation" means that a particular feature, structure, or characteristic described in connection with the embodiment or implementation is included in at least one embodiment of the present application. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" or "one possible implementation" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
The above description is only exemplary of the application and should not be taken as limiting the application, and any modifications, equivalents, improvements and the like that are made within the spirit and principle of the application should be included in the protection scope of the application.

Claims (8)

1. A method of determining a connecting node, the method comprising:
determining the number of direct connection nodes and the number of indirect connection nodes of each node based on the connection state between each node in the network;
calculating the number of the direct connection nodes, the number of the indirect connection nodes and the sum of the weight of each node, and taking the sum as the weight of each node;
determining at least one target node directly connected with a current transmission node based on the connection state among nodes in the network, wherein the current transmission node is a node for receiving a message sent by a connection node;
determining at least one alive node for message transmission and a weight value of the at least one alive node in the at least one target node based on the state attribute of the at least one target node, wherein one alive node corresponds to one weight value;
determining a selection probability of the at least one surviving node based on the weight of the at least one surviving node; dividing any interval according to a proportion based on the selection probability of at least one surviving node to obtain at least one subinterval with the same number as the surviving nodes, wherein any subinterval corresponds to one surviving node, and the proportion of any subinterval in any interval is the same as the selection probability of the surviving node corresponding to any subinterval;
and generating a random number value, and determining the surviving node corresponding to the subinterval to which the drop point position belongs as a connecting node according to the drop point position of the random number.
2. The method according to claim 1, wherein the determining the selection probability of the at least one surviving node based on the weight of the at least one surviving node comprises:
determining the sum of the weights of all the at least one survival node based on the weights of all the survival nodes;
and determining the selection probability of each survival node based on the weight of each survival node and the sum of the weights.
3. The method of claim 1 or 2, further comprising:
and responding to the absence of a target node directly connected with the current transmission node based on the connection state among the nodes in the network, directly connecting the current transmission node with an access node, and determining the access node as the connection node, wherein the access node is a node for sending a message to a target node in the network.
4. The method of claim 3, wherein after determining the access node as the connecting node, further comprising:
and outputting the recorded connection nodes according to the connection sequence, and acquiring a transmission path of the message sent by the access node to the target node.
5. The method of claim 4, further comprising:
and updating the connection state and the weight of each node in the network after the access node is added.
6. An apparatus for determining a connection node, the apparatus comprising:
a fourth determining module, configured to determine, based on a connection state between nodes in a network, the number of direct connection nodes and the number of indirect connection nodes of each node; calculating the number of the direct connection nodes, the number of the indirect connection nodes and the sum of the weight of each node, and taking the sum as the weight of each node;
a first determining module, configured to determine, based on a connection state between nodes in the network, at least one target node directly connected to a current transmission node, where the current transmission node is a node that receives a message sent by a connection node;
a second determining module, configured to determine, based on the state attribute of the at least one target node, at least one surviving node performing message transmission and a weight of the at least one surviving node in the at least one target node, where one surviving node corresponds to one weight;
a third determining module, configured to determine a selection probability of the at least one surviving node based on the weight of the at least one surviving node; dividing any interval according to a proportion based on the selection probability of at least one surviving node to obtain at least one subinterval with the same number as the surviving nodes, wherein any subinterval corresponds to one surviving node, and the proportion of any subinterval in any interval is the same as the selection probability of the surviving node corresponding to any subinterval; and generating a random number value, and determining the surviving node corresponding to the subinterval to which the drop point position belongs as a connecting node according to the drop point position of the random number.
7. A computer device comprising a processor and a memory, the memory having at least one computer program stored therein; the at least one computer program is loaded and executed by one or more processors mentioned above to cause a computer to implement the method of determining a connection node of any one of claims 1 to 5.
8. A computer-readable storage medium, having at least one program code stored therein, the program code being loaded and executed by a processor to cause a computer to implement the method of determining a connection node according to any one of claims 1 to 5.
CN202110121426.2A 2021-01-28 2021-01-28 Method, device and equipment for determining connection node and computer readable storage medium Active CN112995274B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110121426.2A CN112995274B (en) 2021-01-28 2021-01-28 Method, device and equipment for determining connection node and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110121426.2A CN112995274B (en) 2021-01-28 2021-01-28 Method, device and equipment for determining connection node and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN112995274A CN112995274A (en) 2021-06-18
CN112995274B true CN112995274B (en) 2023-03-21

Family

ID=76345790

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110121426.2A Active CN112995274B (en) 2021-01-28 2021-01-28 Method, device and equipment for determining connection node and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN112995274B (en)

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1883184A1 (en) * 2006-07-28 2008-01-30 NTT DoCoMo, Inc. Method and apparatus for routing a message
CN101552719A (en) * 2008-04-01 2009-10-07 华为技术有限公司 Routing selection method and routing selection device
CN111740915B (en) * 2020-08-05 2020-12-11 百度在线网络技术(北京)有限公司 Neighbor node determination method, device, equipment and storage medium
CN112054878B (en) * 2020-08-18 2023-10-13 中钞信用卡产业发展有限公司杭州区块链技术研究院 Block chain-based data transmission method, device, equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于主客观赋权的多属性空间节点选择算法;戴翠琴等;《计算机应用》;20171226(第04期);1-6 *

Also Published As

Publication number Publication date
CN112995274A (en) 2021-06-18

Similar Documents

Publication Publication Date Title
JP7174719B2 (en) Stochastic Relays for Efficient Propagation in Blockchain Networks
Kim et al. An efficient resource allocation approach based on a genetic algorithm for composite services in IoT environments
US8065503B2 (en) Iteratively processing data segments by concurrently transmitting to, processing by, and receiving from partnered process
US20220067063A1 (en) Apparatus and method for adaptively managing sharded blockchain network based on deep q network
CN112119620B (en) System and method for propagating data packets in a network of nodes
US11157320B2 (en) Optimizing runtime environments
CN111431730B (en) Service processing method, system, computer equipment and readable medium
CN112672382B (en) Hybrid collaborative computing unloading method and device, electronic equipment and storage medium
Elsässer et al. The power of memory in randomized broadcasting
Du et al. Biecs: A blockchain-based intelligent edge cooperation system for latency-sensitive services
CN112995274B (en) Method, device and equipment for determining connection node and computer readable storage medium
US10938960B2 (en) System and method for implementing augmented object members for remote procedure call
Haeupler et al. Optimal gossip with direct addressing
Houimli et al. Performance analysis of internet of things application layer protocol
WO2023175381A1 (en) Iterative training of collaborative distributed coded artificial intelligence model
CN110928692B (en) Task processing method and device and electronic equipment
KR20230075456A (en) Operation of Distributed Deterministic Networks
Duchon et al. Optimal randomized self-stabilizing mutual exclusion on synchronous rings
CN107342942B (en) Information transmission method and device for multi-node controller cluster
CN111611068A (en) Data writing method in distributed system, server and client
US11748281B2 (en) Remote memory access using memory address templates
Król et al. Structural Performance Evaluation of Multi-Agent Systems.
Khachumov et al. Combinatorial problem solving method by allocating resources.
US11768722B2 (en) Method for inter-process communication between at least two processes
WO2022236948A1 (en) Fault-tolerant collaborative decision-making method applicable to edge internet-of-things agent apparatus

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant