CN114422427A - Flow balancing method and device, electronic equipment and storage medium - Google Patents
Flow balancing method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN114422427A CN114422427A CN202111617326.5A CN202111617326A CN114422427A CN 114422427 A CN114422427 A CN 114422427A CN 202111617326 A CN202111617326 A CN 202111617326A CN 114422427 A CN114422427 A CN 114422427A
- Authority
- CN
- China
- Prior art keywords
- router
- weight
- node
- target
- routers
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 39
- 230000007246 mechanism Effects 0.000 claims abstract description 27
- 230000003993 interaction Effects 0.000 claims abstract description 12
- 230000015654 memory Effects 0.000 claims description 31
- 238000004590 computer program Methods 0.000 claims description 28
- 238000005516 engineering process Methods 0.000 abstract description 2
- 238000010586 diagram Methods 0.000 description 13
- 230000006870 function Effects 0.000 description 11
- 238000012545 processing Methods 0.000 description 6
- 238000012986 modification Methods 0.000 description 5
- 230000004048 modification Effects 0.000 description 5
- 230000003287 optical effect Effects 0.000 description 4
- 238000004891 communication Methods 0.000 description 3
- 239000013307 optical fiber Substances 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/12—Avoiding congestion; Recovering from congestion
- H04L47/125—Avoiding congestion; Recovering from congestion by balancing the load, e.g. traffic engineering
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L45/00—Routing or path finding of packets in data switching networks
- H04L45/22—Alternate routing
Abstract
The present application relates to the field of cloud computing technologies, and in particular, to a traffic balancing method and apparatus, an electronic device, and a storage medium, which are used to reduce traffic pressure of a network node. The method comprises the following steps: acquiring initial node weights of all network nodes, and synchronizing the initial routing weights of all routers to the corresponding initial node weights; aiming at any network node, when determining that the master-slave switching of the routers occurs, determining the weight of a target node according to the number of master routers in the network node; updating the initial routing weight of each router according to the target node weight to obtain a target routing weight; and determining a main router and a standby router by the way that routers which belong to the same switching mechanism software on different network nodes perform message interaction based on the target routing weight. According to the method and the device, load balance on different network nodes can be achieved by adjusting the number of the main routers on the network nodes, and the flow pressure on a single network node is reduced.
Description
Technical Field
The present application relates to the field of cloud computing technologies, and in particular, to a method and an apparatus for traffic balancing, an electronic device, and a storage medium.
Background
With the popularization of cloud computing, an OpenStack cloud computing management platform is widely adopted. The high-availability function of OpenStack can ensure that routers on a plurality of physical machines keep a master-standby mode based on keepalive exchange mechanism software, and the internet traffic of a user flows out of the master router.
In the related art, when the keepalive function is implemented, broadcasting is performed between two routers, broadcast messages contain keepalive weight information, the routers receiving the messages compare the weight, and the router with the larger weight is upgraded to the main router. If the weights are equal, the IP addresses (Internet Protocol addresses) of messages sending keepalive are compared, and the router with the larger IP Address is upgraded to the main router. However, achieving high availability based on the above method may cause multiple main routers to fall on the same physical machine (i.e., network node), thereby exceeding the maximum network load of the physical machine, resulting in problems of packet loss, high time delay, and the like.
Therefore, how to keep the traffic balance of the network nodes in the OpenStack cluster is an urgent problem to be solved at present.
Disclosure of Invention
The embodiment of the application provides a traffic balancing method and device, electronic equipment and a storage medium, which are used for reducing traffic pressure of network nodes.
The traffic balancing method provided by the embodiment of the application comprises the following steps:
acquiring initial node weights corresponding to the network nodes respectively, and synchronizing the initial routing weights of the routers in the network nodes to the corresponding initial node weights respectively;
for any network node, determining the target node weight of the any network node according to the number of main routers in the any network node when the main-standby switching of the routers occurs in the any network node;
updating the initial routing weight of each router in any network node according to the target node weight to obtain the target routing weight of each router;
and determining a main router and a standby router by the way that routers which belong to the same switching mechanism software on different network nodes perform message interaction based on respective target routing weights.
Optionally, the determining the target node weight of any one of the network nodes according to the number of the master routers in the any one of the network nodes includes:
and taking the sum of the initial node weight and a routing coefficient as the target node weight, wherein the routing coefficient is the integral of the ratio of the number of the main routers in any one network node to a preset parameter value.
Optionally, the determining, by the way that the routers belonging to the same switching mechanism software on different network nodes perform packet interaction based on respective target routing weights, the primary router and the standby router includes:
controlling the routers belonging to the same switching mechanism software on different network nodes to mutually send messages carrying the self target routing weight through the switching mechanism software;
determining, by a message receiver, a router identity of the message receiver according to a comparison result of a target routing weight of a received message sender and a target routing weight of the message receiver, where the router identity represents a master/slave attribute of the message receiver.
Optionally, if the comparison result indicates that the target routing weight of the message receiver is smaller than the target routing weight of the message sender, the router identity of the message receiver is a master router;
if the comparison result shows that the target routing weight of the message receiver is greater than the target routing weight of the message sender, the router identity of the message receiver is a standby router;
if the comparison result shows that the target routing weight of the message receiver is equal to the target routing weight of the message sender, comparing the internet protocol IP addresses of the message receiver and the message sender, wherein the router with the larger IP address is the main router.
The traffic balancing apparatus provided in the embodiment of the present application includes:
an obtaining unit, configured to obtain initial node weights corresponding to network nodes, and synchronize initial routing weights of routers in the network nodes to the corresponding initial node weights, respectively;
a first determining unit, configured to determine, for any one network node, a target node weight of the any one network node according to the number of primary routers in the any one network node when it is determined that primary/secondary switching occurs in a router in the any one network node;
an updating unit, configured to update an initial routing weight of each router in the any network node according to the target node weight, to obtain a target routing weight of each router;
and the second determining unit is used for determining the main router and the standby router in a message interaction mode based on respective target routing weights by the routers which belong to the same switching mechanism software on different network nodes.
Optionally, the first determining unit is specifically configured to:
and taking the sum of the initial node weight and a routing coefficient as the target node weight, wherein the routing coefficient is the integral of the ratio of the number of the main routers in any one network node to a preset parameter value.
Optionally, the second determining unit is specifically configured to:
controlling the routers belonging to the same switching mechanism software on different network nodes to mutually send messages carrying the self target routing weight through the switching mechanism software;
determining, by a message receiver, a router identity of the message receiver according to a comparison result of a target routing weight of a received message sender and a target routing weight of the message receiver, where the router identity represents a master/slave attribute of the message receiver.
Optionally, if the comparison result indicates that the target routing weight of the message receiver is smaller than the target routing weight of the message sender, the router identity of the message receiver is a master router;
if the comparison result shows that the target routing weight of the message receiver is greater than the target routing weight of the message sender, the router identity of the message receiver is a standby router;
if the comparison result shows that the target routing weight of the message receiver is equal to the target routing weight of the message sender, comparing the internet protocol IP addresses of the message receiver and the message sender, wherein the router with the larger IP address is the main router.
An electronic device provided in an embodiment of the present application includes a processor and a memory, where the memory stores a computer program, and when the computer program is executed by the processor, the processor is caused to execute any one of the steps of the traffic balancing method.
An embodiment of the present application provides a computer-readable storage medium, which includes a computer program and is configured to, when the program code is run on an electronic device, cause the electronic device to perform any one of the steps of the traffic balancing method described above.
An embodiment of the present application provides a computer program product, which includes a computer program, the computer program being stored in a computer-readable storage medium; when the processor of the electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device executes the steps of any one of the traffic balancing methods described above.
The beneficial effect of this application is as follows:
the traffic balancing method, the traffic balancing device, the electronic device and the storage medium provided by the embodiment of the application firstly obtain initial node weights corresponding to network nodes respectively, and synchronize the initial routing weights of routers in the network nodes into the corresponding initial node weights respectively; then, aiming at any network node, when the master-slave switching of the routers occurs in any network node, determining the target node weight of any network node according to the number of the master routers in any network node; updating the initial routing weight of each router in any network node according to the target node weight to obtain the target routing weight of each router; finally, the main router and the standby router are determined by the way that the routers which belong to the same exchange mechanism software on different network nodes perform message interaction based on respective target routing weights. The router weight is dynamically adjusted according to the number of the main routers on the network nodes, so that load balance on different network nodes is realized, the flow pressure on a single network node is reduced, the problems of data packet loss and high time delay are reduced, and the bandwidth utilization rate in a network node cluster is improved.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a schematic diagram illustrating a location of a master/slave router in the related art;
fig. 2 is a flowchart of an implementation of a traffic balancing method in an embodiment of the present application;
fig. 3 is a schematic position diagram of a master/slave router in the embodiment of the present application;
fig. 4 is a schematic flow chart of a traffic balancing method in the embodiment of the present application;
fig. 5 is a schematic structural diagram of a flow balancing apparatus in an embodiment of the present application;
fig. 6 is a schematic diagram of a hardware component structure of an electronic device to which an embodiment of the present application is applied.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments, but not all embodiments, of the technical solutions of the present application. All other embodiments obtained by a person skilled in the art without any inventive step based on the embodiments described in the present application are within the scope of the protection of the present application.
Some concepts related to the embodiments of the present application are described below.
OpenStack (cloud computing management platform): the cloud computing management platform is an open-source cloud computing management platform project, is a combination of a series of software open-source projects, provides extensible and elastic cloud computing services for private clouds and public clouds, and provides a cloud computing management platform which is simple to implement, can be expanded in a large scale, is rich and has a unified standard.
Keepalived (exchange mechanism software): the method is used for detecting the state of a server (namely a router), if one server is down or works and fails, Keepallved detects the state, the failed server is removed from a system, meanwhile, other servers are used for replacing the work of the server, when the server works normally, the Keepallved automatically adds the server into a server group, all the work is automatically completed, manual intervention is not needed, and only the failed server is repaired manually.
The router: the network node is a hardware device for connecting two or more networks, plays a role of a gateway between the networks, is a special intelligent network device for reading an address in each data packet and then determining how to transmit, and in the application, the router on a plurality of network nodes is ensured to keep one master device and multiple slave devices through keepalive, and the internet traffic of a user flows out of the master router.
The following briefly introduces the design concept of the embodiments of the present application:
with the popularization of cloud computing, OpenStack is widely adopted. OpenStack has some disadvantages due to less experience in large-scale applications. The high-availability function of OpenStack can ensure that routers on a plurality of physical machines keep a master-standby mode based on keepalive exchange mechanism software, and the internet traffic of a user flows out of the master router.
In the related art, the default weight of Keepalived is 50, when the Keepalived realizes a high-availability function, broadcast is performed between two routers, broadcast messages include Keepalived weight information, the router receiving the messages compares the weight, and the router with the larger weight is upgraded to the main router. If the weights are equal, the IP addresses of the messages sending Keepalived are compared, and the router with the larger IP address is upgraded to the main router. However, achieving high availability based on the above-mentioned manner may cause multiple main routers to fall on the same physical machine (i.e. network node), as shown in fig. 1, both the main router indicated by a solid line and the main router indicated by a dashed line fall on the network node 1, which causes user traffic of the OpenStack cluster to pass through the network node 1, thereby exceeding the maximum network load of the physical machine, resulting in problems of packet loss, high latency, and the like.
Therefore, how to keep the traffic balance of the network nodes in the OpenStack cluster is an urgent problem to be solved at present.
In view of this, embodiments of the present application provide a traffic balancing method, an apparatus, an electronic device, and a storage medium, where first, initial node weights corresponding to network nodes are obtained, and initial routing weights of routers in the network nodes are synchronized to the corresponding initial node weights, respectively; then, aiming at any network node, when the master-slave switching of the routers occurs in any network node, determining the target node weight of any network node according to the number of the master routers in any network node; updating the initial routing weight of each router in any network node according to the target node weight to obtain the target routing weight of each router; finally, the main router and the standby router are determined by the way that the routers which belong to the same exchange mechanism software on different network nodes perform message interaction based on respective target routing weights. The router weight is dynamically adjusted according to the number of the main routers on the network nodes, so that load balance on different network nodes is realized, the flow pressure on a single network node is reduced, the problems of data packet loss and high time delay are reduced, and the bandwidth utilization rate in a network node cluster is improved.
The preferred embodiments of the present application will be described below with reference to the accompanying drawings of the specification, it should be understood that the preferred embodiments described herein are merely for illustrating and explaining the present application, and are not intended to limit the present application, and that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
Referring to fig. 2, an implementation flow chart of a traffic balancing method according to an embodiment of the present application is shown, and a specific implementation flow of the method is as follows:
s201: acquiring initial node weights corresponding to the network nodes respectively, and synchronizing the initial routing weights of the routers in the network nodes to the corresponding initial node weights respectively;
for example, in the OpenStack cluster shown in fig. 3, the initial node weights of the network node 1 and the network node 2 are set to be 50, and the initial routing weights of the router 1, the router 2, the router 3, and the router 4 are set to be 50.
S202: aiming at any network node, determining the target node weight of any network node according to the number of main routers in any network node when the main-standby switching of the routers occurs in any network node;
the master-slave switching refers to switching a router in a network node from a master router to a slave router, or switching the slave router to the master router.
Optionally, when any network node is subjected to active-standby switching, the sum of the initial node weight and the routing coefficient is used as the target node weight.
The routing coefficient is an integer of a ratio of the number of the main routers in any one network node to a preset parameter value, and the target node weight can be determined through the following formula:
wherein 50 is initial node weight, n represents the number of main routers in any network node, k represents preset parameter value, which can be adjusted according to requirement,presentation pairAnd rounding, namely, routing coefficients.
For example, if the number n of master routers is 2 and k is set to 1, the target node weight is 52.
S203: updating the initial routing weight of each router in any network node according to the target node weight to obtain the target routing weight of each router;
when the weight of any one network node is updated from the initial node weight to the target node weight, the initial routing weight of the router on the corresponding network node is also updated to the target routing weight, for example, the initial node weight of the network node 1 is 50, the initial routing weights of the router 1 and the router 2 on the network node 1 are 50, and when the target node weight of the network node 1 is 52, the target routing weights of the router 1 and the router 2 are 52.
S204: and determining a main router and a standby router by the way that routers which belong to the same switching mechanism software on different network nodes perform message interaction based on respective target routing weights.
The router 1 and the router 3 in fig. 3 belong to the same switching mechanism software, and the router 1 and the router 3 may carry their own target routing weights in a message interaction manner, and determine that they are the primary router or the backup router.
In the embodiment of the application, the router weight is dynamically adjusted according to the number of the main routers on the network nodes, so that load balance on different network nodes is realized, the flow pressure on a single network node is reduced, the problems of data packet loss and high time delay are reduced, and the bandwidth utilization rate in a network node cluster is improved.
Optionally, step S204 is implemented based on the following steps:
firstly, controlling routers belonging to the same switching mechanism software on different network nodes to mutually send messages carrying self target routing weights through the switching mechanism software; then, the message receiver determines the router identity of the message receiver according to the comparison result of the target routing weight of the received message sender and the target routing weight of the message receiver.
The router identity represents the master/standby attribute of the message receiver, that is, the router is a master router or a standby router.
Specifically, taking router 1 and router 3 as examples, router 1 receives a packet sent by router 3, obtains a target routing weight of router 3, and router 1 compares the target routing weight of router 1 with the self routing weight to determine a master/slave attribute of router 1, and correspondingly, router 3 receives the packet sent by router 1, obtains the target routing weight of router 1, and compares with the self routing weight to determine the master/slave attribute of router.
Optionally, if the comparison result indicates that the target routing weight of the message receiver is smaller than the target routing weight of the message sender, the router identity of the message receiver is the main router;
if the comparison result shows that the target routing weight of the message receiver is greater than that of the message sender, the router identity of the message receiver is a standby router;
if the comparison result shows that the target routing weight of the message receiver is equal to the target routing weight of the message sender, the internet protocol IP addresses of the message receiver and the message sender are compared, and the router with the larger IP address is the main router.
For example, if the target routing weight of the router 1 is 50, the target routing weight of the router 3 is 52, and the router 1 is used as a message receiver, and if the self routing weight is determined to be smaller than the target routing weight of the message sender, the router 1 is used as a main router, the router 3 is used as a message receiver, and if the self routing weight is determined to be larger than the target routing weight of the message sender, the router 3 is used as a standby router. If the target routing weights of router 1 and router 3 are equal, the IP addresses of both parties are compared, and the router with the larger IP address is identified as the master router.
Referring to fig. 4, which is a schematic flow chart of a traffic balancing method in the embodiment of the present application, the traffic balancing method in the present application is described below with reference to fig. 4 by taking the OpenStack cluster in fig. 3 as an example.
Taking the network node 1 as an example, storing all routers on the node into a circular connection table, determining whether the keepalive weight of the current router is equal to the weight of the current network node, if not, modifying the weight of the router to enable the weight of the router to be equal to the weight of the current network node, and directing to the next router, if so, directly directing to the next router, and finally, expecting to achieve the balance of the number of main routers on different network nodes.
For example, if the initial node weights of the network node 1 and the network node 2 are set to 50, the initial routing weights of the router 1, the router 2, the router 3, and the router 4 are all 50. When one master router is added to the network node 1, and the number of the master routers is 2, the target node weight q is 51. When the circular connection table points to the router 1, the target routing weight of the router 1 is updated from 50 to 51, the router 1 and the router 3 send messages to each other to carry the target routing weight of the router 1, the router 1 determines that the target routing weight of the router 1 is greater than the target routing weight of the router 3, the router 1 is switched to a standby router, and the router 3 determines that the target routing weight of the router 3 is less than the target routing weight of the router 1, and the router 3 is switched to a main router.
In the embodiment of the application, by monitoring the number of routers on a physical machine (i.e., a network node), the keepalive weight of the routers on the physical machine is determined, and the keepalive weights of the routers on the physical machine are adjusted in sequence in a circulating manner, and finally, the balance of the number of main routers on the physical machine is expected to be achieved, so that the flow balance of the network node in an OpenStack cluster can be maintained, the load of the physical machine is reduced, packet loss is reduced, and the bandwidth utilization rate of the cluster is improved.
Based on the same inventive concept, the embodiment of the application also provides a flow balancing device. As shown in fig. 5, it is a schematic structural diagram of a traffic balancing apparatus 500, which may include:
an obtaining unit 501, configured to obtain initial node weights corresponding to each network node, and synchronize the initial routing weights of each router in each network node to the corresponding initial node weights respectively;
a first determining unit 502, configured to determine, for any one network node, a target node weight of the any one network node according to the number of primary routers in the any one network node when it is determined that primary/secondary switching occurs in the router in the any one network node;
an updating unit 503, configured to update the initial routing weight of each router in any network node according to the target node weight, to obtain a target routing weight of each router;
a second determining unit 504, configured to determine the primary router and the standby router in a manner that routers belonging to the same switching mechanism software on different network nodes perform packet interaction based on respective target routing weights.
Optionally, the first determining unit 502 is specifically configured to:
and taking the sum of the initial node weight and the routing coefficient as a target node weight, wherein the routing coefficient is the integral of the ratio of the number of the main routers in any network node to a preset parameter value.
Optionally, the second determining unit 504 is specifically configured to:
controlling the routers belonging to the same switching mechanism software on different network nodes to mutually send messages carrying the own target routing weight through the switching mechanism software;
and determining the self router identity of the message receiver according to the comparison result of the target routing weight of the received message sender and the target routing weight of the message receiver by the message receiver, wherein the router identity represents the main and standby attributes of the message receiver.
Optionally, if the comparison result indicates that the target routing weight of the message receiver is smaller than the target routing weight of the message sender, the router identity of the message receiver is the main router;
if the comparison result shows that the target routing weight of the message receiver is greater than that of the message sender, the router identity of the message receiver is a standby router;
if the comparison result shows that the target routing weight of the message receiver is equal to the target routing weight of the message sender, the internet protocol IP addresses of the message receiver and the message sender are compared, and the router with the larger IP address is the main router.
For convenience of description, the above parts are separately described as modules (or units) according to functional division. Of course, the functionality of the various modules (or units) may be implemented in the same one or more pieces of software or hardware when implementing the present application.
As will be appreciated by one skilled in the art, aspects of the present application may be embodied as a system, method or program product. Accordingly, various aspects of the present application may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
The electronic equipment is based on the same inventive concept as the method embodiment, and the embodiment of the application also provides the electronic equipment. In this embodiment, the electronic device may be configured as shown in fig. 6, and include a memory 601, a communication module 603, and one or more processors 602.
A memory 601 for storing computer programs executed by the processor 602. The memory 601 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, a program required for running an instant messaging function, and the like; the storage data area can store various instant messaging information, operation instruction sets and the like.
The memory 601 may be a volatile memory (volatile memory), such as a random-access memory (RAM); the memory 601 may also be a non-volatile memory (non-volatile memory), such as a read-only memory (rom), a flash memory (flash memory), a hard disk (HDD) or a solid-state drive (SSD); or memory 601 is any other medium that can be used to carry or store a desired computer program in the form of instructions or data structures and that can be accessed by a computer, but is not limited to such. The memory 601 may be a combination of the above memories.
The processor 602 may include one or more Central Processing Units (CPUs), a digital processing unit, and the like. A processor 602, configured to implement the above-mentioned traffic balancing method when calling the computer program stored in the memory 601.
The communication module 603 is used for communicating with the terminal device and other servers.
The embodiment of the present application does not limit the specific connection medium among the memory 601, the communication module 603, and the processor 602. In the embodiment of the present application, the memory 601 and the processor 602 are connected through a bus 604 in fig. 6, the bus 604 is depicted by a thick line in fig. 6, and the connection manner between other components is merely illustrative and is not limited thereto. The bus 604 may be divided into an address bus, a data bus, a control bus, and the like. For ease of description, only one thick line is depicted in fig. 6, but only one bus or one type of bus is not depicted.
The memory 601 stores a computer storage medium, and the computer storage medium stores computer-executable instructions for implementing the traffic balancing method according to the embodiment of the present application. The processor 602 is configured to perform the traffic balancing method described above, as shown in fig. 2.
In some possible embodiments, the various aspects of the traffic balancing method provided in the present application may also be implemented in the form of a program product including a computer program for causing an electronic device to perform the steps in the traffic balancing method according to various exemplary embodiments of the present application described above in this specification when the program product is run on the electronic device, for example, the electronic device may perform the steps as shown in fig. 2.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The program product of embodiments of the present application may employ a portable compact disc read only memory (CD-ROM) and include a computer program, and may be run on a computing device. However, the program product of the present application is not limited thereto, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with a command execution system, apparatus, or device.
A readable signal medium may include a propagated data signal with a readable computer program embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with a command execution system, apparatus, or device.
The computer program embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer programs for carrying out operations of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer program may execute entirely on the user computing device, partly on the user equipment, as a stand-alone software package, partly on the user computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
It should be noted that although several units or sub-units of the apparatus are mentioned in the above detailed description, such division is merely exemplary and not mandatory. Indeed, the features and functions of two or more units described above may be embodied in one unit, according to embodiments of the application. Conversely, the features and functions of one unit described above may be further divided into embodiments by a plurality of units.
Further, while the operations of the methods of the present application are depicted in the drawings in a particular order, this does not require or imply that these operations must be performed in this particular order, or that all of the illustrated operations must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having a computer-usable computer program embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.
Claims (10)
1. A method for traffic balancing, the method comprising:
acquiring initial node weights corresponding to the network nodes respectively, and synchronizing the initial routing weights of the routers in the network nodes to the corresponding initial node weights respectively;
for any network node, determining the target node weight of the any network node according to the number of main routers in the any network node when the main-standby switching of the routers occurs in the any network node;
updating the initial routing weight of each router in any network node according to the target node weight to obtain the target routing weight of each router;
and determining a main router and a standby router by the way that routers which belong to the same switching mechanism software on different network nodes perform message interaction based on respective target routing weights.
2. The method according to claim 1, wherein said determining a target node weight for said any one network node based on the number of master routers in said any one network node comprises:
and taking the sum of the initial node weight and a routing coefficient as the target node weight, wherein the routing coefficient is the integral of the ratio of the number of the main routers in any one network node to a preset parameter value.
3. The method according to claim 1 or 2, wherein the determining the primary router and the backup router by the way that the routers belonging to the same switching mechanism software on different network nodes perform message interaction based on respective target routing weights comprises:
controlling the routers belonging to the same switching mechanism software on different network nodes to mutually send messages carrying the self target routing weight through the switching mechanism software;
determining, by a message receiver, a router identity of the message receiver according to a comparison result of a target routing weight of a received message sender and a target routing weight of the message receiver, where the router identity represents a master/slave attribute of the message receiver.
4. The method according to claim 3, wherein if the comparison result indicates that the target routing weight of the message receiver is less than the target routing weight of the message sender, the router identity of the message receiver is a master router;
if the comparison result shows that the target routing weight of the message receiver is greater than the target routing weight of the message sender, the router identity of the message receiver is a standby router;
if the comparison result shows that the target routing weight of the message receiver is equal to the target routing weight of the message sender, comparing the internet protocol IP addresses of the message receiver and the message sender, wherein the router with the larger IP address is the main router.
5. A flow equalization device, comprising:
an obtaining unit, configured to obtain initial node weights corresponding to network nodes, and synchronize initial routing weights of routers in the network nodes to the corresponding initial node weights, respectively;
a first determining unit, configured to determine, for any one network node, a target node weight of the any one network node according to the number of primary routers in the any one network node when it is determined that primary/secondary switching occurs in a router in the any one network node;
an updating unit, configured to update an initial routing weight of each router in the any network node according to the target node weight, to obtain a target routing weight of each router;
and the second determining unit is used for determining the main router and the standby router in a message interaction mode based on respective target routing weights by the routers which belong to the same switching mechanism software on different network nodes.
6. The apparatus of claim 5, wherein the first determining unit is specifically configured to:
and taking the sum of the initial node weight and a routing coefficient as the target node weight, wherein the routing coefficient is the integral of the ratio of the number of the main routers in any one network node to a preset parameter value.
7. The apparatus of claim 5, wherein the second determining unit is specifically configured to:
controlling the routers belonging to the same switching mechanism software on different network nodes to mutually send messages carrying the self target routing weight through the switching mechanism software;
determining, by a message receiver, a router identity of the message receiver according to a comparison result of a target routing weight of a received message sender and a target routing weight of the message receiver, where the router identity represents a master/slave attribute of the message receiver.
8. The apparatus according to claim 7, wherein if the comparison result indicates that the destination routing weight of the message receiver is less than the destination routing weight of the message sender, the router identity of the message receiver is a master router;
if the comparison result shows that the target routing weight of the message receiver is greater than the target routing weight of the message sender, the router identity of the message receiver is a standby router;
if the comparison result shows that the target routing weight of the message receiver is equal to the target routing weight of the message sender, comparing the internet protocol IP addresses of the message receiver and the message sender, wherein the router with the larger IP address is the main router.
9. An electronic device, comprising a processor and a memory, wherein the memory stores a computer program which, when executed by the processor, causes the processor to carry out the steps of the method according to any one of claims 1 to 4.
10. A computer-readable storage medium, characterized in that it comprises a computer program for causing an electronic device to carry out the steps of the method according to any one of claims 1 to 4, when said computer program is run on said electronic device.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111617326.5A CN114422427B (en) | 2021-12-27 | 2021-12-27 | Flow balancing method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111617326.5A CN114422427B (en) | 2021-12-27 | 2021-12-27 | Flow balancing method and device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114422427A true CN114422427A (en) | 2022-04-29 |
CN114422427B CN114422427B (en) | 2024-03-08 |
Family
ID=81268952
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111617326.5A Active CN114422427B (en) | 2021-12-27 | 2021-12-27 | Flow balancing method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114422427B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116055386A (en) * | 2023-03-07 | 2023-05-02 | 燧原智能科技(成都)有限公司 | Port weight updating method, device, chip and storage medium |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CA2318747A1 (en) * | 1997-12-19 | 1999-07-01 | Holontech Corporation | Router pooling in a network flowswitch |
CN103188157A (en) * | 2011-12-28 | 2013-07-03 | 迈普通信技术股份有限公司 | Router equipment |
US20140149766A1 (en) * | 2012-01-10 | 2014-05-29 | Ahmad Samih | Router parking in power-efficient interconnect architectures |
US20140310391A1 (en) * | 2013-04-16 | 2014-10-16 | Amazon Technologies, Inc. | Multipath routing in a distributed load balancer |
US20170237623A1 (en) * | 2016-02-15 | 2017-08-17 | Kilton Patrick Hopkins | Methods and apparatus for unified integration and processing of a variety of information sensors and systems |
CN107888492A (en) * | 2017-10-16 | 2018-04-06 | 闽南师范大学 | A kind of method and apparatus of VRRP load balancing |
CN111726246A (en) * | 2020-05-29 | 2020-09-29 | 苏州浪潮智能科技有限公司 | Main/standby network card switching method and device in network card binding mode and storage medium |
CN112866107A (en) * | 2021-01-25 | 2021-05-28 | 网宿科技股份有限公司 | IP address notification method, traffic guiding method and network equipment |
-
2021
- 2021-12-27 CN CN202111617326.5A patent/CN114422427B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CA2318747A1 (en) * | 1997-12-19 | 1999-07-01 | Holontech Corporation | Router pooling in a network flowswitch |
CN103188157A (en) * | 2011-12-28 | 2013-07-03 | 迈普通信技术股份有限公司 | Router equipment |
US20140149766A1 (en) * | 2012-01-10 | 2014-05-29 | Ahmad Samih | Router parking in power-efficient interconnect architectures |
US20140310391A1 (en) * | 2013-04-16 | 2014-10-16 | Amazon Technologies, Inc. | Multipath routing in a distributed load balancer |
US20170237623A1 (en) * | 2016-02-15 | 2017-08-17 | Kilton Patrick Hopkins | Methods and apparatus for unified integration and processing of a variety of information sensors and systems |
CN107888492A (en) * | 2017-10-16 | 2018-04-06 | 闽南师范大学 | A kind of method and apparatus of VRRP load balancing |
CN111726246A (en) * | 2020-05-29 | 2020-09-29 | 苏州浪潮智能科技有限公司 | Main/standby network card switching method and device in network card binding mode and storage medium |
CN112866107A (en) * | 2021-01-25 | 2021-05-28 | 网宿科技股份有限公司 | IP address notification method, traffic guiding method and network equipment |
Non-Patent Citations (2)
Title |
---|
KUANGYI LI等: "Dynamic load balanced routing in IP network", 《2016 INTERNATIONAL CONFERENCE ON INFORMATION COMMUNICATION AND MANAGEMENT》 * |
洪亮: "基于VRRP的路由技术研究", 《长沙通信职业技术学院学报》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116055386A (en) * | 2023-03-07 | 2023-05-02 | 燧原智能科技(成都)有限公司 | Port weight updating method, device, chip and storage medium |
CN116055386B (en) * | 2023-03-07 | 2023-06-02 | 燧原智能科技(成都)有限公司 | Port weight updating method, device, chip and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN114422427B (en) | 2024-03-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2020253266A1 (en) | Method for providing edge service, apparatus and device | |
US11258667B2 (en) | Network management method and related device | |
KR100680888B1 (en) | Virtual multicast routing for a cluster having state synchronization | |
US20200195711A1 (en) | Model-based load balancing for network data plane | |
US20200382578A1 (en) | Communication Method, System and Apparatus | |
US11233737B2 (en) | Stateless distributed load-balancing | |
US11003516B2 (en) | Geographical redundancy and dynamic scaling for virtual network functions | |
CN111682927A (en) | Message synchronization method, device, equipment and medium based on MLAG environment | |
US10671421B2 (en) | Virtual machine start method and apparatus | |
CN103631652A (en) | Method and system for achieving virtual machine migration | |
EP4109941A1 (en) | Congestion control method, apparatus and system, device and medium | |
EP3345341A1 (en) | Direct replying actions in sdn switches | |
CN110932876B (en) | Communication system, method and device | |
CN114422427B (en) | Flow balancing method and device, electronic equipment and storage medium | |
CN110391987B (en) | Method, apparatus and computer readable medium for selecting a designated forwarder from a carrier edge device set | |
CN108900422B (en) | Multicast forwarding method and device and electronic equipment | |
WO2015131380A1 (en) | Data processing method and device | |
CN115022261B (en) | Multicast table item synchronization method, equipment and medium based on stacking environment | |
CN113261249A (en) | Data transmission method, related equipment and computer storage medium | |
CN115665026A (en) | Cluster networking method and device | |
US20230370326A1 (en) | Efficient state replication in sdn networks | |
CN114866509B (en) | Virtual IP switching method, device and system | |
CN116319624B (en) | Message processing method, device, equipment and storage medium | |
US11985038B2 (en) | Selecting forwarder in a network installation | |
US20230155898A1 (en) | Selecting forwarder in a network installation |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |