[0039] Example two
[0040] Reference figure 2 , Shows a flow chart of the steps of a transmission path selection method according to the second embodiment of the present invention.
[0041] The transmission path selection method provided by the embodiment of the present invention includes the following steps:
[0042] Step 201: For each transmission path, determine the number of first heartbeat packets received by the storage node in each transmission path within a preset time.
[0043] Among them, the center jump packet of the transmission path sequentially passes through the collection node, the forwarding node, and the storage node.
[0044] It should be noted that the preset time can be set to 1s, 2s, 3s, etc., and no specific settings are made for this.
[0045] Multiple transmission paths are stored in the collection node, and the number of first heartbeat packets received by the storage node from the forwarding node in the transmission path is acquired and the number of first heartbeat packets is acquired.
[0046] Step 202: For each transmission path, calculate the first availability value corresponding to the transmission path through a first formula.
[0047] The first formula is: the first availability value=the number of first heartbeat packets/theoretical value of the number of heartbeat packets received by the storage node within a preset time.
[0048] According to the number of received first heartbeat packets, the first availability value of each transmission path is calculated through the first formula.
[0049] For example: Suppose there is a collection node A i , Transmission path P 1 ~P n , Storage node C. Collection node A i P is stored in 1 ~P n The address of the forwarding node. When the system runs for a period of time, the availability of each transmission path can be calculated through algorithms. For transmission path P i , Assuming its first availability value is h i , The algorithm is as follows:
[0050] First availability value h i = The theoretical value of the number of forwarding node heartbeat packets received by the storage node C within the preset fixed time range/the number of forwarding node heartbeat packets received by the storage node within the preset fixed time range.
[0051] Step 203: For each transmission path, obtain the number of second heartbeat packets received by the forwarding node in each transmission path.
[0052] After obtaining the first availability value, obtain the number of second heartbeat packets received by the forwarding node from the collection node in each path.
[0053] Step 204: For each transmission path, calculate a second availability value corresponding to the transmission path through a second formula.
[0054] The second formula is: second availability value=number of second heartbeat packets/theoretical value of the number of heartbeat packets received by the forwarding node within a preset time.
[0055] When the theoretical value of the number of heartbeat packets received by the forwarding node within the preset time is 0, the second availability value is 1.
[0056] Assume that for transmission path P i , Collection node A i To transmission path P j The second availability value of is a ij , Then there is a ij = The forwarding node in the transmission path receives the collection node A within the preset fixed time range i Number of node heartbeat packets forwarded/Collect node A within a preset fixed time range i The theoretical value of the number of node heartbeat packets forwarded by the forwarding node.
[0057] Through step 201 to step 204, the first available value and the second available value corresponding to each transmission path have been calculated.
[0058] Step 205: For each transmission path, multiply the first availability value and the second availability value corresponding to the transmission path, and use the obtained product as the third availability value corresponding to the transmission path.
[0059] For collection node A i In other words, the algorithm for selecting the transmission path is as follows:
[0060] Node A will be collected i The known transmission path P 1 ~P n By weight (third availability value w ij = Second availability value a ij *The first availability value h i ) Sort from largest to smallest or from smallest to largest.
[0061] Step 206: Select the transmission path corresponding to the maximum value of the third availability value corresponding to each transmission path for data transmission.
[0062] Take each third availability value w ij The largest third availability value w ij Corresponding P j As a transmission path for data transmission or forwarding.
[0063] Specifically, when the collection node A i To forwarding node P j Transmission path or P j When a failure occurs on the transmission path, its corresponding a ij Value or h j The value will decrease, and then its corresponding third availability value will decrease, so that it will not be selected in subsequent transmission selections.
[0064] Specifically, if it is the second availability value a ij Leads to the second availability value a ij Tend to choose a closer or more reliable transmission path for forwarding or data transmission.
[0065] If it is the first availability value h j As a result, the transmission path is damaged or abnormal, and the traffic on the transmission path will tend to 0. After restoration or manual repair, it will return to normal without manual intervention, and the transmission path will enter multiple transmission paths Selection process.
[0066] Step 207: When adding a new transmission path, calculate the third availability value of the new transmission path.
[0067] The first availability value of the new transmission path is calculated according to the calculation formula of the first availability value, and the first availability value is used as the third availability value of the new transmission path.
[0068] When adding a new transmission path For the newly added transmission path, set to any collection point A i In other words, the second availability value a ij Is 1, the first availability value h j It can be calculated by the first availability value=the number of first heartbeat packets/theoretical value of the number of heartbeat packets received by the storage node within the preset time. Since the second availability value is 1, the third availability value is the first availability value. The newly added transmission path can be selected to depend on the initially calculated h j value.
[0069] Step 208: Compare the third availability value of the new transmission path with the third availability value of the selected transmission path.
[0070] The currently selected transmission path is compared with the third availability value of the new transmission path.
[0071] Step 209: Select a transmission path corresponding to the maximum value of the third availability value of the new transmission path and the third availability value corresponding to the selected transmission path for data transmission.
[0072] When the third availability value of the currently selected transmission path is greater than the third availability value of the new transmission path, the currently selected transmission path is still selected. When the third availability value of the currently selected transmission path is less than the third availability value of the new transmission path, the new transmission path is selected for data transmission or forwarding.
[0073] According to a method for selecting a transmission path provided by an embodiment of the present invention, for each transmission path, the number of first heartbeat packets received by a storage node in each transmission path within a preset time is determined; according to the number of first heartbeat packets, each The first availability value of each transmission path; for each transmission path, obtain the number of second heartbeat packets received by the forwarding node in each transmission path; calculate the second availability value of each transmission path according to the number of second heartbeat packets ; For each transmission path, determine the third availability value corresponding to the transmission path according to the first availability value and the second availability value corresponding to the transmission path; select the transmission corresponding to the maximum value of the third availability value corresponding to each transmission path Path for data transmission. It can be seen that through the method for selecting a transmission path provided by the embodiment of the present invention, the availability value of each transmission path is calculated, and the transmission path with a high availability value is used as the current transmission path, which can ensure the availability and availability of the selected transmission path. Reliability. Using the above methods can reduce data loss as much as possible and enhance user experience.