Clock synchronization method, node and system
By constructing a network topology structure associated with the spanning tree, the problem of large clock synchronization errors in the cluster system is solved, achieving higher precision clock synchronization and improving the reliability and security of the cluster system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUAWEI TECH CO LTD
- Filing Date
- 2021-12-23
- Publication Date
- 2026-04-17
AI Technical Summary
In existing technologies, the clock synchronization network topology of a cluster system is not necessarily optimal, resulting in large clock synchronization errors and affecting synchronization accuracy.
By constructing a network topology, the control nodes build the network topology based on the first spanning tree and the target strategy, so that the loop length of any loop is associated with the number of levels of the spanning tree, ensuring that the cumulative sum of the loop lengths of all loops is maximized, thereby improving the accuracy of clock synchronization.
It improves the accuracy of clock synchronization in the cluster system, ensuring the reliability and security of data sharing and inter-device coordination.
Smart Images

Figure CN116346269B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of clock synchronization communication, and more specifically, to a clock synchronization method, node, and system. Background Technology
[0002] With the development of high-performance computing technology and services, system scale is constantly expanding, exhibiting cluster characteristics, meaning that a cluster network composed of multiple host devices is needed to complete business operations. In cluster system applications, clock synchronization is an essential component, providing reliability and security guarantees for functions such as data sharing, inter-device coordination, and time-specific interactions. For example, financial systems need to process transactions according to their arrival time order.
[0003] In related technologies, a technical solution is provided to synchronize the local time of all hosts in a cluster system with a reference clock based on a given network topology. However, in this implementation, the network topology used for clock synchronization is given, and may not be the optimal topology for the cluster system to be synchronized. This results in significant synchronization errors when using this method to synchronize the cluster system's clock, thus affecting the accuracy of clock synchronization. Summary of the Invention
[0004] This application provides a clock synchronization method, node, and system, which helps to improve the accuracy of clock synchronization results.
[0005] Firstly, a clock synchronization method is provided, applied to a cluster system comprising N nodes, including a control node and N-1 network nodes, where N is a positive integer greater than or equal to 2. The method includes: the control node constructing a network topology based on a first spanning tree and a target strategy; the first spanning tree having the network node containing the reference clock as its root node; all nodes in the first spanning tree except the root node having a mapping relationship with the N-1 network nodes; the target strategy indicating the method of connecting target nodes in the first spanning tree; each node in the first spanning tree being at least one node in at least one loop included in the network topology; the loop length of any loop included in the network topology being associated with the number of levels in the first spanning tree and the target strategy; and the control node synchronizing the clocks of the N-1 network nodes based on the reference clock and the network topology.
[0006] In the above technical solution, the network topology used for clock synchronization is constructed by the control node based on the first spanning tree and the target policy. The loop length of any loop included in this network topology is related to the number of levels in the first spanning tree and the target policy; that is, any loop in the network topology includes nodes from each level of the first spanning tree, maximizing the cumulative sum of the loop lengths of all loops in the network topology. It is understood that the larger the cumulative sum of the loop lengths of all loops in the network topology, the more accurate the clock synchronization result. Based on this, when the control node uses this network topology to synchronize the clocks of N-1 network nodes in the cluster system, it helps to improve the accuracy of the clock synchronization result.
[0007] In one possible design, the root node of the first spanning tree has K child nodes, where K is an integer greater than or equal to 2. The first spanning tree includes a first subtree and a second subtree, which have no intersection. The root node of any subtree is a child node of the root node of the first spanning tree. The first subtree includes K-1 leaf nodes, and the second subtree includes K-1 leaf nodes. The control node constructs a network topology based on the first spanning tree and the target strategy, including: when the first leaf node and the second leaf node satisfy a first preset condition, the control node connects the first leaf node and the second leaf node to construct the network topology. The first leaf node is a leaf node of the first subtree, and the second leaf node is a leaf node of the second subtree. The target node includes the first leaf node and the second leaf node.
[0008] In another possible design, satisfying the first preset condition includes: the difference in index between the two leaf nodes corresponding to any two subtrees in the first spanning tree is equal to an integer multiple of K-1.
[0009] In another possible design, the length of any loop in the network topology is (2×d+1), where d represents the number of levels in the first spanning tree, and d is an integer. The distance from any node in the first spanning tree to the root node of the first spanning tree is the number of levels, and "1" represents the number of hops from the first leaf node to the second leaf node.
[0010] In another possible design, the number of loops in the network topology is equal to the number of connections made to the target node in the first spanning tree. The result of rounding is that any loop in the network topology includes the root node of the first spanning tree, the first leaf node, the second leaf node, at least one first intermediate node and at least one second intermediate node, the at least one first intermediate node is a child node of the root node of the first spanning tree and the at least one first intermediate node is a parent node of the first leaf node, the at least one second intermediate node is a child node of the root node of the first spanning tree and the at least one second intermediate node is a parent node of the second leaf node.
[0011] In another possible design, the root node of the first spanning tree has K child nodes, where K is an integer greater than or equal to 2. The first spanning tree includes a first subtree, a second subtree, and a third subtree. No two subtrees of the first, second, and third subtrees intersect. The root node of any subtree is a child node of the root node of the first spanning tree. The first subtree includes K-1 leaf nodes, the second subtree includes K-1 leaf nodes, and the third subtree includes K-2 leaf nodes. The control node constructs a network topology based on the first spanning tree and the target strategy, including: if the first leaf node and the second leaf node satisfy a first preset condition, the control node connects the first leaf node and the second leaf node to construct the network topology. The first leaf node is a leaf node of the first subtree. The second leaf node is a leaf node of the second subtree, and the target node includes the first leaf node and the second leaf node; when the leaf node of the third subtree and the third leaf node satisfy the second preset condition, the control node connects the third leaf node to the root node of the third subtree to construct the network topology, where the third leaf node is a leaf node of the second subtree, and the target node also includes the third leaf node and the root node of the third subtree; when the leaf node of the third subtree and the fourth leaf node satisfy the second preset condition, and when the leaf node of the third subtree and the fifth leaf node satisfy the second preset condition, the control node connects the fourth leaf node to the fifth leaf node to construct the network topology, where the fourth leaf node is a leaf node of the first subtree, and the fifth leaf node is a leaf node of the second subtree.
[0012] In another possible design, satisfying the first preset condition includes: the difference between the indexes of the two leaf nodes corresponding to any two subtrees in the first spanning tree is equal to an integer multiple of K-1; satisfying the second preset condition includes: the difference between the index of any leaf node in the third subtree and the index of the leaf node in the subtrees other than the third subtree in the first spanning tree is not equal to an integer multiple of K-1, and the leaf nodes of the subtrees other than the third subtree in the first spanning tree include the third leaf node, the fourth leaf node, and the fifth leaf node.
[0013] In another possible design, the network topology includes a second loop and a pair The result takes an integer number of first cycles. Any first cycle is a cycle that includes the root node, the first leaf node, and the second leaf node of the first spanning tree. The length of any first cycle is (2×d+1). The second cycle is a cycle that includes the root node, the third leaf node, and the root node of the third subtree of the first spanning tree. The length of the second cycle is 2×d, where d represents the number of levels in the first spanning tree. d is an integer. The distance from any node in the first spanning tree to the root node of the first spanning tree is the number of levels. "1" represents the number of hops from the first leaf node to the second leaf node.
[0014] In another possible design, the degree of any node in the network topology, excluding the leaf nodes of the third subtree, the fourth leaf node, and the fifth leaf node, is K. The degree of any node is K, indicating that the node is connected to any K nodes in the network topology. The degree of any node in the third subtree, the fourth leaf node, and the fifth leaf node is K-1, indicating that the node is connected to any K-1 nodes in the network topology. Any two nodes in the network topology that are connected represent two network nodes that send data packets to each other. These data packets are used to obtain clock offset information between the two network nodes.
[0015] In another possible design, each node in the network topology has M connections to the M nodes in the network topology. Any two nodes in the network topology with connections represent two network nodes that send data packets to each other. These data packets are used to obtain clock offset information between the two network nodes, where M = K and N ≥ K + 1, or M = K - 1 and N ≥ K. Before the control node performs clock synchronization on the N-1 network nodes based on the reference clock and the network topology, the method further includes: the control node coloring the network topology according to the edge coloring method of the graph, so that any two edges of all edges corresponding to any node in the network topology have different colors; the control node assigning time channels to the N-1 network nodes according to the coloring result, so that any network node is assigned M time channels, any two of the M time channels are different, and the M time channels correspond one-to-one with the M connections; and the control node sending a third message, which is used to indicate the M time channels assigned to the network node.
[0016] In another possible design, before the control node performs clock synchronization on the N-1 network nodes according to the reference clock and the network topology, the method further includes: the control node receiving a first message sent by a first network node, which is any one of the N-1 network nodes, the first message indicating the end of a first time slice; the control node broadcasting a second message to the N-1 network nodes, the second message indicating the end of the first time slice and the start of a second time slice, the first time slice being different from the second time slice.
[0017] In another possible design, the degree of any node in the network topology is K. The degree of any node being K indicates that the node is connected to any K nodes in the network topology. Any two nodes in the network topology that are connected indicate that the two network nodes corresponding to the two nodes send data packets to each other. The data packets are used to obtain the clock offset information between the two network nodes.
[0018] In another possible design, the network topology includes P loops, where P equals the number of loops. The result is rounded to an integer. The number of child nodes of the root node of the first spanning tree is K, where K is an integer greater than or equal to 2. The control node performs clock synchronization on the N-1 network nodes according to the reference clock and the network topology, including: the control node obtains P first clock offset information corresponding to the P loops, each first clock offset information including clock offset information between two network nodes corresponding to two connected nodes in the corresponding loop; the control node processes the P loops and the P first clock offset information using the least squares method to obtain P second clock offset information corresponding to the P loops, each second clock offset information including clock offset information between two network nodes corresponding to two connected nodes in the corresponding loop, and the sum of the offset values of all clock offset information included in each second clock offset information is zero, and the clock offset information between two network nodes corresponding to two nodes with the same connection relationship in different loops is the same; the control node performs clock synchronization on the N-1 network nodes according to the P loops, the P second clock offset information, and the reference clock.
[0019] In another possible design, before the control node performs clock synchronization on the N-1 network nodes based on the reference clock and the network topology, the design further includes: the control node sending N-1 probe tasks to the N-1 network nodes, with each of the N-1 network nodes corresponding to one of the N-1 probe tasks. The first probe task in the N-1 probe tasks corresponds to the first network node in the N-1 network nodes. The first probe task is used to instruct the first network node to obtain the clock offset information of the first network node relative to the second network node. The N-1 network nodes include the first network node and the second network node, which are different from each other. The network topology is used to indicate the connection relationship between the first network node and the second network node.
[0020] Secondly, a clock synchronization method is provided, which is applied to a cluster system comprising N nodes, including a control node and N-1 network nodes, where N is a positive integer greater than or equal to 2. The method includes: a first network node receiving a first probe task sent by the control node, the first probe task instructing the first network node to acquire clock offset information of the first network node relative to a second network node, the N-1 network nodes including the first network node and the second network node, wherein the first network node is different from the second network node; the first network node sending clock offset information to the control node, the clock offset information representing the clock offset information of the first network node relative to the second network node.
[0021] Optionally, the first probing task is associated with a network topology, which can be constructed by the control node based on a first spanning tree and a target policy. This network topology indicates the connection relationship between the first network node and the second network node. The network topology is constructed based on the first spanning tree and the target policy. The first spanning tree has the network node containing the reference clock as its root node. All nodes in the first spanning tree, except the root node, have mapping relationships with the N-1 network nodes. The target policy indicates the method of connecting the target nodes in the first spanning tree. Each node in the first spanning tree is at least a node in at least one loop included in the network topology. The loop length of any loop included in the network topology is associated with the number of levels in the first spanning tree and the target policy. Specifically, any loop included in the network topology includes nodes at each level of the first spanning tree, such that the cumulative sum of the loop lengths of all loops included in the network topology is maximized. It is understood that the larger the cumulative sum of the loop lengths of all loops included in the network topology, the more accurate the clock synchronization result.
[0022] In the above technical solution, the first network node receives a first probe task sent by the control node and sends the clock offset information obtained from the first probe task to the control node, enabling the control node to perform clock synchronization using the clock offset information. When the first probe task is associated with the network topology, it helps to improve the accuracy of the clock synchronization results.
[0023] In one possible design, the root node of the first spanning tree has K child nodes, where K is an integer greater than or equal to 2. The first spanning tree includes a first subtree and a second subtree, which have no intersection. The root node of any subtree is a child node of the root node of the first spanning tree. The first subtree includes K-1 leaf nodes, and the second subtree includes K-1 leaf nodes. The first leaf node and the second leaf node satisfy a first preset condition. The first leaf node and the second leaf node are connected to construct the network topology. The first leaf node is a leaf node of the first subtree, and the second leaf node is a leaf node of the second subtree. The target node includes the first leaf node and the second leaf node.
[0024] In another possible design, satisfying the first preset condition includes: the difference in index between the two leaf nodes corresponding to any two subtrees in the first spanning tree is equal to an integer multiple of K-1.
[0025] In another possible design, the length of any loop in the network topology is (2×d+1), where d represents the number of levels in the first spanning tree, and d is an integer. The distance from any node in the first spanning tree to the root node of the first spanning tree is the number of levels, and "1" represents the number of hops from the first leaf node to the second leaf node.
[0026] In another possible design, the number of loops in the network topology is equal to the number of connections made to the target node in the first spanning tree. The result of rounding is that any loop in the network topology includes the root node of the first spanning tree, the first leaf node, the second leaf node, at least one first intermediate node and at least one second intermediate node, the at least one first intermediate node is a child node of the root node of the first spanning tree and the at least one first intermediate node is a parent node of the first leaf node, the at least one second intermediate node is a child node of the root node of the first spanning tree and the at least one second intermediate node is a parent node of the second leaf node.
[0027] In another possible design, the root node of the first spanning tree has K child nodes, where K is an integer greater than or equal to 2. The first spanning tree includes a first subtree, a second subtree, and a third subtree. No two subtrees of the first, second, and third subtrees intersect. The root node of any subtree is a child node of the root node of the first spanning tree. The first subtree includes K-1 leaf nodes, the second subtree includes K-1 leaf nodes, and the third subtree includes K-2 leaf nodes. The first leaf node and the second leaf node satisfy a first preset condition and are connected to construct the network topology. The first leaf node is a leaf node of the first subtree, and the second leaf node... The target node includes the first leaf node and the second leaf node; the leaf node of the third subtree satisfies the second preset condition, and the third leaf node is connected to the root node of the third subtree to construct the network topology. The third leaf node is the leaf node of the second subtree, and the target node also includes the third leaf node and the root node of the third subtree; the leaf node of the third subtree satisfies the second preset condition, and the leaf node of the third subtree satisfies the second preset condition, and the fourth leaf node is connected to the fifth leaf node to construct the network topology. The fourth leaf node is the leaf node of the first subtree, and the fifth leaf node is the leaf node of the second subtree.
[0028] In another possible design, satisfying the first preset condition includes: the difference between the indexes of the two leaf nodes corresponding to any two subtrees in the first spanning tree is equal to an integer multiple of K-1; satisfying the second preset condition includes: the difference between the index of any leaf node in the third subtree and the index of the leaf node in the subtrees other than the third subtree in the first spanning tree is not equal to an integer multiple of K-1, and the leaf nodes of the subtrees other than the third subtree in the first spanning tree include the third leaf node, the fourth leaf node, and the fifth leaf node.
[0029] In another possible design, the network topology includes a second loop and a pair The result takes an integer number of first cycles. Any first cycle is a cycle that includes the root node, the first leaf node, and the second leaf node of the first spanning tree. The length of any first cycle is (2×d+1). The second cycle is a cycle that includes the root node, the third leaf node, and the root node of the third subtree of the first spanning tree. The length of the second cycle is 2×d, where d represents the number of levels in the first spanning tree. d is an integer. The distance from any node in the first spanning tree to the root node of the first spanning tree is the number of levels. "1" represents the number of hops from the first leaf node to the second leaf node.
[0030] In another possible design, the degree of any node in the network topology, excluding the leaf nodes of the third subtree, the fourth leaf node, and the fifth leaf node, is K. The degree of any node is K, indicating that the node is connected to any K nodes in the network topology. The degree of any node in the third subtree, the fourth leaf node, and the fifth leaf node is K-1, indicating that the node is connected to any K-1 nodes in the network topology. Any two nodes in the network topology that are connected represent two network nodes that send data packets to each other. These data packets are used to obtain clock offset information between the two network nodes.
[0031] In another possible design, each node in the network topology has M connections to the M nodes in the network topology. Any two nodes in the network topology that have a connection represent two network nodes that send data packets to each other. The data packets are used to obtain clock offset information between the two network nodes, where M = K and N ≥ K + 1, or M = K - 1 and N ≥ K. Before the first network node sends the clock offset information to the control node, the method further includes: the first network node receiving a third message, which indicates the M time channels allocated to the first network node. Any two of the M time channels are different, and the M time channels correspond one-to-one with the M connections.
[0032] In another possible design, before the first network node sends clock offset information to the control node, the method further includes: the first network node sending a first message to the control node and all network nodes other than the first network node among the N-1 network nodes, using a second spanning tree as the path, the second spanning tree having the first network node as the root node, the first message indicating the end of a first time slice; and / or the first network node receiving a second message sent by the control node, the second message indicating the end of the first time slice and the start of a second time slice, the first time slice being different from the second time slice.
[0033] In another possible design, the degree of any node in the network topology is K. The degree of any node being K indicates that the node is connected to any K nodes in the network topology. Any two nodes in the network topology that are connected indicate that the two network nodes corresponding to the two nodes send data packets to each other. The data packets are used to obtain the clock offset information between the two network nodes.
[0034] In another possible design, before the first network node sends the clock offset information to the control node, the method further includes: the first network node determining the clock offset information based on a first data packet and a second data packet, wherein the first data packet carries a first timestamp and a second timestamp, and the second data packet carries a third timestamp and a fourth timestamp, wherein the first timestamp is used to indicate a first moment when the first network node sends the first data packet to the second network node, the second timestamp is used to indicate a second moment when the second network node receives the first data packet, the third timestamp is used to indicate a third moment when the second network node sends the second data packet to the first network node, and the fourth timestamp is used to indicate a fourth moment when the first network node receives the second data packet.
[0035] Thirdly, a control node is provided, which is applied in a cluster system. The cluster system further includes N-1 network nodes, where N is a positive integer greater than or equal to 2. The control node includes: a processing unit configured to construct a network topology based on a first spanning tree and a target strategy. The first spanning tree has the network node containing the reference clock as its root node. All nodes in the first spanning tree except the root node are mapped to the N-1 network nodes. The target strategy indicates the method of connecting target nodes in the first spanning tree. Each node in the first spanning tree is at least a node in at least one loop included in the network topology. The loop length of any loop included in the network topology is associated with the number of levels in the first spanning tree and the target strategy. The processing unit is also configured to perform clock synchronization on the N-1 network nodes based on the reference clock and the network topology.
[0036] In one possible design, the root node of the first spanning tree has K child nodes, where K is an integer greater than or equal to 2. The first spanning tree includes a first subtree and a second subtree, which have no intersection. The root node of any subtree is a child node of the root node of the first spanning tree. The first subtree includes K-1 leaf nodes, and the second subtree includes K-1 leaf nodes. The processing unit is further configured to: connect the first leaf node and the second leaf node to construct the network topology when the first leaf node and the second leaf node satisfy a first preset condition. The first leaf node is a leaf node of the first subtree, and the second leaf node is a leaf node of the second subtree. The target node includes the first leaf node and the second leaf node.
[0037] In another possible design, satisfying the first preset condition includes: the difference in index between the two leaf nodes corresponding to any two subtrees in the first spanning tree is equal to an integer multiple of K-1.
[0038] In another possible design, the length of any loop in the network topology is (2×d+1), where d represents the number of levels in the first spanning tree, and d is an integer. The distance from any node in the first spanning tree to the root node of the first spanning tree is the number of levels, and "1" represents the number of hops from the first leaf node to the second leaf node.
[0039] In another possible design, the number of loops in the network topology is equal to the number of connections made to the target node in the first spanning tree. The result of rounding is that any loop in the network topology includes the root node of the first spanning tree, the first leaf node, the second leaf node, at least one first intermediate node and at least one second intermediate node, the at least one first intermediate node is a child node of the root node of the first spanning tree and the at least one first intermediate node is a parent node of the first leaf node, the at least one second intermediate node is a child node of the root node of the first spanning tree and the at least one second intermediate node is a parent node of the second leaf node.
[0040] In another possible design, the root node of the first spanning tree has K child nodes, where K is an integer greater than or equal to 2. The first spanning tree includes a first subtree, a second subtree, and a third subtree. No two subtrees of the first, second, and third subtrees intersect. The root node of any subtree is a child node of the root node of the first spanning tree. The first subtree includes K-1 leaf nodes, the second subtree includes K-1 leaf nodes, and the third subtree includes K-2 leaf nodes. The processing unit is further configured to: connect the first leaf node and the second leaf node if the first leaf node and the second leaf node satisfy a first preset condition to construct the network topology. The first leaf node is a leaf node of the first subtree, and the second leaf node is a child node of the first subtree. The target node includes the first leaf node and the second leaf node. When the leaf node of the third subtree and the third leaf node satisfy the second preset condition, the third leaf node is connected to the root node of the third subtree to construct the network topology. The third leaf node is a leaf node of the second subtree. The target node also includes the third leaf node and the root node of the third subtree. When the leaf node of the third subtree and the fourth leaf node satisfy the second preset condition, and when the leaf node of the third subtree and the fifth leaf node satisfy the second preset condition, the fourth leaf node is connected to the fifth leaf node to construct the network topology. The fourth leaf node is a leaf node of the first subtree, and the fifth leaf node is a leaf node of the second subtree.
[0041] In another possible design, satisfying the first preset condition includes: the difference between the indexes of the two leaf nodes corresponding to any two subtrees in the first spanning tree is equal to an integer multiple of K-1; satisfying the second preset condition includes: the difference between the index of any leaf node in the third subtree and the index of the leaf node in the subtrees other than the third subtree in the first spanning tree is not equal to an integer multiple of K-1, and the leaf nodes of the subtrees other than the third subtree in the first spanning tree include the third leaf node, the fourth leaf node, and the fifth leaf node.
[0042] In another possible design, the network topology includes a second loop and a pair The result takes an integer number of first cycles. Any first cycle is a cycle that includes the root node, the first leaf node, and the second leaf node of the first spanning tree. The length of any first cycle is (2×d+1). The second cycle is a cycle that includes the root node, the third leaf node, and the root node of the third subtree of the first spanning tree. The length of the second cycle is 2×d, where d represents the number of levels in the first spanning tree. d is an integer. The distance from any node in the first spanning tree to the root node of the first spanning tree is the number of levels. "1" represents the number of hops from the first leaf node to the second leaf node.
[0043] In another possible design, the degree of any node in the network topology, excluding the leaf nodes of the third subtree, the fourth leaf node, and the fifth leaf node, is K. The degree of any node is K, indicating that the node is connected to any K nodes in the network topology. The degree of any node in the third subtree, the fourth leaf node, and the fifth leaf node is K-1, indicating that the node is connected to any K-1 nodes in the network topology. Any two nodes in the network topology that are connected represent two network nodes that send data packets to each other. These data packets are used to obtain clock offset information between the two network nodes.
[0044] In another possible design, each node in the network topology has M connections to the M nodes in the network topology. Any two nodes in the network topology with connections represent two network nodes that send data packets to each other. The data packets are used to obtain clock offset information between the two network nodes, where M = K and N ≥ K+1, or M = K-1 and N ≥ K. The processing unit is also used to: color the network topology according to the edge coloring method of the graph so that any two edges of all edges corresponding to any node in the network topology have different colors; allocate time channels to the N-1 network nodes according to the coloring result so that any network node is allocated M time channels, and any two time channels of the M time channels are different. The M time channels correspond one-to-one with the M connections. The control node also includes a transceiver unit, which is used to send a third message, which is used to indicate the M time channels allocated to the network node.
[0045] In another possible design, the transceiver unit is also used to: receive a first message sent by a first network node, the first network node being any one of the N-1 network nodes, the first message being used to indicate the end of a first time slice; and broadcast a second message to the N-1 network nodes, the second message being used to indicate the end of the first time slice and the start of a second time slice, the first time slice being different from the second time slice.
[0046] In another possible design, the degree of any node in the network topology is K. The degree of any node being K indicates that the node is connected to any K nodes in the network topology. Any two nodes in the network topology that are connected indicate that the two network nodes corresponding to the two nodes send data packets to each other. The data packets are used to obtain the clock offset information between the two network nodes.
[0047] In another possible design, the network topology includes P loops, where P equals the number of loops. The result is rounded to an integer. The number of child nodes of the root node of the first spanning tree is K, where K is an integer greater than or equal to 2. The transceiver unit is further configured to: acquire P first clock offset information corresponding to the P loops, each first clock offset information including clock offset information between two network nodes corresponding to two connected nodes in the corresponding loop; the processing unit is further configured to: process the P loops and the P first clock offset information using the least squares method to obtain P second clock offset information corresponding to the P loops, each second clock offset information including clock offset information between two network nodes corresponding to two connected nodes in the corresponding loop, and the sum of the offset values corresponding to all clock offset information included in each second clock offset information is zero, and the clock offset information corresponding to two network nodes with the same connection relationship in different loops is the same; and perform clock synchronization on the N-1 network nodes based on the P loops, the P second clock offset information and the reference clock.
[0048] In another possible design, the transceiver unit is also used for: the control node sending N-1 probe tasks to the N-1 network nodes, the N-1 network nodes corresponding one-to-one with the N-1 probe tasks, the first probe task among the N-1 probe tasks corresponding to the first network node among the N-1 network nodes, the first probe task being used to instruct the first network node to obtain the clock offset information of the first network node relative to the second network node, the N-1 network nodes including the first network node and the second network node, the first network node and the second network node being different, and the network topology being used to indicate the connection relationship between the first network node and the second network node.
[0049] Fourthly, a first network node is provided, which is applied in a cluster system. The cluster system further includes N-1 network nodes, where N is a positive integer greater than or equal to 2. The first network node includes: a transceiver unit, configured to receive a first probe task sent by the control node, the first probe task being configured to instruct the first network node to acquire clock offset information of the first network node relative to a second network node, the N-1 network nodes including the first network node and the second network node, the first network node being different from the second network node; the transceiver unit is also configured to send clock offset information to the control node, the clock offset information representing the clock offset information of the first network node relative to the second network node.
[0050] The first probing task is associated with a network topology, which can be constructed by the control node based on a first spanning tree and a target strategy. This network topology indicates the connection relationship between the first network node and the second network node. The network topology is constructed based on the first spanning tree and the target strategy. The first spanning tree has the network node containing the reference clock as its root node. All nodes in the first spanning tree, except the root node, have a mapping relationship with the N-1 network nodes. The target strategy indicates the method of connecting the target nodes in the first spanning tree. Each node in the first spanning tree is at least one node in at least one loop included in the network topology. The loop length of any loop included in the network topology is associated with the number of levels in the first spanning tree and the target strategy.
[0051] In one possible design, the root node of the first spanning tree has K child nodes, where K is an integer greater than or equal to 2. The first spanning tree includes a first subtree and a second subtree, which have no intersection. The root node of any subtree is a child node of the root node of the first spanning tree. The first subtree includes K-1 leaf nodes, and the second subtree includes K-1 leaf nodes. The first leaf node and the second leaf node satisfy a first preset condition. The first leaf node and the second leaf node are connected to construct the network topology. The first leaf node is a leaf node of the first subtree, and the second leaf node is a leaf node of the second subtree. The target node includes the first leaf node and the second leaf node.
[0052] In another possible design, satisfying the first preset condition includes: the difference in index between the two leaf nodes corresponding to any two subtrees in the first spanning tree is equal to an integer multiple of K-1.
[0053] In another possible design, the length of any loop in the network topology is (2×d+1), where d represents the number of levels in the first spanning tree, and d is an integer. The distance from any node in the first spanning tree to the root node of the first spanning tree is the number of levels, and "1" represents the number of hops from the first leaf node to the second leaf node.
[0054] In another possible design, the number of loops in the network topology is equal to the number of connections made to the target node in the first spanning tree. The result of rounding is that any loop in the network topology includes the root node of the first spanning tree, the first leaf node, the second leaf node, at least one first intermediate node and at least one second intermediate node, the at least one first intermediate node is a child node of the root node of the first spanning tree and the at least one first intermediate node is a parent node of the first leaf node, the at least one second intermediate node is a child node of the root node of the first spanning tree and the at least one second intermediate node is a parent node of the second leaf node.
[0055] In another possible design, the root node of the first spanning tree has K child nodes, where K is an integer greater than or equal to 2. The first spanning tree includes a first subtree, a second subtree, and a third subtree. No two subtrees of the first, second, and third subtrees intersect. The root node of any subtree is a child node of the root node of the first spanning tree. The first subtree includes K-1 leaf nodes, the second subtree includes K-1 leaf nodes, and the third subtree includes K-2 leaf nodes. The first leaf node and the second leaf node satisfy a first preset condition and are connected to construct the network topology. The first leaf node is a leaf node of the first subtree, and the second leaf node... The target node includes the first leaf node and the second leaf node; the leaf node of the third subtree satisfies the second preset condition, and the third leaf node is connected to the root node of the third subtree to construct the network topology. The third leaf node is the leaf node of the second subtree, and the target node also includes the third leaf node and the root node of the third subtree; the leaf node of the third subtree satisfies the second preset condition, and the leaf node of the third subtree satisfies the second preset condition, and the fourth leaf node is connected to the fifth leaf node to construct the network topology. The fourth leaf node is the leaf node of the first subtree, and the fifth leaf node is the leaf node of the second subtree.
[0056] In another possible design, satisfying the first preset condition includes: the difference between the indexes of the two leaf nodes corresponding to any two subtrees in the first spanning tree is equal to an integer multiple of K-1; satisfying the second preset condition includes: the difference between the index of any leaf node in the third subtree and the index of the leaf node in the subtrees other than the third subtree in the first spanning tree is not equal to an integer multiple of K-1, and the leaf nodes of the subtrees other than the third subtree in the first spanning tree include the third leaf node, the fourth leaf node, and the fifth leaf node.
[0057] In another possible design, the network topology includes a second loop and a pair The result takes an integer number of first cycles. Any first cycle is a cycle that includes the root node, the first leaf node, and the second leaf node of the first spanning tree. The length of any first cycle is (2×d+1). The second cycle is a cycle that includes the root node, the third leaf node, and the root node of the third subtree of the first spanning tree. The length of the second cycle is 2×d, where d represents the number of levels in the first spanning tree. d is an integer. The distance from any node in the first spanning tree to the root node of the first spanning tree is the number of levels. "1" represents the number of hops from the first leaf node to the second leaf node.
[0058] In another possible design, the degree of any node in the network topology, excluding the leaf nodes of the third subtree, the fourth leaf node, and the fifth leaf node, is K. The degree of any node is K, indicating that the node is connected to any K nodes in the network topology. The degree of any node in the third subtree, the fourth leaf node, and the fifth leaf node is K-1, indicating that the node is connected to any K-1 nodes in the network topology. Any two nodes in the network topology that are connected represent two network nodes that send data packets to each other. These data packets are used to obtain clock offset information between the two network nodes.
[0059] In another possible design, each node in the network topology has M connections to the M nodes in the network topology. Any two nodes in the network topology that have a connection represent two network nodes that send data packets to each other. The data packets are used to obtain clock offset information between the two network nodes, where M = K and N ≥ K + 1, or M = K - 1 and N ≥ K. The transceiver unit is also used to receive a third message, which indicates the M time channels allocated to the first network node. Any two of the M time channels are different, and the M time channels correspond one-to-one with the M connections.
[0060] In another possible design, the transceiver unit is also used to: send a first message to the control node and the network nodes other than the first network node among the N-1 network nodes, using the second spanning tree as the path, wherein the second spanning tree is rooted at the first network node, and the first message is used to indicate the end of the first time slice; and / or receive a second message sent by the control node, wherein the second message is used to indicate the end of the first time slice and the start of the second time slice, wherein the first time slice is different from the second time slice.
[0061] In another possible design, the degree of any node in the network topology is K. The degree of any node being K indicates that the node is connected to any K nodes in the network topology. Any two nodes in the network topology that are connected indicate that the two network nodes corresponding to the two nodes send data packets to each other. The data packets are used to obtain the clock offset information between the two network nodes.
[0062] In another possible design, the first network node further includes a processing unit for: determining the clock offset information based on a first data packet and a second data packet, wherein the first data packet carries a first timestamp and a second timestamp, and the second data packet carries a third timestamp and a fourth timestamp, wherein the first timestamp indicates a first moment when the first network node sends the first data packet to the second network node, the second timestamp indicates a second moment when the second network node receives the first data packet, the third timestamp indicates a third moment when the second network node sends the second data packet to the first network node, and the fourth timestamp indicates a fourth moment when the first network node receives the second data packet.
[0063] Fifthly, a control node is provided, which has the functions of the control node described in the third aspect above. These functions can be implemented in hardware or in software. The hardware or software includes one or more modules corresponding to the aforementioned functions.
[0064] In one possible implementation, the control node's structure includes a processor configured to support the control node in performing the corresponding functions described above.
[0065] The control node may also include a memory that is coupled to the processor and stores the program instructions and data necessary for the control node.
[0066] In another possible implementation, the control node includes a processor, a transmitter, a receiver, random access memory (RAM), read-only memory (ROM), and a bus. The processor is coupled to the transmitter, receiver, RAM, and ROM via the bus. When the control node needs to run, it is booted by a basic input / output system (BIS) embedded in the ROM or a bootloader in the embedded system, guiding the control node into normal operation. After the control node enters normal operation, an application program and operating system run in the RAM, causing the processor to execute the methods of the first aspect or any possible implementation thereof.
[0067] Sixthly, a first network node is provided, which has the functions of the first network node described in the fourth aspect above. These functions can be implemented in hardware or in software. The hardware or software includes one or more modules corresponding to the functions described above.
[0068] In one possible implementation, the first network node includes a processor configured to support the first network node in performing the corresponding functions described above.
[0069] The first network node may also include a memory for coupling with a processor, which stores the necessary program instructions and data of the first network node.
[0070] In another possible implementation, the first network node includes a processor, a transmitter, a receiver, random access memory (RAM), read-only memory (ROM), and a bus. The processor is coupled to the transmitter, receiver, RAM, and ROM via the bus. When the first network node needs to run, it is booted by a basic input / output system (BIS) embedded in the ROM or a bootloader in the embedded system, guiding the first network node into normal operation. After the first network node enters normal operation, an application program and operating system are run in the RAM, causing the processor to execute the methods of the second aspect or any possible implementation thereof.
[0071] In a seventh aspect, a computer program product is provided, comprising: computer program code, which, when run on a computer, causes the computer to perform either the first or second aspect described above, and any possible method of performing either the first or second aspect described above.
[0072] Eighthly, a computer-readable medium is provided that stores program code, which, when executed on a computer, causes the computer to perform the first or second aspect described above, and any possible method of the first or second aspect described above. Such computer-readable storage includes, but is not limited to, one or more of the following: read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), flash memory, electrically EPROM (EEPROM), and hard drive.
[0073] A ninth aspect provides a chip system including a processor and a data interface, wherein the processor reads instructions stored in a memory through the data interface to execute the methods of the first aspect or the second aspect, and any possible implementation thereof. In specific implementations, the chip system may be implemented as a central processing unit (CPU), a microcontroller unit (MCU), a microprocessor (MPU), a digital signal processor (DSP), a system-on-chip (SoC), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or a programmable logic device (PLD).
[0074] In a tenth aspect, a system is provided, comprising N nodes, including a control node and N-1 network nodes. The control node is used to execute the method in the first aspect or any possible implementation thereof, and the first network node is used to execute the method in the second aspect or any possible implementation thereof, wherein the first network node is any one of the N-1 network nodes, and N is a positive integer greater than or equal to 2.
[0075] Based on the implementation methods provided in the above aspects, this application can be further combined to provide more implementation methods. Attached Figure Description
[0076] Figure 1 This is a schematic block diagram of the system architecture 100 to which this application applies.
[0077] Figure 2 This is a schematic flowchart of a clock synchronization method 200 provided in an embodiment of this application.
[0078] Figure 3 This is a schematic diagram of the first spanning tree provided in an embodiment of this application.
[0079] Figure 4 This is a schematic diagram illustrating the construction of a network topology based on a first spanning tree and a target strategy, provided in an embodiment of this application.
[0080] Figure 5This is another schematic diagram of constructing a network topology based on a first spanning tree and a target strategy, provided by an embodiment of this application.
[0081] Figure 6 This is a schematic diagram of the edge coloring method of the diagram provided in the embodiments of this application.
[0082] Figure 7 yes Figure 4 The corresponding network topology includes a schematic diagram of a loop.
[0083] Figure 8 This is a schematic flowchart of a clock synchronization method 800 provided in an embodiment of this application.
[0084] Figure 9 This is a schematic diagram of a control node 900 provided in an embodiment of this application.
[0085] Figure 10 This is a schematic diagram of a first network node 1000 provided in an embodiment of this application.
[0086] Figure 11 This is a schematic diagram of the hardware structure of a device 1100 provided in an embodiment of this application.
[0087] Figure 12 This is a schematic diagram of a system 1200 provided in an embodiment of this application. Detailed Implementation
[0088] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0089] The terminology used in the implementation section of this application is for the purpose of explaining specific embodiments of this application only, and is not intended to limit this application.
[0090] In this application, the terms "first," "second," and "third" are used to distinguish identical or similar items that have essentially the same function. There is no logical or temporal dependency between "first," "second," and "third," nor are they limited in quantity or execution order.
[0091] This application will present various aspects, embodiments, or features relating to systems that may include multiple devices, components, modules, etc. It should be understood and appreciated that individual systems may include additional devices, components, modules, etc., and / or may not include all the devices, components, modules, etc. discussed in conjunction with the accompanying drawings. Furthermore, combinations of these approaches are also possible.
[0092] Furthermore, in the embodiments of this application, the words "exemplary," "for example," etc., are used to indicate that they are examples, illustrations, or descriptions. Any embodiment or design scheme described as "exemplary" in this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of the term "exemplary" is intended to present the concept in a concrete manner.
[0093] The network architecture and business scenarios described in the embodiments of this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided in the embodiments of this application. As those skilled in the art will know, with the evolution of network architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0094] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0095] In this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0096] The following describes in detail the relevant technologies of the embodiments of this application:
[0097] First, a brief introduction to the relevant technical terms used in the embodiments of this application will be given.
[0098] 1. One-way delay (OWD)
[0099] OWD refers to the time required to transmit a data packet from one network entity to another in network communication. A network entity can be a network device or a host. The counterpart to one-way latency is round-trip time (RTT), which is the time required for a data packet to travel back and forth once. Generally, twice the one-way latency is the RTT.
[0100] 2. Clock offset
[0101] Clock offset, also known as clock skew, refers to the relative difference between two clocks, that is, the difference between the times displayed by the two clocks at the same moment. For example, at the same moment, if two clocks display the time as 12:00 and 12:01 respectively, then the clock offset of the first clock relative to the second clock is -1 second, and the clock offset of the second clock relative to the first clock is 1 second.
[0102] 3. Clock skew speed
[0103] Clock offset rate, also known as offset speed, refers to the rate at which the offset between two clocks changes over time. It is usually expressed in microseconds per second (µs / s), representing the magnitude of the clock offset change over one second. The offset rate can be positive or negative, depending on which clock is used as the reference.
[0104] Below, in conjunction with Figure 1 The system architecture applicable to this application is described.
[0105] Figure 1 This is a schematic block diagram of the system architecture 100 to which this application applies.
[0106] like Figure 1 As shown, system architecture 100 includes a control node 110 and a network node. For example, Figure 1 The example shown includes three network nodes: network node 120, network node 130, and network node 140. Optionally, the system architecture 100 may include a greater number of network nodes. Figure 1 The example shown is that control node 110 is deployed on a node other than the network nodes in system architecture 100. Optionally, control node 110 can also be deployed on any network node in system architecture 100. For example, control node 110 can be deployed on network node 120, network node 130, or network node 140.
[0107] Among the aforementioned institutions 100, any two network nodes that are connected ( Figure 1 Control nodes and network nodes (shown as dashed lines in the text) can communicate with each other and have a connection relationship. Figure 1Network nodes (shown as solid lines in the text) can also communicate with each other. For example, network node 120 can communicate with network node 130. Similarly, control node 110 can communicate with network node 140.
[0108] In this embodiment, the network node where the reference clock for clock synchronization is located is not specifically limited. In one example, the network node where the reference clock for clock synchronization is located can be the control node in the system architecture 100 described above or any other network node. In another example, the network node where the reference clock for clock synchronization is located can also be a network node other than the system architecture 100 described above.
[0109] It should be understood that the above system architecture 100 is merely illustrative and does not constitute any limitation on the system architecture to which the clock synchronization method provided in this application is applicable. For example, the above system architecture 100 may also include a greater number of network nodes. Furthermore, the above control node 110 may also be deployed on network node 120, network node 130, or network node 140.
[0110] Below, in conjunction with Figures 2 to 8 This paper introduces a clock synchronization method provided in the embodiments of this application.
[0111] Figure 2 This is a schematic flowchart of a clock synchronization method 200 provided in an embodiment of this application. Figure 2 As shown, method 200 includes steps 210 and 220, which are described in detail below. Method 200 can be applied to, but is not limited to, the system architecture 100 described above. The following description uses the application of method 200 to a cluster system as an example, where the cluster system includes N nodes, including a control node and N-1 network nodes, where N is a positive integer greater than or equal to 2.
[0112] Step 210: The control node constructs a network topology based on the first spanning tree and the target policy. The first spanning tree takes the network node where the reference clock is located as the root node. The nodes in the first spanning tree, except for the root node, have a mapping relationship with N-1 network nodes. The target policy is used to indicate the way to connect the target nodes in the first spanning tree. Each node in the first spanning tree is at least a node in at least one loop included in the network topology. The loop length of any loop included in the network topology is associated with the number of levels included in the first spanning tree and the target policy.
[0113] In this system, the first spanning tree is rooted at the network node containing the reference clock. All nodes in the first spanning tree, excluding the root node, are mapped to N-1 network nodes. In one example, any node in the first spanning tree, excluding the root node, corresponds to one of the N-1 network nodes. This mapping is related to the order in which these N-1 network nodes establish communication connections with the control node. Specifically, the first network node in the cluster system to establish a communication connection with the control node corresponds to the first child node of the root node of the first spanning tree; the second network node in the cluster system to establish a communication connection with the control node corresponds to the second child node of the root node of the first spanning tree, and so on. For example, using... Figure 3 The first spanning tree shown is used as an example. This first spanning tree includes d levels, where the d-th level is the level containing the leaf nodes of the first spanning tree, and the number of nodes in the d-th level is no greater than N. d =K×(Kd) d-1 d is an integer. In level 0 (i.e., the level where the root node of the first spanning tree is located), node 0 (i.e., the node with index 0) has a mapping relationship with the network node where the reference clock is located, that is, leaf node 0 corresponds to the network node where the reference clock is located. Figure 3 The first three nodes of the first level of the first spanning tree shown are numbered 1, 2, and 3, respectively. That is, the network node corresponding to node number 1 can be the first node in the cluster system to establish a connection with the control node. The network node corresponding to node number 2 can be the second node in the cluster system to establish a connection with the control node. The network node corresponding to node number 3 can be the third node in the cluster system to establish a connection with the control node. It should be understood that... Figure 3 This is for illustrative purposes only and does not constitute any limitation on the first spanning tree provided in the embodiments of this application. Figure 3 The example illustrates this using level 0 as the root node of the first spanning tree. Optionally, the root node could be level 1, in which case level 0 is not included. In another example, nodes in the first spanning tree (excluding the root node) are mapped to N-1 network nodes. That is, any node in the first spanning tree (excluding the root node) corresponds to one of these N-1 network nodes, and this mapping is independent of the order in which these N-1 network nodes establish communication connections with the control node. Figure 3For example, in this implementation, the network node corresponding to the node with the sequence number 1 can be the 3rd node in the cluster system to establish a connection with the control node, the network node corresponding to the node with the sequence number 2 can be the 1st node in the cluster system to establish a connection with the control node, and the network node corresponding to the node with the sequence number 3 can be the 2nd node in the cluster system to establish a connection with the control node.
[0114] In this context, the distance from any node at any level in the first spanning tree to the root node of the first spanning tree is the number of that arbitrary level. Furthermore... Figure 3 For example, Figure 3 The distance from any leaf node in the d-th level of the first spanning tree shown to the root node of the first spanning tree is equal to d.
[0115] The number of subtrees included in the first spanning tree is equal to the number of child nodes of the root node of the first spanning tree. That is, when the number of child nodes of the root node of the first spanning tree is K, where K is an integer greater than or equal to 2, the number of subtrees included in the first spanning tree is equal to K. The root node of each subtree included in the first spanning tree is the child node corresponding to the root node of the first spanning tree. Furthermore... Figure 3 For example, a child node of the root node of the first spanning tree is node 1, and the subtree obtained with node 1 as the root node of the subtree is subtree 1. See [link to relevant documentation]. Figure 3 As shown by the dashed line in the image.
[0116] In this embodiment, the control node constructs the network topology based on the first spanning tree and the target policy in the following two ways:
[0117] Method 1:
[0118] In this implementation, the root node of the first spanning tree has K child nodes, where K is an integer greater than or equal to 2. The first spanning tree includes a first subtree and a second subtree, which have no intersection. The root node of any subtree is a child node of the root node of the first spanning tree. The first subtree includes K-1 leaf nodes, and the second subtree includes K-1 leaf nodes. The control node constructs the network topology based on the first spanning tree and the target strategy, including: when the first leaf node and the second leaf node satisfy a first preset condition, the control node connects the first leaf node and the second leaf node to construct the network topology. The first leaf node is a leaf node of the first subtree, and the second leaf node is a leaf node of the second subtree. The target node includes both the first leaf node and the second leaf node. It is understood that the first spanning tree can also include multiple first subtrees and multiple second subtrees.
[0119] Optionally, satisfying the first preset condition includes: the difference between the indexes of the two leaf nodes corresponding to any two subtrees in the first spanning tree is an integer multiple of K-1. Assuming the index of the first leaf node of the first subtree is n, where n is a positive integer, the indexes of the leaf nodes of the subtrees whose index differs from the first leaf node by an integer multiple of K-1 are: n+m1(K-1), n+m2(K-1), ..., n+m K-1 (K-1), where m j =j, j=1,2,3,...,K-1, and m1≤……≤m K-1 NN d ≤n+m1×(K-1)≤≤n+m K-1 ×(K-1)≤N. This can be understood as n+m K-1 (K-1) represents a leaf node in a subtree other than the first subtree in the first spanning tree, and this leaf node has a corresponding relationship with the first leaf node of the first subtree (that is, it satisfies the first preset condition).
[0120] Optionally, the number of loops in the network topology is equal to the number of connections made to the target node in the first spanning tree. The rounded result shows that any loop in the network topology includes the root node, first leaf node, second leaf node, at least one first intermediate node, and at least one second intermediate node of the first spanning tree. At least one first intermediate node is a child node of the root node of the first spanning tree and a parent node of the first leaf node. At least one second intermediate node is a child node of the root node of the first spanning tree and a parent node of the second leaf node. Where K is odd... The result is a non-integer; in this case, the number of loops in the network topology is equal to the number of loops in the network. The result of rounding. For example, when K equals 3 and N equals 9, for... The result of rounding is 5, which means that the number of loops in the network topology is equal to 5.
[0121] Optionally, the degree of any node in the network topology is K. A degree of K indicates that this node is connected to any K nodes in the network topology. Any two connected nodes in the network topology represent two network nodes that send data packets to each other. These data packets are used to obtain clock offset information between the two network nodes. Figure 4Taking node 5 as an example, node 5 has a degree of K = 4, meaning that node 5 is connected to any one of nodes 1, 8, 11, and 14. Therefore, the network node corresponding to node 5 can send data packets to the network nodes corresponding to any one of nodes 1, 8, 11, and 14.
[0122] Optionally, the length of any loop in the network topology is (2×d+1), where d represents the number of levels in the first spanning tree, and d is an integer. The distance from any node in any level of the first spanning tree to the root node of the first spanning tree is the number of levels, and "1" represents the number of hops from the first leaf node to the second leaf node.
[0123] The following is combined with Figure 4 Let's take an example, assuming the cluster system includes 16 (N-1=16) network nodes that have established connections with the control node. Figure 4 The first spanning tree shown has d levels, where d = 0, 1, 2. Node 0 (i.e., the node with index 0) is the root node of the first spanning tree, and node 0 has a mapping relationship with the network node where the reference clock is located. The nodes in the first spanning tree other than node 0 (i.e., nodes 1 to 16) have mapping relationships with the 16 network nodes in the cluster system, and these mapping relationships can be set according to the order in which the control node is established with these 16 network nodes. Figure 4 In the first spanning tree, the root node has four child nodes (1, 2, 3, 4), therefore the first spanning tree has four subtrees (subtree 1, subtree 2, subtree 3, and subtree 4). Subtree 1 includes the middle node 1 and leaf nodes 5 through 7. Subtree 2 includes the middle node 2 and leaf nodes 8 through 10. Subtree 3 includes the middle node 3 and leaf nodes 11 through 13. Subtree 4 includes the middle node 4 and leaf nodes 14 through 16. Figure 4 In the diagram, the root node (i.e., node 0) is the parent node of the four intermediate nodes. Intermediate node 1 is the parent node of leaf nodes 5, 6 and 7. Intermediate node 2 is the parent node of leaf nodes 8, 9 and 10. Intermediate node 3 is the parent node of leaf nodes 11, 12 and 13. Intermediate node 4 is the parent node of leaf nodes 14, 15 and 16.
[0124] by Figure 4 Taking subtree 1 and subtree 2 as examples, the difference between leaf node 5 of subtree 1 and leaf node 8 of subtree 2 is equal to K-1, where K is an integer multiple of 4. Based on this, the control node can connect leaf node 5 and leaf node 8 (see...). Figure 4 (The dashed lines in the diagram). Taking subtrees 2 and 3 as examples, the difference between leaf node 9 of subtree 2 and leaf node 12 of subtree 3 is equal to K-1, where K is an integer multiple of 4. Based on this, the control node can connect leaf node 9 and leaf node 12. Figure 4 (Not shown in the image). For Figure 4 Connecting the leaf nodes of the first spanning tree using the method described in Method 1 above can include the following connections (total) (Several connections): Leaf node 5 of subtree 1 is connected to leaf node 8 of subtree 2, leaf node 5 of subtree 1 is connected to leaf node 11 of subtree 3, and leaf node 5 of subtree 1 is connected to leaf node 14 of subtree 4 (e.g., ...). Figure 4 (As shown by the dotted lines in the diagram), leaf node 6 of subtree 1 is connected to leaf node 9 of subtree 2; leaf node 6 of subtree 1 is connected to leaf node 12 of subtree 3; leaf node 6 of subtree 1 is connected to leaf node 15 of subtree 4; leaf node 7 of subtree 1 is connected to leaf node 10 of subtree 2; leaf node 7 of subtree 1 is connected to leaf node 13 of subtree 3; leaf node 7 of subtree 1 is connected to leaf node 16 of subtree 4; leaf node 8 of subtree 2 is connected to leaf node 11 of subtree 3; leaf node 8 of subtree 2 ...8 of subtree 2 is connected to leaf node 9 of subtree 2; leaf node 6 of subtree 1 is connected to leaf node 12 of subtree 3; leaf node 7 of subtree 1 is connected to leaf node 13 of subtree 3; leaf node 7 of subtree 1 is connected to leaf node 16 of subtree 4; leaf node 8 of subtree 2 is connected to leaf node 11 of subtree 3; leaf node 8 of subtree 2 is connected to leaf node 9 of subtree 2; leaf node 8 of subtree 2 is connected to leaf node 9 of subtree Leaf node 14 of subtree 4 is connected; leaf node 9 of subtree 2 is connected to leaf node 12 of subtree 3; leaf node 9 of subtree 2 is connected to leaf node 15 of subtree 4; leaf node 10 of subtree 2 is connected to leaf node 13 of subtree 3; leaf node 10 of subtree 2 is connected to leaf node 16 of subtree 4; leaf node 11 of subtree 3 is connected to leaf node 14 of subtree 4; leaf node 13 of subtree 3 is connected to leaf node 16 of subtree 4; leaf node 15 of subtree 4 is connected to leaf node 12 of subtree 3. It should be understood that... Figure 4 The diagram only shows the results of leaf node 5 of subtree 1 being connected to leaf node 8 of subtree 2, leaf node 11 of subtree 3, and leaf node 14 of subtree 4, respectively. Figure 4 The black arrow in the diagram indicates one loop in the network topology, namely the C0→1→5→8→2→C0 loop, with a loop length of (2×d+1). It is understandable that... Figure 4 The corresponding network topology includes a loop length of (2×d+1) for any loop.
[0125] Method 2:
[0126] In this implementation, the root node of the first spanning tree has K child nodes, where K is an integer greater than or equal to 2. The first spanning tree includes a first subtree, a second subtree, and a third subtree. No two subtrees in the first, second, and third subtrees intersect. The root node of any subtree is a child node of the root node of the first spanning tree. The first subtree includes K-1 leaf nodes, the second subtree includes K-1 leaf nodes, and the third subtree includes K-2 leaf nodes. The control node constructs the network topology based on the first spanning tree and the target strategy, including: when the first leaf node and the second leaf node satisfy a first preset condition, the control node connects the first leaf node and the second leaf node to construct the network topology, where the first leaf node is a child node of the first subtree. The first leaf node is the first leaf node of the second subtree, and the second leaf node is the target node. When the leaf nodes of the third subtree and the third leaf node satisfy a second preset condition, the control node connects the third leaf node to the root node of the third subtree to construct a network topology. The third leaf node is the first leaf node of the second subtree, and the target node also includes the third leaf node and the root node of the third subtree. When the leaf nodes of the third subtree and the fourth leaf node satisfy a second preset condition, and the leaf nodes of the third subtree and the fifth leaf node satisfy a second preset condition, the control node connects the fourth leaf node to the fifth leaf node to construct a network topology. The fourth leaf node is the first leaf node of the first subtree, and the fifth leaf node is the second leaf node of the second subtree.
[0127] Optionally, in some implementations, the first spanning tree may not contain both a fourth leaf node and a fifth leaf node simultaneously. In this case, the control node will not connect the fourth leaf node to the fifth leaf node. Specifically, "not containing both fourth and fifth leaf nodes simultaneously" means that the first spanning tree contains only either a fourth leaf node or a fifth leaf node. For example, when the number of children K of the root node of the first spanning tree is 3, this implementation does not contain either a fourth leaf node or a fifth leaf node.
[0128] Optionally, satisfying the first preset condition includes: the difference between the indexes of the two leaf nodes corresponding to any two subtrees in the first spanning tree is equal to an integer multiple of K-1; satisfying the second preset condition includes: the difference between the index of any leaf node in the third subtree and the index of the leaf node in the subtrees other than the third subtree in the first spanning tree is not equal to an integer multiple of K-1, and the leaf nodes of the subtrees other than the third subtree in the first spanning tree include the third leaf node, the fourth leaf node, and the fifth leaf node.
[0129] Optionally, the network topology includes a second loop and pairs of... The result takes an integer number of first cycles. Any first cycle is a cycle that includes the root node, the first leaf node, and the second leaf node of the first spanning tree. The length of any first cycle is (2×d+1). The second cycle is a cycle that includes the root node, the third leaf node, and the root node of the third subtree of the first spanning tree. The length of the second cycle is 2×d, where d represents the number of levels in the first spanning tree. d is an integer. The distance from any node in the first spanning tree to the root node of the first spanning tree is the number of levels. "1" represents the number of hops from the first leaf node to the second leaf node.
[0130] Optionally, the degree of any node in the network topology, excluding the leaf nodes of the third, fourth, and fifth subtrees, is K. A degree of K indicates that the node is connected to any K nodes in the network topology. The degree of any node in the leaf nodes of the third, fourth, and fifth subtrees is K-1. A degree of K-1 indicates that the node is connected to any K-1 nodes in the network topology. Any two nodes in the network topology that are connected indicate that the two network nodes corresponding to these two nodes send data packets to each other. These data packets are used to obtain clock offset information between the two network nodes.
[0131] It is understandable that in Method 2 above, the method by which the control node connects the first leaf node and the second leaf node to construct the network topology when the first leaf node and the second leaf node meet the first preset condition is the same as the method in Method 1 above. Details not elaborated here can be found in the relevant descriptions in Method 1 above.
[0132] The following is combined with Figure 5 Let's take an example, assuming the cluster system includes 15 (N-1=15) network nodes that have established connections with the control node. Figure 5 The first spanning tree shown has d levels, where d = 0, 1, 2. Node 0 (i.e., the node with index 0) is the root node of the first spanning tree, and node 0 has a mapping relationship with the network node where the reference clock is located. Nodes 1 to 15 in the first spanning tree, excluding node 0, have mapping relationships with the 15 network nodes in the cluster system. These mapping relationships can be set according to the order in which the control node establishes its relationship with these 15 network nodes. Figure 5In the first spanning tree, the root node has four child nodes (1, 2, 3, 4), therefore the first spanning tree has four subtrees (subtree 1, subtree 2, subtree 3, and subtree 4). Subtree 1 includes the middle node 1 and leaf nodes 5 through 7. Subtree 2 includes the middle node 2 and leaf nodes 8 through 10. Subtree 3 includes the middle node 3 and leaf nodes 11 through 13. Subtree 4 includes the middle node 4 and leaf nodes 14 through 15. Figure 5 In the diagram, the root node (i.e., node 0) is the parent node of the four intermediate nodes. Intermediate node 1 is the parent node of leaf nodes 5, 6 and 7. Intermediate node 2 is the parent node of leaf nodes 8, 9 and 10. Intermediate node 3 is the parent node of leaf nodes 11, 12 and 13. Intermediate node 4 is the parent node of leaf nodes 14 and 15.
[0133] exist Figure 5 In the given information, leaf node 7 of subtree 1 and leaf nodes 14 and 15 of subtree 4 satisfy the second preset condition, namely, the difference between the index of leaf node 7 and the index of any leaf node in subtree 4 is not equal to K-1, where K = 4. Similarly, leaf node 10 of subtree 2 and leaf nodes of subtree 4 satisfy the second preset condition, as do leaf nodes 13 of subtree 3 and leaf nodes of subtree 4. Based on this, leaf node 13 of subtree 3 can be connected to the root node of subtree 4 (i.e., intermediate node 4), and leaf node 7 of subtree 1 can be connected to leaf node 10 of subtree 2 (e.g., ...). Figure 5 (As shown by the dotted lines in the diagram). Optionally, leaf node 7 of subtree 1 can be connected to the root node of subtree 4 (i.e., intermediate node 4), and leaf node 13 of subtree 3 can be connected to leaf node 10 of subtree 2. Figure 5 (Not shown in the image). Optionally, leaf node 10 of subtree 2 can be connected to the root node of subtree 4 (i.e., intermediate node 4), and leaf node 13 of subtree 3 can be connected to leaf node 7 of subtree 1. Figure 5 (Not shown in the image). For example, for Figure 5 Connecting nodes in the first spanning tree using the method described in Method 2 above can include the following connections (total) (Several connections): Leaf node 5 of subtree 1 is connected to leaf node 8 of subtree 2; leaf node 5 of subtree 1 is connected to leaf node 11 of subtree 3; leaf node 5 of subtree 1 is connected to leaf node 14 of subtree 4; leaf node 6 of subtree 1 is connected to leaf node 9 of subtree 2; leaf node 6 of subtree 1 is connected to leaf node 12 of subtree 3; leaf node 6 of subtree 1 is connected to leaf node 15 of subtree 4; leaf node 7 of subtree 1 is connected to leaf node 10 of subtree 2 (at this time, leaf node 7 and leaf node 10 have two connections, such as...). Figure 5(As shown by the dashed and dotted lines in the diagram), leaf node 7 of subtree 1 is connected to leaf node 13 of subtree 3; leaf node 8 of subtree 2 is connected to leaf node 11 of subtree 3; leaf node 8 of subtree 2 is connected to leaf node 14 of subtree 4; leaf node 9 of subtree 2 is connected to leaf node 12 of subtree 3; leaf node 9 of subtree 2 is connected to leaf node 15 of subtree 4; leaf node 10 of subtree 2 is connected to leaf node 13 of subtree 3; leaf node 11 of subtree 3 is connected to leaf node 14 of subtree 4; leaf node 15 of subtree 4 is connected to leaf node 12 of subtree 3; and leaf node 13 of subtree 3 is connected to the root node of subtree 4 (i.e., node 4). It should be understood that... Figure 5 The results only show the connection of some nodes. Figure 5 The corresponding network topology includes two types of loops. The first type of loop has a loop length of 2×d+1, for example, the C0→1→5→8→2→C0 loop. The second type of loop has a loop length of 2×d, for example, the C0→3→13→4→C0 loop.
[0134] It should be understood that the methods described above, specifically K=4, were used as examples. Optionally, K can be a positive integer greater than or equal to 2, and can also be any positive integer other than 4. For example, K=3 or K=10.
[0135] In this embodiment of the application, the clock offset information includes the clock offset amount and the clock offset speed.
[0136] Step 220: The control node synchronizes the clocks of N-1 network nodes according to the reference clock and network topology.
[0137] In this embodiment, each node in the network topology has M connections with the M nodes in the network topology. Any two nodes in the network topology with connections represent two network nodes that send data packets to each other. The data packets are used to obtain clock offset information between the two network nodes, where M = K and N ≥ K + 1, or M = K - 1 and N ≥ K. Before step 220, the control node can also perform the following steps: coloring the network topology according to the edge coloring method of the graph so that any two edges of all edges corresponding to any node in the network topology have different colors; allocating time channels to the N-1 network nodes according to the coloring result so that any network node is allocated M time channels, and any two time channels are different. The M time channels correspond one-to-one with the M connections; sending a third message, which is used to indicate the M time channels allocated to any network node. The time channel is used to indicate a specific time period. For example, time channel 1 can be used to indicate the time period from t0 to t1. The two time channels are different, which can be understood as the two specific time periods indicated by the two time channels not overlapping. For example, time channel 1 and time channel 2 are different; time channel 1 can indicate the time interval from t0 to t3, while time channel 2 can indicate the time interval from t3 to t6. In this embodiment, the edge coloring algorithm for the graph is not specifically limited. For example, the graph coloring algorithm could be the Misa-Gries algorithm.
[0138] For example, with Figure 6 This example illustrates how a control node can allocate M time channels to any given network node. Figure 6 As shown, assume that in the network topology, node 0 is connected to any one of nodes 1, 2, and 3; node 1 is connected to any one of nodes 2 and 3; and node 2 is connected to node 3. Based on this, the control node colors the network topology using an edge coloring method, ensuring that any two edges corresponding to any given node in the network topology have different colors. Figure 5The coloring results are shown, where any two of the colors 1, 2, and 3 are different. Taking all edges corresponding to node 1 as an example, edge 1-2 is color 1, edge 1-0 is color 3, and edge 1-3 is color 2. Similarly, taking all edges corresponding to node 0 as an example, edge 0-1 is color 3, edge 0-2 is color 2, and edge 0-3 is color 1. Again using node 1 as an example, based on the edge coloring results, the control node can allocate time channel 1 to the network nodes corresponding to node 1 and 2, meaning the network node corresponding to node 1 uses time channel 1 to send data packets to the network node corresponding to node 2; the control node can allocate time channel 2 to the network nodes corresponding to node 1 and 3, meaning the network node corresponding to node 1 uses time channel 2 to send data packets to the network node corresponding to node 3; and the control node can allocate time channel 3 to the network nodes corresponding to node 1 and 0, meaning the network node corresponding to node 1 uses time channel 3 to send data packets to the network node corresponding to node 0. This data packet is used to obtain the clock offset information of the network node corresponding to node 1 relative to the network node corresponding to node 2.
[0139] Optionally, before step 220, the control node may further perform the following steps: the control node receives a first message sent by a first network node, where the first network node is any one of N-1 network nodes, and the first message indicates the end of the first time slice; the control node broadcasts a second message to the N-1 network nodes, where the second message indicates the end of the first time slice and the start of the second time slice, and the first time slice is different from the second time slice. The second message may include a first identifier and a second identifier. The first identifier of the first time slice is different from the second identifier of the time slice. In this embodiment, a time slice has an identifier ID, which is used to uniquely identify a time slice. For example, the ID of time slice 1 is ID1. Based on this, after the controller or network node identifies a time slice with ID1, it can determine that the time slice corresponding to ID1 is time slice 1. For example, in some implementations, the controller can divide the time to generate multiple time slices i, and send the information of these multiple time slices i to the network nodes in the distributed cluster. The information of any time slice i may include the ID of the time slice i and the time period corresponding to the time slice i.
[0140] In this embodiment of the application, the network topology includes P loops, where P equals the number of loops. The result is rounded to the nearest integer. The number of child nodes of the root node of the first spanning tree is K, where K is an integer greater than or equal to 2. The control node performs clock synchronization on N-1 network nodes based on the reference clock and network topology. This includes: the control node acquiring P first clock offset information corresponding to P loops, each first clock offset information including clock offset information between two network nodes corresponding to two connected nodes in the corresponding loop; the control node processing the P loops and P first clock offset information using the least squares method to obtain P second clock offset information corresponding to the P loops, each second clock offset information including clock offset information between two network nodes corresponding to two connected nodes in the corresponding loop, and the sum of the offset values of all clock offset information included in each second clock offset information is zero. The clock offset information between two network nodes corresponding to two nodes with the same connection relationship in different loops is the same; the control node performs clock synchronization on N-1 network nodes based on the P loops, P second clock offset information, and the reference clock. In this network topology, any loop corresponds to a first clock offset information, and each first clock offset information includes clock offset information (i.e., clock offset amount and clock offset speed) between two network nodes corresponding to two connected nodes in the corresponding loop. Figure 7 It shows Figure 4 The corresponding network topology includes a loop, namely the C0→1→5→8→2→C0 loop, and the clock offset corresponding to the C0→1 edge is 25, the clock offset corresponding to the 1→5 edge is 5, the clock offset corresponding to the 5→8 edge is 2.5, the clock offset corresponding to the 8→2 edge is -10, and the clock offset corresponding to the 2→0 edge is -2.5.
[0141] Assuming the one-way delay from network node a to network node b is equal to the one-way delay from network node b to network node a, the clock offset and clock offset rate of network node a relative to network node b can be determined by the following formula:
[0142]
[0143] In the above formula, OWD represents the one-way delay from network node a to network node b, or the one-way delay from network node b to network node a. OWD can accurately calculate the offset. The offset is r × x a The corresponding clock offset difference, Offset 0 is T×X a The corresponding clock offset difference. Drift is the clock offset rate. T×X a The moment when network node a sends data packet 1 to network node b. R×X b Let t be the time when network node a receives data packet 1. bAt time 3, network node b sends data packet 2 to network node a. Data packet 2 carries R×X. b and t×x b r×x a The time when network node a receives data packet 2 is 4.
[0144] In this process, the control node uses the least squares method to process P loops and P first clock offset information to obtain P second clock offset information corresponding to the P loops. Below, we take one loop as an example to illustrate how the control node uses the least squares method to process this loop and its first clock offset information to obtain the corresponding second clock offset information (including clock offset amount and clock offset speed). Once the network topology G(V,E) is determined, the corresponding loop matrix A can be obtained. |L|×|E| Each column corresponds to a directed edge (i,j)∈E in G, and each row corresponds to a linear independent cycle L in G. n ∈L, if (j→k)∈L n If an edge is a positive edge on E, then the corresponding element in A is 1, the opposite edge is -1, and all others are 0. Figure 7 Taking the loop shown as an example, namely the loop C0→1→5→8→2→C0, the edges of this loop are C0→1, 1→5, 5→8, 8→2, 2→C0 in sequence. The matrix corresponding to this loop is A=[1,1,1,1,1]. Each node in each time slice probes based on the network topology, obtaining M=[M e ] |E|×1 Based on AM=Y, the loop error Y=[y] is obtained. l ] |L|×1 Assume the current measured value is M = [25, 5, 2.5, -10, -2.5]. T Then Y =
[20] is Figure 7 The loop shown corresponds to the error, where [] T This represents the transpose operation on the matrix. Loop optimization distributes the error of each loop in the error Y to its edges using least squares, so that the sum of the offsets of all optimized loops is 0. This is achieved through ΔM = A T (AA T ) -1 Y represents the error value of each loop. l Assigned to the included probe edges, where ΔM = [||ΔM e ||] |E|×1 The clock offset correction for each edge e∈E is ΔM. e .by Figure 7 For example, if we distribute the loop error of 20 points across the 5 edges contained in the loop, we can calculate ΔM = [4,4,4,4,4] using the above formula. TFinally, error compensation is performed on the detection results, where M-ΔM is the clock deviation after loop optimization. Figure 7 The optimized clock offset is M - ΔM = [21, 1, -1.5, -14, -6.5] T ,Right now Figure 7 The clock offset result corresponding to the second clock offset information of the loop shown is: M-ΔM=[21,1,-1.5,-14,-6.5] T Following the same logic, the control node can obtain... Figure 7 The result of the clock offset speed corresponding to the second clock offset information of the loop shown.
[0145] It should be noted that, in the embodiments of this application, the clock offset information between two nodes corresponding to the same side of different loops is the same. Figure 4 For example, edge 1→5 is an edge included in the loop C0→1→5→8→2→C0, and edge 1→5 is also an edge included in the loop C0→1→5→11→3→C0. That is, after processing with the least squares method, it is necessary to ensure that the clock offset information between the two network nodes corresponding to edge 1→5 included in these two loops is the same.
[0146] Optionally, before step 220, the control node may also perform the following steps: The control node sends N-1 probe tasks to N-1 network nodes, with each of the N-1 network nodes corresponding one-to-one with the N-1 probe tasks. The first probe task among the N-1 probe tasks corresponds to the first network node among the N-1 network nodes. The first probe task instructs the first network node to acquire the clock offset information of the first network node relative to the second network node. The N-1 network nodes include both the first and second network nodes, which are different from each other. The network topology indicates the connection relationship between the first and second network nodes. Based on this, step 220 above performs clock synchronization on a time slice basis. The first probe task is one of the N-1 probe tasks. The first network node is one of the N-1 network nodes. That is, there is a one-to-one correspondence between one of the N-1 network nodes and one of the N-1 probe tasks.
[0147] In this embodiment, the network topology used for clock synchronization is constructed by the control node based on a first spanning tree and a target policy. The loop length of any loop included in the network topology is associated with the number of levels in the first spanning tree and the target policy; that is, any loop in the network topology includes nodes from each level of the first spanning tree, maximizing the cumulative sum of the loop lengths of all loops in the network topology. It is understood that the larger the cumulative sum of the loop lengths of all loops in the network topology, the more accurate the clock synchronization result. Therefore, when the control node uses this network topology to synchronize the clocks of N-1 network nodes in the cluster system, it helps to improve the accuracy of the clock synchronization results.
[0148] The above text combined Figures 1 to 7 This application introduces a clock synchronization method provided in its embodiments. The following section, in conjunction with... Figure 8 This application introduces a specific embodiment of the clock synchronization method provided in its embodiments. It should be understood that... Figure 8 The examples provided are merely to help those skilled in the art understand the embodiments of this application, and are not intended to limit the embodiments to the specific numerical values or specific scenarios illustrated. Those skilled in the art will understand based on the following... Figure 8 The examples can obviously be modified or changed in various ways, and such modifications and changes also fall within the scope of the embodiments of this application.
[0149] Figure 8 This is a schematic flowchart of a clock synchronization method 800 provided in an embodiment of this application. Figure 8 As shown, the method includes steps 810 to 890. Steps 810 to 890 are described below.
[0150] In this embodiment of the application, the cluster system has N nodes, including 1 controller and 16 network nodes, i.e., N=17.
[0151] Step 810: The controller performs probe session management on all network nodes in the cluster system to obtain information about all network nodes included in the cluster system, which includes 16 network nodes.
[0152] The information of all network nodes included in the cluster system includes, but is not limited to, the order in which the 16 network nodes in the cluster system establish communication connections with the controller.
[0153] Step 820: The controller constructs a network topology based on the first spanning tree and the target policy, and sends probe tasks to network nodes in the cluster system based on the network topology.
[0154] In this embodiment of the application, the first spanning tree can be as follows: Figure 4As shown. The method by which the controller constructs the network topology based on the first spanning tree and the target policy is the same as the method described in step 210 above, and can be found in the relevant description in step 210 above. Figure 4 Connecting the leaf nodes of the first spanning tree using the method described in Method 1 above can include the following connections (total) (Several connections): Leaf node 5 of subtree 1 is connected to leaf node 8 of subtree 2, leaf node 5 of subtree 1 is connected to leaf node 11 of subtree 3, and leaf node 5 of subtree 1 is connected to leaf node 14 of subtree 4 (e.g., ...). Figure 4 (As shown by the dotted lines in the diagram), leaf node 6 of subtree 1 is connected to leaf node 9 of subtree 2; leaf node 6 of subtree 1 is connected to leaf node 12 of subtree 3; leaf node 6 of subtree 1 is connected to leaf node 15 of subtree 4; leaf node 7 of subtree 1 is connected to leaf node 10 of subtree 2; leaf node 7 of subtree 1 is connected to leaf node 13 of subtree 3; leaf node 7 of subtree 1 is connected to leaf node 16 of subtree 4; leaf node 8 of subtree 2 is connected to leaf node 11 of subtree 3; leaf node 8 of subtree 2 ...8 of subtree 2 is connected to leaf node 9 of subtree 2; leaf node 6 of subtree 1 is connected to leaf node 12 of subtree 3; leaf node 7 of subtree 1 is connected to leaf node 13 of subtree 3; leaf node 7 of subtree 1 is connected to leaf node 16 of subtree 4; leaf node 8 of subtree 2 is connected to leaf node 11 of subtree 3; leaf node 8 of subtree 2 is connected to leaf node 9 of subtree 2; leaf node 8 of subtree 2 is connected to leaf node 9 of subtree Leaf node 14 of subtree 4 is connected; leaf node 9 of subtree 2 is connected to leaf node 12 of subtree 3; leaf node 9 of subtree 2 is connected to leaf node 15 of subtree 4; leaf node 10 of subtree 2 is connected to leaf node 13 of subtree 3; leaf node 10 of subtree 2 is connected to leaf node 16 of subtree 4; leaf node 11 of subtree 3 is connected to leaf node 14 of subtree 4; leaf node 13 of subtree 3 is connected to leaf node 16 of subtree 4; leaf node 15 of subtree 4 is connected to leaf node 12 of subtree 3. It should be understood that... Figure 4 The diagram only shows the results of leaf node 5 of subtree 1 being connected to leaf node 8 of subtree 2, leaf node 11 of subtree 3, and leaf node 14 of subtree 4, respectively. Figure 4 The black arrow in the diagram indicates one loop in the network topology, namely the C0→1→5→8→2→C0 loop, with a loop length of (2×d+1). It is understandable that... Figure 4 The corresponding network topology includes a loop length of (2×d+1) for any loop.
[0155] Step 830: The controller processes the network topology according to the edge coloring method of the graph and allocates a time channel to each network node in the cluster system.
[0156] The method described in step 830 above is the same as the graph edge coloring method in step 220 above; please refer to step 220 above for details. After executing step 830 above, the colors of any two edges among all edges corresponding to any node in the network topology will be different.
[0157] After step 830, the controller determines the start of time slice 1. The method by which the controller determines the start of time slice 1 is the same as the method by which the control node determines the start of time slice i in step 210 above. For details, please refer to the relevant content in step 210 above.
[0158] Step 840: Network node #1 in the cluster system sends data packet #1 to the corresponding network node #2 according to the received probe task. The data packet #1 is used to obtain the clock offset information 1 of network node #1 relative to network node #2. The clock offset information 1 includes clock offset amount 1 and clock offset speed 1.
[0159] In this embodiment, clock offset information 1 represents the clock offset information between two network nodes corresponding to any edge in any loop of the network topology. Network node #1 corresponds to leaf node #1 of subtree #1 of the first spanning tree, and network node #2 corresponds to leaf node #2 of subtree #2 of the first spanning tree. Subtree #1 and subtree #2 do not overlap, and leaf node #1 and leaf node #2 satisfy a first preset condition. Satisfying the first preset condition includes: the difference in index between the two leaf nodes corresponding to any two subtrees in the first spanning tree is equal to an integer multiple of K-1. For example... Figure 4 As shown, network node #1 can be the network node corresponding to node 5 in the first spanning tree, and network node #2 can be the network node corresponding to any one of nodes 8, 11, and 14 in the first spanning tree.
[0160] Step 850: The controller determines that time slice 1 has ended.
[0161] The method in step 850 above is the same as the method in step 220 above for the control node to determine the end of time slice i. For details, please refer to the relevant description in step 220 above.
[0162] Step 860: Network node #1 determines clock offset information 1 based on data packet #1 and data packet #2, and sends clock offset information 2 to the controller.
[0163] In this context, data packet #2 is a data packet sent by network node #2 to network node #1. Data packet #2 carries the timestamp of network node #2 receiving data packet #1 and the timestamp of network node #2 sending data packet #2. The method for determining clock offset information 1 in step 860 above is the same as the method for the control node to determine clock offset information in step 220 above. For details, please refer to the relevant description in step 220 above.
[0164] Step 870: The controller determines the clock offset information #2 for each loop based on the 18 loops included in the network topology and the clock offset information #1 for each loop; and determines the clock offset information 3 of each network node in each loop relative to the reference clock based on the clock offset information #2 for each loop included in the network topology, and sends the clock offset information 3 to the corresponding network node.
[0165] The clock offset information #1 for each loop includes multiple clock offset information 1s corresponding to that loop, each of which corresponds one-to-one with the multiple edges included in each loop. Each clock offset information 1 represents the clock offset between two network nodes corresponding to that edge. The clock offset information #2 for each loop includes multiple clock offset information 2s corresponding to that loop, each of which corresponds one-to-one with the multiple edges included in each loop. Each clock offset information 2 represents the clock offset between two network nodes corresponding to that edge.
[0166] The method in step 870 above is the same as the method in step 220 above. For details, please refer to the relevant description in step 220 above.
[0167] Below, in conjunction with, for example Figure 4 The clock offset information 3 for each network node in step 870 above. Assume the clock offset amount of the network node corresponding to node #1 in the first spanning tree relative to the network node corresponding to node 0 in the first spanning tree is X1, and the clock offset speed of the network node corresponding to node #1 relative to the network node corresponding to node 0 is Y1. That is, the clock offset information 3 for node #1 includes X1 and Y1. The clock offset amount of the network node corresponding to node #2 relative to the network node corresponding to node #1 is X2, and the clock offset speed of the network node corresponding to node #2 relative to the network node corresponding to node #1 is Y2. That is, the clock offset information 3 for node #2 includes X1+X2 and Y1+Y2. Here, node #1 is a node at the first level in the first spanning tree, node #2 is a node at the second level in the first spanning tree, and node #1 is the parent node of node #2.
[0168] Step 880: Network node h determines whether the local clock needs to be adjusted.
[0169] Where h is a positive integer, and 1 ≤ h ≤ 16. Network node h determines whether its local clock needs adjustment, including:
[0170] If network node h determines that its local clock needs adjustment, then step 890 is executed after step 880; or, if network node h determines that its local clock does not need adjustment, then step 810 is executed after step 880. It is understood that if network node h determines that its local clock needs adjustment, then the clock offset amount or clock offset rate corresponding to the clock offset information of network node h relative to the reference clock is not zero.
[0171] Step 890: Network node h adjusts its local clock according to clock offset information 3.
[0172] As described in step 870 above, the clock offset information 3 corresponding to node #1 of the first spanning tree includes X1 and Y1. The clock offset information 3 corresponding to node #2 of the first spanning tree includes X1+X2 and Y1+Y2. Based on this, synchronizing the network node corresponding to node #1 with the reference clock includes: decreasing the local clock of the network node corresponding to node #1 by X1, and decreasing the frequency of the local clock of the network node corresponding to node #1 by Y1. Synchronizing the network node corresponding to node #2 with the reference clock includes: decreasing the time of the local clock of the network node corresponding to node #2 by X1+X2, and decreasing the frequency of the local clock of the network node corresponding to node #2 by Y1+Y2. For example, Figure 4 In the first spanning tree, node 1 can be node #1, and node 5 can be node #2.
[0173] The above text combined Figures 1 to 8 This paper details the clock synchronization method provided in this application. Below, we will discuss the method in conjunction with... Figures 9 to 12 This application provides a detailed description of the control node, the first network node, and the system. It should be understood that the descriptions of the method embodiments correspond to the descriptions of the apparatus embodiments; therefore, any parts not described in detail can be found in the foregoing method embodiments.
[0174] Figure 9 This is a schematic diagram of a control node 900 provided in an embodiment of this application. Figure 9 The control node 900 shown includes a transceiver unit 910 and a processing unit 920.
[0175] Specifically, the transceiver unit 910 is used to execute the steps related to the control node receiving or sending messages in step 210 or step 220, the steps related to sending the probe task in step 820, the steps related to allocating a time channel for the cluster system in step 830, and the steps related to sending the corresponding clock offset information 3 to the network node in step 870. These steps can be found in the relevant descriptions above and will not be repeated in detail here. The processing unit 920 is used to execute the steps related to determining the clock offset information in steps 210, 220, 810, 820, 830, 850, and 870, as well as steps 880 and 890. These steps can be found in the relevant descriptions above and will not be repeated in detail here.
[0176] Figure 10 This is a schematic diagram of a first network node 1000 provided in an embodiment of this application. Figure 10 The first network node 1000 shown includes a transceiver unit 1010 and a processing unit 1020.
[0177] Specifically, the transceiver unit 1010 is used to execute the steps related to the first network node sending a first message or receiving a second message in method 200, and the steps related to the network node (e.g., network node #1 or network node #2) sending or receiving data packets in method 800. The processing unit 1020 is used to execute the steps related to the first network node determining the first clock offset information in method 200, and the steps related to network node #1 determining clock offset information #1 in method 800.
[0178] Figure 11 This is a schematic diagram of the hardware structure of a device 1100 provided in an embodiment of this application.
[0179] like Figure 11 As shown, the device 1100 includes a processor 1110, a communication interface 1120, a memory 1130, and a bus 1140. The communication interface 1120 can be implemented wirelessly or via a wired connection; specifically, it can be a network interface card (NIC). The processor 1110, memory 1130, and communication interface 1120 are connected via the bus 1140.
[0180] In some implementations, Figure 11 The device 1100 shown can execute the corresponding steps performed by the control node in the above method embodiment. These steps can be found in the relevant descriptions above, and will not be repeated in detail here.
[0181] Among them, in the above Figure 9When the functions of each unit module included in the control node 900 are executed by software, the memory 1130 can store the program code executed by the software, and the processor 1110 can call the program code stored in the memory 1130 to execute the functions of each unit module included in the control node 900. For details not elaborated here, please refer to the above. Figure 9 The description of control node 900 in the document.
[0182] Specifically, the communication interface 1120 may include a transmitter and a receiver, and the specific functions of the transmitter are as described above. Figure 9 The transmitting function of the transceiver unit 910 shown is the same. The functions of the transmitter, which are not described in detail here, can be found above. Figure 9 The transmitting function of the transceiver unit 910 shown is illustrated. The specific functions of the receiver are the same as described above. Figure 9 The receiving function of the transceiver unit 910 shown is the same. The functions of the receiver, which are not described in detail here, can be found above. Figure 9 The receiving function of the transceiver unit 910 shown.
[0183] The memory 1130 includes an operating system 1131 and an application program 1132, used to store programs, code, or computer-executable instructions. When the processor or hardware device executes these programs, code, or computer-executable instructions, the processing procedures involving the control node in the method embodiment can be completed. Optionally, the memory 1130 may include read-only memory (ROM) and random access memory (RAM). The ROM includes a basic input / output system (BIOS) or an embedded system; the RAM includes the application program and the operating system. When the control node needs to run, the system is booted through the BIOS embedded in the ROM or the bootloader in the embedded system, guiding the control node into normal operating mode. After the control node enters normal operating mode, the application program and the operating system running in the RAM complete the processing procedures involving the control node in the method embodiment.
[0184] In some other implementations, Figure 11 The device 1100 shown can perform the corresponding steps executed by the network node (e.g., the first network node) in the above method embodiments. These steps can be found in the relevant descriptions above and will not be repeated in detail here.
[0185] Among them, in the above Figure 10When the functions of each unit module included in the first network node 1000 are executed by software, the memory 1130 can store the program code executed by the software, and the processor 1110 can call the program code stored in the memory 1130 to execute the functions of each unit module included in the first network node 1100. For details not elaborated here, please refer to the above. Figure 10 The description of the first network node 1000.
[0186] Specifically, the communication interface 1120 may include a transmitter and a receiver, and the specific functions of the transmitter are as described above. Figure 10 The transmitting function of the transceiver unit 1010 shown is the same. The functions of the transmitter, which are not described in detail here, can be found above. Figure 10 The transceiver unit 1010 shown here has a transmitting function. The specific function of the receiver is the same as described above. Figure 10 The receiving function of the transceiver unit 1010 shown is the same. The functions of the receiver, which are not described in detail here, can be found above. Figure 10 The receiving function of the transceiver unit 1010 shown.
[0187] The memory 1130 includes an operating system 1131 and an application program 1132, used to store programs, code, or computer-executable instructions. When the processor or hardware device executes these programs, code, or computer-executable instructions, the processing procedures involving the first network node in the method embodiment can be completed. Optionally, the memory 1130 may include read-only memory (ROM) and random access memory (RAM). The ROM includes a basic input / output system (BIOS) or an embedded system; the RAM includes the application program and the operating system. When the first network node needs to run, the system is booted through the BIOS embedded in the ROM or the bootloader in the embedded system, guiding the first network node into normal operating mode. After the first network node enters normal operating mode, the application program and the operating system running in the RAM complete the processing procedures involving the first network node in the method embodiment.
[0188] Understandable Figure 11 Only a simplified design of device 1100 is shown. In some implementations, network device 1100 may also include any number of processors 1110, communication interfaces 1120, or memory 1130. In other implementations, network device 1100 may include only any number of processors 1110 and communication interfaces 1120.
[0189] Figure 12 This is a schematic diagram of a system 1200 according to an embodiment of this application. Figure 12 As shown, the system 1200 may include the above-mentioned Figure 9 The control node 900 shown and the above Figure 10 The diagram shows N-1 first network nodes 1000, where N is a positive integer greater than or equal to 2. The hardware structure of the control node 900 and the first network nodes 1000 can be as follows: Figure 11 As shown.
[0190] This application provides a computer program product that, when run on a control node, causes the control node to execute the method described in the above method embodiments.
[0191] This application provides a computer program product that, when run on a first network node, causes the first network node to execute the method described in the above method embodiment.
[0192] This application provides a computer-readable storage medium for storing a computer program that includes methods for performing the methods described in the above-described method embodiments.
[0193] This application provides a chip system including at least one processor and an interface; the at least one processor is used to call and run a computer program to cause the chip system to perform the methods described in the above method embodiments. The various product forms of the devices described above each have any of the functions of the network devices in the above method embodiments, which will not be elaborated further here.
[0194] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0195] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0196] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0197] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0198] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0199] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0200] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A clock synchronization method, characterized in that, The method is applied to a cluster system comprising N nodes, including a control node and N-1 network nodes, where N is a positive integer greater than or equal to 2. The control node constructs a network topology based on a first spanning tree and a target strategy. The first spanning tree takes the network node where the reference clock is located as the root node. All nodes in the first spanning tree except the root node have a mapping relationship with the N-1 network nodes. The target strategy is used to indicate the way to connect the target nodes in the first spanning tree. Each node in the first spanning tree is at least a node in at least one loop included in the network topology. The loop length of any loop included in the network topology is associated with the number of levels included in the first spanning tree and the target strategy. The control node performs clock synchronization on the N-1 network nodes according to the reference clock and the network topology; The root node of the first spanning tree has K child nodes, where K is an integer greater than or equal to 2. The first spanning tree includes a first subtree and a second subtree, which have no intersection. The root node of any subtree is a child node of the root node of the first spanning tree. The first subtree includes K-1 leaf nodes, and the second subtree includes K-1 leaf nodes. The control node constructs the network topology based on the first spanning tree and the target policy, including: When the first leaf node and the second leaf node meet the first preset condition, the control node connects the first leaf node and the second leaf node to construct the network topology. The first leaf node is the leaf node of the first subtree, the second leaf node is the leaf node of the second subtree, and the target node includes the first leaf node and the second leaf node. The loop length of any loop in the network topology is associated with the number of levels in the first spanning tree and the target policy, including: The network topology includes any loop that includes nodes at each level of the first spanning tree.
2. The method according to claim 1, characterized in that, The condition of satisfying the first preset condition includes: the difference in the index of the two leaf nodes corresponding to any two subtrees in the first spanning tree is equal to an integer multiple of K-1.
3. The method according to claim 1, characterized in that, The length of any loop in the network topology is (2×d+1), where d represents the number of levels in the first spanning tree and is an integer. The distance from any node in any level of the first spanning tree to the root node of the first spanning tree is the number of levels. "1" represents the number of hops from the first leaf node to the second leaf node.
4. The method according to any one of claims 1 to 3, characterized in that, The number of loops in the network topology is equal to the number of connections made to the target nodes in the first spanning tree. The number of loops included in the network topology is equal to the number of loops in the network topology. The result of rounding is that any loop in the network topology includes the root node of the first spanning tree, the first leaf node, the second leaf node, at least one first intermediate node, and at least one second intermediate node. The at least one first intermediate node is a child node of the root node of the first spanning tree and a parent node of the first leaf node. The at least one second intermediate node is a child node of the root node of the first spanning tree and a parent node of the second leaf node.
5. The method according to claim 1, characterized in that, The first spanning tree also includes a third subtree, wherein there is no intersection between any two subtrees of the first subtree, the second subtree, and the third subtree, and the third subtree includes K-2 leaf nodes. The control node constructs the network topology based on the first spanning tree and the target policy, and also includes: When the leaf node of the third subtree and the third leaf node satisfy the second preset condition, the control node connects the third leaf node to the root node of the third subtree to construct the network topology. The third leaf node is the leaf node of the second subtree, and the target node also includes the third leaf node and the root node of the third subtree. When the leaf nodes of the third subtree and the fourth leaf node satisfy the second preset condition, and when the leaf nodes of the third subtree and the fifth leaf node satisfy the second preset condition, the control node connects the fourth leaf node and the fifth leaf node to construct the network topology, wherein the fourth leaf node is the leaf node of the first subtree and the fifth leaf node is the leaf node of the second subtree.
6. The method according to claim 5, characterized in that, The condition of satisfying the first preset condition includes: the difference in the index of the two leaf nodes corresponding to any two subtrees in the first spanning tree is equal to an integer multiple of K-1; The second preset condition includes: the difference between the index of any leaf node in the third subtree and the index of the leaf node in the subtree other than the third subtree in the first spanning tree is not equal to an integer multiple of K-1, and the leaf nodes of the subtree other than the third subtree in the first spanning tree include the third leaf node, the fourth leaf node, and the fifth leaf node.
7. The method according to claim 5, characterized in that, The network topology includes a second loop and pairs. The result takes an integer number of first cycles. Any first cycle is a cycle including the root node, the first leaf node, and the second leaf node of the first spanning tree. The length of any first cycle is (2×d+1). The second cycle is a cycle including the root node, the third leaf node, and the root node of the third subtree of the first spanning tree. The length of the second cycle is 2×d, where d represents the number of levels in the first spanning tree and is an integer. The distance from any node in the first spanning tree to the root node of the first spanning tree is the number of levels. "1" represents the number of hops from the first leaf node to the second leaf node.
8. The method according to any one of claims 5 to 7, characterized in that, The degree of any node in the network topology, excluding the leaf nodes of the third subtree, the fourth leaf node, and the fifth leaf node, is K. A degree of K indicates that the node is connected to any K nodes in the network topology. The degree of any node among the leaf nodes of the third subtree, the fourth leaf node, and the fifth leaf node is K-1. A degree of K-1 indicates that the node is connected to any K-1 nodes in the network topology. Any two nodes connected in the network topology represent two network nodes that send data packets to each other. These data packets are used to obtain clock offset information between the two network nodes.
9. The method according to any one of claims 1 to 3 or 5 to 7, characterized in that, Each node in the network topology has M connections to the M nodes in the network topology. Any two nodes in the network topology with connections represent two network nodes that send data packets to each other. The data packets are used to obtain clock offset information between the two network nodes, where M = K and N ≥ K + 1, or M = K - 1 and N ≥ K. Before the control node performs clock synchronization on the N-1 network nodes according to the reference clock and the network topology, the method further includes: The control node performs edge coloring on the network topology according to the graph edge coloring method, so that any two edges of any node in the network topology have different colors. The control node allocates time channels to the N-1 network nodes according to the coloring result, so that any network node is allocated M time channels, any two of the M time channels are different, and the M time channels correspond one-to-one with the M connection relationships. The control node sends a third message, which is used to indicate the M time channels allocated to any one of the network nodes.
10. The method according to any one of claims 1 to 3 or 5 to 7, characterized in that, Before the control node performs clock synchronization on the N-1 network nodes according to the reference clock and the network topology, the method further includes: The control node receives a first message sent by a first network node, where the first network node is any one of the N-1 network nodes, and the first message is used to indicate the end of the first time slice. The control node broadcasts a second message to the N-1 network nodes. The second message indicates that the first time slice has ended and the second time slice has begun. The first time slice and the second time slice are different.
11. The method according to any one of claims 1 to 3, characterized in that, The degree of any node in the network topology is K. The degree of any node being K indicates that the node is connected to any K nodes in the network topology. Any two nodes in the network topology that are connected indicate that the two network nodes corresponding to the two nodes send data packets to each other. The data packets are used to obtain clock offset information between the two network nodes.
12. The method according to any one of claims 1 to 3 or 5 to 7, characterized in that, The network topology includes P loops, where P equals a pair of loops. The result is taken as an integer. The number of child nodes of the root node of the first spanning tree is K, where K is an integer greater than or equal to 2. The control node performs clock synchronization on the N-1 network nodes according to the reference clock and the network topology, including: The control node obtains P first clock offset information corresponding to the P loops, and each first clock offset information includes clock offset information between two network nodes corresponding to two connected nodes in the corresponding loop. The control node uses the least squares method to process the P loops and the P first clock offset information to obtain P second clock offset information corresponding to the P loops. Each second clock offset information includes the clock offset information between two network nodes corresponding to two connected nodes in the corresponding loop, and the sum of the offset values corresponding to all clock offset information included in each second clock offset information is zero. The clock offset information between two network nodes corresponding to two nodes with the same connection relationship in different loops is the same. The control node performs clock synchronization on the N-1 network nodes based on the P loops, the P second clock offset information, and the reference clock.
13. The method according to any one of claims 1 to 3 or 5 to 7, characterized in that, Before the control node performs clock synchronization on the N-1 network nodes according to the reference clock and the network topology, the method further includes: The control node sends N-1 probe tasks to the N-1 network nodes. Each of the N-1 network nodes corresponds one-to-one with one of the N-1 probe tasks. The first probe task in the N-1 probe tasks corresponds to the first network node in the N-1 network nodes. The first probe task is used to instruct the first network node to obtain the clock offset information of the first network node relative to the second network node. The N-1 network nodes include the first network node and the second network node. The first network node and the second network node are different. The network topology is used to indicate the connection relationship between the first network node and the second network node.
14. A clock synchronization device, characterized in that, The device is applied in a cluster system, which includes N nodes, including a control node and N-1 network nodes, where N is a positive integer greater than or equal to 2. The device includes a processing unit. The processing unit is configured to construct a network topology based on a first spanning tree and a target strategy. The first spanning tree is rooted at the network node where the reference clock is located. All nodes in the first spanning tree except the root node are mapped to the N-1 network nodes. The target strategy is used to indicate the way to connect target nodes in the first spanning tree. Each node in the first spanning tree is at least a node in at least one loop included in the network topology. The loop length of any loop included in the network topology is associated with the number of levels included in the first spanning tree and the target strategy. The processing unit is further configured to synchronize the clocks of the N-1 network nodes according to the reference clock and the network topology; The root node of the first spanning tree has K child nodes, where K is an integer greater than or equal to 2. The first spanning tree includes a first subtree and a second subtree, which have no intersection. The root node of any subtree is a child node of the root node of the first spanning tree. The first subtree includes K-1 leaf nodes, and the second subtree includes K-1 leaf nodes. The processing unit is further configured to: connect the first leaf node and the second leaf node to construct the network topology when the first leaf node and the second leaf node satisfy the first preset condition, wherein the first leaf node is the leaf node of the first subtree, the second leaf node is the leaf node of the second subtree, and the target node includes the first leaf node and the second leaf node. The loop length of any loop in the network topology is associated with the number of levels in the first spanning tree and the target policy, including: The network topology includes any loop that includes nodes at each level of the first spanning tree.
15. The apparatus according to claim 14, characterized in that, The first spanning tree also includes a third subtree, wherein there is no intersection between any two subtrees of the first subtree, the second subtree, and the third subtree, and the third subtree includes K-2 leaf nodes. The processing unit is also used for: When the leaf node of the third subtree and the third leaf node satisfy the second preset condition, the third leaf node is connected to the root node of the third subtree to construct the network topology. The third leaf node is the leaf node of the second subtree, and the target node also includes the third leaf node and the root node of the third subtree. If the leaf node of the third subtree and the fourth leaf node satisfy the second preset condition, and if the leaf node of the third subtree and the fifth leaf node satisfy the second preset condition, the fourth leaf node and the fifth leaf node are connected to construct the network topology, wherein the fourth leaf node is the leaf node of the first subtree and the fifth leaf node is the leaf node of the second subtree.
16. The apparatus according to claim 14 or 15, characterized in that, The device also includes a transceiver unit. The transceiver unit is also used for: Before the control node performs clock synchronization on the N-1 network nodes according to the reference clock and the network topology, it receives a first message sent by a first network node, where the first network node is any one of the N-1 network nodes, and the first message is used to indicate the end of the first time slice; A second message is broadcast to the N-1 network nodes. The second message is used to indicate that the first time slice has ended and the second time slice has started. The first time slice and the second time slice are different.
17. A control node, characterized in that, include: A processor configured to be coupled to a memory, read and execute instructions and / or program code in the memory to perform the method as claimed in any one of claims 1 to 13.
18. A chip system, characterized in that, include: A logic circuit for coupling with an input / output interface, through which data is transmitted to perform the method as described in any one of claims 1 to 13.
19. A computer-readable medium, characterized in that, The computer-readable medium stores program code that, when run on a computer, causes the computer to perform the method as described in any one of claims 1 to 13.
20. A system, characterized in that, The system includes N nodes, which include a control node and N-1 network nodes. The control node is used to execute the method as described in any one of claims 1 to 13, where N is a positive integer greater than or equal to 2.
21. A computer program product, characterized in that, The computer program product includes computer program code that, when run on a computer, causes the computer to perform the method as described in any one of claims 1 to 13.
Citation Information
Patent Citations
Network and method for clock synchronization of clusters in a time triggered network
CN101512944A
Synchronizing nodes of a multi-hop network
US20110268139A1