Link load balancing method, device, equipment and medium
By acquiring link performance data and dynamically optimizing hash weights, the problem of low link resource utilization in existing technologies is solved, achieving a more efficient load balancing effect and adapting to the complex changes in heterogeneous link environments.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-05
- Publication Date
- 2026-04-14
AI Technical Summary
Existing load balancing technologies struggle to dynamically and accurately adjust traffic allocation strategies based on the real-time performance status of links, resulting in low link resource utilization and poor overall load balancing performance, especially noticeable in heterogeneous link environments.
By acquiring link performance data, determining the hash weight gradient and gradient adjustment step size, and dynamically optimizing the hash weight, traffic can be reasonably distributed across each link. This includes acquiring link performance data, determining the load balancing objective function, calculating the hash weight gradient and adjustment step size, and performing load balancing.
It significantly improves link resource utilization and overall load balancing performance, enhances the adaptability and intelligence of load balancing, and is better able to cope with complex and ever-changing network conditions in heterogeneous link environments.
Smart Images

Figure CN121864692A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of load balancing technology, specifically relating to a link load balancing method, apparatus, device, and medium. Background Technology
[0002] In modern communication networks, multi-link aggregation technology is commonly used to improve data transmission reliability and throughput, combining multiple physical or logical links to form a logical high-bandwidth channel. Load balancing technology, a key technology in multi-link aggregation, aims to distribute traffic as evenly as possible across the links to fully utilize link resources and avoid situations where some links are overloaded while others are idle.
[0003] However, current load balancing technologies struggle to dynamically and accurately adjust traffic allocation strategies based on the real-time performance status of links when faced with a set of links with heterogeneous characteristics (such as different bandwidths, latency, and packet loss rates). This results in low utilization of link resources and poor overall load balancing performance. Summary of the Invention
[0004] In view of the above problems, embodiments of the present invention are proposed to provide a link load balancing method, apparatus, device and medium that overcomes the problem that it is difficult to dynamically and accurately adjust the traffic allocation strategy according to the real-time performance status of the link, resulting in low link resource utilization and poor overall load balancing effect, or at least partially solves the above problems.
[0005] In a first aspect, embodiments of the present invention provide a link load balancing method, the method comprising: Obtain link performance data for each link in a preset link set; Based on the link performance data of each link, determine the hash weight gradient of each link; Based on the link performance data of each link, determine the gradient adjustment step size of each link; Load balancing is performed on each link based on the hash weight gradient of each link and the corresponding gradient adjustment step size.
[0006] Optionally, determining the hash weight gradient of each link based on the link performance data of each link includes: Based on the link performance data of each link, obtain the load balancing objective function; Based on the load balancing objective function and the link performance data, the hash weight gradient is obtained by differentiating the current hash weight of each link.
[0007] Optionally, obtaining the load balancing objective function based on the link performance data of each link includes: Based on the link performance data of each link, obtain the weighting coefficients; The load balancing objective function is determined based on the weighting coefficients, the preset initial objective function, and the preset constraint function.
[0008] Optionally, the link performance data includes traffic data, and obtaining the weighting coefficient based on the link performance data of each link includes: Based on the traffic data of each link, determine the total traffic data of the preset link set; Based on the total flow data, obtain the weighting coefficients.
[0009] Optionally, the weighting coefficient can be obtained based on the total flow data using the following formula:
[0010] in, These are the initial weighting coefficients. To constrain the penalty coefficient for violations, This indicates that the constraint has violated the tolerance threshold. This represents the sensitivity coefficient to traffic fluctuations. This represents the change in total traffic data between the current period and the previous period, i.e. This indicates the degree of constraint violation in the current iteration.
[0011] Optionally, the link performance data includes traffic data, link latency, link packet loss rate, and link utilization. The step of differentiating the current hash weight of each link based on the load balancing objective function and the link performance data to obtain the hash weight gradient includes: Based on the preset load balancing optimization objective function, the traffic data, the link latency, the link packet loss rate, and the link utilization, the derivative of the current hash weight of each link is calculated to obtain the hash weight gradient.
[0012] Optionally, the link performance data includes link bandwidth data, and determining the gradient adjustment step size for each link based on the link performance data includes: Based on the link bandwidth data of each link, the gradient adjustment step size of each link is determined.
[0013] Optionally, determining the gradient adjustment step size for each link based on the link bandwidth data of each link includes: Based on the link bandwidth data of each link, the bandwidth ratio of each link is determined, wherein the bandwidth ratio is the ratio of the bandwidth of each link to the total bandwidth of all links in the preset link set; The gradient adjustment step size for each link is determined based on the bandwidth ratio of each link.
[0014] Optionally, the link performance data further includes traffic data, and determining the gradient adjustment step size for each link based on the link performance data includes: Based on the link bandwidth data and traffic data of each link, the gradient adjustment step size of each link is determined.
[0015] Optionally, determining the gradient adjustment step size for each link based on the link bandwidth data and the traffic data includes: Obtain the initial step size and adjustment weight of each link; The gradient adjustment step size of each link is determined based on the initial step size, the adjustment weight, the link bandwidth data, and the traffic data.
[0016] Optionally, based on the initial step size, adjustment weight, link bandwidth data, and traffic data of each link, the gradient adjustment step size of each link is determined using the following formula:
[0017] in, This is the initial step size for the algorithm. To adjust the weights, This represents the traffic data at one time point in a cycle on the i-th link. This represents the traffic data of the i-th link at the current moment. This represents the link bandwidth data for the i-th link.
[0018] Optionally, the step of load balancing each link based on its hash weight gradient and corresponding gradient adjustment step size includes: The hash weights of each link are updated based on the hash weight gradient of each link and the corresponding gradient adjustment step size. If the updated hash weights of each link meet the preset heuristic adjustment conditions, then the number of links in the preset link set is determined. If the number of links is even, the two largest hash weights and the two smallest hash weights are swapped respectively; When the number of links is odd, swap the two smallest hash weights; Traffic is allocated to each link based on the swapped hash weights.
[0019] Secondly, embodiments of the present invention provide a link load balancing device, the device comprising: The data acquisition module is used to acquire the link performance data of each link in the preset link set; The weight gradient determination module is used to determine the hash weight gradient of each link based on the link performance data of each link. The step size adjustment module is used to determine the gradient adjustment step size of each link based on the link performance data of each link. The load balancing module is used to perform load balancing on each link based on the hash weight gradient of each link and the corresponding gradient adjustment step size.
[0020] Optionally, the weight gradient determination module includes: The objective function determination submodule is used to obtain the load balancing objective function based on the link performance data of each link; The weight gradient calculation submodule is used to calculate the derivative of the current hash weight of each link based on the load balancing objective function and the link performance data, so as to obtain the hash weight gradient.
[0021] Optionally, the objective function determination submodule includes: The weighting coefficient determination unit is used to obtain weighting coefficients based on the link performance data of each link; The objective function calculation unit is used to determine the load balancing objective function based on the weighting coefficients, the preset initial objective function, and the preset constraint function.
[0022] Optionally, the link performance data includes traffic data, and the weighting coefficient determination unit includes: The traffic data determination subunit is used to determine the total traffic data of the preset link set based on the traffic data of each link. The weighting coefficient calculation subunit is used to obtain the weighting coefficients based on the total flow data.
[0023] Optionally, the weighting coefficient calculation subunit includes: The weighting coefficient formula calculation subunit is used to obtain the weighting coefficients based on the total flow data using the following formula:
[0024] in, These are the initial weighting coefficients. To constrain the penalty coefficient for violations, This indicates that the constraint has violated the tolerance threshold. This represents the sensitivity coefficient to traffic fluctuations. This represents the change in total traffic data between the current period and the previous period, i.e. This indicates the degree of constraint violation in the current iteration.
[0025] Optionally, the link performance data includes traffic data, link latency, link packet loss rate, and link utilization; the weight gradient calculation submodule includes: The weight gradient comprehensive calculation unit is used to calculate the derivative of the current hash weight of each link based on the preset load balancing optimization objective function, the traffic data, the link latency, the link packet loss rate and the link utilization rate, to obtain the hash weight gradient.
[0026] Optionally, the link performance data includes link bandwidth data, and the adjustment step size determination module includes: The first gradient adjustment step size submodule is used to determine the gradient adjustment step size of each link based on the link bandwidth data of each link.
[0027] Optionally, the first gradient adjustment step size submodule includes: A bandwidth ratio determination unit is used to determine the bandwidth ratio of each link based on the link bandwidth data of each link. The bandwidth ratio is the ratio of the bandwidth of each link to the total bandwidth of each link in a preset link set. The bandwidth ratio gradient adjustment step size determination unit is used to determine the gradient adjustment step size of each link based on the bandwidth ratio of each link.
[0028] Optionally, the link performance data further includes traffic data, and the adjustment step size determination module includes: The second gradient adjustment step size submodule is used to determine the gradient adjustment step size of each link based on the link bandwidth data and the traffic data of each link.
[0029] Optionally, the second gradient adjustment step size submodule includes: An initial step size determination unit is used to obtain the initial step size and adjustment weight of each link; The gradient adjustment comprehensive calculation unit is used to determine the gradient adjustment step size of each link based on the initial step size, the adjustment weight, the link bandwidth data, and the traffic data of each link.
[0030] Optionally, the gradient adjustment comprehensive calculation unit includes: The gradient adjustment formula calculation subunit is used to determine the gradient adjustment step size of each link based on the initial step size, the adjustment weight, the link bandwidth data, and the traffic data, using the following formula:
[0031] in, This is the initial step size for the algorithm. To adjust the weights, This represents the traffic data at one time point in a cycle on the i-th link. This represents the traffic data of the i-th link at the current moment. This represents the link bandwidth data for the i-th link.
[0032] Optionally, the load balancing module includes: The hash weight update submodule is used to update the hash weight of each link by adjusting the step size according to the hash weight gradient of each link and the corresponding gradient. The adjustment condition judgment submodule is used to determine the number of links in the preset link set if the updated hash weights of each link meet the preset heuristic adjustment conditions. The even-number swapping submodule is used to swap the two largest hash weights with the two smallest hash weights when the number of links is even. The odd number swap submodule is used to swap the two smallest hash weights when the number of links is odd. The traffic allocation submodule is used to allocate traffic to each link based on the swapped hash weights.
[0033] Thirdly, embodiments of the present invention provide an electronic device, the device including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method described in the first aspect.
[0034] Fourthly, embodiments of the present invention provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0035] In this embodiment of the invention, by acquiring the link performance data of each link in a preset link set, the current operating status of each link can be perceived in real time. Based on the link performance data of each link, the hash weight gradient of each link is determined, ensuring the accuracy of the adjustment direction. At the same time, based on the link performance data of each link, the gradient adjustment step size of each link is determined, so that the adjustment range can match the real-time performance of the link. Finally, based on the hash weight gradient of each link and the corresponding gradient adjustment step size, load balancing is performed on each link. This process can continuously and accurately optimize the hash weight according to the dynamic changes in link performance, thereby distributing traffic more reasonably to each link. This effectively solves the problem mentioned in the background art of difficulty in dynamically and accurately adjusting the traffic allocation strategy according to the real-time performance status of the link, significantly improving the link resource utilization and overall load balancing effect, and enhancing the adaptability and intelligence level of load balancing, enabling better response to complex and ever-changing network conditions in heterogeneous link environments. Attached Figure Description
[0036] Figure 1 This is a flowchart illustrating the steps of an embodiment of the link load balancing method of the present invention; Figure 2 This is a flowchart illustrating the steps of another embodiment of the link load balancing method of the present invention; Figure 3 This is a schematic diagram of a scenario of an embodiment of the link load balancing method of the present invention; Figure 4 This is a structural block diagram of an embodiment of the link load balancing device of the present invention. Detailed Implementation
[0037] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the 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 effort are within the scope of protection of the present invention.
[0038] The terms "first," "second," etc., used in the specification and claims of this invention are used to distinguish similar objects and are not used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention can be implemented in orders other than those illustrated or described herein. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0039] The link load balancing method, apparatus, device, and medium provided by the present invention will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.
[0040] Reference Figure 1 The diagram illustrates a flowchart of an embodiment of the link load balancing method of the present invention, which may specifically include the following steps: Step 101: Obtain the link performance data of each link in the preset link set.
[0041] In this step, the preset link set refers to the sum of all links participating in data traffic distribution and carrying under the current load balancing strategy. These links are typically heterogeneous, meaning they may differ in bandwidth, latency, reliability, and other aspects. Link performance data is a collective term for various parameters used to describe and characterize the current or recent operating status, inherent attributes, and transmission quality of each link in the preset link set.
[0042] Obtaining link performance data is the foundation and prerequisite for achieving effective load balancing. Its purpose is to provide a basis for subsequent hash weight adjustments by collecting objective data that reflects the true state of the links. The specific types of link performance data can be selected according to the goals and priorities of load balancing. For example, it can include real-time traffic data reflecting the current traffic load of the link, link latency data reflecting the speed of data transmission on the link, link packet loss rate data reflecting the proportion of data loss during data transmission, and link utilization data reflecting the use of link bandwidth resources. Furthermore, the inherent bandwidth value of the link itself can also be considered a basic type of link performance data. These data can be obtained through various means such as existing network management protocols, dedicated link detection tools, or chip-built-in statistical registers; this invention does not specifically limit these methods. By continuously or periodically acquiring this link performance data, a comprehensive understanding of the operational status of the entire link set can be built.
[0043] Step 102: Determine the hash weight gradient of each link based on the link performance data of each link.
[0044] In this step, hash weight refers to the numerical value assigned to each link in the preset link set to determine the traffic distribution ratio. The magnitude of the hash weight directly affects the amount of traffic flowing through the corresponding link. The hash weight gradient (or simply gradient) is a mathematical concept representing the rate of change of one or more preset load balancing optimization objective functions (functions used to measure the effectiveness of load balancing) relative to the hash weights of each link under the current hash weight configuration. The direction of the gradient indicates the direction in which each hash weight should be adjusted to make the objective function value more optimal (e.g., more balanced load, lower total latency); the magnitude of the gradient reflects, to some extent, the sensitivity of the adjustment.
[0045] Determining the hash weight gradient based on link performance data hinges on linking the objective operational status data of the links obtained in step 101 with the optimization objectives of load balancing. Typically, one or more load balancing optimization objective functions are first defined. These functions may aim to minimize load differences between links, reduce overall network latency or packet loss, or avoid link overload. The construction of these objective functions directly or indirectly depends on link performance data. Then, by taking the derivative of these objective functions with respect to the hash weights of each link, or using other similar mathematical analysis methods, the hash weight gradient can be obtained. For example, if the utilization of a link is too high, as reflected in the utilization index in the link performance data, the gradient calculation result may indicate the need to reduce the hash weight of that link or increase the hash weights of other links to reduce its load. Therefore, this step essentially transforms the link performance status into a mathematical signal guiding hash weight adjustment, a crucial step in achieving intelligent load balancing.
[0046] Step 103: Determine the gradient adjustment step size for each link based on the link performance data of each link.
[0047] In this step, the gradient adjustment step size (or simply step size) refers to the magnitude of the hash weight adjustment in each iteration when updating the hash weights of each link using the gradient descent algorithm or other gradient-based optimization algorithms. Determining an appropriate gradient adjustment step size is crucial for the efficiency and stability of the optimization process: too large a step size may cause the optimization process to oscillate and fail to converge or miss the optimal solution; too small a step size may result in slow convergence and an inability to respond promptly to changes in the network state.
[0048] Determining the gradient adjustment step size based on link performance data demonstrates the invention's adaptability to the heterogeneity and dynamism of links. Different link performance data, such as different bandwidths, different real-time traffic, and different utilization rates, mean that links have different capacities and resilience. For example, links with high bandwidth and low current utilization can withstand greater traffic changes, and therefore can be assigned larger gradient adjustment step sizes to accelerate their weight adjustment speed, enabling them to handle more traffic more quickly. Conversely, for links with low bandwidth or already high utilization, to avoid overload due to excessive weight adjustment, smaller gradient adjustment step sizes may be required for finer weight fine-tuning. Therefore, this step incorporates link performance data into the step size calculation, ensuring that the hash weight adjustment range of each link matches its current actual carrying capacity and network status, thereby achieving a more robust and efficient hash weight optimization process.
[0049] Step 104: Load balancing is performed on each link based on the hash weight gradient of each link and the corresponding gradient adjustment step size.
[0050] In this step, the hash weight gradient indicates the direction and sensitivity of adjusting the hash weights of each link to optimize the load balancing objective function; while the gradient adjustment step size specifies the specific magnitude of each weight adjustment. The core purpose of this step is to comprehensively utilize the information from both to dynamically adjust the hash weights of each link in the preset link set, and to achieve reasonable traffic distribution based on the adjusted hash weights, ultimately achieving the goal of load balancing.
[0051] Specifically, the process of load balancing across links typically involves the following key steps: First, based on the hash weight gradient and the corresponding gradient adjustment step size, a new hash weight value for each link is calculated. This calculation process is essentially an optimization iterative process. For example, gradient descent or its variants can be used to update the current hash weight along the direction indicated by the gradient, according to the increment specified by the step size. In this way, the hash weights can gradually evolve towards achieving the optimal or near-optimal direction for the objective function, such as more balanced link load and better network performance.
[0052] After obtaining the updated hash weights, the system applies these new hash weights to the traffic allocation mechanism. This is typically achieved through a hash algorithm, which calculates a hash value based on certain characteristics of the packet, such as source IP, destination IP, and port number, and then combines this hash value with the hash weight of each link to map the packet to the appropriate link for transmission. The magnitude of the hash weight directly affects the probability that each link is selected to carry traffic; links with higher weights are usually allocated more traffic.
[0053] Furthermore, to further optimize traffic allocation and avoid issues such as excessive traffic concentration or low resource utilization under special circumstances, after updating hash weights based on gradients and step sizes, necessary post-processing or adjustments can be performed on the updated hash weights according to preset strategies. For example, the distribution of weights can be detected, and if the weights of some links are found to be too large or too small, heuristic fine-tuning operations can be performed to ensure that traffic is more evenly distributed across all links, making full use of link resources and avoiding overload on a single link.
[0054] By acquiring the link performance data of each link in a preset link set, the current operating status of each link can be perceived in real time. Based on the link performance data of each link, the hash weight gradient of each link is determined, ensuring the accuracy of the adjustment direction. At the same time, based on the link performance data of each link, the gradient adjustment step size of each link is determined, so that the adjustment range can match the real-time performance of the link. Finally, based on the hash weight gradient of each link and the corresponding gradient adjustment step size, load balancing is performed on each link. This process can continuously and accurately optimize the hash weight according to the dynamic changes in link performance, thereby distributing traffic more reasonably to each link. This effectively solves the problem mentioned in the background technology of the difficulty in dynamically and accurately adjusting the traffic allocation strategy according to the real-time performance status of the link, significantly improving the link resource utilization and overall load balancing effect, and enhancing the adaptability and intelligence level of load balancing, enabling it to better cope with the complex and ever-changing network conditions in heterogeneous link environments.
[0055] Reference Figure 2 The flowchart illustrates another embodiment of the link load balancing method of the present invention, which may specifically include the following steps: Step 201: Obtain the link performance data of each link in the preset link set; this step is similar to step 101, and the explanation can refer to the explanation of step 101, so it will not be repeated here.
[0056] In one example, assume a set of heterogeneous links, which can be represented as {L1, L2, ..., LN}, where Li represents the i-th link and N is the number of links. The bandwidth of the heterogeneous links can be represented as a vector {B1, B2, ..., BN}. For optimization purposes, this bandwidth vector can be simplified to obtain the simplest integer ratio of the link bandwidths. The inherent bandwidth value Bi of the link is the basic link performance data.
[0057] The dynamic network metrics for each link are statistically analyzed, including: Link delay vector: represented as {d1, d2, ..., dN}, where di is the delay of the i-th link. Packet loss rate vector: represented as {l1, l2, ..., lN}, where li is the packet loss rate of the i-th link. Real-time network traffic of the link is represented as xi. Based on real-time traffic and link bandwidth, link utilization can be expressed as ui = xi / Bi, where ui represents the utilization of the i-th link. Therefore, link performance data can specifically include the link's inherent bandwidth Bi, real-time traffic xi, delay di, packet loss rate li, and the calculated link utilization ui, etc.
[0058] Step 202: Obtain the load balancing objective function based on the link performance data of each link; In this step, the load balancing objective function is one or more mathematical expressions used to quantitatively define the optimization direction and objective of load balancing, such as minimizing the load difference between links, minimizing total network latency, and minimizing packet loss rate. Obtaining the load balancing objective function refers to constructing or adjusting the objective function to guide subsequent hash weight optimization calculations based on the currently acquired link performance data. The focus of this step is on the construction process of the objective function itself, especially how to integrate link performance data into the objective function, or how to adjust the parameters of the objective function based on the link performance data.
[0059] For example, based on the ideas of avoiding link overload or idleness, reducing total link latency and packet loss, and ensuring the smoothness of weight changes, the following load balancing objective function can be designed, defined as follows: This indicates the total traffic on the current link. This indicates the current overall link utilization rate. This represents the weight value after the previous update. , , These are weighting coefficients that control the priority of different optimization objectives, i.e.:
[0060] Therefore, the objective function for link load balancing optimization is defined as:
[0061] In one embodiment, step 202 may include the following sub-steps: Sub-step S11: Obtain weighting coefficients based on the link performance data of each link; In this step, the weighting coefficients refer to parameters used to adjust the relative importance of different components or optimization sub-objectives in the load balancing objective function. Obtaining the weighting coefficients involves dynamically calculating or adjusting the specific values of these coefficients based on current link performance data.
[0062] Link performance data objectively reflects the current operating status of each link. Different link performance data characteristics may correspond to different optimization priorities. For example, when link performance data indicates a significant increase in latency or packet loss rate on some links, it may be necessary to increase the weight of objective terms related to reducing latency and packet loss in the objective function; when link performance data indicates a large difference in load between links, it may be necessary to increase the weight of objective terms related to load balancing. Therefore, this step dynamically determines or adjusts these weighting coefficients by analyzing link performance data, so that the composition of the objective function can adapt to the actual situation of the current network and optimization needs.
[0063] Sub-step S12: Determine the load balancing objective function based on the weighting coefficients, the preset initial objective function, and the preset constraint function.
[0064] In this step, the preset initial objective function refers to a predefined functional framework used to express the basic optimization direction of load balancing. It may contain multiple optimization sub-objectives, such as terms related to link utilization balance or total network latency. The preset constraint function refers to predefined equality or inequality conditions that must be satisfied during the optimization process, such as the sum of hash weights being a fixed value.
[0065] The process of determining the load balancing objective function involves integrating the weighting coefficients obtained in sub-step S11, the preset initial objective function, and the preset constraint functions to form the final objective function used for optimization calculation. Specifically, this may include: applying the weighting coefficients obtained in sub-step S11 to each component of the preset initial objective function to adjust their relative contributions to the overall objective function; and integrating the preset constraint functions into the weighted initial objective function using appropriate mathematical forms, such as the Lagrange multiplier method or penalty function method, to form a comprehensive optimization objective that considers the constraints. Through sub-steps S11 and S12, the final load balancing objective function comprehensively reflects the network state reflected by the current link performance data, the preset basic optimization direction, and the constraints that must be met. This objective function will serve as the core mathematical model for subsequent calculation of hash weight gradients and guiding weight optimization adjustments, thereby making the optimization process more targeted and adaptive to the dynamically changing network environment.
[0066] For example, the preset constraint function is that the sum of hash weights is fixed to the sum of the initial bandwidth ratios.
[0067] Specifically, heterogeneous links have an initial bandwidth ratio During algorithm optimization, the hash weight vector is specified. The sum of all elements in the set is fixed as the sum of the initial bandwidth ratios. Therefore, the predefined constraint function can be expressed as: Right now C sum It also serves as the modulus of the hash algorithm. After a message undergoes hash calculation, its hash result is relative to C. sum Modulo operation is used to determine which link the message is mapped to; In one embodiment, the link performance data includes traffic data, and sub-step S11 may include the following sub-steps: Sub-step S111: Determine the total traffic data of the preset link set based on the traffic data of each link; In this step, traffic data refers to the real-time or recent average data volume flowing through each link, usually denoted as xi (where i represents the i-th link). The total traffic data of the preset link set refers to the sum of the traffic data of all links within that set, i.e. Here, N represents the total number of links in the link set. The purpose of this step is to calculate the total traffic volume currently carried by the entire link set by aggregating the independent traffic data of each link. This total traffic data reflects the current overall load level of the network.
[0068] Sub-step S112: Obtain the weighting coefficients based on the total flow data.
[0069] In this step, the total traffic data X based on the preset link set determined in sub-step S111 is used. total This is used to calculate or adjust the weighting coefficients used in the objective function. The magnitude and trend of total traffic data can serve as important evidence for judging the overall network load and optimization needs. For example, when the total traffic data X... total When the total traffic data X is high, approaching the total capacity of the link set, it may mean that avoiding link overload needs to be prioritized. In this case, the weighting coefficients can be adjusted to increase the weight of terms related to link utilization or overload risk in the objective function. Conversely, when the total traffic data X is low... total When the load is low, more emphasis can be placed on optimizing other performance metrics. Therefore, this step incorporates the macro-level metric of total traffic data into the determination of the weighting coefficients, allowing the weighting coefficients to better adapt to changes in the overall network traffic load, thereby optimizing the orientation of the objective function.
[0070] In one embodiment, sub-step S112 may include the following sub-steps: Sub-step S1121: Based on the total flow data, obtain the weighting coefficient using the following formula:
[0071] in, These are the initial weighting coefficients. To constrain the penalty coefficient for violations, This indicates that the constraint has violated the tolerance threshold. This represents the sensitivity coefficient to traffic fluctuations. This represents the change in total traffic data between the current period and the previous period, i.e. This indicates the degree of constraint violation in the current iteration.
[0072] For example, based on the dynamic weighting coefficient u(t), the load balancing objective function L(W), and the constraint function G(W), the optimization function F(W) can be obtained, that is:
[0073] The optimization function F(W), serving as the direct basis for calculating the hash weight gradient, is the core mathematical model in the load balancing optimization process. Specifically, the load balancing objective function L(W) characterizes the optimization direction for the link load balancing effect, such as minimizing load differences and reducing total latency. The constraint function G(W) specifies the conditions that must be met during the hash weight adjustment process, namely, the sum of hash weights equals the sum of initial bandwidth ratios. By multiplying the dynamic weighting coefficient u(t) with the constraint function G(W) and adding it to the load balancing objective function L(W), the optimization function F(W) integrates the optimization objective and constraint conditions into a unified mathematical expression. Correspondingly, the hash weight gradient obtained in step 203 by differentiating the current hash weights of each link can be understood as taking the partial derivative of the optimization function F(W) with respect to the hash weights Wi of each link. The obtained hash weight gradient not only reflects the direction and magnitude sensitivity of the hash weight adjustment for optimizing the load balancing objective function L(W), but also incorporates the influence of the constraint function G(W). The role of the dynamic weighting coefficient u(t) is to dynamically adjust the weight of the constraints in the optimization process. When the degree of constraint violation is high, the dynamic weighting coefficient u(t) can be increased accordingly, so that the hash weight gradient is more inclined to guide the weight adjustment to meet the constraints; when the constraints are close to being met, the dynamic weighting coefficient u(t) can be decreased accordingly, so that the hash weight gradient focuses more on optimizing the load balancing objective function L(W).
[0074] Furthermore, based on the aforementioned optimization function F(W), the update rule for hash weights can be expressed as: in: This represents the hash weight of the i-th link at the k-th iteration (or update).
[0075] This represents the hash weight of the i-th link at the (k+1)-th iteration (or update).
[0076] This represents the gradient adjustment step size for the i-th link.
[0077] The optimization function F(W) is expressed as follows: The partial derivative with respect to Wi. This update rule enables iterative optimization of hash weights, allowing the hash weight configuration to continuously evolve towards improving load balancing performance while satisfying constraints.
[0078] Step 203: Based on the load balancing objective function and the link performance data, the derivative of the current hash weight of each link is calculated to obtain the hash weight gradient; In this step, the hash weight gradient is a vector composed of the partial derivatives of the load balancing objective function with respect to the current hash weights of each link. The current hash weight refers to the hash weight value of each link before the start of this iteration. Taking the derivative with respect to the current hash weight calculates the rate of change of the objective function value with respect to each hash weight individually.
[0079] Specifically, the load balancing objective function is a function of the hash weights of each link, and this objective function already incorporates link performance data (e.g., weighting coefficients calculated from link performance data, and link latency, packet loss rate, utilization, etc., which may be directly referenced in the objective function). Therefore, based on this load balancing objective function and the current link performance data, the current hash weight of each link is... Find the partial derivatives respectively. The partial derivatives obtained together form the hash weight gradient vector.
[0080] The physical meaning of hash weight gradient is that it indicates, under the current hash weight configuration and link performance state, how each hash weight w should be adjusted to optimize the load balancing objective function value. i The direction and magnitude of the adjustment should be sensitive. Each component in the gradient corresponds to the hash weight of a link, the sign of which indicates whether the weight should be increased or decreased, and the absolute value reflects, to some extent, the degree to which adjusting the weight improves the objective function value.
[0081] In one embodiment, the link performance data includes traffic data, link latency, link packet loss rate, and link utilization. Step 203 may include the following sub-steps: Sub-step S21: Based on the preset load balancing optimization objective function, the traffic data, the link latency, the link packet loss rate, and the link utilization, the derivative of the current hash weight of each link is obtained to obtain the hash weight gradient.
[0082] In this embodiment, the link performance data specifically includes traffic data, link latency, link packet loss rate, and link utilization. The preset load balancing optimization objective function is a function of these specific link performance data; that is, the form of the objective function may explicitly include these parameters. For example, the objective function may include terms related to the variance of link utilization, terms related to the product of link latency and packet loss rate, etc.
[0083] The core of sub-step S21 is to use these specific link performance data as known inputs and substitute them into the preset load balancing optimization objective function. Then, for this objective function, partial derivatives are calculated for the current hash weight wi (i=1,2,...,N) of each link.
[0084] Since the objective function depends directly or indirectly on these specific link performance data, the differentiation process is essentially calculating the sensitivity and direction of change of the objective function value to changes in each hash weight wi, given the current link performance state characterized by traffic data, latency, packet loss rate, utilization rate, and the current hash weight configuration.
[0085] The hash weight gradient obtained through this derivative operation can more accurately reflect the requirements of various specific performance indicators in the current network for hash weight adjustment, thus providing more targeted guidance for subsequent weight updates to achieve better load balancing. For example, if the latency and packet loss rate of a certain link are high, the gradient obtained through the derivative may tend to reduce the hash weight of that link to reduce the traffic flowing through that link, thereby reducing the overall network latency and packet loss.
[0086] Step 204: Determine the gradient adjustment step size for each link based on the link performance data of each link. This step is similar to step 103, and the explanation can refer to the explanation of step 103, so it will not be repeated here.
[0087] In one embodiment, the link performance data includes link bandwidth data, and step 204 may include the following sub-steps: Sub-step S31: Determine the gradient adjustment step size of each link based on the link bandwidth data of each link.
[0088] In this embodiment, the link performance data specifically includes link bandwidth data Bi. The core of sub-step S31 is to determine the gradient adjustment step size based solely on the link bandwidth data. Link bandwidth is a key inherent attribute of a link, directly reflecting the maximum traffic capacity the link can handle. Links with different bandwidths typically have different tolerances for traffic adjustments and adaptability during load balancing. For example, links with higher bandwidth can usually allow for larger gradient adjustment steps to converge to the optimal weight configuration more quickly; while links with lower bandwidth may require smaller, more refined gradient adjustment steps to avoid traffic overload due to excessive weight adjustments. Therefore, by associating the gradient adjustment step size with the link bandwidth data, this step allows the step size setting to initially adapt to the inherent differences in the carrying capacity of different links.
[0089] In one embodiment, the link performance data further includes traffic data, and sub-step S31 may include the following sub-steps: Sub-step S311: Determine the gradient adjustment step size for each link based on the link bandwidth data and the traffic data of each link.
[0090] In this embodiment, in addition to the link bandwidth data Bi, the link performance data further includes traffic data xi, which is the current real-time traffic load of each link. The core is to comprehensively utilize the inherent bandwidth data of the link and the traffic data reflecting the current load status to jointly determine the gradient adjustment step size.
[0091] Compared to using only link bandwidth data, introducing traffic data allows for a more refined and dynamic determination of the gradient adjustment step size. Real-time link traffic data reflects its current load pressure. For example, for links with high bandwidth but current traffic approaching their bandwidth capacity, it may be necessary to temporarily reduce their gradient adjustment step size to avoid further increasing the load and causing overload; while for links with high bandwidth and low current traffic, a larger step size can be used. Conversely, for low-bandwidth links, even if their current traffic is not high, a smaller step size may be necessary to ensure stability. Therefore, by combining link bandwidth data and traffic data, sub-step S311 can determine a more adaptive and reasonable gradient adjustment step size, thereby accelerating the optimization convergence speed while better ensuring network stability and load balancing.
[0092] In one embodiment, sub-step S311 may include the following sub-step: Sub-step S3111: Obtain the initial step size and adjustment weight of each link; In this step, the initial step size is usually denoted as λ. baseIt is a preset baseline step size value used for calculating the subsequent gradient adjustment step size. The adjustment weight (usually denoted as Ci, where i represents the i-th link) is a coefficient used to reflect the relative relationship of certain inherent characteristics between the links.
[0093] The initial step size can be obtained by reading a global initial step size value from the system configuration parameters. The adjustment weights, on the other hand, are determined based on the inherent characteristics of each link in the preset link set. For example, if the links have heterogeneous bandwidth, the bandwidth values of each link can be simplified to obtain the simplest integer ratio of the link bandwidths; each term in this ratio serves as the adjustment weight Ci for the corresponding link. Therefore, the adjustment weight Ci reflects the inherent differences between the links.
[0094] Sub-step S3112: Determine the gradient adjustment step size of each link based on the initial step size, the adjustment weight, the link bandwidth data, and the traffic data of each link.
[0095] In this step, determining the gradient adjustment step size is a comprehensive calculation process, and its inputs include: the initial step size and adjustment weights obtained in sub-step S3111, as well as the link bandwidth data and traffic data in the link performance data.
[0096] Specifically, the initial step size provides a baseline for calculation; adjustment weights, such as link bandwidth ratios, are used to allocate the potential for adjustment across different links, and these adjustment weights are typically normalized to obtain a relative proportion; link bandwidth data is an inherent attribute of the link and is closely related to the adjustment weights; and traffic data reflects the dynamic load changes of the link.
[0097] By combining these factors—initial step size, adjustment weights, link bandwidth data, and traffic data—in a pre-defined mathematical manner, the appropriate gradient adjustment step size for each link under the current network conditions can be calculated. The core idea is to ensure that the gradient adjustment step size reflects both the inherent capability differences of the links and adapts to the current traffic dynamics, thereby achieving more accurate and stable hash weight updates.
[0098] In one embodiment, sub-step S3112 may include the following: Based on the initial step size, adjustment weight, link bandwidth data, and traffic data for each link, the gradient adjustment step size for each link is determined using the following formula:
[0099] in, This is the initial step size for the algorithm. To adjust the weights, This represents the traffic data at one time point in a cycle on the i-th link. This represents the traffic data of the i-th link at the current moment. This represents the link bandwidth data for the i-th link. You can configure it yourself according to your business needs.
[0100] In one embodiment, sub-step S31 may include the following: Based on the link bandwidth data of each link, the bandwidth ratio of each link is determined, wherein the bandwidth ratio is the ratio of the bandwidth of each link to the total bandwidth of all links in the preset link set; based on the bandwidth ratio of each link, the gradient adjustment step size of each link is determined.
[0101] In this embodiment, sub-step S31 is specifically defined as determining the gradient adjustment step size based on the link bandwidth ratio, and the process includes two key steps: First, determine the bandwidth ratio of each link. Link bandwidth data refers to the inherent bandwidth value Bi of each link. The total bandwidth of all links in the preset link set is the sum of the bandwidth values of all links, i.e. Where n is the total number of links. The bandwidth ratio ri of the i-th link is defined as the ratio of the bandwidth Bi of that link to the total bandwidth of the links, and its mathematical expression is:
[0102] The bandwidth ratio ri reflects the proportion of the bandwidth of the i-th link in the total bandwidth of the entire link set. Its value is between 0 and 1, and the sum of the bandwidth ratios of all links is 1.
[0103] Secondly, the gradient adjustment step size is determined based on the bandwidth ratio. This is done after obtaining the bandwidth ratio r for each link. i This is then used as a key basis for determining the gradient adjustment step size. Typically, this bandwidth ratio r is used... i With a preset initial step size λ base Combined, the final gradient adjustment step size λ is calculated. i For example, the initial step size λ can be... base Multiply by bandwidth ratio r i This approach allows links with larger bandwidth to receive relatively larger gradient adjustment step sizes, while links with smaller bandwidth receive relatively smaller gradient adjustment step sizes. This ensures that the gradient adjustment step size matches the inherent carrying capacity of the link. As a result, during the optimization process, links with more abundant bandwidth resources can adjust their weights more quickly to handle more traffic, while links with limited bandwidth resources adjust more cautiously to avoid overload.
[0104] Step 205: Based on the hash weight gradient of each link and the corresponding gradient adjustment step size, load balancing is performed on each link. This step is similar to step 104, and the explanation can refer to the explanation of step 104, so it will not be repeated here.
[0105] For example, an initial update period ΔT can be set, and the algorithm updates the hash weight value once every ΔT period using the gradient descent algorithm. When a link is detected to meet at least one of the following preset conditions, a hash weight update is triggered immediately without waiting for the current period to end: ,or ,in This represents the current delay of the i-th link. Let Pi represent the latency of the link since the last update, and Pi represent the current packet loss rate of the i-th link. Each time an event-driven update is triggered, the current update period ΔT is adjusted to 0.9 × ΔT, but ΔT must not be less than half of its initial value. If no event-triggered update occurs within 10 consecutive ΔT periods, ΔT returns to its initial value. This mechanism aims to balance the real-time performance of load balancing with the stability of the algorithm, avoiding the negative impact on global convergence and network stability that may result from excessively frequent weight changes.
[0106] In one embodiment, step 205 may include the following sub-steps: Sub-step 41: Update the hash weight of each link by adjusting the step size according to the hash weight gradient of each link and the corresponding gradient. In this step, the hash weight is updated based on gradient descent or a similar optimization algorithm. Specifically, for each link, its current hash weight value is subtracted or added, depending on the optimization direction. The hash weight gradient component of that link is multiplied by the corresponding gradient adjustment step size. Mathematically, this can be represented as... ,in λ is the hash weight of the i-th link in the t-th iteration. i It is its gradient adjustment step size, It is its hash weight gradient. This refers to the updated hash weights. The purpose of this step is to adjust the hash weights with an appropriate step size along the direction indicated by the gradient, so that the load balancing objective function value moves in a more optimal direction.
[0107] Sub-step 42: If the updated hash weights of each link meet the preset heuristic adjustment conditions, then determine the number of links in the preset link set. In this step, after updating the hash weights using gradients and step sizes, the updated hash weights need to be checked to determine whether they meet preset heuristic adjustment conditions. These preset heuristic adjustment conditions typically refer to hash weight distribution characteristics that can predict potential over-concentration of traffic or underutilization of link resources. For example, there may be significantly larger or smaller values in the updated hash weights, or the difference between the maximum and minimum hash weights may exceed a preset threshold.
[0108] If the judgment result meets the preset heuristic adjustment conditions, the total number of links N in the preset link set is further determined to prepare for subsequent weight swapping operations based on the number of links. If the conditions are not met, the process may directly proceed to the subsequent traffic allocation steps or perform other processing. For example, the preset heuristic adjustment conditions include: the number of links n ≥ 3, and the hash weight distribution exhibits extreme values. When the above conditions are met, if the number of links n is even, the two largest hash weights are swapped with the two smallest hash weights; if the number of links n is odd, the two smallest hash weights are swapped. This approach aims to appropriately avoid excessive traffic concentration and activate the resources of low-weight links.
[0109] Sub-step 43: If the number of links is even, swap the two largest hash weights with the two smallest hash weights respectively; In this step, when substep 42 determines that the number of links N is even and the updated hash weights meet the preset heuristic adjustment conditions, a specific weight swap operation is performed. Specifically, in the updated hash weight set, the two hash weights with the largest weight values and the two hash weights with the smallest weight values are found, and then these two sets of hash weights are swapped. For example, if the two largest weights are w... a and w b The two smallest weights are w c and w d After swapping w a with w c Exchange, w b with w d Exchange (or w) a with w d Exchange, w b with w c (Swap). The purpose of this operation is to avoid excessive traffic concentration on high-weight links by adjusting the positions of extreme weights, and to attempt to activate the resources of low-weight links.
[0110] Sub-step 44: When the number of links is odd, swap the two smallest hash weights; In this step, when substep 42 determines that the number of links N is odd and the updated hash weights meet the preset heuristic adjustment conditions, another specific weight swap operation is performed. Specifically, in the updated hash weight set, the two hash weights with the smallest weight values are found and swapped. The purpose of this operation is also to improve the weight distribution, attempting to guide traffic to the links with the smaller original weights to promote balanced resource utilization.
[0111] Sub-step 45: Distribute traffic to each link based on the adjusted hash weights.
[0112] In this step, whether the hash weight is updated solely after sub-step 41, or heuristically adjusted after sub-steps 43 or 44 based on the update in sub-step 41, it will be used as the final hash weight to guide traffic allocation across links. Specifically, a hash algorithm is typically used to calculate a hash value based on certain characteristics of the packet, such as source IP address, destination IP address, and port number. This hash value is then combined with the final hash weight to map the packet to the corresponding link for transmission. The size of the hash weight determines the probability of traffic being allocated to each link, thereby achieving load balancing. Through sub-steps 41 to 45, the hash weight is optimized and updated using the gradient descent method, and a heuristic weight adjustment mechanism is introduced to address potential traffic concentration issues, further improving the load balancing effect and network resource utilization.
[0113] Reference Figure 3 The diagram illustrates a scenario of an embodiment of the link load balancing method of the present invention, the details of which are as follows: First, link performance data, such as real-time traffic, link latency, packet loss rate, utilization, and bandwidth, are collected from the heterogeneous link set. Then, part of the collected link performance data is used to determine the objective function, and the other part is used to determine the gradient adjustment step size. Subsequently, using the hash weight gradient and gradient adjustment step size determined by the objective function and corresponding mathematical differentiation methods, the hash weights are updated together using the gradient descent algorithm. Next, the updated hash weights are applied to achieve traffic allocation, and heuristic adjustments can be performed on extreme weight distributions that meet preset conditions to achieve load balancing. Finally, the changes in link performance after load balancing are updated in real-time to the link performance data determination stage through a data feedback mechanism, triggering a new round of data collection and optimization processes. This forms a dynamic iterative closed loop of data collection, parameter calculation, weight adjustment, traffic allocation, and performance feedback, continuously optimizing the traffic allocation effect of heterogeneous links.
[0114] By acquiring the link performance data of each link in a preset link set, the current operating status of each link can be perceived in real time. Based on the link performance data of each link, the hash weight gradient of each link is determined, ensuring the accuracy of the adjustment direction. At the same time, based on the link performance data of each link, the gradient adjustment step size of each link is determined, so that the adjustment range can match the real-time performance of the link. Finally, based on the hash weight gradient of each link and the corresponding gradient adjustment step size, load balancing is performed on each link. This process can continuously and accurately optimize the hash weight according to the dynamic changes in link performance, thereby distributing traffic more reasonably to each link. This effectively solves the problem mentioned in the background technology of the difficulty in dynamically and accurately adjusting the traffic allocation strategy according to the real-time performance status of the link, significantly improving the link resource utilization and overall load balancing effect, and enhancing the adaptability and intelligence level of load balancing, enabling it to better cope with the complex and ever-changing network conditions in heterogeneous link environments.
[0115] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0116] Reference Figure 4 The diagram shows a structural block diagram of an embodiment of the link load balancing device of the present invention, the details of which are as follows: The data acquisition module 301 is used to acquire the link performance data of each link in the preset link set; The weight gradient determination module 302 is used to determine the hash weight gradient of each link based on the link performance data of each link. The step size adjustment module 303 is used to determine the gradient adjustment step size of each link based on the link performance data of each link. The load balancing module 304 is used to perform load balancing on each link according to the hash weight gradient of each link and the corresponding gradient adjustment step size.
[0117] In one embodiment, the weight gradient determination module includes: The objective function determination submodule is used to obtain the load balancing objective function based on the link performance data of each link; The weight gradient calculation submodule is used to calculate the derivative of the current hash weight of each link based on the load balancing objective function and the link performance data, so as to obtain the hash weight gradient.
[0118] In one embodiment, the objective function determination submodule includes: The weighting coefficient determination unit is used to obtain weighting coefficients based on the link performance data of each link; The objective function calculation unit is used to determine the load balancing objective function based on the weighting coefficients, the preset initial objective function, and the preset constraint function.
[0119] In one embodiment, the link performance data includes traffic data, and the weighting coefficient determination unit includes: The traffic data determination subunit is used to determine the total traffic data of the preset link set based on the traffic data of each link. The weighting coefficient calculation subunit is used to obtain the weighting coefficients based on the total flow data.
[0120] In one embodiment, the weighting coefficient calculation subunit includes: The weighting coefficient formula calculation subunit is used to obtain the weighting coefficients based on the total flow data using the following formula:
[0121] in, These are the initial weighting coefficients. To constrain the penalty coefficient for violations, This indicates that the constraint has violated the tolerance threshold. This represents the sensitivity coefficient to traffic fluctuations. This represents the change in total traffic data between the current period and the previous period, i.e. This indicates the degree of constraint violation in the current iteration.
[0122] In one embodiment, the link performance data includes traffic data, link latency, link packet loss rate, and link utilization; the weight gradient calculation submodule includes: The weight gradient comprehensive calculation unit is used to calculate the derivative of the current hash weight of each link based on the preset load balancing optimization objective function, the traffic data, the link latency, the link packet loss rate and the link utilization rate, to obtain the hash weight gradient.
[0123] In one embodiment, the link performance data includes link bandwidth data, and the adjustment step size determination module includes: The first gradient adjustment step size submodule is used to determine the gradient adjustment step size of each link based on the link bandwidth data of each link.
[0124] In one embodiment, the first gradient adjustment step size submodule includes: A bandwidth ratio determination unit is used to determine the bandwidth ratio of each link based on the link bandwidth data of each link. The bandwidth ratio is the ratio of the bandwidth of each link to the total bandwidth of each link in a preset link set. The bandwidth ratio gradient adjustment step size determination unit is used to determine the gradient adjustment step size of each link based on the bandwidth ratio of each link.
[0125] In one embodiment, the link performance data further includes traffic data, and the adjustment step size determination module includes: The second gradient adjustment step size submodule is used to determine the gradient adjustment step size of each link based on the link bandwidth data and the traffic data of each link.
[0126] In one embodiment, the second gradient adjustment step size submodule includes: An initial step size determination unit is used to obtain the initial step size and adjustment weight of each link; The gradient adjustment comprehensive calculation unit is used to determine the gradient adjustment step size of each link based on the initial step size, the adjustment weight, the link bandwidth data, and the traffic data of each link.
[0127] In one embodiment, the gradient adjustment comprehensive calculation unit includes: The gradient adjustment formula calculation subunit is used to determine the gradient adjustment step size of each link based on the initial step size, the adjustment weight, the link bandwidth data, and the traffic data, using the following formula:
[0128] in, This is the initial step size for the algorithm. To adjust the weights, This represents the traffic data at one time point in a cycle on the i-th link. This represents the traffic data of the i-th link at the current moment. This represents the link bandwidth data for the i-th link.
[0129] In one embodiment, the load balancing module includes: The hash weight update submodule is used to update the hash weight of each link by adjusting the step size according to the hash weight gradient of each link and the corresponding gradient. The adjustment condition judgment submodule is used to determine the number of links in the preset link set if the updated hash weights of each link meet the preset heuristic adjustment conditions. The even-number swapping submodule is used to swap the two largest hash weights with the two smallest hash weights when the number of links is even. The odd number swap submodule is used to swap the two smallest hash weights when the number of links is odd. The traffic allocation submodule is used to allocate traffic to each link based on the swapped hash weights.
[0130] The link load balancing device in this embodiment of the invention can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc., while non-mobile electronic devices can be servers, network attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. This embodiment of the invention does not impose specific limitations.
[0131] The link load balancing device in this embodiment of the invention can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this embodiment of the invention does not impose specific limitations.
[0132] The link load balancing device provided in this embodiment of the invention can achieve Figures 1 to 3 The various processes implemented in the method embodiments are not described in detail here to avoid repetition.
[0133] By acquiring the link performance data of each link in a preset link set, the current operating status of each link can be perceived in real time. Based on the link performance data of each link, the hash weight gradient of each link is determined, ensuring the accuracy of the adjustment direction. At the same time, based on the link performance data of each link, the gradient adjustment step size of each link is determined, so that the adjustment range can match the real-time performance of the link. Finally, based on the hash weight gradient of each link and the corresponding gradient adjustment step size, load balancing is performed on each link. This process can continuously and accurately optimize the hash weight according to the dynamic changes in link performance, thereby distributing traffic more reasonably to each link. This effectively solves the problem mentioned in the background technology of the difficulty in dynamically and accurately adjusting the traffic allocation strategy according to the real-time performance status of the link, significantly improving the link resource utilization and overall load balancing effect, and enhancing the adaptability and intelligence level of load balancing, enabling it to better cope with the complex and ever-changing network conditions in heterogeneous link environments.
[0134] This invention also provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described link load balancing method embodiment and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0135] This invention also provides a readable storage medium on which a computer program is stored. When the computer program is executed by a processor, it implements the various processes of the above-described link load balancing method embodiment and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0136] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0137] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of the present invention is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0138] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0139] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of the present invention.
Claims
1. A link load balancing method, characterized in that, The method includes: Obtain link performance data for each link in a preset link set; Based on the link performance data of each link, determine the hash weight gradient of each link; Based on the link performance data of each link, determine the gradient adjustment step size of each link; Load balancing is performed on each link based on the hash weight gradient of each link and the corresponding gradient adjustment step size.
2. The link load balancing method according to claim 1, characterized in that, The step of determining the hash weight gradient of each link based on the link performance data of each link includes: Based on the link performance data of each link, obtain the load balancing objective function; Based on the load balancing objective function and the link performance data, the hash weight gradient is obtained by differentiating the current hash weight of each link.
3. The link load balancing method according to claim 2, characterized in that, The step of obtaining the load balancing objective function based on the link performance data of each link includes: Based on the link performance data of each link, obtain the weighting coefficients; The load balancing objective function is determined based on the weighting coefficients, the preset initial objective function, and the preset constraint function.
4. The link load balancing method according to claim 3, characterized in that, The link performance data includes traffic data. Obtaining weighting coefficients based on the link performance data of each link includes: Based on the traffic data of each link, determine the total traffic data of the preset link set; Based on the total flow data, obtain the weighting coefficients.
5. The link load balancing method according to claim 4, characterized in that, Based on the total traffic data, the weighting coefficient is obtained using the following formula: in, These are the initial weighting coefficients. To constrain the penalty coefficient for violations, This indicates that the constraint has violated the tolerance threshold. This represents the sensitivity coefficient to traffic fluctuations. This represents the change in total traffic data between the current period and the previous period, i.e. This indicates the degree of constraint violation in the current iteration.
6. The link load balancing method according to claim 1, characterized in that, The link performance data includes traffic data, link latency, link packet loss rate, and link utilization. The step of differentiating the current hash weight of each link based on the load balancing objective function and the link performance data to obtain the hash weight gradient includes: Based on the preset load balancing optimization objective function, the traffic data, the link latency, the link packet loss rate, and the link utilization, the derivative of the current hash weight of each link is calculated to obtain the hash weight gradient.
7. The link load balancing method according to claim 1, characterized in that, The link performance data includes link bandwidth data. Determining the gradient adjustment step size for each link based on the link performance data includes: Based on the link bandwidth data of each link, the gradient adjustment step size of each link is determined.
8. The link load balancing method according to claim 7, characterized in that, The step of determining the gradient adjustment step size for each link based on the link bandwidth data of each link includes: Based on the link bandwidth data of each link, the bandwidth ratio of each link is determined, wherein the bandwidth ratio is the ratio of the bandwidth of each link to the total bandwidth of all links in the preset link set; The gradient adjustment step size for each link is determined based on the bandwidth ratio of each link.
9. The link load balancing method according to claim 7, characterized in that, The link performance data also includes traffic data. Determining the gradient adjustment step size for each link based on the link performance data includes: Based on the link bandwidth data and traffic data of each link, the gradient adjustment step size of each link is determined.
10. The link load balancing method according to claim 9, characterized in that, The step of determining the gradient adjustment step size for each link based on the link bandwidth data and the traffic data includes: Obtain the initial step size and adjustment weight of each link; The gradient adjustment step size of each link is determined based on the initial step size, the adjustment weight, the link bandwidth data, and the traffic data.
11. The link load balancing method according to claim 10, characterized in that, Based on the initial step size, adjustment weight, link bandwidth data, and traffic data for each link, the gradient adjustment step size for each link is determined using the following formula: in, This is the initial step size for the algorithm. To adjust the weights, This represents the traffic data at one time point in a cycle on the i-th link. This represents the traffic data of the i-th link at the current moment. This represents the link bandwidth data for the i-th link.
12. The link load balancing method according to claim 1, characterized in that, The step of load balancing each link based on its hash weight gradient and corresponding gradient adjustment step size includes: The hash weights of each link are updated based on the hash weight gradient of each link and the corresponding gradient adjustment step size. If the updated hash weights of each link meet the preset heuristic adjustment conditions, then the number of links in the preset link set is determined. If the number of links is even, the two largest hash weights and the two smallest hash weights are swapped respectively; When the number of links is odd, swap the two smallest hash weights; Traffic is allocated to each link based on the swapped hash weights.
13. A link load balancing device, characterized in that, The device includes: The data acquisition module is used to acquire the link performance data of each link in the preset link set; The weight gradient determination module is used to determine the hash weight gradient of each link based on the link performance data of each link. The step size adjustment module is used to determine the gradient adjustment step size of each link based on the link performance data of each link. The load balancing module is used to perform load balancing on each link based on the hash weight gradient of each link and the corresponding gradient adjustment step size.
14. An electronic device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the link load balancing method as described in claims 1-12.
15. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the link load balancing method as described in claims 1-12.