Election method and device used between switches

By introducing node consistency coefficient and network load regulation parameters into the ring network system, the repeated election problems caused by too many nodes are solved, the election efficiency and system stability are improved, and the system is not able to provide services for a long time.

CN119420621APending Publication Date: 2025-02-11OB TELECOM ELECTRONICS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411415659.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

The existing ring network system has repeatedly elected due to too many nodes during the election process, and it is unable to provide services to the outside world during the election process, resulting in the system being unable to provide services for a long time.

Method used

Introduce node consistency coefficient and network load regulation parameters, and adjust the status of the main node ring network port by timely launching election reports, including node MAC address, node ID, election port, priority, node consistency coefficient and network load regulation parameters. , and initiate a timed election when the node is disconnected or launched.

Benefits of technology

It improves election efficiency, shortens the time from initialization to normal operation, avoids the system being unable to provide services for a long time, and improves the overall stability and operation efficiency of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119420621A_ABST
    Figure CN119420621A_ABST
Patent Text Reader

Abstract

The invention provides an election method and device used between switches, relates to the technical field of network communication, and aims to improve network stability and communication efficiency in a ring network system. The method comprises the following steps: after a node is initialized, a ring network port of a switch initiates an election message regularly, and the election message comprises an MAC address of the node, a node ID, an election port, a priority, a node consistency coefficient and a network load adjustment parameter; the node with the highest priority is defaulted as a main node, and other nodes stop election and forward election messages; and after the main node finishes election, the port state is dynamically adjusted based on the received message. The device comprises a processor, a memory and a bus, and the processor executes instructions in the memory to implement the election method. According to the method, indexes such as the node consistency coefficient, the network load adjusting parameter and the link health degree are introduced, the election process is dynamically optimized, the stability and the election efficiency of the network are improved, and the problems of resource exhaustion and network instability in the prior art are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of network communication, and in particular to an election method and device between switches. Background Art

[0002] In the existing ring network system, in order to ensure the stability and connectivity of the network, the ring network port of each switch is used as an independent election entity. The main purpose of the election is to automatically calculate and determine a master node, so as to avoid network storms, broadcast storms and other problems that may occur in the ring network through the control of the master node on the network. When some ports of the master node are in a blocked state, the ring network can effectively avoid the problem of endless circulation of data packets in the network, thereby maintaining the stability of the system.

[0003] However, in the prior art, the election process of the ring network has major defects. First, during the election period, all nodes in the ring network will continuously send election messages until the master node is selected and notifies other nodes to start the service. During this period, the network cannot provide services to the outside world, and the entire ring network can only resume normal communication after the election is over. Especially when the number of nodes in the ring network is large, the number of election messages may increase rapidly, causing the processing capacity of the switch chip or the cache resources to be quickly exhausted. If the message processing speed is lower than the sending speed of the election message, or the cache of the device overflows and discards some messages, then some nodes will not be able to receive their own election messages, causing the election process of the entire ring network to come to a deadlock, and the master node cannot be selected, which in turn causes the system to be in a state of being unable to provide services for a long time.

[0004] In addition, existing election mechanisms usually lack the ability to dynamically adjust the load of different nodes in the network, and fail to fully consider the health status of the link. In a complex network environment, some nodes may be unable to effectively participate in the election or provide subsequent network services due to excessive load or unstable links. These problems lead to inefficiency in the ring network election process and easily cause network instability. Summary of the invention

[0005] In order to solve the technical problems in the prior art that the ring network system causes repeated elections due to too many nodes during the election period and cannot provide external services during the election process, the present invention provides an election method for switches.

[0006] The technical solution provided by the present invention is as follows:

[0007] First aspect:

[0008] The present invention provides an election method for switches, comprising:

[0009] S1: After the node is initialized, the ring network port of the switch periodically initiates an election message, which includes the node MAC address, node ID, election port, priority, node consistency coefficient Ω and network load adjustment parameter Ψ;

[0010] S2: By default, the node with the highest priority is the master node, and the other nodes are transmission nodes. When the transmission node receives the election message of the master node, it stops the election and forwards the election message;

[0011] S3: When all the ring network ports of the master node receive the election message sent by itself, the election ends, and the state of the ring network port of the master node is adjusted based on the node consistency coefficient Ω and the network load adjustment parameter Ψ in the received election message:

[0012] If the sending port and receiving port of the election message are the same, the port is set to forward;

[0013] If the sending port and receiving port are different, the high priority port is set to blocking and the other ports are set to forwarding;

[0014] S4: When the ring network port of the switch node is offline, the ring network port of the adjacent switch initiates a scheduled election. When the ring network port of the switch node is online, the current ring network node port initiates a scheduled election.

[0015] Second aspect:

[0016] The present invention provides an election device for switches, comprising:

[0017] A processor, a memory and a bus, wherein the memory stores execution instructions, and the processor executes the instructions to implement the election method between switches.

[0018] The beneficial effects brought about by the technical solution provided by the present invention include at least:

[0019] (1) In the present invention, by introducing the node consistency coefficient and the network load adjustment parameter, the problem of repeated elections in the ring network system due to too many device nodes in the prior art is solved. By quantitatively analyzing the network status of each node, it is possible to ensure a more accurate evaluation of the node priority during the election process, avoiding election deadlocks caused by nodes not receiving election messages in time. This not only greatly improves the election efficiency, but also shortens the time from system initialization to normal operation, effectively preventing the system from being unable to provide services for a long time;

[0020] (2) In the present invention, the network load adjustment parameters dynamically reflect the real-time load of each node, so that during the election process, adjustments can be made according to the actual state of the network load, avoiding the situation where some high-load nodes are excessively involved in the election due to insufficient processing capacity. By adjusting the transmission load in real time, it is possible to achieve balanced distribution of network resources, reduce resource competition and bottleneck problems in the network, and further improve the overall stability and operation efficiency of the system;

[0021] (3) In the present invention, the introduction of link health enables the system to continuously monitor the link status of each node and use the stability of the link as an important basis for priority determination during the election process. When the election messages of multiple nodes have the same priority, the system can give priority to selecting the node with the best link quality as the master node, ensuring that the election result has higher network stability while taking into account efficiency. This mechanism not only enhances the rationality of the election process, but also improves the fault tolerance and reliability of the entire ring network system in a complex network environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0023] Figure 1 A schematic diagram of a flow chart of an election method between switches provided by an embodiment of the present invention;

[0024] Figure 2 A schematic diagram of the structure of an election device between switches provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0025] The technical solution of the present invention is described below in conjunction with the accompanying drawings.

[0026] In the embodiments of the present invention, words such as "exemplarily" and "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "example" in the present invention should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of the word "example" is intended to present the concept in a specific way. In addition, in the embodiments of the present invention, the meaning expressed by "and / or" can be both, or it can be either of the two.

[0027] In the embodiments of the present invention, "image" and "picture" can sometimes be used interchangeably. It should be noted that when the difference between them is not emphasized, the meanings they intend to express are the same. "of", "corresponding, relevant" and "corresponding" can sometimes be used interchangeably. It should be noted that when the difference between them is not emphasized, the meanings they intend to express are the same.

[0028] In the embodiments of the present invention, sometimes a subscript such as W1 may be mistakenly written as a non-subscript such as W1. When the difference is not emphasized, the meanings to be expressed are consistent.

[0029] In order to make the technical problems, technical solutions and advantages to be solved by the present invention more clear, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.

[0030] Reference Manual Attached Figure 1 , shows a flow chart of an election method between switches provided by an embodiment of the present invention.

[0031] The embodiment of the present invention provides an election method for switches, and the processing flow may include the following steps:

[0032] S1: After the node is initialized, the ring network port of the switch periodically initiates an election message, which includes the node MAC address, node ID, election port, priority, node consistency coefficient Ω and network load adjustment parameter Ψ.

[0033] It should be noted that in a switch ring network, node initialization is the basic step for system startup, and election messages are the main means of transmitting information between nodes during the election process. By initiating election messages, nodes can broadcast their identity information and status in the ring network, including MAC address, ID, election port, and priority. The node consistency coefficient and network load adjustment parameters are innovative designs that are used to quantify the working status and load of each node in order to more reasonably determine its role in the network.

[0034] It is understandable that this step ensures that each node can pass the necessary information at the beginning of the election to ensure the smooth progress of the election process. This step provides necessary data support for subsequent elections, especially through consistency coefficients and load adjustment parameters, which can more accurately evaluate the suitability of nodes and avoid unreasonable master node selection.

[0035] S2: By default, the node with the highest priority is the master node, and the other nodes are transmission nodes. When the transmission node receives the election message from the master node, it stops the election and forwards the election message.

[0036] It should be noted that the election process can quickly determine the master node through the priority sorting mechanism. Setting the node with the highest priority as the master node by default simplifies the complexity of the election. The transmission node stops the election by identifying the election message of the master node and immediately forwards the election message to ensure that the status of the master node is transmitted to the entire network as soon as possible.

[0037] It is understandable that the core role of this step is to quickly determine the master node and effectively reduce unnecessary election repetitions. Through priority sorting, the master node can be determined more quickly, and the stop election and forwarding operations of the transmission node further speed up the propagation of the election message, ensuring that the system can quickly enter the working state and avoid long-term network stagnation.

[0038] S3: When all the ring network ports of the master node receive the election message sent by itself, the election ends, and the state of the ring network port of the master node is adjusted based on the node consistency coefficient Ω and the network load adjustment parameter Ψ in the received election message:

[0039] If the sending port and receiving port of the election message are the same, the port is set to forward.

[0040] If the sending port and receiving port are different, the high priority port is set to blocking and the other ports are set to forwarding.

[0041] It should be noted that the master node receiving the election message sent by itself is a signal that the election has ended, indicating that the election message has been circulated in the network and all nodes have participated in the election. The state of the master node port is adjusted according to the node consistency coefficient and network load adjustment parameters to ensure that the port configuration of the master node can maximize the stability and load balance of the network.

[0042] It is understandable that this step ensures the final completion of the election process, ensuring that the system can exit the election mode in time and resume normal service. At the same time, through the automatic adjustment of the port status, it ensures that the network can still maintain stable operation under different link states, avoiding network failures and performance degradation caused by inconsistent ports or unbalanced loads.

[0043] S4: When the ring network port of the switch node is offline, the ring network port of the adjacent switch initiates a scheduled election. When the ring network port of the switch node is online, the current ring network node port initiates a scheduled election.

[0044] It should be noted that any node disconnection in the ring network will affect the stability of the entire network. Therefore, when a node is disconnected or online, the system needs to immediately initiate an election to ensure dynamic adjustment of the network structure. Neighboring nodes initiate elections by detecting changes in the ring network to ensure that a new master node can be quickly found after disconnection and recovery, or the legitimacy of the current master node can be reconfirmed.

[0045] Understandably, this step enhances the system's self-healing capabilities, ensuring that the ring network can quickly reorganize and stabilize in the event of a node going offline or online, ensuring network connectivity and normal operation. Even in complex or dynamically changing network environments, the system can maintain high availability through an adaptive election mechanism.

[0046] In a possible implementation, the node consistency coefficient Ω is used to measure the consistency of the switch nodes in the ring network, and the calculation formula is as follows:

[0047]

[0048] Among them, E active Indicates the number of active ports on the current switch, E total is the total number of ports on the node, and 1 is used to ensure that the coefficient is not zero in special cases, including very small number of ports.

[0049] It should be noted that the number of active ports refers to the number of ports of the current switch that are in normal working state in the network. It directly reflects the effective contribution of the switch node to the ring network. The more active ports there are, the more communication tasks the switch node can handle, and the consistency coefficient will increase accordingly. This indicator is crucial for judging the stability of the switch. If most of the ports of the switch are inactive, the stability of this node in the network will be reduced, and it may not be suitable to be the master node during the election process.

[0050] The total number of ports refers to the total number of all physical or logical ports of a switch node. This parameter is used to reflect the overall resource capacity of the node. In the election, the potential resources of the node need to be considered to ensure that the master node has sufficient capacity to control the entire network.

[0051] The "1" in the formula is to ensure that the consistency coefficient is positive even in extreme cases (such as when there are 0 active ports or the total number of ports is very small). This design can avoid the coefficient being zero when there are no active ports or the number of ports is very small, which can lead to problems such as election failure or the system being unable to process election messages.

[0052] For example, when all ports of a switch node are inactive (i.e., E active =0), adding "1" can ensure that the formula will not return a zero value, ensuring the continuation of the election process.

[0053] The node consistency coefficient can effectively reflect whether the switch node is stable in the ring network and whether it has sufficient resources and capabilities to support the normal operation of the network. A high consistency coefficient indicates that the node is healthy and reliable in the current network state. In the election process of the master node, this coefficient can be used to evaluate the status of each node. By comparing the consistency coefficient of each node, the system can give priority to nodes with higher consistency coefficients as master nodes, ensuring that the master nodes have sufficient resources and capabilities to maintain the stability of the ring network. Since the consistency coefficient takes into account the ratio of the number of active ports to the total number of ports, it can prevent nodes with scarce resources or unstable operation from being elected as master nodes. For example, a switch with a large number of total ports but very few active ports will have a lower consistency coefficient, thereby reducing its possibility of becoming a master node. Through the node consistency coefficient, the election message can contain more information reflecting the health status of the node, making the entire election process more dynamic and intelligent. The system can select and adjust the master node according to the consistency coefficients of different nodes, ensuring that the nodes in the network can dynamically adapt to the election process in different states.

[0054] In a possible implementation, the network load adjustment parameter Ψ is used to dynamically adjust the load state of the switch, and the calculation formula is as follows:

[0055]

[0056] Among them, L current is the actual transmission load of the current switch, C max is the maximum transmission capacity of the node, N active is the number of active nodes in the current ring network. The square term in the formula is used to amplify the impact of load on network stability.

[0057] It should be noted that the actual transmission load L of the current switch current The actual load at a certain point in time is usually proportional to the network traffic currently processed by the switch. When the transmission load is high, the switch may be under high pressure when transmitting data, and the system needs to make corresponding adjustments. The higher the load, the more likely the switch's processing capacity is to approach its upper limit, affecting the overall stability of the network. Therefore, the load adjustment parameter amplifies the impact of load changes by square, allowing the system to quickly identify high-load nodes and make dynamic adjustments.

[0058] Maximum transmission capacity C maxIt is the maximum traffic that a switch can handle under ideal conditions. It is an important indicator to measure the hardware capabilities of a switch. In the election process of the master node and the transmission node, it is necessary to ensure that the switch with a larger maximum transmission capacity can handle more traffic, while the switch with a smaller load can handle less network tasks. By comparing the current load with the ratio of the maximum transmission capacity, the system can determine whether the load of a switch has approached or exceeded its maximum processing capacity, and make better decisions in the election based on this information.

[0059] The number of active nodes in the current ring network N active Indicates the number of nodes in the current ring network that participate in network communication and can process data. The number of active nodes directly reflects the total availability of resources in the ring network. When there are more active nodes, it means that the resources of the entire network are sufficient, and the system can allocate more load to other nodes; when there are fewer active nodes, the network load will be concentrated on limited nodes, and the system needs to make dynamic adjustments to the node load. The number of active nodes plus "1" in the formula is used to avoid calculation errors when the number of active nodes is 0 in extreme cases.

[0060] The square term Used to amplify the impact of the current load on network stability. This is because the increase in load does not linearly affect network stability, especially when the load is close to the maximum capacity, a small increase in load may have a greater impact on network performance. Therefore, by square amplification, the system can detect load changes more sensitively and make load balancing and adjustments in a timely manner.

[0061] In a possible implementation, the master node determines the priority of each switch node based on the node consistency coefficient Ω and the network load adjustment parameter Ψ. When the priority of the received election message is low, the current node stops the election and forwards the received election message.

[0062] It should be noted that in this embodiment, the master node determines the priority of each switch node based on the node consistency coefficient and the network load adjustment parameter. This mechanism can better measure the actual performance of each node in the network. The node consistency coefficient reflects the stability and consistency of the node in the ring network, while the network load adjustment parameter is used to measure the current load status of the node. By combining these two indicators, the master node can more accurately evaluate the priority of each node and ensure that the node with a high priority in the network assumes the responsibility of the master node. When the switch node receives an election message from other nodes, the node will compare it based on the priority information contained. If the current node finds that the priority of the received election message is lower, it means that its own state is more suitable for serving as the master node than the node that sent the election message, so the current node will continue the election process. However, if the priority of the received election message is higher, it means that the node that sent the election message has better consistency or network load performance. At this time, the current node stops the election and forwards the received election message, thereby speeding up the election process. The main function of this mechanism is to optimize the election process and reduce delays and conflicts in the election process. By dynamically determining the priority based on consistency and load conditions, the network can quickly select the most suitable master node, avoiding unnecessary repeated elections and improving the stability and operation efficiency of the network. This method ensures that high-performance nodes in the ring network can be selected as master nodes first, ensuring the continuous and efficient operation of the entire network.

[0063] In a possible implementation, the link health Λ is used to evaluate the link quality of each node, and the calculation formula is as follows:

[0064]

[0065] Among them, T delivered is the number of successfully transmitted messages, T sent is the total number of messages sent, k is a constant used to prevent the denominator from being zero, and the link health Λ helps nodes determine the stability of the link.

[0066] It should be noted that link health is a key indicator to measure the transmission quality and stability of the link where the node is located. By calculating the ratio of successfully transmitted messages to sent messages, the system can evaluate the reliability of the link in real time. Since data transmission in the network is inevitably affected by various interferences or failures, such as signal interference, poor physical connection or device overload, link health can help nodes determine whether the current link status is stable. Link health is crucial for ring network election. During the election process, the system will refer to the link health of each node to ensure that the elected master node has a reliable link so that it can effectively undertake the task of managing data traffic. If the link health of a node is low, it means that its connection quality is poor and it is not suitable to be the master node. At this time, the system will give priority to nodes with higher link health as master nodes to ensure the stability and connectivity of the entire network. In addition, link health can also help nodes dynamically adjust their routing decisions during operation. Nodes with higher link health are not only suitable for participating in elections, but also suitable for taking on more network data forwarding tasks after the election to improve the overall communication efficiency of the ring network.

[0067] In a possible implementation, the priority of the node is dynamically adjusted according to the following weight combination formula:

[0068] Priority=w1·Ω+w2·Ψ+w3·Λ

[0069] Among them, and are the weight coefficients preset by the system, which dynamically optimize the election results by balancing the consistency coefficient Ω, the network load adjustment parameter Ψ and the link health Λ.

[0070] It should be noted that through this combination formula, the election results can be dynamically optimized during the election process. The system will flexibly adjust the priority of each node according to the node consistency, load status and link health status in the actual network environment, thereby ensuring that the election results of the master node can maintain the stability of the ring network and optimize the resource utilization efficiency of the entire network.

[0071] In a possible implementation, when the ring network port of a node comes back online, the system recalculates the node consistency coefficient Ω and the network load adjustment parameter Ψ of the node to ensure that the election process is performed based on the latest network status.

[0072] Understandably, the purpose of this process is to ensure that the election is adjusted based on the latest current network status. The ring network port that comes back online may affect the overall structure and load balance of the network, so it is very important to recalculate these two parameters:

[0073] The node consistency coefficient reflects the active status of the node's ports. After the node is back online, new ports may be added or previously invalid ports may be restored, affecting the calculation of the consistency coefficient.

[0074] The network load adjustment parameter is used to evaluate the actual transmission load of the node. The node that comes back online may bring new load changes, so this parameter needs to be recalculated to avoid unreasonable master node election due to outdated information during the election process. Through this mechanism, the system can make dynamic adjustments based on the latest network status to ensure that the election of the master node always matches the actual operation of the network, thereby optimizing the stability and efficiency of the entire ring network system.

[0075] In a possible implementation, when multiple nodes have the same priority, the node with the best link quality is preferentially selected as the master node by comparing the link health Λ.

[0076] Specifically, link health reflects the link quality of each node and measures the transmission stability and reliability of the node in the network. The higher the link health, the better the communication quality of the node and the more stable the link. Through this mechanism, when multiple nodes have the same priority, the system will give priority to the node with the highest link health as the master node. This ensures that the selected master node not only has a reasonable priority in the network architecture, but also has the best link quality, thereby further improving the overall stability and communication efficiency of the network and reducing the probability of network failures or delays. This method of optimizing election results through link health helps to more effectively deal with competition problems caused by close node performance in complex network environments, and ensure the robustness and reliability of the system.

[0077] In one possible implementation, after the election, the master node notifies all nodes of the election results by broadcasting an election message. The election results include the balance consistency coefficient Ω, the network load adjustment parameter Ψ, and the link health Λ in the current network to ensure the transparency of the election results and the synchronization of the network status.

[0078] It can be understood that the broadcast of the balance consistency coefficient Ω, the network load adjustment parameter Ψ and the link health Λ helps to ensure that each node in the entire ring network system can synchronously understand the current network status and election results, thereby ensuring the transparency of the election process and enabling each node to adjust its own operating status in time to adapt to the latest situation of the network. This mechanism can further improve the coordination and stability of the network and effectively avoid potential network conflicts and unnecessary communication delays.

[0079] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention include at least:

[0080] (1) In the present invention, by introducing the node consistency coefficient and the network load adjustment parameter, the problem of repeated elections in the ring network system due to too many device nodes in the prior art is solved. By quantitatively analyzing the network status of each node, it is possible to ensure a more accurate evaluation of the node priority during the election process, avoiding election deadlocks caused by nodes not receiving election messages in time. This not only greatly improves the election efficiency, but also shortens the time from system initialization to normal operation, effectively preventing the system from being unable to provide services for a long time;

[0081] (2) In the present invention, the network load adjustment parameters dynamically reflect the real-time load of each node, so that during the election process, adjustments can be made according to the actual state of the network load, avoiding the situation where some high-load nodes are excessively involved in the election due to insufficient processing capacity. By adjusting the transmission load in real time, it is possible to achieve balanced distribution of network resources, reduce resource competition and bottleneck problems in the network, and further improve the overall stability and operation efficiency of the system;

[0082] (3) In the present invention, the introduction of link health enables the system to continuously monitor the link status of each node and use the stability of the link as an important basis for priority determination during the election process. When the election messages of multiple nodes have the same priority, the system can give priority to selecting the node with the best link quality as the master node, ensuring that the election result has higher network stability while taking into account efficiency. This mechanism not only enhances the rationality of the election process, but also improves the fault tolerance and reliability of the entire ring network system in a complex network environment.

[0083] Reference Manual Attached Figure 2 , shows a schematic diagram of the structure of an election device between switches provided by an embodiment of the present invention.

[0084] The embodiment of the present invention further provides an election device 20 for use between switches, which is applied to the above-mentioned election method for use between switches, and includes:

[0085] Processor 201, memory 202 and bus 203, the memory 202 stores execution instructions, and the processor 201 executes the instructions to implement the election method as in the method embodiment.

[0086] The election device 20 for switches provided in the embodiment of the present invention can execute the above-mentioned election method for switches and achieve the same or similar technical effects. To avoid repetition, the present invention will not elaborate on them.

[0087] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention include at least:

[0088] (1) In the present invention, by introducing the node consistency coefficient and the network load adjustment parameter, the problem of repeated elections in the ring network system due to too many device nodes in the prior art is solved. By quantitatively analyzing the network status of each node, it is possible to ensure a more accurate evaluation of the node priority during the election process, avoiding election deadlocks caused by nodes not receiving election messages in time. This not only greatly improves the election efficiency, but also shortens the time from system initialization to normal operation, effectively preventing the system from being unable to provide services for a long time;

[0089] (2) In the present invention, the network load adjustment parameters dynamically reflect the real-time load of each node, so that during the election process, adjustments can be made according to the actual state of the network load, avoiding the situation where some high-load nodes are excessively involved in the election due to insufficient processing capacity. By adjusting the transmission load in real time, it is possible to achieve balanced distribution of network resources, reduce resource competition and bottleneck problems in the network, and further improve the overall stability and operation efficiency of the system;

[0090] (3) In the present invention, the introduction of link health enables the system to continuously monitor the link status of each node and use the stability of the link as an important basis for priority determination during the election process. When the election messages of multiple nodes have the same priority, the system can give priority to selecting the node with the best link quality as the master node, ensuring that the election result has higher network stability while taking into account efficiency. This mechanism not only enhances the rationality of the election process, but also improves the fault tolerance and reliability of the entire ring network system in a complex network environment.

[0091] The above contents are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

[0092] There are a few points to note:

[0093] (1) The drawings of the embodiments of the present invention only relate to the structures related to the embodiments of the present invention, and other structures may refer to the general design.

[0094] (2) For the sake of clarity, in the drawings used to describe the embodiments of the present invention, the thickness of the layers or regions is exaggerated or reduced, that is, these drawings are not drawn according to the actual scale. It is understood that when an element such as a layer, film, region or substrate is referred to as being "on" or "under" another element, the element may be "directly" "on" or "under" the other element or there may be intermediate elements.

[0095] (3) In the absence of conflict, the embodiments of the present invention and the features therein may be combined with each other to obtain new embodiments.

[0096] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. The protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A method for election between switches, characterized in that: include: S1: After the node is initialized, the ring network port of the switch periodically initiates an election message, which includes the node MAC address, node ID, election port, priority, node consistency coefficient Ω and network load adjustment parameter Ψ; S2: By default, the node with the highest priority is the master node, and the other nodes are transmission nodes. When the transmission node receives the election message of the master node, it stops the election and forwards the election message; S3: When all the ring network ports of the master node receive the election message sent by itself, the election ends, and the state of the ring network port of the master node is adjusted based on the node consistency coefficient Ω and the network load adjustment parameter Ψ in the received election message: If the sending port and receiving port of the election message are the same, the port is set to forward; If the sending port and receiving port are different, the high priority port is set to blocking and the other ports are set to forwarding; S4: When the ring network port of the switch node is offline, the ring network port of the adjacent switch initiates a scheduled election. When the ring network port of the switch node is online, the current ring network node port initiates a scheduled election.

2. The election method between switches according to claim 1, characterized in that: include: The node consistency coefficient Ω is used to measure the consistency of the switch node in the ring network, and the calculation formula is as follows: Among them, E active Indicates the number of active ports on the current switch, E total is the total number of ports of the node, and 1 is used to ensure that the coefficient is not zero in special cases, including a very small number of ports.

3. The election method between switches according to claim 2, characterized in that: include: The network load adjustment parameter Ψ is used to dynamically adjust the load state of the switch, and the calculation formula is as follows: Among them, L current is the actual transmission load of the current switch, C max is the maximum transmission capacity of the node, N active is the number of active nodes in the current ring network. The square term in the formula is used to amplify the impact of load on network stability.

4. The election method between switches according to claim 3, characterized in that: include: The master node determines the priority of each switch node based on the node consistency coefficient Ω and the network load adjustment parameter Ψ. When the priority of the received election message is low, the current node stops the election and forwards the received election message.

5. The election method between switches according to claim 4, characterized in that: include: Link health Λ is used to evaluate the link quality of each node. The calculation formula is as follows: Among them, T delivered is the number of successfully transmitted messages, T sent is the total number of messages sent, k is a constant used to prevent the denominator from being zero, and the link health Λ helps nodes determine link stability.

6. The election method between switches according to claim 5, characterized in that: include: The priority of the node is dynamically adjusted according to the following weight combination formula: Priority=w1·Ω+w2·Ψ+w3·Λ Among them, and are weight coefficients preset by the system, and the election result is dynamically optimized through the balance consistency coefficient Ω, the network load adjustment parameter Ψ and the link health Λ.

7. The election method between switches according to claim 6, characterized in that: include: When the ring network port of a node comes back online, the system recalculates the node consistency coefficient Ω and the network load adjustment parameter Ψ of the node to ensure that the election process is performed based on the latest network status.

8. The election method between switches according to claim 7, characterized in that: include: When multiple nodes have the same priority, the node with the best link quality is selected as the master node by comparing the link health Λ.

9. The election method between switches according to claim 8, characterized in that: include: After the election, the master node notifies all nodes of the election results by broadcasting an election message. The election results include the balance consistency coefficient Ω, the network load adjustment parameter Ψ and the link health Λ in the current network to ensure the transparency of the election results and the synchronization of the network status.

10. An election device for switches, characterized in that: include: A processor, a memory and a bus, wherein the memory stores execution instructions, and the processor executes the instructions to implement the election method according to any one of claims 1 to 9.