Load Balancing Method, Device, Network Device, and Computer Readable Storage Medium
By timely calculating and updating bandwidth quality in network devices and dynamically selecting the target port for message forwarding, the problem of packet loss in link aggregation devices is solved, and load balancing and efficient forwarding are achieved.
Patent Information
- Application Number
- CN202211224809.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-09
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2042-10-09
AI Technical Summary
In network devices that use link aggregation, traffic loss is prone to occur when forwarding packet traffic, that is, packet loss problem.
The bandwidth quality of the pipeline and member ports is calculated by each core timing, and the port bandwidth quality is updated in the quality table, and the target port is determined from the member port of the aggregation port according to the latest bandwidth quality to forward packets.
Load balancing is realized, which significantly reduces the probability of packet loss and improves the forwarding efficiency of network equipment.
Smart Images

Figure CN115643215B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technologies, and in particular, to a load balancing method, apparatus, network device, and computer-readable storage medium. Background Art
[0002] Link aggregation, that is, Ethernet link aggregation Eth-Trunk, refers to bundling multiple Ethernet physical links of a network device (for example, a switch) together to form a logical link, thereby achieving the purpose of increasing the link bandwidth. All network devices performing link aggregation are collectively referred to as an aggregation group.
[0003] A network device adopting link aggregation may simultaneously adopt a multi-core and multi-pipeline chip architecture. Under the multi-core and multi-pipeline chip architecture, each pipeline of the network device is equivalent to an independent chip, and the final complete chip is composed of multiple pipelines. However, when the network device forwards packet traffic, the pipeline with member ports has a large load, and thus packet loss, that is, traffic loss, is very likely to occur. Summary of the Invention
[0004] In view of this, an object of the present invention is to provide a load balancing method, apparatus, network device, and computer-readable storage medium, which can improve the problem that traffic is very likely to be lost when a network device adopting link aggregation forwards packets.
[0005] To achieve the above object, the technical solutions adopted in the embodiments of the present invention are as follows:
[0006] In a first aspect, an embodiment of the present invention provides a load balancing method, which is applied to a network device. The network device includes at least two core chips, each core includes multiple pipelines under its jurisdiction, each pipeline includes ordinary ports and / or member ports under its jurisdiction, and each member port forms an aggregation port with at least one other member port. The method includes:
[0007] Each core periodically calculates the current first bandwidth quality of each pipeline under its jurisdiction, and periodically calculates the current second bandwidth quality of each member port under its jurisdiction, and synchronizes all the first bandwidth qualities and the second bandwidth qualities to each pipeline of the remaining all cores;
[0008] Each pipeline updates the port bandwidth quality of each member port in a quality table according to the first bandwidth quality and the second bandwidth quality;
[0009] When any of the pipelines receives a forwarding packet from any port under its jurisdiction and the outlet of the forwarding packet is an aggregated port, the target port is determined from all the member ports of the aggregated port according to all the port bandwidth qualities in the quality table, and the forwarding packet is sent to the target pipeline where the target port is located, so as to send the forwarding packet out from the target port through the target pipeline.
[0010] Further, the step of determining the target port from all the member ports of the aggregated port according to all the port bandwidth qualities in the quality table includes:
[0011] Sort all the member ports of the aggregated port according to all the port bandwidth qualities in the quality table, and query each member port of the aggregated port in descending order;
[0012] Calculate the total bandwidth of the current bandwidth of the currently queried member port and the required bandwidth of the forwarding packet, and determine whether the total bandwidth exceeds the limited bandwidth of the currently queried member port;
[0013] If not, use the currently queried member port as the target port;
[0014] If so, continue to query the next member port until the target port is found.
[0015] Further, the step of periodically calculating the current first bandwidth quality of each of the pipelines under its jurisdiction includes:
[0016] Periodically collect the number of bytes currently passed by each of the pipelines under its jurisdiction, and obtain the current first bandwidth quality of each pipeline according to the level interval where the number of bytes is located.
[0017] Further, the step of periodically calculating the current second bandwidth quality of each of the member ports under its jurisdiction includes:
[0018] Periodically collect the number of bytes currently passed by each of the member ports under its jurisdiction, and obtain the current second bandwidth quality of each member port based on the level interval where the number of bytes is located.
[0019] Further, the step of each core updating the port bandwidth quality of each member port in the quality table according to the first bandwidth quality and the second bandwidth quality includes:
[0020] For each of the member ports, calculate a first product value between the first bandwidth quality of the pipeline to which the member port belongs and a first preset weight, calculate a second product value between the second bandwidth quality of the member port and a second preset weight, and calculate the sum of the first product value and the second product value to obtain the port bandwidth quality of the member port.
[0021] Further, each of the pipelines further includes an ingress processing engine module, and the method further includes:
[0022] When any pipeline receives a forwarding packet from any port under its jurisdiction, the ingress processing engine module of the pipeline determines the egress of the forwarding packet according to the destination address of the forwarding packet and a pre-stored forwarding table, and queries whether the egress is an aggregation port.
[0023] Further, each of the pipelines further includes a traffic management module and an egress processing engine module, and the method further includes:
[0024] When the target pipeline receives a forwarding packet, the traffic management module performs traffic management on the forwarding packet, and after the egress processing engine module edits the forwarding packet, the forwarding packet is sent out from the target port.
[0025] In a second aspect, an embodiment of the present invention provides a load balancing device applied to a network device. The network device includes at least two core chips. Each core includes a plurality of pipelines under its jurisdiction. Each pipeline includes ordinary ports and / or member ports under its jurisdiction. Each member port and at least one other member port form an aggregation port. The load balancing device includes a monitoring module and a processing module;
[0026] The monitoring module is configured to periodically calculate the current first bandwidth quality of each pipeline under the jurisdiction of each core, and periodically calculate the current second bandwidth quality of each member port under the jurisdiction of each core, and synchronize all the first bandwidth qualities and the second bandwidth qualities to each pipeline of the remaining all cores;
[0027] The monitoring module is further configured to update the port bandwidth quality of each member port in a quality table according to the first bandwidth quality and the second bandwidth quality through each pipeline;
[0028] The processing module is configured to, when any one of the pipelines receives a forwarding packet from any port under its jurisdiction and the egress port of the forwarding packet is an aggregated port, determine a target port from all member ports of the aggregated port according to the port bandwidth qualities of all ports in the quality table, and send the forwarding packet to the target pipeline where the target port is located, so as to send the forwarding packet out from the target port through the target pipeline.
[0029] In a third aspect, an embodiment of the present invention provides a network device, including a processor and a memory. The memory stores a computer program that can be executed by the processor, and the processor can execute the machine-executable instructions to implement the load balancing method as described in the first aspect.
[0030] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the load balancing method as described in the first aspect is implemented.
[0031] In the load balancing method, device, network device, and computer-readable storage medium provided by the embodiments of the present invention, each core of the chip of the network device periodically calculates the current first bandwidth branch of each pipeline and the current second bandwidth quality of each member port, and synchronizes the calculated first bandwidth quality and second bandwidth quality to each pipeline of other cores. Thus, each pipeline updates the port bandwidth quality of each member port in the quality table. Therefore, when any pipeline receives a forwarding packet with an egress port being an aggregated port, according to the latest port bandwidth quality of each member port, a target port is determined from all member ports of the aggregated port, and the forwarding packet is sent to the target pipeline where the target port is located, so as to send the forwarding packet out through the target port, realizing determining which member port will send the forwarding packet according to the latest port bandwidth quality of the member port, thereby greatly improving the problem of packet loss.
[0032] To make the above objects, features, and advantages of the present invention more obvious and understandable, the following specifically enumerates preferred embodiments and, in conjunction with the accompanying drawings, makes a detailed description as follows. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required to be used in the embodiments. It should be understood that the following drawings only show some embodiments of the present invention, and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.
[0034] Figure 1 The block diagram of the load balancing system provided by the embodiment of the present invention is shown.
[0035] Figure 2 The structural schematic diagram of the chip of the network device provided by the embodiment of the present invention is shown.
[0036] Figure 3 One of the flow schematic diagrams of the load balancing method provided by the embodiment of the present invention is shown.
[0037] Figure 4 The flow schematic diagram of partial sub-steps of step S15 is shown.
[0038] Figure 5 It shows Figure 4 The flow schematic diagram of partial sub-steps of step S153 in it.
[0039] Figure 6 The block schematic diagram of the load balancing device provided by the embodiment of the present invention is shown.
[0040] Figure 7 The block schematic diagram of the network device provided by the embodiment of the present invention is shown.
[0041] Reference numerals: 100 - load balancing system; 110 - network device; 120 - computer device; 130 - chip; 140 - load balancing device; 150 - monitoring module; 160 - processing module. Specific embodiments
[0042] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Usually, the components of the embodiments of the present invention described and shown in the accompanying drawings here can be arranged and designed in various different configurations.
[0043] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed present invention, but merely represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present invention.
[0044] It should be noted that relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising a..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.
[0045] A network device adopting link aggregation may simultaneously adopt a multi-core and multi-pipeline chip architecture. Under the multi-core and multi-pipeline chip architecture, each pipeline of the network device is equivalent to an independent chip, and the final complete chip is composed of multiple pipelines. Each pipeline can independently undertake the work of packet reception or forwarding, and the ports on each pipeline can be link-aggregated with the ports on other pipelines to form an aggregated port.
[0046] However, due to the adoption of link aggregation by the network device, when the network device forwards packet traffic, the load on the pipeline with member ports is large. Therefore, it is very easy for a certain pipeline to receive packet traffic that needs to be forwarded when the bandwidth is insufficient, resulting in traffic loss, that is, packet loss.
[0047] Based on the above considerations, an embodiment of the present invention provides a load balancing method, which can improve the problem that packets are easily lost when a network device adopting link aggregation forwards packets. Hereinafter, the load balancing method will be introduced.
[0048] The load balancing method provided by the embodiment of the present invention can be applied to a load balancing system 100 as Figure 1 shown. The load balancing system 100 includes a network device 110 and multiple computer devices 120. The network device 110 and each computer device 120 can be communicatively connected through a network.
[0049] Referring to Figure 2, the network device 110 includes at least two core chips 130. Each core includes multiple pipelines under its jurisdiction, and each pipeline includes ordinary ports and / or member interfaces under its jurisdiction. For each pipeline, it can simultaneously have ordinary ports and member ports under its jurisdiction, and both the ordinary ports and the member ports can be multiple, or it can only have ordinary ports under its jurisdiction, or only have member ports under its jurisdiction. Each core also includes a communication channel that communicates with any pipeline of the core. Through this communication channel, the pipelines within the core can communicate with each other.
[0050] It should be understood that each ordinary port can be configured as a member port.
[0051] Each member port of the pipeline forms an aggregated port with at least one other member port through link aggregation. It should be understood that all member ports of the aggregated port can belong to the same pipeline or different pipelines.
[0052] Each pipeline also includes an ingress processing engine module, a traffic management module, and an egress processing engine module.
[0053] Among them, the ingress processing engine (IPE) module is used to, when receiving a forwarding packet, look up the pre-stored forwarding table according to the destination address of the forwarding packet to determine the egress. The traffic management (TM) module performs traffic management such as packet rate limiting and congestion management. The egress processing engine (EPE) module is used to edit the packet, for example, add or delete the vlan field in the packet, etc.
[0054] The computer device 120 is used to send packets to the network device 110 or receive packets sent by the network device 110.
[0055] Among them, the computer device 120 includes but is not limited to: mobile terminals, tablet computers, personal computers, measurement terminals, wearable portable devices, and servers, etc. The server can be an independent server or a server cluster.
[0056] In one implementation, referring to Figure 3 , the embodiment of the present invention provides a load balancing method, including the following steps. In this implementation, it is exemplified by applying this load balancing method to the Figure 1 network device 110 in.
[0057] S11. Each core calculates the current first bandwidth quality of each pipeline under its jurisdiction, and the current second bandwidth quality of each member port under its jurisdiction, and synchronizes all the first bandwidth qualities and second bandwidth qualities to the pipelines of all the remaining cores.
[0058] S13. Each pipeline updates the port bandwidth quality of each member port in the quality table according to the first bandwidth quality and the second bandwidth quality.
[0059] S15. When any pipeline receives a forwarding packet from any port under its jurisdiction and the egress of the forwarding packet is an aggregation port, it determines a target port from all the member ports of the aggregation port according to all the port bandwidth qualities in the quality table, and sends the forwarding packet to the target pipeline where the target port is located, so as to send the forwarding packet out from the target port through the target pipeline.
[0060] For each core of the network device 110, all the pipelines and the member ports of the pipelines included therein belong to the jurisdiction objects. For a pipeline, it belongs to the core where it is located. Similarly, for each member port, it belongs to the core where it is located. Each pipeline pre-stores a quality table.
[0061] Each core synchronizes the current first bandwidth quality of all the pipelines under its jurisdiction and the current second bandwidth quality of all the member ports under its jurisdiction to the pipelines of other cores of the network device 110, so that each pipeline in the network device 110 can know the first bandwidth quality of all the pipelines of the entire chip 130 and the second bandwidth quality of all the member ports.
[0062] In an example, with a period of 2 ms, referring to Figure 2 , the network device 110 includes core 0 and core 1, and each core includes 2 pipelines (respectively pipeline 0 and pipeline 1, and in actual application, there can be more than two pipelines). For pipeline 0 of core 1, its pipeline identifier can be C1s1, and for member port 1 of pipeline 0 of core 1, its port identifier can be C1s1g1.
[0063] Every 2 ms, each core of the network device 110 calculates the current first bandwidth quality of all its own pipelines and the current second bandwidth quality of each member port of the pipelines under its jurisdiction, and synchronizes each first bandwidth quality with the corresponding pipeline identifier and each second bandwidth quality with the corresponding member port identifier to the pipelines of all the remaining cores. Each pipeline updates the port bandwidth quality of all the member ports of the network device 110 in the quality table in a covering manner according to the first bandwidth quality and the second bandwidth quality sent by each core.
[0064] The pipeline of network device 110 (pipeline 1 of core 0) receives the forwarding packet sent by network device 110 from the ordinary port or member port under its jurisdiction. When it is queried that the egress of the forwarding packet is aggregation port A, the target port is determined from all member ports of aggregation port A according to the port bandwidth quality of all member ports of aggregation port A on the quality table. If the target port is port g2 of pipeline 1 of core 1, the forwarding packet is sent to pipeline 1 of core 1. After receiving the forwarding packet, pipeline 1 of core 1 sends the forwarding packet out from its port g2.
[0065] Compared with the packet forwarding method of traditional network devices, the load balancing method provided by the present invention can determine which member port to send the forwarding packet according to the latest port bandwidth quality of the member ports, which can greatly improve the problem of packet loss while achieving load balancing.
[0066] It should be noted that when there is only one core in the chip of the network device, the network device can still adopt the load balancing method provided by the embodiments of the present invention. At this time, the core synchronizes the first bandwidth quality of each pipeline under its jurisdiction and the second bandwidth quality of each member port to all pipelines. Each pipeline updates the port bandwidth quality of each member port under its jurisdiction according to the first bandwidth quality and the second bandwidth quality, and determines the target port from all member ports of the aggregation port according to the port bandwidth quality, and sends the forwarding packet to the target pipeline where the target port is located.
[0067] In one implementation, in order to accurately obtain the current first bandwidth quality of each pipeline, a function of monitoring the load condition of the pipelines under the jurisdiction of the core is introduced to determine the first bandwidth quality according to the actual load of the pipelines. Specifically, each core periodically collects the number of bytes passed by each pipeline under its jurisdiction, and obtains the current first bandwidth quality of each pipeline according to the level interval where the number of bytes is located.
[0068] Similarly, in order to accurately obtain the current second bandwidth quality of each member port, a function of monitoring the load condition of the member ports under the jurisdiction of the core is introduced to determine the first bandwidth quality according to the actual load of the pipelines. Specifically, each core periodically collects the number of bytes currently passed by each member port under its jurisdiction, and obtains the current first bandwidth quality of each member port according to the level interval where the number of bytes is located.
[0069] In practical applications, there can be multiple level intervals, and each level interval can correspond to a specific score. For example, if there are 16 level intervals, then there are 16 scores (which can be 0 - 15), and the fewer the number of bytes, the higher the corresponding score. When the number of bytes currently forwarded by a certain pipeline or a certain member port is 0, and 0 belongs to the first level interval, and the score corresponding to the first level interval is 15, then the current first bandwidth quality of this pipeline is 15 points, or the current second bandwidth quality of this member port is 15 points. It should be understood that the more bytes passed through per unit time, the heavier the load is indicated, and the worse the quality is.
[0070] In the traditional method of receiving and sending packet traffic for member ports, generally either only the bandwidth quality of the member port is considered, or only the bandwidth quality of the pipeline is considered. However, there is often background traffic in the pipeline, that is, the packet traffic received and sent by the ordinary ports on the pipeline. For example, pipeline 1 has member port S1, pipeline 2 has member ports S2 and ordinary ports, S1 and S2 are bound as an aggregated port, all 10 packet traffic in pipeline 1 are forwarded to S1, and all N (much larger than 10) packet traffic in pipeline 2 are forwarded to the ordinary port. At this time, these N packet traffic are the background traffic.
[0071] If only the bandwidth quality of the member port is considered and the bandwidth quality of the pipeline is not considered, the quality of member port S2 is better, but due to the existence of background traffic, in fact, the quality of pipeline 2 is not better than that of pipeline 1. At this time, if the newly added traffic selects pipeline 2, pipeline 2 is very likely to cause packet loss due to insufficient forwarding capacity.
[0072] If only the bandwidth quality of the pipeline is considered and the bandwidth quality of the member port is not considered, there are only 10 flows in pipeline 1. Compared with the n flows in pipeline 2, the quality of pipeline 1 seemingly is better than that of pipeline 2. However, since there is no traffic on member port S2 of pipeline 2, therefore, S1 is not necessarily better than S2. At this time, if the newly added traffic selects member port S1 of pipeline 1, it is very likely to cause packet loss due to insufficient forwarding capacity of s1.
[0073] Considering that both the current second bandwidth quality of the member port itself and the current first bandwidth quality of the pipeline to which it belongs will affect the final bandwidth quality of the member port, in one implementation, in order to more accurately measure the port bandwidth quality of each member port, weights are introduced in the port bandwidth quality calculation. Specifically, for each member port, calculate the first product value between the first bandwidth quality of the pipeline to which this member port belongs and the first preset weight, calculate the second product value between the second bandwidth quality of this member port and the second preset weight, and calculate the sum of the first product value and the second product value to obtain the port bandwidth quality of this member port.
[0074] Expressed by a calculation formula, it is: Q = q1×a + q2×b, where Q represents the port bandwidth quality, q1 represents the first bandwidth quality, q2 represents the second bandwidth quality, a represents the first preset weight, b represents the second preset weight, and a + b = 1.
[0075] For different pipelines, the first preset weight and the second preset weight can be different. For example, for pipeline 1 of core 1, the first preset weight can be 80%, and the second preset weight can be 20%. For pipeline 1 of core 0, the first preset weight can be 70%, and the second preset weight can be 30%.
[0076] Through the above settings, after comprehensively considering the second bandwidth quality of the member ports and the first bandwidth quality of the pipelines where the member ports are located, the port bandwidth quality is obtained, so that the port bandwidth quality fully considers the quality of the member ports and the quality of the pipelines, that is, the balance of bandwidth quality consideration is achieved, which further helps to achieve the effect of balance and no packet loss.
[0077] Furthermore, the network device 110 can pre-store an aggregation port table, and the information of all member ports of each aggregation port can be recorded in the aggregation port table. Since each pipeline includes an ingress processing engine module, a traffic management module, and an egress processing engine module, in one implementation, referring to Figure 4 , step S15 may include the following sub-steps.
[0078] S151, when any pipeline receives a forwarding packet from any port under its jurisdiction, the ingress processing engine module of the pipeline determines the egress of the forwarding packet according to the destination address of the forwarding packet and the pre-stored forwarding table.
[0079] S152, query whether the egress is an aggregation port. If so, execute step S153.
[0080] After determining the egress of the forwarding packet, it can be known whether the egress is an aggregation port by querying the aggregation port table pre-stored in the network device 110.
[0081] S153, according to the port bandwidth quality of all ports in the quality table, determine the target port from all member ports of the aggregation port, and send the forwarding packet to the target pipeline where the target port is located.
[0082] S154, when the target pipeline receives the forwarding packet, perform traffic management on the forwarding packet through the traffic management module, and after editing the forwarding packet through the egress processing engine module, send the forwarding packet out from the target port.
[0083] Among them, traffic management may include but is not limited to: transmission speed configuration. For example, speed can be limited. The content that the egress processing engine module edits the forwarded packet can be: adding or deleting the vlan field in the packet.
[0084] Through the above steps S151 - S154, the forwarded packets with the egress being a certain aggregated port are sent out from the appropriate member ports, so as to reduce the probability of packet loss.
[0085] In a real - time manner, in order to minimize the probability of packet loss as much as possible, in one implementation, referring to Figure 5 , the above step S153 may include the following sub - steps.
[0086] S1531, sort all the member ports of the aggregated port according to the bandwidth quality of all ports in the quality table, and query each member port of the aggregated port in descending order.
[0087] S1532, calculate the total bandwidth of the current bandwidth of the currently queried member port and the required bandwidth of the forwarded packet.
[0088] It should be understood that the total bandwidth = the current bandwidth of the currently queried member port + the required bandwidth of the forwarded packet. The current bandwidth refers to the bandwidth occupied by the current load of the member port.
[0089] S1533, determine whether the total bandwidth exceeds the restricted bandwidth of the currently queried member port. If so, execute step S1534; if not, execute step S1535.
[0090] Among them, the restricted bandwidth refers to the maximum bandwidth that the member port allows.
[0091] S1534, take the currently queried member port as the target port.
[0092] S1535, continue to query the next member port until the member port whose current bandwidth and the total bandwidth of the forwarded packet are less than or equal to its own restricted bandwidth, and take this member port as the target port.
[0093] If the total bandwidth between the current bandwidth of all member ports of the egress and the forwarded packet is greater than the restricted bandwidth of the member port, then the member port with the smallest difference between the total bandwidth and the restricted bandwidth can be selected as the target port, or re - query until a member port with a total bandwidth less than or equal to the restricted bandwidth is obtained as the target port.
[0094] Through the above steps S1531 - S1535, the optimal target port can be found for the forwarded packet to minimize the probability of packet loss of the forwarded packet as much as possible.
[0095] The load balancing method provided by the embodiments of the present invention periodically evaluates the quality of each member port of a network device, that is, adopts a dynamic quality evaluation mechanism, which requires no manual intervention, increases the degree of intelligence, and reduces the configuration complexity. At the same time, according to the port bandwidth quality of the member ports, the optimal member port is selected as the target port for forwarding packets, so as to send the forwarding packets from the target port, realizing multi-level load balancing, considering the pipeline level and the port level, effectively reducing the possibility of congestion in the link aggregation scenario, and being able to effectively prevent packet loss or dropping.
[0096] Based on the concept of the above load balancing method, in one implementation, referring to Figure 6 , the embodiments of the present invention further provide a load balancing device 140, which can be applied to a network device as shown in Figure 1 . The load balancing device 140 may include a monitoring module 150 and a processing module 160.
[0097] The monitoring module 150 is configured to periodically calculate the current first bandwidth quality of each pipeline under its jurisdiction through each core, and periodically calculate the current second bandwidth quality of each member port under its jurisdiction, and synchronize all the first bandwidth qualities and the second bandwidth qualities to each pipeline of the remaining all cores.
[0098] The monitoring module 150 is further configured to update the port bandwidth quality of each member port in the quality table according to the first bandwidth quality and the second bandwidth quality through each pipeline.
[0099] When the processing module 160 receives a forwarding packet from any port under its jurisdiction and the exit of the forwarding packet is an aggregation port, it determines a target port from all the member ports of the aggregation port according to all the port bandwidth qualities in the quality table, and sends the forwarding packet to the target pipeline where the target port is located, so as to send the forwarding packet from the target port through the target pipeline.
[0100] In the above load balancing device 140, through the collaborative action of the monitoring module 150, the processing module 160 and the cores of the network device 110 and each pipeline, it is realized to determine which member port to send the forwarding packet according to the latest port bandwidth quality of the member ports, thereby being able to greatly improve the problem of packet loss.
[0101] For the specific definition of the load balancing device 140, reference can be made to the definition of the load balancing method in the foregoing text, which will not be elaborated herein. Each module in the above load balancing device 140 can be implemented in whole or in part by software, hardware, and their combination. Each of the above modules can be embedded in the processor in the network device 110 in hardware form or independent of the processor, or stored in the memory of the network device 110 in software form, so as to facilitate the processor to call and execute the operations corresponding to each of the above modules.
[0102] In one embodiment, a network device 110 is provided, and its internal structure diagram can be as Figure 7 shown. The network device 110 includes a processor, a memory, a communication interface, a display screen, and an input device connected through a system bus. Among them, the processor of the network device 110 is used to provide computing and control capabilities. The memory of the network device 110 includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the network device 110 is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a carrier network, near field communication (NFC), or other technologies. When the computer program is executed by the processor, it implements the load balancing method provided in the above embodiment.
[0103] Figure 7 The structure shown in Figure 7 is only a block diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation on the network device 110 to which the solution of the present invention is applied. The specific network device 110 may include more or fewer components than those shown in
[0104] shown, or combine some components, or have different component arrangements. Figure 7 In one embodiment, the load balancing device 140 provided by the present invention can be implemented in the form of a computer program, and the computer program can run on the network device 110 as shown in Figure 6 shown. The memory of the network device 110 can store each program module that constitutes the load balancing device 140. For example,
[0105] For example, Figure 7 the network device 110 shown in Figure 6 can execute steps S11 and S13 through the monitoring module 150 in the load balancing device 140 as shown in
[0106] In one embodiment, a control device is provided, including a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the following steps are implemented: Each core periodically calculates the current first bandwidth quality of each pipeline under its jurisdiction, and periodically calculates the current second bandwidth quality of each member port under its jurisdiction, and synchronizes all the first bandwidth qualities and the second bandwidth qualities to the pipelines of all the remaining cores; Each pipeline updates the port bandwidth quality of each member port in the quality table according to the first bandwidth quality and the second bandwidth quality; When any pipeline receives a forwarding packet from any port under its jurisdiction and the egress of the forwarding packet is an aggregation port, a target port is determined from all the member ports of the aggregation port according to all the port bandwidth qualities in the quality table, and the forwarding packet is sent to the target pipeline where the target port is located, so as to send the forwarding packet out from the target port through the target pipeline.
[0107] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: Each core periodically calculates the current first bandwidth quality of each pipeline under its jurisdiction, and periodically calculates the current second bandwidth quality of each member port under its jurisdiction, and synchronizes all the first bandwidth qualities and the second bandwidth qualities to the pipelines of all the remaining cores; Each pipeline updates the port bandwidth quality of each member port in the quality table according to the first bandwidth quality and the second bandwidth quality; When any pipeline receives a forwarding packet from any port under its jurisdiction and the egress of the forwarding packet is an aggregation port, a target port is determined from all the member ports of the aggregation port according to all the port bandwidth qualities in the quality table, and the forwarding packet is sent to the target pipeline where the target port is located, so as to send the forwarding packet out from the target port through the target pipeline.
[0108] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions, and operations of devices, methods, and computer program products according to multiple embodiments of the present invention. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the part of the module, program segment, or code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, as well as the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0109] In addition, each functional module in various embodiments of the present invention can be integrated together to form an independent part, or each module can exist alone, or two or more modules can be integrated to form an independent part.
[0110] If the described function is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage media include: USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs, and other media that can store program codes.
[0111] The above description is only the preferred embodiments of the present invention and is not used to limit the present invention. For those skilled in the art, the present invention can have various modifications and changes. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included in the protection scope of the present invention.
Claims
1. A load balancing method, characterized in that, Applied to a network device, the network device includes at least two core chips, each core includes a plurality of pipelines under its jurisdiction, each pipeline includes a general port and / or a member port under its jurisdiction, and each member port forms an aggregation port with at least one other member port. The method includes: Each core periodically calculates the current first bandwidth quality of each pipeline under its jurisdiction, and periodically calculates the current second bandwidth quality of each member port under its jurisdiction, and synchronizes all the first bandwidth qualities and the second bandwidth qualities to each pipeline of the remaining all cores; Each pipeline updates the port bandwidth quality of each member port in the quality table according to the first bandwidth quality and the second bandwidth quality; When any pipeline receives a forwarding packet from any port under its jurisdiction and the exit of the forwarding packet is an aggregation port, according to all the port bandwidth qualities in the quality table, determines a target port from all the member ports of the aggregation port, and sends the forwarding packet to the target pipeline where the target port is located, so as to send the forwarding packet out from the target port through the target pipeline; The step that each pipeline updates the port bandwidth quality of each member port in the quality table according to the first bandwidth quality and the second bandwidth quality includes: For each member port, calculates a first product value between the first bandwidth quality of the pipeline to which the member port belongs and a first preset weight, calculates a second product value between the second bandwidth quality of the member port and a second preset weight, and calculates the sum of the first product value and the second product value to obtain the port bandwidth quality of the member port.
2. The load balancing method according to claim 1, wherein The step of determining a target port from all the member ports of the aggregation port according to all the port bandwidth qualities in the quality table includes: Sorts all the member ports of the aggregation port according to all the port bandwidth qualities in the quality table, and queries each member port of the aggregation port in descending order; Calculates the total bandwidth of the current bandwidth of the currently queried member port and the required bandwidth of the forwarding packet, and determines whether the total bandwidth exceeds the limited bandwidth of the currently queried member port; If not, takes the currently queried member port as the target port; If so, continues to query the next member port until the target port is queried.
3. The load balancing method according to claim 1 or 2, characterized in that The step of periodically calculating the current first bandwidth quality of each pipeline under its jurisdiction includes: Periodically collects the number of bytes currently passing through each pipeline under its jurisdiction, and obtains the current first bandwidth quality of each pipeline according to the level interval where the number of bytes is located.
4. The load balancing method according to claim 1 or 2, characterized in that, The step of periodically calculating the current second bandwidth quality of each member port under its jurisdiction includes: Periodically collects the number of bytes currently passing through each member port under its jurisdiction, and obtains the current second bandwidth quality of each member port based on the level interval where the number of bytes is located.
5. The load balancing method according to claim 2, wherein Each pipeline further includes an ingress processing engine module, and the method further includes: When any pipeline receives a forwarding packet from any port under its jurisdiction, the ingress processing engine module of the pipeline determines the egress of the forwarding packet based on the destination address of the forwarding packet and the pre-stored forwarding table, and queries whether the egress is an aggregated port.
6. The load balancing method according to claim 5, wherein Each of the pipelines further includes a traffic management module and an egress processing engine module, and the method further includes: When the target pipeline receives a forwarding packet, the traffic management module performs traffic management on the forwarding packet, and after the egress processing engine module edits the forwarding packet, the forwarding packet is sent out from the target port.
7. A load balancing device, characterized in that, Applied to a network device, the network device includes at least two core chips, each core includes multiple pipelines under its jurisdiction, each pipeline includes ordinary ports and / or member ports under its jurisdiction, each member port forms an aggregated port with at least one other member port, and the load balancing device includes a monitoring module and a processing module to implement the load balancing method according to any one of claims 1 to 6; The monitoring module is configured to periodically calculate the current first bandwidth quality of each pipeline under the jurisdiction of each core, and periodically calculate the current second bandwidth quality of each member port under the jurisdiction of each core, and synchronize all the first bandwidth qualities and the second bandwidth qualities to the pipelines of all the remaining cores; The monitoring module is further configured to update the port bandwidth quality of each member port in the quality table through each pipeline according to the first bandwidth quality and the second bandwidth quality; When any pipeline receives a forwarding packet from any port under its jurisdiction and the egress of the forwarding packet is an aggregated port, the processing module determines a target port from all the member ports of the aggregated port according to all the port bandwidth qualities in the quality table, and sends the forwarding packet to the target pipeline where the target port is located, so as to send the forwarding packet out from the target port through the target pipeline.
8. A network device, characterized in that, Comprising a processor and a memory, the memory stores a computer program that can be executed by the processor, and the processor can execute the computer program to implement the load balancing method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the load balancing method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Endogenous safe network data message programmable processing device
CN112417458A
Load balancing among output ports
US20210328929A1