Heartbeat detection method, device, equipment, medium and program product of network device
By calculating one-way transmission delay using PTP format heartbeat detection messages and timestamps, and combining bidirectional delay data to evaluate link status, the accuracy and reliability issues of link detection in existing technologies are resolved, achieving efficient link performance evaluation and traffic optimization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZIGUANG HENGYUE TECH CO LTD
- Filing Date
- 2026-03-26
- Publication Date
- 2026-05-29
AI Technical Summary
Existing heartbeat detection mechanisms are difficult to accurately quantify the real-time transmission performance of the link and are easily affected by factors such as link load and latency, which reduces the reliability of detection.
The heartbeat detection message in PTP format is used to calculate the one-way transmission delay by acquiring and recording the sending and receiving timestamps, and to evaluate the link performance by combining the two-way delay data. The link status is judged based on the delay threshold and the delay change within the time window, and the detection strategy is dynamically adjusted.
It improves the accuracy and reliability of link detection, can accurately quantify link performance, reduce false positives, optimize traffic transmission paths, and improve the system's business continuity and stability.
Smart Images

Figure CN122120168A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of link detection technology, and more specifically, to a method, apparatus, device, medium, and program product for heartbeat detection of network devices. Background Technology
[0002] In the field of network communication, Multi-Chassis Link Aggregation Group (MLAG) technology improves link bandwidth and reliability by virtualizing multiple physical devices into a single logical device. To ensure collaborative operation between MLAG peers, continuous monitoring of the connection status between each peer is necessary.
[0003] Currently, traditional heartbeat detection mechanisms typically employ a two-way request-response model, using periodic exchange of messages to determine whether the peer device is alive or whether the link is connected.
[0004] However, such methods often struggle to accurately quantify the real-time transmission performance of a link, and the message exchange process is easily affected by factors such as link load and latency, further weakening the reliability of performance monitoring. Therefore, a solution is needed to improve the accuracy and reliability of heartbeat detection. Summary of the Invention
[0005] The purpose of this application is to provide a method, apparatus, device, medium, and program product for heartbeat detection of network devices, so as to improve the accuracy and reliability of heartbeat detection.
[0006] In a first aspect, embodiments of this application provide a heartbeat detection method for a network device, applied to a first network device in a multi-chassis link aggregation group, the method comprising: Obtain a heartbeat detection message sent by a second network device; wherein, the second network device is another peer network device in the multi-chassis link aggregation group that is communicatively connected to the first network device, the heartbeat detection message is a message transmitted by the second network device based on PTP format, and the heartbeat detection message is encapsulated with a message sending timestamp, wherein PTP is a Precision Time Protocol; Record the timestamp of the received heartbeat detection message; Based on the sending timestamp and the receiving timestamp, the one-way transmission delay from the second network device to the first network device is determined; Based on the unidirectional transmission delay, determine the link performance status between itself and the second network device.
[0007] In this embodiment of the application, by obtaining the heartbeat message carrying the precise PTP transmission timestamp and recording the local reception timestamp, a high-precision one-way transmission delay can be calculated, thereby achieving a precise quantitative evaluation of link performance and effectively improving the accuracy and reliability of link detection for network devices.
[0008] In some embodiments, determining the link performance status between itself and the second network device based on the one-way transmission delay includes: Receive a second one-way transmission delay sent by the second network device; wherein the second one-way transmission delay is a one-way transmission delay from the first network device to the second network device determined by the second network device; By combining the one-way transmission delay and the second one-way transmission delay, the link performance status between itself and the second network device is determined.
[0009] In this embodiment of the application, by exchanging and integrating bidirectional unidirectional transmission delay data, the link status between two devices can be comprehensively evaluated by combining measurement data from both directions, thereby further improving the accuracy and reliability of link detection.
[0010] In some embodiments, determining the link performance status between itself and the second network device based on the one-way transmission delay includes: If the one-way transmission delay exceeds a preset first delay threshold, the link performance state is determined to be a congested state. If the one-way transmission delay exceeds a preset second delay threshold, the link performance status is determined to be a fault state; wherein the second delay threshold is greater than the first delay threshold.
[0011] In this embodiment of the application, by setting different delay thresholds to classify and judge the delay situation, it is possible to accurately distinguish the degree of abnormality in link performance and further improve the flexibility of link detection.
[0012] In some embodiments, determining the link performance status between itself and the second network device based on the one-way transmission delay includes: Obtain multiple consecutively determined one-way transmission delays within a preset time window; Based on the multiple unidirectional transmission delays, the link performance status between itself and the second network device is determined.
[0013] In this embodiment of the application, by comprehensively analyzing multiple consecutive delay detection data within a time window, interference caused by instantaneous network jitter can be effectively eliminated, further improving the accuracy and reliability of link detection.
[0014] In some embodiments, determining the link performance status between itself and the second network device based on the plurality of one-way transmission delays further includes: Calculate the change between any two adjacent unidirectional transmission delays among the plurality of unidirectional transmission delays; Based on the changes, determine the link performance status between itself and the second network device.
[0015] In the embodiments of this application, by calculating the rate of change or fluctuation between consecutive delays, the degradation trend of link performance can be effectively captured, thereby further improving the sensitivity and comprehensiveness of link detection.
[0016] In some embodiments, the method further includes: When it is determined that the current link is in an abnormal state based on the link performance status, the network load sharing strategy of the current link in the multi-chassis link aggregation group is adjusted based on the abnormal state. The current link is the link between the first network device and the second network device, and the abnormal state includes a congestion state or a fault state.
[0017] In this embodiment of the application, by automatically adjusting the load sharing strategy of the link when an anomaly is determined, the traffic transmission path can be dynamically optimized, thereby further improving the service continuity and stability of the multi-device combined system.
[0018] In some embodiments, the method further includes: Based on the real-time network status of the multi-chassis link aggregation group, the heartbeat detection strategy between the first network device and the second network device is dynamically adjusted. The real-time network status includes the link performance status or the one-way transmission delay, and the heartbeat detection strategy includes the transmission method and transmission frequency of the heartbeat detection message.
[0019] In this embodiment, by dynamically adjusting the sending frequency or transmission mode of heartbeat messages according to the real-time network status, the monitoring effect and resource consumption can be comprehensively balanced, thereby further improving the efficiency and flexibility of link detection.
[0020] In some embodiments, the sending timestamp is generated by the second network device based on its second clock; the receiving timestamp is recorded by the first network device based on the first clock when it receives the heartbeat detection message; wherein the first clock and the second clock are synchronized in advance using a precise time protocol.
[0021] In this embodiment of the application, by synchronizing the clocks of two devices and obtaining the corresponding timestamp information based on the PTP protocol, the uniformity of the time base can be ensured, thereby further improving the accuracy and reliability of link detection.
[0022] Secondly, embodiments of this application provide a heartbeat detection device for a network device, applied to a first network device in a multi-chassis link aggregation group, comprising: The message acquisition module is used to acquire heartbeat detection messages sent by the second network device; wherein, the second network device is another peer network device in the multi-chassis link aggregation group that is communicatively connected to the first network device, the heartbeat detection message is a message transmitted by the second network device based on PTP format, and the heartbeat detection message is encapsulated with a message sending timestamp, wherein PTP is a Precision Time Protocol; The timestamp recording module is used to record the received timestamp of the heartbeat detection message; The delay determination module is used to determine the one-way transmission delay from the second network device to the first network device based on the sending timestamp and the receiving timestamp; The status determination module is used to determine the link performance status between itself and the second network device based on the one-way transmission delay.
[0023] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, can implement the method described in any embodiment of the first aspect.
[0024] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, can implement the method described in any embodiment of the first aspect.
[0025] Fifthly, embodiments of this application provide a computer program product, the computer program product including a computer program, wherein when the computer program is executed by a processor, it can implement the method described in any embodiment of the first aspect. Attached Figure Description
[0026] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0027] Figure 1 A flowchart illustrating a heartbeat detection method for a network device provided in an embodiment of this application; Figure 2 This is a schematic diagram of the structure of a heartbeat detection device for a network device provided in an embodiment of this application; Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0028] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0029] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0030] like Figure 1 As shown, this application provides a heartbeat detection method for a network device, applied to a first network device in a multi-chassis link aggregation group, and may include the following steps: S1. Obtain the heartbeat detection message sent by the second network device; wherein, the second network device is another peer network device in the multi-chassis link aggregation group that is connected to the first network device for communication, the heartbeat detection message is a message transmitted by the second network device based on PTP format, and the heartbeat detection message is encapsulated with the message's sending timestamp, PTP being a precise time protocol.
[0031] For example, a multi-chassis link aggregation group may include at least a first network device and a second network device (typically a switch) that are peers. These two network devices are configured to use the Precision Time Protocol (PTP) as a time synchronization protocol for heartbeat detection. Based on this embodiment, by utilizing the PTP protocol's robust error correction and verification mechanisms and multi-layer transmission structure, heartbeat message exchange can be better guaranteed, effectively improving the accuracy and reliability of link detection.
[0032] For example, the first network device can be any network device in a multi-chassis link aggregation group, which continuously listens through its network interface (e.g., an Ethernet port). When it receives a message sent by the second network device (another peer network device in the multi-chassis link aggregation group that is communicatively connected to the first network device), it can parse it to confirm that the message is a pre-agreed PTP format message used for heartbeat detection.
[0033] It should be noted that the heartbeat detection message can be a standard PTP event message (such as a Sync message) or a custom message that utilizes the PTP message header and format. For example, the message format should conform to the PTP protocol standard, including fields such as source address, destination address, and timestamp. From the specified fields of the message, the sending timestamp (T1) written by the second network device at the time of transmission can be extracted.
[0034] S2. Record the timestamp of the received heartbeat detection message.
[0035] For example, when the heartbeat detection message arrives at its physical layer chip or network interface controller, the first network device immediately triggers a timestamp recording action to obtain a high-precision reception timestamp.
[0036] For example, the recording of the received timestamp can be accomplished by a high-precision local clock built into the first network device and pre-synchronized with the second network device via the PTP protocol, so as to record the current precise moment as the received timestamp (T2).
[0037] S3. Determine the one-way transmission delay from the second network device to the first network device based on the sending timestamp and receiving timestamp.
[0038] Understandably, the first network device (e.g., the control module) can perform delay calculations after acquiring T1 and T2. For example, the calculation formula could be: one-way transmission delay Δt = T2 - T1. Since T1 and T2 are recorded based on a clock synchronized via PTP, the calculated Δt can accurately reflect the total time elapsed from when the heartbeat detection message leaves the second network device to when it arrives at the first network device (which mainly includes the transmission time of the heartbeat detection message during this period).
[0039] S4. Based on the one-way transmission delay, determine the link performance status between itself and the second network device.
[0040] For example, after calculating the one-way transmission delay, the one-way transmission delay can be compared with a preset performance baseline or threshold, such as 0.5 milliseconds in a stable network.
[0041] For example, the status judgment logic can be defined as follows: if Δt ≤ 2 milliseconds, the link performance status is determined to be "normal"; if 2 milliseconds < Δt ≤ 20 milliseconds, the link performance status is determined to be "congested"; if Δt > 20 milliseconds or packets are continuously lost, the link performance status is determined to be "severely abnormal or faulty".
[0042] For example, when an anomaly such as link congestion or equipment failure is determined based on the link performance status, a corresponding link quality alarm can be triggered.
[0043] This application embodiment obtains heartbeat messages carrying precise PTP transmission timestamps and records local reception timestamps, enabling the calculation of high-precision one-way transmission delays. This allows for accurate quantitative evaluation of link performance, effectively improving the accuracy and reliability of link detection for network devices.
[0044] In some embodiments, heartbeat detection messages can be transmitted via multicast. Using the multicast function of the PTP protocol, heartbeat detection messages can be simultaneously sent to multiple MLAG peer devices. This method reduces network resource consumption and improves detection efficiency. For example, in a large data center network with multiple MLAG groups requiring heartbeat detection, using PTP multicast, a heartbeat detection message sent by one network device can be received by multiple related MLAG devices. Compared to unicast, this significantly reduces network resource consumption and improves heartbeat detection efficiency, making it particularly suitable for large-scale network deployments.
[0045] In certain specific situations, unicast mode can also be selected to directly send heartbeat detection messages to designated MLAG peer devices.
[0046] In some embodiments, heartbeat detection messages can be encrypted using a message digest algorithm (such as MD5) during transmission to ensure message integrity and security. Using a message digest algorithm (such as MD5) to verify message integrity prevents tampering during transmission. When using PTP protocol messages to detect MLAG heartbeat links, this reliability guarantees the accuracy of heartbeat detection results. Even under network congestion or with minimal packet loss, the status of the heartbeat link can still be accurately determined, reducing the possibility of false positives.
[0047] It's important to note that the network topology in MLAG can be complex and diverse, including tree and ring structures. The PTP protocol can adapt well to various network topologies, enabling heartbeat link detection for MLAG. For example, in a tree topology, the PTP protocol can leverage its hierarchical structure to propagate heartbeat detection messages downwards from the root node, effectively covering all MLAG devices in the network. In a ring topology, with proper configuration, the PTP protocol can prevent messages from endlessly looping within the ring and accurately detect the status of each MLAG heartbeat link, providing reliable heartbeat detection services for MLAG devices in complex network topologies.
[0048] In some embodiments, determining the link performance status between itself and the second network device based on one-way transmission delay includes: Receive a second one-way transmission delay sent by the second network device; wherein the second one-way transmission delay is the one-way transmission delay from the first network device to the second network device determined by the second network device; By combining the one-way transmission delay and the second one-way transmission delay, the link performance status between itself and the second network device is determined.
[0049] For example, the first network device calculates the one-way transmission delay (Delay) from the second network device to the local device. AtoB After that, it can encapsulate its own delay data (one-way transmission delay) or the preliminary status determined locally in a status synchronization message through an independent transmission channel (such as a dedicated VLAN or in-band management channel) and actively send it to the second network device (which can be any peer network device in the same MLAG).
[0050] Similarly, the first network device can also receive similar messages (state synchronization messages) from the second network device, which include the one-way transmission delay (Delay) calculated by the second network device from the first network device to itself. BtoA (i.e., the second one-way transmission delay) or its preliminary state judgment.
[0051] Based on this, the first network device can combine Delay AtoB and Delay BtoA A comprehensive evaluation can be conducted, such as taking the maximum or average of the two values as the final link delay, to determine the final link performance status. Alternatively, the delay in each direction can be assessed separately to determine if it is abnormal; for example, if only the delay... AtoB Abnormal and Delay BtoA If it is normal, it indicates that there is a problem with the receiving path of the first network device, rather than link congestion, thus allowing for a more accurate anomaly assessment.
[0052] Based on this embodiment, by exchanging and integrating bidirectional unidirectional transmission delay data, the link status between two devices can be comprehensively evaluated by combining measurement data from both directions, thereby further improving the accuracy and reliability of link detection.
[0053] In some embodiments, determining the link performance status between itself and the second network device based on one-way transmission delay includes: If the one-way transmission delay exceeds a preset first delay threshold, the link performance status is determined to be congested. If the one-way transmission delay exceeds a preset second delay threshold, the link performance status is determined to be a fault state; wherein the second delay threshold is greater than the first delay threshold.
[0054] For example, when the link performance status is in a certain state, two delay thresholds can be preset: a first delay threshold (e.g., 10 milliseconds) is used as the basis for judging the congestion state, and a second delay threshold (e.g., 100 milliseconds) is used as the basis for judging the fault state.
[0055] For example, after obtaining the one-way transmission delay Δt, it can first be compared with a first delay threshold. If Δt is greater than 10 milliseconds (the first delay threshold) but less than 100 milliseconds (the second delay threshold) and the message is reachable, the link performance status is determined to be congested, and a link quality alarm can be triggered, for example. If Δt continuously exceeds 100 milliseconds (the second delay threshold), or if no valid heartbeat message is received within three consecutive detection periods (in which case Δt can be considered a timeout value), the link performance status is determined to be faulty, and a higher-level link fault alarm can be triggered, for example.
[0056] Based on this embodiment, by setting different delay thresholds to classify and judge delay conditions, it is possible to accurately distinguish the degree of abnormality in link performance and further improve the flexibility of link detection.
[0057] In some embodiments, determining the link performance status between itself and the second network device based on one-way transmission delay includes: Obtain multiple consecutively determined one-way transmission delays within a preset time window; Based on multiple unidirectional transmission delays, the link performance status between itself and the second network device is determined.
[0058] For example, the first network device may maintain a sliding time window of a preset length (the window size can be configured as needed, for example, 5 sampling times as a window) to store multiple (e.g. 5) one-way transmission delay values (e.g. Δt1, Δt2, ..., Δt5) that have been calculated recently.
[0059] When assessing link performance status, the judgment is no longer based on a single one-way transmission delay. Instead, it is replaced by a comprehensive analysis of data within the current time window. For example, the average of multiple one-way transmission delays can be calculated, and the status can be determined based on the average (e.g., if the average exceeds a congestion threshold, the link status is determined to be congested); or, the proportion of samples exceeding the threshold in the window can be checked. If this proportion exceeds a preset threshold (e.g., 80%, meaning 4 out of 5 exceed the limit), the status is determined to be abnormal (congestion or fault).
[0060] Understandably, this approach effectively filters out single latency spikes caused by sudden bursts of network traffic, avoiding misjudgments and making status assessments smoother and more reliable.
[0061] Based on this embodiment, by comprehensively analyzing multiple consecutive delay detection data within a time window, interference caused by instantaneous network jitter can be effectively eliminated, further improving the accuracy and reliability of link detection.
[0062] In some embodiments, determining the link performance status between itself and the second network device based on multiple one-way transmission delays further includes: Calculate the variation between any two adjacent one-way transmission delays in a set of multiple one-way transmission delays; Based on the changing situation, determine the link performance status between itself and the second network device.
[0063] For example, in addition to judging the state based on the absolute value of the delay within a preset time window, the state can also be judged based on the changes (amount of change or rate of change) between adjacent delay samples, such as calculating (Δt5-Δt4), (Δt4-Δt3), etc.
[0064] For example, if the detected continuous changes are all positive and show an increasing trend (i.e., the delay is accelerating), even if the absolute value of the current delay (or the average delay within the window) has not yet reached the fault threshold, it can be determined that the link performance is deteriorating rapidly and the abnormal state (congestion or fault) can be triggered in advance.
[0065] Furthermore, the jitter of each one-way transmission delay can be calculated, which is the standard deviation of each delay value from the average value within the window. A sudden increase in jitter indicates a decrease in link stability, and this can serve as an auxiliary indicator for judging network instability. This allows for a more comprehensive and accurate prediction of abnormal performance states in the transmission link.
[0066] Based on this embodiment, by calculating the rate of change or fluctuation between consecutive delays, the degradation trend of link performance can be effectively captured, thereby further improving the sensitivity and comprehensiveness of link detection.
[0067] In some embodiments, the method further includes: When it is determined that the current link is in an abnormal state based on the link performance status, the network load sharing strategy of the current link in the multi-chassis link aggregation group is adjusted based on the abnormal state. The current link is the link between the first network device and the second network device, and abnormal states include congestion or fault states.
[0068] For example, when it is determined that the current link (i.e. the link connecting the first network device and the second network device) is in a congested or faulty state, a network load adjustment action can be triggered.
[0069] Specifically, the load balancing algorithm parameters of the MLAG port group can be adjusted. For example, assuming the MLAG group contains both the faulty link and another normal link (such as the link between the first network device and the third network device), the load distribution weight of the faulty link can be dynamically reduced, while the load weight of the normal link is increased accordingly. In this way, subsequent service traffic will be distributed more to the normal link, thereby reducing the pressure on the faulty link.
[0070] Based on this embodiment, by automatically adjusting the load-sharing strategy of a link when an anomaly is detected, the traffic transmission path can be dynamically optimized, thereby further improving the service continuity and stability of a multi-device combined system.
[0071] In some embodiments, the system can record the results of each heartbeat detection to a log file, including, for example, timestamps, delay times, and alarm information. By periodically analyzing the log files, the real-time health status of the network can be assessed, and network configuration and management strategies can be optimized.
[0072] In some embodiments, the method further includes: Based on the real-time network status of the multi-chassis link aggregation group, dynamically adjust the heartbeat detection strategy between the first network device and the second network device; Among them, the real-time network status includes link performance status or one-way transmission delay, and the heartbeat detection strategy includes the transmission method and transmission frequency of heartbeat detection messages.
[0073] For example, the heartbeat detection strategy can be dynamically adjusted based on real-time network conditions, such as the current heartbeat link performance status or the latest one-way transmission delay.
[0074] For example, when the initial state is good, a lower frequency (the transmission frequency of the heartbeat detection message, such as once per second) of multicast method (the transmission method of the heartbeat detection message) can be used to send heartbeat detection messages to save resources.
[0075] When a delay exceeds a preset threshold and enters a congestion warning state (or there is a trend of increasing delay), the system automatically increases the detection frequency (the transmission frequency of heartbeat detection messages) to a higher frequency (e.g., once every 100 milliseconds), switches the message sending method (the transmission method of heartbeat detection messages) to a more reliable unicast method, and can also mark the message transmission priority as the highest priority to ensure that it is not crowded out by business traffic.
[0076] Once the network has stabilized for a period of time, the heartbeat detection strategy will automatically revert to a low-frequency, multicast mode.
[0077] Based on this embodiment, by dynamically adjusting the sending frequency or transmission mode of heartbeat messages according to the real-time network status, it is possible to comprehensively balance monitoring effectiveness and resource consumption, thereby further improving the efficiency and flexibility of link detection.
[0078] In some embodiments, after the system triggers an alarm and executes countermeasures due to an anomaly detected, the following mechanism is used for stable recovery: 1. Conditional judgment: If the delay of the heartbeat detection by the system is lower than a recovery threshold that is more stringent than the anomaly determination threshold for a period of time, the anomaly is considered to have been eliminated.
[0079] 2. Gradual recovery process: 2.1 For load balancing policy recovery: Based on preset step sizes and intervals, gradually move traffic from the backup link back to the original primary link. Verify after each rollback step; if the heartbeat detection latency worsens again, immediately roll back to the previous step.
[0080] 2.2 Regarding the restoration of the detection strategy: Once the network status or latency has fully stabilized, gradually restore the increased heartbeat detection frequency to the default configuration and adjust the heartbeat detection message transmission method back to the default method.
[0081] In some embodiments, the sending timestamp is generated by the second network device based on its second clock; the receiving timestamp is recorded by the first network device based on the first clock when it receives a heartbeat detection message; wherein the first clock and the second clock are synchronized in advance using a precise time protocol.
[0082] For example, in the initial stage of MLAG network establishment, the first network device and the second network device can synchronize their clocks via the PTP protocol. Furthermore, during heartbeat detection, clock synchronization can be re-triggered based on preset events or according to preset cycles.
[0083] Network devices can exchange messages through dedicated clock links or data links, ultimately synchronizing their local clocks (first clock and second clock) to sub-microsecond precision.
[0084] Based on this, when constructing a heartbeat detection message, the second network device can generate a transmission timestamp using a dedicated hardware or high-precision software interface locked to its PTP clock. When the message arrives at its physical layer port, the first network device captures and records the reception timestamp using a timestamp engine also locked to the PTP clock. Since the clock references of both network devices are aligned via PTP, the calculated one-way transmission delay accurately reflects the precise time elapsed for the message in the network medium and processing path.
[0085] Based on this embodiment, by synchronizing the clocks of two devices and obtaining the corresponding timestamp information based on the PTP protocol, the uniformity of the time base can be ensured, thereby further improving the accuracy and reliability of link detection.
[0086] Please refer to Figure 2 , Figure 2 A block diagram illustrating the composition of a heartbeat detection device for a network device according to some embodiments of this application is shown. It should be understood that the heartbeat detection device for this network device is similar to that described above. Figure 1 Corresponding to the method embodiments, it is able to perform each step involved in the above method embodiments. The specific function of the heartbeat detection device of the network device can be found in the description above. To avoid repetition, a detailed description is appropriately omitted here.
[0087] Figure 2 The heartbeat detection device of the network device includes at least one software function module that can be stored in memory or embedded in the heartbeat detection device of the network device in the form of software or firmware. The heartbeat detection device of the network device is applied to the first network device in a multi-chassis link aggregation group, including: The message acquisition module 210 is used to acquire the heartbeat detection message sent by the second network device; wherein, the second network device is another peer network device in the multi-chassis link aggregation group that is connected to the first network device for communication, and the heartbeat detection message is a message transmitted by the second network device based on the PTP format, and the heartbeat detection message is encapsulated with the message's sending timestamp, where PTP is the Precision Time Protocol. The timestamp recording module 220 is used to record the received timestamp of the heartbeat detection message; The delay determination module 230 is used to determine the one-way transmission delay from the second network device to the first network device based on the sending timestamp and the receiving timestamp; The status determination module 240 is used to determine the link performance status between itself and the second network device based on the one-way transmission delay.
[0088] It is understood that the above-described device embodiments correspond to the method embodiments of the present invention. The heartbeat detection device for a network device provided by the embodiments of the present invention can implement the heartbeat detection method for a network device provided by any one of the method embodiments of the present invention.
[0089] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the device described above can be referred to the corresponding process in the aforementioned method, and will not be elaborated further here.
[0090] like Figure 3As shown, some embodiments of this application provide an electronic device 300, which includes a memory 310, a processor 320, and a computer program stored in the memory 310 and executable on the processor 320. When the processor 320 reads the program from the memory 310 via a bus 330 and executes the program, it can implement any of the methods included in the heartbeat detection method of the network device described above.
[0091] Processor 320 can process digital signals and may include various computing architectures. For example, it may be a complex instruction set computer architecture, a reduced instruction set computer architecture, or an architecture that implements multiple instruction set combinations. In some examples, processor 320 may be a microprocessor.
[0092] The memory 310 can be used to store instructions executed by the processor 320 or data related to the execution of instructions. These instructions and / or data may include code used to implement some or all of the functions of one or more modules described in the embodiments of this application. The processor 320 of this disclosure embodiment can be used to execute the instructions in the memory 310 to implement the methods shown above. The memory 310 includes dynamic random access memory, static random access memory, flash memory, optical memory, or other memories well known to those skilled in the art.
[0093] Some embodiments of this application also provide a computer-readable storage medium storing a computer program that, when executed by a processor, describes the method described in the method embodiments.
[0094] Some embodiments of this application also provide a computer program product that, when run on a computer, causes the computer to perform the methods described in the method embodiments.
[0095] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For apparatus embodiments, since they are basically similar to method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0096] It should be understood, in the several embodiments provided in this application, that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0097] In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0098] If the aforementioned functions are implemented as software functional modules 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.
[0099] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application. It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0100] 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.
[0101] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A heartbeat detection method for a network device, characterized in that, The method, applied to a first network device in a multi-chassis link aggregation group, includes: Obtain a heartbeat detection message sent by a second network device; wherein, the second network device is another peer network device in the multi-chassis link aggregation group that is communicatively connected to the first network device, the heartbeat detection message is a message transmitted by the second network device based on PTP format, and the heartbeat detection message is encapsulated with a message sending timestamp, wherein PTP is a Precision Time Protocol; Record the timestamp of the received heartbeat detection message; Based on the sending timestamp and the receiving timestamp, the one-way transmission delay from the second network device to the first network device is determined; Based on the unidirectional transmission delay, determine the link performance status between itself and the second network device.
2. The heartbeat detection method for network devices according to claim 1, characterized in that, The step of determining the link performance status between itself and the second network device based on the one-way transmission delay includes: Receive a second one-way transmission delay sent by the second network device; wherein the second one-way transmission delay is a one-way transmission delay from the first network device to the second network device determined by the second network device; By combining the one-way transmission delay and the second one-way transmission delay, the link performance status between itself and the second network device is determined.
3. The heartbeat detection method for network devices according to claim 1, characterized in that, The step of determining the link performance status between itself and the second network device based on the one-way transmission delay includes: If the one-way transmission delay exceeds a preset first delay threshold, the link performance state is determined to be a congested state. If the one-way transmission delay exceeds a preset second delay threshold, the link performance status is determined to be a fault state; wherein the second delay threshold is greater than the first delay threshold.
4. The heartbeat detection method for network devices according to claim 1, characterized in that, The step of determining the link performance status between itself and the second network device based on the one-way transmission delay includes: Obtain multiple consecutively determined one-way transmission delays within a preset time window; Based on the multiple unidirectional transmission delays, the link performance status between itself and the second network device is determined.
5. The heartbeat detection method for network devices according to claim 4, characterized in that, The step of determining the link performance status between itself and the second network device based on the plurality of one-way transmission delays further includes: Calculate the change between any two adjacent unidirectional transmission delays among the plurality of unidirectional transmission delays; Based on the changes, determine the link performance status between itself and the second network device.
6. The heartbeat detection method for network devices according to claim 1, characterized in that, The method further includes: When it is determined that the current link is in an abnormal state based on the link performance status, the network load sharing strategy of the current link in the multi-chassis link aggregation group is adjusted based on the abnormal state. The current link is the link between the first network device and the second network device, and the abnormal state includes a congestion state or a fault state.
7. The heartbeat detection method for network devices according to claim 1, characterized in that, The method further includes: Based on the real-time network status of the multi-chassis link aggregation group, the heartbeat detection strategy between the first network device and the second network device is dynamically adjusted. The real-time network status includes the link performance status or the one-way transmission delay, and the heartbeat detection strategy includes the transmission method and transmission frequency of the heartbeat detection message.
8. The heartbeat detection method for network devices according to claim 1, characterized in that, The sending timestamp is generated by the second network device based on its second clock; the receiving timestamp is recorded by the first network device based on its first clock when it receives the heartbeat detection message; wherein the first clock and the second clock are synchronized in advance using a precise time protocol.
9. A heartbeat detection device for a network device, characterized in that, The first network device used in a multi-chassis link aggregation group includes: The message acquisition module is used to acquire heartbeat detection messages sent by the second network device; wherein, the second network device is another peer network device in the multi-chassis link aggregation group that is communicatively connected to the first network device, the heartbeat detection message is a message transmitted by the second network device based on PTP format, and the heartbeat detection message is encapsulated with a message sending timestamp, wherein PTP is a Precision Time Protocol; The timestamp recording module is used to record the received timestamp of the heartbeat detection message; The delay determination module is used to determine the one-way transmission delay from the second network device to the first network device based on the sending timestamp and the receiving timestamp; The status determination module is used to determine the link performance status between itself and the second network device based on the one-way transmission delay.
10. An electronic device, characterized in that, The device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, can implement the heartbeat detection method of any one of claims 1-8.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the heartbeat detection method of the network device as described in any one of claims 1-8.
12. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the heartbeat detection method of the network device according to any one of claims 1-8.