Load balancing method and device of network card, electronic equipment and storage medium

By monitoring the bandwidth difference of the optical port of the network card, determining the target queue and transferring it to another optical port, the problem of backpressure of the optical port of the network card is solved, and more efficient load balancing and transmission efficiency are achieved.

CN120583038APending Publication Date: 2025-09-02CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510592947.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-08
Publication Date
2025-09-02

AI Technical Summary

Technical Problem

After multiple optical ports of the network card are bound, the traffic load is unbalanced, resulting in backpressure of the optical port and affecting the overall transmission efficiency.

Method used

By monitoring the current bandwidth and the bandwidth difference between the target optical port, the target queue is determined, and bound to another optical port to achieve data transmission, load balancing is flexibly performed.

Benefits of technology

It improves the use efficiency of optical ports, enhances the overall transmission efficiency of network cards, and avoids optical port backpressure and network congestion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120583038A_ABST
    Figure CN120583038A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computer application, and discloses a load balancing method and device of a network card, electronic equipment and a storage medium. The method comprises the following steps: acquiring the current bandwidth of a target optical port; if the current bandwidth of the target optical port is greater than the due bandwidth of the target optical port, obtaining a difference value between the current bandwidth and the due bandwidth to obtain a first bandwidth difference value; determining a target queue corresponding to the first bandwidth difference value in a plurality of queues of the target optical port; according to the invention, the target queue is bound to the other optical port, the data corresponding to the first bandwidth difference value is transmitted through the other optical port, the target queue of the target optical port is transferred to the other optical port to realize data transmission, the load balancing of the network card is flexibly and skillfully realized, the use efficiency of the optical port is improved, and the overall transmission efficiency of the network card is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer application technology, and in particular to a load balancing method, device, electronic device, and storage medium for a network card. Background Art

[0002] Currently, multiple optical ports on a network card are typically bound into a single bond to increase the card's overall bandwidth. For example, a network card with two 25Gbps optical ports can achieve a single 50Gbps throughput. However, due to varying packet characteristics, the traffic transmitted by the network card cannot be evenly distributed across each optical port. When optical port back pressure is generated, the actual traffic forwarded by the network card falls below the 50Gbps throughput.

[0003] To address this issue, a hash value is typically calculated using one or more of the message's source IP (Internet Protocol), destination IP, source MAC (Media Access Control Address), destination MAC, and the protocol port. The modulus of the hash value is then used to determine the optical port for transmission. However, because this solution relies on the characteristics of user traffic, the calculated hash values ​​in certain scenarios can conflict, leading to an unbalanced transmission rate load on the network card. Summary of the Invention

[0004] In view of this, the present application provides a load balancing method, device, electronic device and storage medium for a network card to solve the problem of unbalanced network card load.

[0005] In a first aspect, the present application provides a load balancing method for a network card, the network card including at least two optical ports, each optical port being bound to at least two queues, the method comprising: obtaining the current bandwidth of a target optical port; if the current bandwidth of the target optical port is greater than the expected bandwidth of the target optical port, obtaining the difference between the current bandwidth and the expected bandwidth to obtain a first bandwidth difference; determining a target queue corresponding to the first bandwidth difference among multiple queues of the target optical port; and binding the target queue to another optical port to transmit data corresponding to the first bandwidth difference through the other optical port.

[0006] The load balancing method of the network card of the present application, if it is monitored that the current bandwidth of the target optical port is greater than the expected bandwidth of the target optical port, that is, it indicates that the current transmission rate of the target optical port exceeds its own expected bandwidth, so the network card needs to be load balanced to avoid the situation of optical port back pressure at the target optical port. By using the first bandwidth difference between the current bandwidth of the target optical port and the expected bandwidth, a target queue corresponding to the first bandwidth difference is determined among the multiple queues of the target optical port, and the target queue is bound to another optical port, so that the corresponding data can be transmitted through the other optical port, that is, by transferring the target queue of the target optical port to another optical port to realize data transmission, the load balancing of the network card is flexibly and cleverly realized. Since this solution only needs to move the determined target queue to another optical port, it can accurately and quickly load balance the network card, improve the efficiency of optical port use and improve the overall transmission efficiency of the network card, thereby solving the problem of unbalanced load on the network card.

[0007] In an optional embodiment, determining a target queue corresponding to a first bandwidth difference among multiple queues of a target optical port includes: using the idle bandwidth of another optical port and the first bandwidth difference to determine a first bandwidth interval corresponding to the first bandwidth difference; and determining a target queue corresponding to the first bandwidth interval among multiple queues of the target optical port.

[0008] By combining the idle bandwidth of the other optical port and the first bandwidth difference, the first bandwidth interval corresponding to the first bandwidth difference can be accurately and reasonably determined, so that a queue can be selected as the target queue from the queues whose current transmission rate is in the first bandwidth interval, so that the target queue that needs to be moved out of the target optical port is reasonable and the bandwidth resources of the other optical port can be maximized.

[0009] In an optional embodiment, the method further includes: if the target queue corresponding to the first bandwidth interval is not determined, determining the bandwidth interval before the first bandwidth interval as the second bandwidth interval; determining the target queue corresponding to the second bandwidth interval among the multiple queues of the target optical port; obtaining a second bandwidth difference between the first bandwidth difference and an upper limit value of the second bandwidth interval, determining a third bandwidth interval corresponding to the second bandwidth difference, and determining the target queue corresponding to the third bandwidth interval among the multiple queues of the target optical port.

[0010] If the target queue corresponding to the first bandwidth interval is not determined, that is, there is no queue with a current transmission rate within the first bandwidth interval on the target optical port, the bandwidth interval before the first bandwidth interval is used as the second bandwidth interval, and the target queue is re-determined, thereby avoiding the situation where the network card cannot be load balanced due to the inability to determine the target queue. The third bandwidth interval corresponding to the second bandwidth difference is determined by the second bandwidth difference between the first bandwidth difference and the upper limit of the second bandwidth interval, and the target queue corresponding to the third bandwidth interval is determined. This avoids the failure to balance all bandwidth data exceeding the target optical port's required bandwidth to another optical port, which may cause optical port back pressure, network congestion, and packet loss, further achieving more accurate load balancing of the network card.

[0011] In an optional embodiment, the idle bandwidth of another optical port and the first bandwidth difference are used to determine a first bandwidth interval corresponding to the first bandwidth difference, including: if the first bandwidth difference is less than or equal to the idle bandwidth of the other optical port, the first bandwidth interval corresponding to the first bandwidth difference is determined by using a first predetermined rule, the idle bandwidth of the other optical port, and the first bandwidth difference; if the first bandwidth difference is greater than the idle bandwidth of the other optical port, the first bandwidth interval corresponding to the first bandwidth difference is determined by using a second predetermined rule and the idle bandwidth of the other optical port.

[0012] When the first bandwidth difference is less than or equal to the idle bandwidth of the other optical port, the first bandwidth interval is determined using the first predetermined rule; when the first bandwidth difference is greater than the idle bandwidth of the other optical port, the first bandwidth interval is determined using the second predetermined rule. That is, by comprehensively considering the size relationship between the first bandwidth difference and the idle bandwidth of the other optical port, the first bandwidth interval can be reasonably determined, avoiding the situation where the current transmission rate corresponding to the subsequently determined target queue is too high and cannot be carried by the other optical port, or the current transmission rate corresponding to the target queue is too low, resulting in poor load balancing effect on the network card, due to unreasonable determination of the first bandwidth interval.

[0013] In an optional embodiment, a first bandwidth interval corresponding to the first bandwidth difference is determined using a first predetermined rule, the idle bandwidth of another optical port, and the first bandwidth difference, including: determining a bandwidth interval corresponding to a lower limit value that is less than or equal to the first bandwidth difference and an upper limit value that is less than or equal to the idle bandwidth as the first bandwidth interval.

[0014] If the lower limit value of the first bandwidth interval is less than the first bandwidth difference value, it indicates that the first bandwidth difference value can be within the first bandwidth interval; if the upper limit value of the first bandwidth interval is less than or equal to the idle bandwidth of the other optical port, it indicates that the current transmission rate of the target queue determined subsequently can be carried by the other optical port, and that optical port back pressure will not occur in the other optical port due to load imbalance.

[0015] In an optional embodiment, a first bandwidth interval corresponding to the first bandwidth difference is determined using a second predetermined rule and the idle bandwidth of another optical port, including: determining whether there are other optical ports whose idle bandwidth is greater than the first bandwidth difference, where the other optical ports are optical ports in the network card other than the target optical port and the other optical port; if there are other optical ports, determining the first bandwidth interval corresponding to the first bandwidth difference using the idle bandwidth of the other optical ports and the first bandwidth difference; if there are no other optical ports, determining the bandwidth interval corresponding to the idle bandwidth of the other optical port whose lower limit is greater than or equal to the first bandwidth interval as the first bandwidth interval.

[0016] If the idle bandwidth of the other optical port is insufficient to carry the first bandwidth difference, priority is given to whether there are other optical ports in the network card whose idle bandwidth is greater than or equal to the first bandwidth difference. If so, the excess bandwidth data of the target optical port is preferentially loaded to the other optical ports; if not, the bandwidth interval corresponding to the idle bandwidth of the other optical port whose lower limit is greater than or equal to the other optical port is determined as the first bandwidth interval. That is to say, the current transmission rate of the determined target queue is at least the idle bandwidth of the other optical port, so that the current transmission rate of the other optical port can be as close as possible to the required bandwidth of the other optical port.

[0017] In an optional embodiment, obtaining the current bandwidth of the target optical port includes: using a register to periodically obtain traffic information of each queue of the target optical port; using the traffic information of each queue to determine the current bandwidth of each queue; and using the sum of the current bandwidths of each queue to determine the current bandwidth of the target optical port.

[0018] The register accurately records traffic information for each queue, providing an accurate data source for calculating the current bandwidth of the target optical port. The periodic acquisition method updates traffic information for each queue at short intervals, promptly reflecting traffic changes and avoiding data lag caused by long intervals. This ensures more accurate calculations of the current bandwidth of each queue, and consequently, more accurate determinations of the current bandwidth of the target optical port.

[0019] In a second aspect, the present application provides a load balancing device for a network card, the network card including at least two optical ports, each optical port being bound to at least two queues, the device including: a bandwidth acquisition module for acquiring the current bandwidth of a target optical port; a difference acquisition module for acquiring the difference between the current bandwidth and the expected bandwidth if the current bandwidth of the target optical port is greater than the expected bandwidth of the target optical port, to obtain a first bandwidth difference; a queue determination module for determining a target queue corresponding to the first bandwidth difference among multiple queues of the target optical port; and a queue binding module for binding the target queue to another optical port to transmit bandwidth data corresponding to the first bandwidth difference through the other optical port.

[0020] In a third aspect, the present application provides an electronic device comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, computer instructions being stored in the memory, and the processor executing the load balancing method of the network card of the above-mentioned first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0021] In a fourth aspect, the present application provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the load balancing method for a network card according to the first aspect or any corresponding embodiment thereof.

[0022] In a fifth aspect, the present application provides a computer program product, comprising computer instructions, which are used to enable a computer to execute the load balancing method for a network card according to the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the specific implementation methods of the present application or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the specific implementation methods or the description of the prior art. Obviously, the drawings described below are some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0024] Figure 1 1 is a flow chart of a load balancing method for a network card according to an embodiment of the present application;

[0025] Figure 2 is a flow chart of a load balancing method for another network card according to an embodiment of the present application;

[0026] Figure 3 is a flow chart of another method for load balancing of a network card according to an embodiment of the present application;

[0027] Figure 4 is a structural block diagram of a load balancing device for a network card according to an embodiment of the present application;

[0028] Figure 5 It is a schematic diagram of the hardware structure of the electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0029] To make the purpose, technical solutions, and advantages of the embodiments of the present application more clear, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative efforts shall fall within the scope of protection of this application.

[0030] In conjunction with the application scenarios on which the execution of the network card load balancing method, device, electronic device, and storage medium depends, the application scenarios are described here.

[0031] First, the terms involved in one or more embodiments of the present application are explained.

[0032] XPS (Transmit Packet Steering, or XPS) is a feature in the Linux kernel network stack designed to optimize the performance of multi-queue network cards when sending packets. XPS improves packet transmission throughput and locality by binding CPUs to specific transmit queues, reducing CPU cache line hops.

[0033] Bond (network card binding or network card bundling): is a technology that binds multiple interfaces or ports into a virtual network card.

[0034] Optical port back pressure: The traffic that an optical port needs to forward exceeds the required bandwidth of the optical port, causing packet accumulation and affecting the forwarding performance of other optical ports.

[0035] In today's world, information technology and network applications are developing at an exponential and explosive pace, causing network cards to carry an increasing number of services. Consequently, various types of network cards have emerged. For example, a network card may appear to have more than one optical port. For this type of network card, multiple optical ports are typically bound together into a bond to increase the card's overall bandwidth.

[0036] For example, a network card with two 25Gbps optical ports can achieve a single 50Gbps throughput. However, due to different packet characteristics, the traffic transmitted by the network card cannot be evenly distributed to each optical port. When optical port back pressure is generated, the actual traffic forwarded by the network card will not reach the 50Gbps throughput.

[0037] To address this issue, a quintuple is typically used to calculate traffic load. This involves calculating a hash value based on one or more of the packet's source IP address, destination IP address, source MAC address, destination MAC address, and protocol port number. The modulus of the hash value is then used to determine the optical port for transmission. However, this solution relies on the characteristics of user traffic. In some scenarios, the quintuple of user traffic does not change randomly, leading to conflicts in the calculated hash values. This, in turn, leads to an unbalanced traffic load and affects the overall forwarding bandwidth of the network card.

[0038] In view of this, the present application proposes a load balancing method, apparatus, electronic device, and storage medium for a network card. The method includes: obtaining the current bandwidth of a target optical port; if the current bandwidth of the target optical port is greater than the expected bandwidth of the target optical port, obtaining the difference between the current bandwidth and the expected bandwidth to obtain a first bandwidth difference; determining a target queue corresponding to the first bandwidth difference among multiple queues of the target optical port; and binding the target queue to another optical port to transmit data corresponding to the first bandwidth difference through the other optical port.

[0039] The load balancing method of the network card of the present application, if it is monitored that the current bandwidth of the target optical port is greater than the expected bandwidth of the target optical port, that is, it indicates that the current transmission rate of the target optical port exceeds its own expected bandwidth, so the network card needs to be load balanced to avoid the situation of optical port back pressure at the target optical port. By using the first bandwidth difference between the current bandwidth of the target optical port and the expected bandwidth, a target queue corresponding to the first bandwidth difference is determined among the multiple queues of the target optical port, and the target queue is bound to another optical port, so that the corresponding data can be transmitted through the other optical port, that is, by transferring the target queue of the target optical port to another optical port to realize data transmission, the load balancing of the network card is flexibly and cleverly realized. Since this solution only needs to move the determined target queue to another optical port, it can accurately and quickly load balance the network card, improve the efficiency of optical port use and improve the overall transmission efficiency of the network card, thereby solving the problem of unbalanced load on the network card.

[0040] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods. First, the network card in the present application is introduced.

[0041] The network card of the present application includes at least two optical ports, each of which is bound to at least two queues. In other words, the network card of the present application has multiple optical ports, and each optical port is bound to multiple queues. For each optical port, the number of queues can be the same as or different from the number of queues of other optical ports. This application does not impose any restrictions on this. The number of optical ports and the number of queues can be flexibly adjusted according to actual circumstances. This application does not impose any restrictions on the specific number of optical ports in the network card or the specific number of queues in each optical port.

[0042] In addition, each queue in the optical port can process data independently. For example, when processing a large number of concurrent network requests, different queues can simultaneously receive and process data from different clients. By allocating data to different queues and processing them in parallel by different hardware units or threads, the efficiency of data processing is greatly improved, and the multi-core processor and parallel processing capabilities of the network card are fully utilized. In other words, for an optical port, the multiple queues of the optical port jointly complete the data forwarding of the optical port, and the sum of the current transmission rates of the multiple queues together constitutes the current bandwidth of the optical port. When the optical port forwards data, the current transmission rate of each queue is obtained, and the bandwidth range in which the current transmission rate is located is determined, so that a bandwidth statistics table of the optical port can be formed.

[0043] For ease of understanding, the following example illustrates bandwidth statistics for each optical port on a network interface card (NIC) with two optical ports and 32 queues. The two optical ports are optical port 0 and optical port 1, and each of the 32 queues has a unique queue ID. The 32 queues are queue 0, queue 1, queue 2, ..., queue 31.

[0044] First, bind 32 queues to two optical ports using round-robin binding. For example, bind queue 0 to optical port 0, queue 1 to optical port 1, queue 2 to optical port 0, queue 3 to optical port 1, queue 4 to optical port 0, and so on. Of course, in actual applications, you can also directly bind queues to optical ports 0 and 1. For another example, bind queues 0-15 to optical port 0, and queues 16-31 to optical port 1. For another example, bind queues 0-15 to optical port 1, and queues 16-31 to optical port 0.

[0045] Secondly, a maximum transmission rate is set for each queue. For example, the maximum forwarding rate of each queue can be, but is not limited to, 5 Gbps.

[0046] Again, the maximum transmission rate of each queue can be divided into multiple bandwidth intervals, so that the bandwidth interval in which the current transmission rate of each queue is located can be accurately counted. It should be understood that the finer the granularity of the maximum transmission rate division of each queue, the more accurate the subsequent load balancing. Thus, in this application, there is no restriction on the bandwidth interval divided by the maximum transmission rate of each queue. For example, the maximum transmission rate of each queue is divided into 10 bandwidth intervals, namely 0-0.5, 0.5-1.0, 1.0-1.5, 1.5-2.0, 2.0-2.5, 2.5-3.0, 3.0-3.5, 3.5-4.0, 4.0-4.5 and 4.5-5.0.

[0047] Finally, the current transmission rate of each queue on each optical port is counted, and the current transmission rate of each queue is matched with the bandwidth range to obtain the bandwidth statistics table of each optical port. For example, the bandwidth statistics table of optical port 0 shown in Table 1 and the bandwidth statistics table of optical port 1 shown in Table 2 can be obtained.

[0048] Table 1 Bandwidth statistics of optical port 0

[0049]

[0050] Table 2 Bandwidth statistics of optical port 1

[0051]

[0052] In conjunction with the above content, the load balancing method of the network card in this application is introduced. According to an embodiment of the present application, an embodiment of the load balancing method of the network card is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.

[0053] In this embodiment, a load balancing method for a network card is provided, which can be used in the above-mentioned network card. Figure 1 Flowchart of the load balancing method of the network card according to the embodiment of the present application. Figure 1 As shown, the process includes the following steps:

[0054] Step S102: Acquire the current bandwidth of the target optical port.

[0055] Current bandwidth refers to the network data transmission rate currently being used or available on a target optical port at a given moment. It reflects the target optical port's actual communication capabilities and data transmission speed, typically measured in bits per second (bps), such as 100Mbps or 1Gbps.

[0056] There are several ways to obtain the current bandwidth of a target optical port. For example, the current bandwidth of the target optical port can be obtained through the relevant hardware in the network card. Another example is that the current bandwidth of the target optical port can be obtained through the relevant software configured in the network card. In actual applications, the current bandwidth of the target optical port can be obtained in real time or periodically.

[0057] Step S104: If the current bandwidth of the target optical port is greater than the expected bandwidth of the target optical port, a difference between the current bandwidth and the expected bandwidth is obtained to obtain a first bandwidth difference.

[0058] The target optical port's bandwidth is the theoretical maximum data transmission rate it can achieve under ideal conditions, based on factors such as its hardware specifications, network configuration, and the connected network environment. It is an inherent property of the target optical port and represents the maximum communication capacity it can provide under normal operating conditions.

[0059] Step S106: Determine a target queue corresponding to the first bandwidth difference among the multiple queues of the target optical port.

[0060] The first bandwidth difference between the target optical port's current bandwidth and its expected bandwidth can be used to determine the transmission rate exceeding the target optical port's expected bandwidth. Based on the transmission rate exceeding the target optical port's expected bandwidth, i.e., the first bandwidth difference, a target queue with a current transmission rate near the first bandwidth difference is identified. The target queue is then bound to another optical port, cleverly balancing the target optical port's load to the other port and improving the bandwidth utilization of the other port.

[0061] Step S108: Bind the target queue to another optical port to transmit data corresponding to the first bandwidth difference through the other optical port.

[0062] For the other optical port, its idle bandwidth can be greater than or equal to the first bandwidth difference, or less than the first bandwidth difference. When the idle bandwidth of the other optical port is greater than or equal to the first bandwidth difference, the target queue corresponding to the first bandwidth difference can be bound to the other optical port. When the idle bandwidth of the other optical port is less than the first bandwidth difference, the first bandwidth difference can be split to determine multiple target queues, and then the multiple target queues can be bound to the corresponding other optical port. In this way, the other optical port can be one or more optical ports of the network card, excluding the target optical port.

[0063] The load balancing method for the network card provided in this embodiment, if it is monitored that the current bandwidth of the target optical port is greater than the expected bandwidth of the target optical port, that is, it indicates that the current transmission rate of the target optical port exceeds its own expected bandwidth, so the network card needs to be load balanced to avoid the situation of optical port back pressure at the target optical port. By using the first bandwidth difference between the current bandwidth of the target optical port and the expected bandwidth, a target queue corresponding to the first bandwidth difference is determined among the multiple queues of the target optical port, and the target queue is bound to another optical port. In this way, the corresponding data can be transmitted through the other optical port, that is, data transmission is achieved by transferring the target queue of the target optical port to another optical port, thereby flexibly and cleverly achieving load balancing of the network card. Since this solution only needs to move the determined target queue to another optical port, it can accurately and quickly load balance the network card, improve the efficiency of optical port use and improve the overall transmission efficiency of the network card, thereby solving the problem of unbalanced load on the network card.

[0064] In this embodiment, a load balancing method for a network card is provided, which can be used in the above-mentioned network card. Figure 2 Flowchart of the load balancing method of the network card according to the embodiment of the present application. Figure 2 As shown, the process includes the following steps:

[0065] Step S202: Get the current bandwidth of the target optical port. Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.

[0066] Step S204: If the current bandwidth of the target optical port is greater than the expected bandwidth of the target optical port, the difference between the current bandwidth and the expected bandwidth is obtained to obtain a first bandwidth difference. Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.

[0067] Step S206: Determine a target queue corresponding to the first bandwidth difference among the multiple queues of the target optical port.

[0068] Specifically, the above step S206 includes:

[0069] Step S2062: Determine a first bandwidth interval corresponding to the first bandwidth difference by using the idle bandwidth of another optical port and the first bandwidth difference.

[0070] Step S2064: Determine a target queue corresponding to the first bandwidth interval among the multiple queues of the target optical port.

[0071] Idle bandwidth refers to the unused available data transmission capacity of a network link or interface (e.g., an optical port) at a specific moment. Using the idle bandwidth of another optical port and the first bandwidth difference, a first bandwidth interval corresponding to the first bandwidth difference can be quickly and reasonably determined.

[0072] The first bandwidth interval is the bandwidth interval that the first bandwidth difference can be in. For example, if the first bandwidth difference is 2.6 Gbps, then the corresponding first bandwidth interval is the bandwidth interval of 2.5-3.0.

[0073] If the idle bandwidth of the other optical port is greater than or equal to the first bandwidth difference, it indicates that the idle bandwidth of the other optical port exceeds the bandwidth of the target optical port. In this way, the first bandwidth interval corresponding to the first bandwidth difference can be directly determined, thereby determining the target queue whose current transmission rate is in the first bandwidth interval.

[0074] If the idle bandwidth of the other optical port is less than the first bandwidth difference, it indicates that the idle bandwidth of the other optical port cannot carry the excess bandwidth of the target optical port. In this way, the first bandwidth difference can be split to determine the excess bandwidth of the target optical port that can be carried by the idle bandwidth of the other optical port. Then, the corresponding first bandwidth interval is determined based on the divided first bandwidth difference, and then one or more target queues are determined.

[0075] Through steps S2062 to S2064, combined with the idle bandwidth of the other optical port and the first bandwidth difference, the first bandwidth interval corresponding to the first bandwidth difference can be accurately and reasonably determined, so that a queue can be selected as the target queue from the queues whose current transmission rates are in the first bandwidth interval, so that the target queue that needs to be moved out of the target optical port is reasonable and the bandwidth resources of the other optical port can be maximized.

[0076] Step S208: Bind the target queue to another optical port to transmit data corresponding to the first bandwidth difference through the other optical port. Figure 1 Step S108 of the illustrated embodiment will not be described in detail here.

[0077] The network card load balancing method provided in this embodiment, if the current bandwidth of a target optical port is detected to be greater than the target optical port's expected bandwidth, indicating that the target optical port's current transmission rate exceeds its expected bandwidth, requires load balancing of the network card to avoid optical port back pressure on the target optical port. Using a first bandwidth difference between the target optical port's current bandwidth and the expected bandwidth, a first bandwidth interval corresponding to the first bandwidth difference is determined among multiple queues of the target optical port. A queue with a current transmission rate within the first bandwidth interval is then selected as a target queue, and the target queue is then bound to another optical port. This allows the corresponding data to be transmitted through the other optical port. This method, by transferring the target queue of the target optical port to the other optical port, enables data transmission, thus flexibly and cleverly achieving load balancing for the network card. Because this solution only requires moving the determined target queue to the other optical port, it can accurately and quickly load balance the network card, improving optical port utilization efficiency and the overall transmission efficiency of the network card, thereby resolving the problem of unbalanced network card load.

[0078] In an optional embodiment, the method further includes: if the target queue corresponding to the first bandwidth interval is not determined, determining the bandwidth interval before the first bandwidth interval as the second bandwidth interval; determining the target queue corresponding to the second bandwidth interval among the multiple queues of the target optical port; obtaining a second bandwidth difference between the first bandwidth difference and an upper limit value of the second bandwidth interval, determining a third bandwidth interval corresponding to the second bandwidth difference, and determining the target queue corresponding to the third bandwidth interval among the multiple queues of the target optical port.

[0079] If a target queue corresponding to the first bandwidth interval cannot be determined, it indicates that no queue with a current transmission rate within the first bandwidth interval exists on the target optical port. In this case, the bandwidth interval immediately preceding the first bandwidth interval is determined as the second bandwidth interval, and then a queue with a current transmission rate within the second bandwidth interval is selected as the target queue. Since the target queue determined at this point cannot transmit data corresponding to the first bandwidth difference, the second bandwidth difference between the first bandwidth difference and the upper limit of the second bandwidth interval is used to determine a third bandwidth interval corresponding to the second bandwidth difference, and then a target queue with a current transmission rate within the third bandwidth interval is determined.

[0080] For example, assume that optical port 1 is the target optical port, the expected bandwidth of optical port 1 is 25 Gbps, and optical port 0 is another optical port. Assume that the current bandwidth of optical port 1 is 28.6 Gbps, the first bandwidth difference is 28.6-25=3.6 Gbps, and the first bandwidth interval corresponding to the first bandwidth difference is 3.5-4.0. From Table 2, there is no queue in the bandwidth interval of 3.5-4.0, that is, there is no queue whose current transmission rate is in the bandwidth interval of 3.5-4.0. In this case, the bandwidth interval before the first bandwidth interval, that is, 3.0-3.5, is determined as the second bandwidth interval. Since queues 29 and 31 exist in the bandwidth interval of 3.0-3.5 in Table 2, one of queues 29 and 31 can be determined as the target queue. Since the maximum bandwidth rate corresponding to the bandwidth range of 3.0-3.5 is 3.5 Gbps, and the first bandwidth difference is 3.6 Gbps, optical port 1 still exceeds 3.6-3.5 = 0.1 Gbps. Therefore, we need to further determine the third bandwidth range corresponding to the second bandwidth difference of 0.1 Gbps, which is the bandwidth range of 0-0.5. Since the queues with current transmission rates in the bandwidth range of 0-0.5 in Table 2 are queues 1, 3, and 5, we can select one of these queues as the target queue.

[0081] In the above-described embodiment, if the target queue corresponding to the first bandwidth interval is not determined, that is, if there is no queue on the target optical port whose current transmission rate is within the first bandwidth interval, the bandwidth interval preceding the first bandwidth interval is used as the second bandwidth interval, and the target queue is re-determined, thereby avoiding the situation where the network card cannot be load balanced due to the inability to determine the target queue. By determining the second bandwidth difference between the first bandwidth difference and the upper limit of the second bandwidth interval, a third bandwidth interval corresponding to the second bandwidth difference is determined, and the target queue corresponding to the third bandwidth interval is determined. This avoids the problem of optical port back pressure, network congestion, and packet loss caused by the failure to balance all bandwidth data exceeding the target optical port's required bandwidth to another optical port, thereby further achieving more accurate load balancing of the network card.

[0082] In an optional embodiment, the idle bandwidth of another optical port and the first bandwidth difference are used to determine a first bandwidth interval corresponding to the first bandwidth difference, including: if the first bandwidth difference is less than or equal to the idle bandwidth of the other optical port, the first bandwidth interval corresponding to the first bandwidth difference is determined by using a first predetermined rule, the idle bandwidth of the other optical port, and the first bandwidth difference; if the first bandwidth difference is greater than the idle bandwidth of the other optical port, the first bandwidth interval corresponding to the first bandwidth difference is determined by using a second predetermined rule and the idle bandwidth of the other optical port.

[0083] In the above-mentioned embodiment, when the first bandwidth difference is less than or equal to the idle bandwidth of the other optical port, the first bandwidth interval is determined using the first predetermined rule; when the first bandwidth difference is greater than the idle bandwidth of the other optical port, the first bandwidth interval is determined using the second predetermined rule. That is, by comprehensively considering the size relationship between the first bandwidth difference and the idle bandwidth of the other optical port, the first bandwidth interval can be reasonably determined, thereby avoiding situations such as the current transmission rate corresponding to the target queue subsequently determined being too high and unable to be carried by the other optical port due to unreasonable determination of the first bandwidth interval, and the current transmission rate corresponding to the target queue being too low, resulting in poor load balancing effect on the network card.

[0084] In an optional embodiment, a first bandwidth interval corresponding to the first bandwidth difference is determined using a first predetermined rule, the idle bandwidth of another optical port, and the first bandwidth difference, including: determining a bandwidth interval corresponding to a lower limit value that is less than or equal to the first bandwidth difference and an upper limit value that is less than or equal to the idle bandwidth as the first bandwidth interval.

[0085] If the first bandwidth difference is less than or equal to the idle bandwidth of the other optical port, it indicates that the other optical port has sufficient idle bandwidth for load balancing. For ease of understanding, the specific process of determining the first bandwidth interval and the target queue is described below using a specific example.

[0086] For example, the target optical port is the aforementioned optical port 1, the expected bandwidth of optical port 1 is 25 Gbps, and optical port 0 is another optical port. Assuming that the current bandwidth of optical port 1 is 27.6 Gbps, the first bandwidth difference is 27.6 - 25 = 2.6 Gbps. The idle bandwidth of optical port 0 is 3 Gbps. According to the first predetermined rule, the first bandwidth interval is 2.5-3.0. Since there is no queue in Table 2 whose current transmission rate is in the bandwidth interval of 2.5-3.0, the bandwidth interval of 2.0-2.5 is determined as the second bandwidth interval. Since queues 25 and 27 exist in the bandwidth interval of 2.0-2.5 in Table 2, either queue 25 or queue 27 can be used as the target queue and bound to optical port 0, as shown in the updated bandwidth statistics table of optical port 0 in Table 3.

[0087] Continuing with the previous example, since queue 25 is in the bandwidth range of 2.0-2.5, that is, the maximum possible current transmission rate of queue 25 is 2.5 Gbps, and the first bandwidth difference is 2.6 Gbps, the second bandwidth difference between the first bandwidth difference and the upper limit of the second bandwidth range is 0.1 Gbps. The third bandwidth range in which 0.1 Gbps is located is 0-0.5. Queues 1, 3, and 5 exist in this bandwidth range. Therefore, any one of queues 1, 3, and 5 can be determined as the target queue and bound to optical port 0. For details, see the updated bandwidth statistics table of optical port 0 shown in Table 3.

[0088] Table 3 Updated bandwidth statistics of optical port 0

[0089]

[0090] For another example, let's assume the target optical port is optical port 1, its expected bandwidth is 25 Gbps, and optical port 0 is another optical port. Assume the current bandwidth of optical port 1 is 27.2 Gbps, and the first bandwidth difference is 27.6 - 25 = 2.2 Gbps. The available bandwidth of optical port 0 is 3 Gbps. According to the first predetermined rule, the first bandwidth interval is 2.0-2.5. Queues 25 and 27 exist within this bandwidth interval. Therefore, one of queues 25 and 27 can be used as the target queue and bound to optical port 0. This is shown in Table 3, the updated bandwidth statistics table for optical port 0.

[0091] For another example, the target optical port is optical port 1, the expected bandwidth of optical port 1 is 25 Gbps, and optical port 0 is another optical port. Assume that the current bandwidth of optical port 1 is 26 Gbps, and the first bandwidth difference is 26 - 25 = 1 Gbps. The idle bandwidth of optical port 0 is 2 Gbps. According to the first predetermined rule, the first bandwidth interval corresponding to the first bandwidth difference is 1-1.5. From Table 2, we can see that the queues in the bandwidth interval of 1-1.5 are queues 13, 15, and 17, respectively. Any of queues 13, 15, and 17 can be used as the target queue. For example, as shown in Table 4, queue 17 is bound to optical port 0, resulting in the updated bandwidth statistics table for optical port 0 shown in Table 4.

[0092] Table 4 Updated bandwidth statistics of optical port 0

[0093]

[0094] In the above embodiment, the lower limit value of the first bandwidth interval is less than the first bandwidth difference value, indicating that the first bandwidth difference value can be within the first bandwidth interval; the upper limit value of the first bandwidth interval is less than or equal to the idle bandwidth of the other optical port, indicating that the current transmission rate of the target queue determined subsequently can be carried by the other optical port, and the load imbalance will not cause optical port back pressure in the other optical port.

[0095] In an optional embodiment, a first bandwidth interval corresponding to the first bandwidth difference is determined using a second predetermined rule and the idle bandwidth of another optical port, including: determining whether there are other optical ports whose idle bandwidth is greater than the first bandwidth difference, where the other optical ports are optical ports in the network card other than the target optical port and the other optical port; if there are other optical ports, determining the first bandwidth interval corresponding to the first bandwidth difference using the idle bandwidth of the other optical ports and the first bandwidth difference; if there are no other optical ports, determining the bandwidth interval corresponding to the idle bandwidth of the other optical port whose lower limit is greater than or equal to the first bandwidth interval as the first bandwidth interval.

[0096] In the above embodiment, if the idle bandwidth of the other optical port is insufficient to carry the first bandwidth difference, priority is given to whether there are other optical ports in the network card whose idle bandwidth is greater than or equal to the first bandwidth difference. If so, the excess bandwidth data of the target optical port is preferentially loaded to the other optical ports; if not, the bandwidth interval corresponding to the idle bandwidth of the other optical port whose lower limit is greater than or equal to the other optical port is determined as the first bandwidth interval. That is to say, the current transmission rate of the determined target queue is at least the idle bandwidth of the other optical port, so that the current transmission rate of the other optical port can be as close as possible to the required bandwidth of the other optical port.

[0097] For example, the target optical port is the aforementioned optical port 1, the required bandwidth of optical port 1 is 25 Gbps, and optical port 0 is another optical port. Assuming that the current bandwidth of optical port 1 is 26 Gbps, the first bandwidth difference is 26-25-1 Gbps. The idle bandwidth of optical port 0 is 0.5 Gbps. At this point, the idle bandwidth of optical port 0 is insufficient to accommodate the excess traffic from optical port 1. Therefore, the first bandwidth interval can be determined as 0.5-1.0. From Table 2, the queues in the bandwidth interval of 0.5-1.0 are queue 7, queue 9, or queue 11. Therefore, any one of queues 7, queue 9, or queue 11 can be determined as the target queue, and the target queue can be bound to optical port 0 to make the bandwidth of optical port 0 as close to 25 Gbps as possible. For example, queue 7 can be bound to optical port 0. Specifically, the updated bandwidth statistics table for optical port 0 is shown in Table 5.

[0098] Table 5 Updated bandwidth statistics of optical port 0

[0099]

[0100] In an optional embodiment, obtaining the current bandwidth of the target optical port includes: using a register to periodically obtain traffic information of each queue of the target optical port; using the traffic information of each queue to determine the current bandwidth of each queue; and using the sum of the current bandwidths of each queue to determine the current bandwidth of the target optical port.

[0101] Optionally, the register may be a traffic statistics register. In actual application, traffic information of each queue of the target optical port is periodically obtained. The smaller the interval, the smaller the current bandwidth of the target optical port is obtained, and the better the load balancing effect on the network card.

[0102] In the above implementation, the register accurately records traffic information for each queue, providing an accurate data source for calculating the current bandwidth of the target optical port. The periodic acquisition method updates traffic information for each queue at relatively short intervals, promptly reflecting traffic changes and avoiding data lags caused by long intervals. This ensures more accurate calculations of the current bandwidth of each queue, and consequently, more accurate determinations of the current bandwidth of the target optical port.

[0103] For ease of understanding, the following Figure 3 The load balancing method of the network card in this application is further described. Figure 3 As shown, the present application also provides a flow chart of a load balancing method for a network card. The flow chart includes steps S301 to S307.

[0104] Step S301: Check whether the current bandwidth of the target optical port exceeds the required bandwidth. If the current bandwidth of the target optical port exceeds the required bandwidth, execute steps S302 to S307; if the current bandwidth of the target optical port does not exceed the required bandwidth, continue to monitor whether the current bandwidth of the target optical port exceeds the required bandwidth.

[0105] Step S302, determine whether another optical port has idle bandwidth. If the other optical port has idle bandwidth, execute steps S303 to S307; if the other optical port does not have idle bandwidth, determine whether other optical ports of the network card have idle bandwidth.

[0106] Step S303 determines a first bandwidth difference and searches for a target queue. Specifically, the first bandwidth difference is determined using the difference between the target optical port's current bandwidth and the required bandwidth. The first bandwidth difference and the available bandwidth of another optical port are then used to determine a first bandwidth interval. The target queue is then determined based on the first bandwidth interval.

[0107] Step S304: Check whether the target queue has been determined. If the target queue has been determined, the target queue is bound to another optical port. If the target queue has not been determined, the bandwidth interval preceding the first bandwidth interval is determined as the second bandwidth interval. The target queue is then determined based on the second bandwidth interval. Simultaneously, the second bandwidth difference is determined based on the first bandwidth difference and the upper limit of the second bandwidth interval, and a third bandwidth interval corresponding to the second bandwidth difference is determined. Finally, the target queue corresponding to the third bandwidth interval is determined.

[0108] Step S305: Bind the target queue to another optical port to achieve load balancing for the network card.

[0109] Step S306: Determine the second bandwidth difference and the target queue, that is, determine the previous bandwidth interval of the first bandwidth interval as the second bandwidth interval, and then determine the target queue based on the second bandwidth interval.

[0110] Step S307: Whether the target queue is determined; if the target queue is determined, the target queue is bound to another optical port; if the target queue is not determined, step S306 is continued, that is, the target queue is determined from the previous bandwidth interval of the second bandwidth interval.

[0111] This embodiment also provides a load balancing device for a network card, which is used to implement the above-mentioned embodiments and preferred implementations. Details already described will not be repeated here. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.

[0112] This embodiment provides a load balancing device for a network card, such as Figure 4 Shown, including:

[0113] The bandwidth acquisition module 410 is configured to acquire the current bandwidth of the target optical port.

[0114] The difference acquisition module 420 is configured to acquire the difference between the current bandwidth and the expected bandwidth to obtain a first bandwidth difference if the current bandwidth of the target optical port is greater than the expected bandwidth of the target optical port.

[0115] The queue determination module 430 is configured to determine a target queue corresponding to the first bandwidth difference among the multiple queues of the target optical port.

[0116] The queue binding module 440 is configured to bind the target queue to another optical port, so as to transmit data corresponding to the first bandwidth difference through the other optical port.

[0117] In some optional embodiments, the queue determination module includes a first determination unit and a second determination unit, wherein the first determination unit is used to determine a first bandwidth interval corresponding to the first bandwidth difference by using the idle bandwidth of another optical port and the first bandwidth difference; and the second determination unit is used to determine a target queue corresponding to the first bandwidth interval among multiple queues of the target optical port.

[0118] In some optional embodiments, the device further includes a first determination module, a second determination module and an acquisition module, wherein the first determination module is used to determine the previous bandwidth interval of the first bandwidth interval as the second bandwidth interval if the target queue corresponding to the first bandwidth interval is not determined; the second determination module is used to determine the target queue corresponding to the second bandwidth interval among multiple queues of the target optical port; the acquisition module is used to obtain a second bandwidth difference between the first bandwidth difference and an upper limit value of the second bandwidth interval, determine a third bandwidth interval corresponding to the second bandwidth difference, and determine the target queue corresponding to the third bandwidth interval among multiple queues of the target optical port.

[0119] In some optional embodiments, the first determination unit includes a first determination subunit and a second determination subunit, wherein the first determination subunit is used to determine the first bandwidth interval corresponding to the first bandwidth difference by using a first predetermined rule, the idle bandwidth of the other optical port, and the first bandwidth difference if the first bandwidth difference is less than or equal to the idle bandwidth of the other optical port; and the second determination subunit is used to determine the first bandwidth interval corresponding to the first bandwidth difference by using a second predetermined rule and the idle bandwidth of the other optical port if the first bandwidth difference is greater than the idle bandwidth of the other optical port.

[0120] In some optional implementations, the first determining subunit is configured to determine a bandwidth interval corresponding to a lower limit value less than or equal to the first bandwidth difference and an upper limit value less than or equal to the idle bandwidth as the first bandwidth interval.

[0121] In some optional embodiments, the second determination subunit is used to determine whether there are other optical ports whose idle bandwidth is greater than the first bandwidth difference, where the other optical ports are optical ports in the network card other than the target optical port and the other optical port; if there are other optical ports, the idle bandwidth of the other optical ports and the first bandwidth difference are used to determine the first bandwidth interval corresponding to the first bandwidth difference; if there are no other optical ports, the bandwidth interval corresponding to the idle bandwidth of the other optical port whose lower limit is greater than or equal to that of the other optical port is determined as the first bandwidth interval.

[0122] In some optional embodiments, the bandwidth acquisition module includes an acquisition unit, a third determination unit, and a fourth determination unit. The acquisition unit is configured to periodically acquire traffic information of each queue of the target optical port using a register; the third determination unit is configured to determine the current bandwidth of each queue using the traffic information of each queue; and the fourth determination unit is configured to determine the current bandwidth of the target optical port using the sum of the current bandwidths of each queue.

[0123] The load balancing device of the network card of the present application, if it is monitored that the current bandwidth of the target optical port is greater than the expected bandwidth of the target optical port, that is, it indicates that the current transmission rate of the target optical port exceeds its own expected bandwidth, so the network card needs to be load balanced to avoid the situation of optical port back pressure at the target optical port. By using the first bandwidth difference between the current bandwidth of the target optical port and the expected bandwidth, a target queue corresponding to the first bandwidth difference is determined among the multiple queues of the target optical port, and the target queue is bound to another optical port, so that the corresponding data can be transmitted through the other optical port, that is, by transferring the target queue of the target optical port to another optical port to realize data forwarding, the load balancing of the network card is flexibly and cleverly realized. Since this solution only needs to move the determined target queue to another optical port, it can accurately and quickly load balance the network card, improve the efficiency of optical port use and improve the overall transmission efficiency of the network card, thereby solving the problem of unbalanced load on the network card.

[0124] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0125] The load balancing device of the network card in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0126] The embodiment of the present application also provides an electronic device, which can be the above-mentioned network card, having the above-mentioned Figure 5 The load balancing device of the network card shown.

[0127] See also Figure 5 , Figure 5 This is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present application. Figure 5 As shown, the computer device includes: one or more processors 510, memory 520, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components utilize different buses to communicate with each other and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in the memory or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Equally, multiple computer devices can be connected, and each device provides part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 510 is taken as an example.

[0128] Processor 510 may be a central processing unit, a network processor, or a combination thereof. Processor 510 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic, or any combination thereof.

[0129] The memory 520 stores instructions that can be executed by at least one processor 510, so that the at least one processor 510 executes the method shown in the above embodiment.

[0130] The memory 520 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created based on the use of the computer device, etc. In addition, the memory 520 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 520 may optionally include a memory remotely located relative to the processor 510, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0131] The memory 520 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid-state drive; the memory 520 may also include a combination of the above types of memory.

[0132] The computer device also includes an input device 530 and an output device 540. The processor 510, the memory 520, the input device 530 and the output device 540 can be connected via a bus or other means. Figure 5 The bus connection is taken as an example.

[0133] The input device 530 can receive input digital or character information and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a trackpad, a touch pad, an indicator stick, one or more mouse buttons, a trackball, a joystick, etc. The output device 540 can include a display device, an auxiliary lighting device (e.g., an LED), and a tactile feedback device (e.g., a vibration motor). The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display, and a plasma display. In some optional embodiments, the display device can be a touch screen.

[0134] The embodiments of the present application also provide a computer-readable storage medium. The above-mentioned method according to the embodiment of the present application can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and downloaded through a network and will be stored in a local storage medium, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor or hardware, the method shown in the above embodiment is implemented.

[0135] Part of the present application may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present application through the operation of the computer. Those skilled in the art should understand that the form in which the computer program instruction exists in a computer-readable medium includes but is not limited to a source file, an executable file, an installation package file, etc. Accordingly, the way in which the computer program instruction is executed by the computer includes but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium that can be accessed by the computer.

[0136] Although the embodiments of the present application have been described with reference to the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present application, and such modifications and variations shall fall within the scope defined by the appended claims.

Claims

1. A load balancing method for a network card, characterized in that: The network card includes at least two optical ports, each of the optical ports is bound to at least two queues, and the method includes: Get the current bandwidth of the target optical port; If the current bandwidth of the target optical port is greater than the expected bandwidth of the target optical port, obtaining a difference between the current bandwidth and the expected bandwidth to obtain a first bandwidth difference; Determining a target queue corresponding to the first bandwidth difference among the multiple queues of the target optical port; The target queue is bound to another optical port, so as to transmit data corresponding to the first bandwidth difference through the other optical port.

2. The method according to claim 1, characterized in that Determining a target queue corresponding to the first bandwidth difference among the multiple queues of the target optical port includes: Determining a first bandwidth interval corresponding to the first bandwidth difference by using the idle bandwidth of the other optical port and the first bandwidth difference; The target queue corresponding to the first bandwidth interval is determined among the multiple queues of the target optical port.

3. The method according to claim 2, characterized in that The method further comprises: If the target queue corresponding to the first bandwidth interval is not determined, determining the bandwidth interval before the first bandwidth interval as the second bandwidth interval; Determining the target queue corresponding to the second bandwidth interval among the multiple queues of the target optical port; A second bandwidth difference between the first bandwidth difference and an upper limit of the second bandwidth interval is obtained, a third bandwidth interval corresponding to the second bandwidth difference is determined, and the target queue corresponding to the third bandwidth interval is determined among the multiple queues of the target optical port.

4. The method according to claim 2, characterized in that Determining a first bandwidth interval corresponding to the first bandwidth difference by using the idle bandwidth of the other optical port and the first bandwidth difference includes: If the first bandwidth difference is less than or equal to the idle bandwidth of the other optical port, determining the first bandwidth interval corresponding to the first bandwidth difference by using a first predetermined rule, the idle bandwidth of the other optical port, and the first bandwidth difference; If the first bandwidth difference is greater than the idle bandwidth of the other optical port, the first bandwidth interval corresponding to the first bandwidth difference is determined by using a second predetermined rule and the idle bandwidth of the other optical port.

5. The method according to claim 4, characterized in that Determining the first bandwidth interval corresponding to the first bandwidth difference by using a first predetermined rule, the idle bandwidth of the other optical port, and the first bandwidth difference includes: The bandwidth interval corresponding to a lower limit value of which is less than or equal to the first bandwidth difference and an upper limit value of which is less than or equal to the idle bandwidth is determined as the first bandwidth interval.

6. The method according to claim 4, characterized in that Determining the first bandwidth interval corresponding to the first bandwidth difference by using the second predetermined rule and the idle bandwidth of the other optical port includes: Determine whether there are other optical ports whose idle bandwidth is greater than the first bandwidth difference, where the other optical ports are the optical ports in the network card except the target optical port and the other optical port; If the other optical port exists, determining a first bandwidth interval corresponding to the first bandwidth difference by using the idle bandwidth of the other optical port and the first bandwidth difference; If the other optical port does not exist, the bandwidth interval corresponding to the idle bandwidth of the other optical port, whose lower limit is greater than or equal to the idle bandwidth of the other optical port, is determined as the first bandwidth interval.

7. The method according to any one of claims 1 to 6, characterized in that Get the current bandwidth of the target optical port, including: periodically acquiring the flow information of each queue of the target optical port by using a register; Determining the current bandwidth of each queue using the traffic information of each queue; The current bandwidth of the target optical port is determined by using the sum of the current bandwidths of the queues.

8. A load balancing device for a network card, characterized in that: The network card includes at least two optical ports, each of the optical ports is bound to at least two queues, and the device includes: Bandwidth acquisition module, used to obtain the current bandwidth of the target optical port; a difference acquisition module, configured to acquire a difference between the current bandwidth and the expected bandwidth to obtain a first bandwidth difference if the current bandwidth of the target optical port is greater than the expected bandwidth of the target optical port; a queue determination module, configured to determine a target queue corresponding to the first bandwidth difference among the plurality of queues of the target optical port; The queue binding module is configured to bind the target queue to another optical port, so as to transmit data corresponding to the first bandwidth difference through the other optical port.

9. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the load balancing method of the network card according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the load balancing method for a network card according to any one of claims 1 to 7.