Load balancing method, electronic device, storage medium and program product

By designing a load evaluation function and an adaptive dynamic load balancing algorithm, combined with an improved cuckoo algorithm, the weight of server nodes is dynamically adjusted, solving the problem of load imbalance in existing technologies and achieving efficient load balancing and improved stability.

CN121957918APending Publication Date: 2026-05-01CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD
Filing Date
2026-04-01
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

Existing load balancing algorithms struggle to efficiently adjust strategies in complex network environments, especially under high concurrency and high load conditions, where they are prone to load imbalances and fail to consider resource utilization efficiency under low load conditions.

Method used

By designing a load evaluation function, combining an adaptive dynamic load balancing algorithm and an improved Cuckoo algorithm, the weights of server nodes are adjusted according to their real-time load and weights, and a static or dynamic load balancing algorithm is dynamically selected to achieve load balancing of the server cluster.

Benefits of technology

It improves the load balancing efficiency of server clusters under different load conditions, reduces jitter, enhances system stability and resource utilization efficiency, and reduces operation and maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121957918A_ABST
    Figure CN121957918A_ABST
Patent Text Reader

Abstract

The invention provides a load balancing method, electronic equipment, a storage medium and a program product. The method comprises the steps of determining a real-time load of each server node according to an index value of each load index of each server node in a current server cluster and a weight coefficient of each load index; determining a first threshold value according to the real-time load of each server node in the server cluster, wherein the first threshold value is used for determining an adopted target load balancing algorithm; comparing the total real-time load of the current server cluster with a first threshold value, and determining an adopted target load balancing algorithm based on a comparison result; and distributing the task requests based on the target load balancing algorithm.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of server cluster management, and in particular to a load balancing method, electronic device, storage medium, and program product. Background Technology

[0002] With the rapid development of the internet and the surge in user numbers, higher demands are being placed on server performance. Server clusters have become the preferred solution due to their efficiency and cost-effectiveness, making load balancing technology a key research focus. Load balancing algorithms in related technologies are divided into static load balancing algorithms and dynamic load balancing algorithms. Static load balancing algorithms are suitable for simple scenarios, but they are prone to load imbalance in complex network environments (such as high concurrency and high load). Dynamic load balancing algorithms do not take into account resource utilization efficiency under low load conditions. In short, in related technologies, server clusters cannot efficiently adjust their load balancing strategies when facing different load conditions. Summary of the Invention

[0003] This application provides a load balancing method, an electronic device, a storage medium, and a program product.

[0004] The technical solution of this application embodiment is implemented as follows: This application provides a load balancing method, the method comprising: The real-time load of each server node is determined based on the load metric values ​​of each server node in the current server cluster and the weight coefficient of each load metric. A first threshold is determined based on the real-time load of each server node in the server cluster, and the first threshold is used to determine the target load balancing algorithm to be used. The total real-time load of the current server cluster is compared with a first threshold, and the target load balancing algorithm is determined based on the comparison result. Task requests are allocated based on the target load balancing algorithm.

[0005] This application also provides an electronic device, which includes a processor and a memory for storing a computer program that can run on the processor; wherein the processor is used to run the computer program to perform any of the above-described load balancing methods.

[0006] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements any of the above-described load balancing methods.

[0007] This application also provides a computer program product, including a computer program or computer executable instructions, which, when executed by a processor, implements any of the above-described load balancing methods.

[0008] As can be seen, the embodiments of this application can reasonably determine the real-time load of each server node based on the index values ​​of each load index and the weight coefficient of each load index. Thus, a first threshold can be determined based on the real-time load of each server node, and a target load balancing algorithm that matches the real-time load of the server node can be reasonably determined through the first threshold. This is beneficial for the server cluster to efficiently adjust the load balancing strategy when facing different load conditions. Attached Figure Description

[0009] Figure 1 This is a flowchart of a load balancing method according to an embodiment of this application; Figure 2 This is a flowchart of another load balancing method according to an embodiment of this application; Figure 3 This is a schematic diagram of the load balancing device according to an embodiment of this application; Figure 4 This is a schematic diagram of the composition structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0010] Load balancing algorithms in related technologies are divided into static load balancing algorithms and dynamic load balancing algorithms. Static load balancing algorithms are suitable for simple scenarios, but they are prone to load imbalance in complex network environments (such as high concurrency and high load). In one example, Nginx, as a high-performance reverse proxy server, incorporates several traditional load balancing algorithms and performs well under low concurrency requests. However, in high-concurrency scenarios, static load balancing algorithms, because they do not consider the real-time load of server nodes, may lead to uneven resource allocation and affect the performance of the server cluster. Dynamic load balancing algorithms do not take into account resource utilization efficiency under low load conditions and are prone to getting trapped in local optima, resulting in load imbalance.

[0011] Static load balancing algorithms can be effective in handling simple server cluster scenarios, but their limitations become increasingly apparent as network environments become more complex, especially when facing high concurrency and high load challenges. Specifically, static algorithms, using a point-to-point approach, can easily generate misleading peak points in practical applications, leading to uneven load distribution.

[0012] A related technology also proposes a dynamic weighted load balancing algorithm based on Nginx. This algorithm combines a weighted round-robin strategy and comprehensively considers the hardware performance and workload of server nodes. However, while this algorithm performs excellently in high-concurrency scenarios, its efficiency is not fully realized in low-load environments.

[0013] Related technologies have also proposed a dynamic weighted load balancing scheme based on predicted thresholds. This scheme aims to reduce frequent weight adjustments and thus avoid server jitter by calculating the load balance of the cluster. However, at low concurrency levels, the need for frequent threshold predictions may actually increase response time and negatively impact system performance.

[0014] Related technologies have also proposed a load balancing scheme based on an improved genetic algorithm. This scheme dynamically switches between static and dynamic load balancing by calculating a threshold. However, due to the inherent limitations of genetic algorithms, this improved algorithm may get trapped in local optima, affecting the overall accuracy and efficiency, especially in high-concurrency environments.

[0015] In summary, current technologies fail to efficiently adjust load balancing strategies for server clusters under varying load conditions. While load balancing algorithms in these technologies have shown some effectiveness in specific scenarios, they still suffer from numerous shortcomings. For instance, they lack effective solutions for balancing efficiency under low load environments and avoiding getting trapped in local optima.

[0016] In view of the technical problems existing in related technologies, this application proposes technical solutions based on its embodiments.

[0017] The embodiments of this application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the embodiments provided herein are merely illustrative of the embodiments of this application and are not intended to limit the embodiments of this application. Furthermore, the embodiments provided below are some embodiments for implementing this application, and not all embodiments for implementing this application. Unless otherwise specified, the technical solutions described in the embodiments of this application can be implemented in any combination.

[0018] It should be noted that, in the embodiments of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a method or apparatus that includes a list of elements includes not only the elements expressly described, but also other elements not expressly listed, or elements inherent to implementing the method or apparatus. Without further limitations, an element defined by the phrase "comprising a..." does not exclude the presence of other related elements (e.g., steps in the method or units in the apparatus, such as portions of circuitry, processors, programs, or software, etc.) in the method or apparatus that includes that element.

[0019] The load balancing method provided in this application includes a series of steps, but the load balancing method provided in this application is not limited to the steps described. Similarly, the load balancing device provided in this application includes a series of modules, but the device provided in this application is not limited to the modules explicitly described, but may also include modules that need to be set up for obtaining relevant information or processing based on information.

[0020] This application proposes a load balancing method. Figure 1 This is a flowchart of a load balancing method according to an embodiment of this application, such as... Figure 1 As shown, the process includes: Step 101: Determine the real-time load of each server node based on the load metric values ​​of each server node in the current server cluster and the weight coefficient of each load metric.

[0021] In this embodiment, a load evaluation function can be designed for each server node in the server cluster to determine the real-time load of each server node. Understandably, different evaluation metrics have a significant impact on the judgment of server load balancing. In this embodiment, the load evaluation function for the server nodes can be optimized. The optimized load evaluation function can more reasonably assess the load status of each server node in the server cluster, thereby achieving effective allocation and utilization of resources in the server cluster.

[0022] In some embodiments, a weighted summation method or other methods can be used to design the load evaluation function for the server nodes. For example, the load evaluation function can be constructed based on load metrics such as CPU utilization, memory utilization, disk input / output (IO) utilization, and network bandwidth utilization, along with their corresponding weighting coefficients. By combining these load metrics with their respective weights, a load evaluation function for the server nodes is formed, accurately reflecting the actual load of each node.

[0023] For example, the first The load evaluation function for each server node can be denoted as: , It can be calculated using formula (1).

[0024] (1) in, , , and These represent the weighting coefficients for CPU utilization, memory utilization, disk I / O utilization, and network bandwidth utilization, respectively, and satisfy the following conditions: , Indicates the first CPU utilization of each server node Indicates the first Memory usage of each server node Indicates the first Disk I / O utilization of each server node Indicates the first Network bandwidth utilization of each server node The value ranges from 1 to , This represents the number of server nodes in the server cluster. It can represent the first Load status of each server node.

[0025] In this embodiment of the application, the weight coefficients of each load index can be determined by various methods. For example, the weight coefficients of each load index can be preset based on experience, or the weight coefficients of each load index can be determined by the entropy weight method.

[0026] The following is an illustrative example of the process for determining the weight coefficients of each load index using the entropy weight method. First, calculate the weight coefficients of the first load index... The first server node The load metric is related to the first load metric of each server node in the server cluster. The percentage of the sum of all load metrics , The value ranges from 1 to , The number of load indicators, The calculation formula is formula (2). (2) in, Indicates the first The first server node One load metric, These can be positive or negative indicators. A higher value for a positive indicator indicates a better evaluation; conversely, a lower value for a negative indicator indicates a better evaluation. It can be seen that... Normalization It is calculated from 1 data point.

[0027] In calculation Then, the first can be calculated using formula (3). Entropy value of each load metric .

[0028] (3) in, These are the standardized coefficients of the entropy weight method. , .

[0029] After calculating the entropy value of each load metric, the weighting coefficient of each load metric is calculated. Weighting coefficients of each load metric It can be calculated using formula (4).

[0030] (4) in, For information entropy redundancy, .

[0031] It can be seen that by using the above formulas (1) to (4), the following can be calculated: , , and .

[0032] In this embodiment of the application, the first The real-time load of each server node is denoted as . , It is the first Each server node according to The resulting real-time load.

[0033] Step 102: Determine the first threshold based on the real-time load of each server node in the server cluster. The first threshold is used to determine the target load balancing algorithm to be used.

[0034] In this embodiment, the target load balancing algorithm can be a static load balancing algorithm or a dynamic load balancing algorithm. To allocate task requests based on the target load balancing algorithm, a dynamic load balancing algorithm needs to be designed in advance. In some embodiments, an adaptive dynamic load balancing algorithm under high load conditions can be designed based on the server node load evaluation function.

[0035] In adaptive dynamic load balancing algorithms, it's necessary to determine the weights of server nodes. A higher weight indicates stronger performance, and vice versa. The weights of server nodes are used to determine which node to assign tasks to in the dynamic load balancing algorithm. In one example, a task can be assigned to the server node with the highest weight; in another example, the task might be assigned to the node with the highest weight. The weight of the server node and the allocation of tasks to the first The probabilities of each server node are positively correlated. In an adaptive dynamic load balancing algorithm, the allocation strategy needs to be adjusted in a timely manner based on the real-time load status and hardware performance of each server node. The core of achieving load balancing in an adaptive dynamic load balancing algorithm lies in dynamically adjusting the weights of server nodes.

[0036] The following example illustrates the dynamic adjustment of server node weights in an adaptive dynamic load balancing algorithm.

[0037] Before a task request arrives, the processing capacity of each server node can be calculated based on its performance metrics such as CPU and memory. An initial weight for each server node can then be set based on this processing capacity. For example, the initial weight of each server node can be determined based on its hardware performance metrics. The initial value of the weight of each server node can be denoted as: .

[0038] Understandably, frequent updates to server node weights can cause server cluster instability. Accurate weight adjustments not only balance the load on the server cluster but also further improve its stability. In some embodiments, server node resource utilization can be used as the basis for weight adjustments. The resource utilization rate of each server node is denoted as... For example, the resource utilization of each server node can be determined based on the real-time load of each service node and the weight of each server node. It can be calculated using formula (5).

[0039] (5) in, Indicates the first The weights of each server node at the initial moment, It is the first The initial value of the weight of the i-th server node, in relation to the i-th After the weights of each server node are adjusted at least once The number obtained through the most recent adjustment or update The weight of each server node.

[0040] In some other embodiments, a dynamic weighted round-robin algorithm based on historical load data can be used to calculate the weight of a server node by recording the historical load data of each server node.

[0041] After determining the resource utilization of each server node, a load dispersion parameter characterizing the load dispersion state of the server cluster can be determined based on the resource utilization of each server node and the average resource utilization of all server nodes. If the load dispersion parameter is greater than a preset threshold, the weight of each server node is updated. It can be seen that since the load dispersion parameter characterizes the load dispersion state of the server cluster, if the load dispersion parameter is greater than or equal to the preset threshold, the load distribution of the server cluster can be considered to be in a relatively unbalanced state. In this case, updating the weight of each server node helps to rationally determine the nodes for task allocation, thereby facilitating load balancing among the server nodes in the server cluster.

[0042] Here, if the load dispersion parameter is less than the preset threshold, there is no need to update or adjust the weight of each server node.

[0043] In some embodiments, the load balancing degree, which describes the dispersion of resource utilization of each server node, can be determined based on the resource utilization of each server node and the average resource utilization of each server node; and the load balancing degree can be used to determine the load dispersion parameter.

[0044] Here, load balancing can be denoted as: , The smaller the value, the smaller the fluctuation in resource utilization of each server node, and the more balanced the load of the server cluster. A larger value indicates greater fluctuations in resource utilization across server nodes and a more unbalanced load across the server cluster. In this case, it may be necessary to adjust the weights of the server nodes. For example, It can be calculated using formula (6).

[0045] (6) in, This represents the average resource utilization rate of each server node.

[0046] As can be seen, the embodiments of this application can reasonably determine the load dispersion parameters that characterize the load dispersion state of the server cluster based on a comprehensive consideration of the average resource utilization rate of each server node and the dispersion of the resource utilization rate of each server node.

[0047] For example, the load discrete parameter is denoted as , The larger the value, the greater the load dispersion of the server cluster; conversely, the smaller the value, the smaller the load dispersion of the server cluster. It can be calculated using formula (7).

[0048] (7) in, Indicates the degree of cluster dispersion. , , and Let be the two correlation coefficients set, and It can be seen that The range of values ​​is .

[0049] Regarding the implementation of updating the weight of each server node, in some embodiments, the weight of each server node can be updated based on its real-time load. Understandably, considering the real-time load of each server node helps to ensure that the updated weights more accurately reflect the load distribution of each server node, thereby facilitating load balancing among the server nodes when allocating tasks using the updated weights.

[0050] For example, a dynamic weighted round-robin algorithm can be used to adjust the weight of each server node. The implementation of adjusting the weight of each server node using the dynamic weighted round-robin algorithm is as follows: the load monitoring and data collection module collects data within a time period... Internally, data is collected from each server node, and load dispersion parameters are calculated. Determine the load discrete parameters Is it greater than or equal to a preset threshold? If the load is discrete... If the load is less than the preset threshold, the weights of each server node will not be adjusted. (This is in contrast to the previous sentence about load dispersion parameters.) If the value is greater than or equal to the preset threshold, the weight of each server node will be adjusted to reduce server cluster jitter and improve the load balancing effect of server nodes.

[0051] When adjusting the weight of a server node, the load evaluation index and initial weight of the server node can be used as a reference. For example, the weight of the server node can be adjusted according to formula (8).

[0052] (8) in, This indicates the number of elements before the weight adjustment. The weight of the _th server node, before the first weight adjustment The weights of each server node are the initial weights. ; This indicates the number of elements before the weight adjustment. The weight of each server node.

[0053] The solution adopted in this application embodiment can adjust the weight of server nodes under high load by using a dynamic weighted round-robin algorithm. By considering the load evaluation indicators, real-time performance utilization and threshold of server nodes, a more reasonable task allocation can be achieved by adjusting the weight of server nodes, ensuring load balance and preventing server cluster jitter.

[0054] Of course, in some other embodiments, optimization algorithms such as particle swarm optimization (PSO), genetic algorithm (GA), or simulated annealing algorithm can also be used to adjust the weight of server nodes.

[0055] The adaptive dynamic load balancing algorithm described above is more suitable for high-concurrency, high-load scenarios, while the static load balancing algorithm, due to its simple logic and low resource consumption, is more suitable for low-load scenarios. Therefore, it is necessary to determine the first threshold for switching from a static load balancing algorithm to a dynamic load balancing algorithm. This means selecting the most suitable load balancing algorithm under different load levels.

[0056] Step 103: Compare the total real-time load of the current server cluster with the first threshold, and determine the target load balancing algorithm to be used based on the comparison result.

[0057] In this embodiment of the application, if the total real-time load of the current server cluster is less than the first threshold... The target load balancing algorithm is a static load balancing algorithm; if the total real-time load of the current server cluster is greater than or equal to the first threshold. If the target load balancing algorithm is a dynamic load balancing algorithm, for example, the target load balancing algorithm can be the adaptive dynamic load balancing algorithm described above.

[0058] Step 104: Distribute task requests based on the target load balancing algorithm.

[0059] In practical applications, steps 101 to 104 can be implemented based on a processor and a communication interface. The processor can be at least one of the following: Application Specific Integrated Circuit (ASIC), Digital Signal Processor (DSP), Digital Signal Processing Device (DSPD), Programmable Logic Device (PLD), Field Programmable Gate Array (FPGA), CPU, controller, microcontroller, and microprocessor.

[0060] As can be seen, the embodiments of this application can reasonably determine the real-time load of each server node based on the index values ​​of each load index and the weight coefficient of each load index. Thus, a first threshold can be determined based on the real-time load of each server node, and a target load balancing algorithm that matches the real-time load of the server node can be reasonably determined through the first threshold. This is beneficial for the server cluster to efficiently adjust the load balancing strategy when facing different load conditions.

[0061] In some embodiments, the fitness function of the Cuckoo Algorithm can be optimized based on the real-time load of each server node, the weight of each server node, and the preset initial hardware load index of the server cluster. Then, the first threshold is solved using the optimized fitness function and the Cuckoo Algorithm.

[0062] In this embodiment, an improved adaptive cuckoo algorithm is proposed based on the cuckoo algorithm. This algorithm can effectively calculate the optimal transition point between static and dynamic load balancing strategies, thereby achieving optimal resource allocation and utilization. For example, the process of solving the first threshold using the improved adaptive cuckoo algorithm may include the following steps: Step S1: Initialize the cuckoo population. Set the maximum number of iterations, population size, and search space dimensions.

[0063] In this step, random generation is possible. A bird's nest, in the cuckoo algorithm This can be a preset fixed value. The location of each nest is calculated based on the fitness function and mapped to a solution in the population space. Simultaneously record the optimal solution .

[0064] Among them, Take 1 to hour, Indicates the first The dynamic load weight of each server node in the adaptive cuckoo algorithm described above is used to characterize the priority of the tasks assigned to that node. The fitness function is based on the load weight of each node. The load balance in the adaptive cuckoo algorithm is calculated based on the value and real-time load index, serving as the basis for evaluating the quality of the nest.

[0065] For example, the value of the optimized fitness function is negatively correlated with the sum of squares of the real-time load of each server node, and positively correlated with the sum of the differences between the real-time load of each server node and the initial hardware load metric.

[0066] For example, the fitness function can be The expression is determined as shown in formula (9).

[0067] (9) in, It is the rate of change of hardware load indicators. This is the initial hardware load metric for the server cluster. It is a thermodynamic constant.

[0068] Step S2: Update individual positions using Levi's fly-through. Globally update the solution positions using Levi's fly-through to obtain new candidate solutions. Retain better solutions using a greedy strategy and update the current best solution by comparing with the fitness function. Then, the first threshold is calculated.

[0069] Here, the goal of solving the fitness function is to determine the optimal threshold for the server cluster to switch from static load balancing to dynamic load balancing, thereby finding the first threshold for the server cluster to switch from the static load balancing algorithm to the dynamic load balancing algorithm.

[0070] Step S3: Evaluate the new location based on the fitness function value. After completing the global exploration, perform a local search using a preference-based random walk, building upon the current solution. The probability of the nest being discovered by the host. Randomly generate a number ,if If the solution is not found to be good, it will be replaced by a new solution.

[0071] Step S4: Before the preset stopping condition is met, repeat the solution search process from steps S2 to S3. After the stopping condition is met, output the solution. .

[0072] As can be seen, the embodiments of this application can reasonably optimize the fitness function of the Cuckoo Algorithm based on a comprehensive consideration of the real-time load of each server node, the weight of each server node, and the preset initial hardware load index of the server cluster. This is beneficial to improving the ability of the Cuckoo Algorithm to find local optima and to achieve iteration towards the global optimum.

[0073] In some embodiments, the step size factor of the cuckoo algorithm can be optimized based on the distribution entropy of the cuckoo population in the search space. Then, the first threshold is solved using the optimized fitness function, the optimized step size factor, and the cuckoo algorithm.

[0074] In some other embodiments, statistical methods or other heuristic algorithms may be used to determine the first threshold, such as by setting the first threshold using statistics such as mean and variance.

[0075] In this embodiment, the step size factor of the cuckoo algorithm can be optimized based on the distribution entropy of the cuckoo population in the optimization search space, building upon the cuckoo algorithm provided by related technologies. Entropy is a metric for measuring the degree of disorder in a system, while population entropy reflects the degree of disorder in population distribution during the algorithm's optimization process. Here, we can use... This represents the distribution entropy of the cuckoo population in the optimization search space. The expression can be the expression shown in formula (10).

[0076] (10) in, express, Indicates the first The number of requests processed by each server node within the statistical period, as shown in formula (10). This represents the total number of requests processed by all server nodes in the cluster. Load entropy The larger the value, the more evenly the cluster load is distributed; conversely, the smaller the value, the more uneven the load distribution. Understandably, The larger the value, the more dispersed the population; conversely, the smaller the value, the more concentrated the population.

[0077] For example, the optimized step size factor It can be calculated using formula (11).

[0078] (11) in, and These are the theoretical minimum and maximum values ​​of the distribution entropy. To adjust the parameters.

[0079] Understandably, the population entropy will adjust accordingly through the nonlinear adaptive change of the distribution entropy. This allows the population to converge quickly during the optimization process, while avoiding getting trapped in local optima, thus making it more likely to find the global optimum.

[0080] This application proposes a novel adaptive load balancing algorithm based on an improved cuckoo algorithm, aiming to achieve more efficient load balancing in complex network environments. By adopting the solution of this application, the load distribution of server clusters can be optimized and the overall performance can be improved.

[0081] This application proposes a dynamic and static load balancing algorithm combining an improved Cuckoo algorithm and the Nginx platform, aiming to find a first threshold for switching between different load balancing algorithms. In this application embodiment, a server load monitoring module is set up to collect real-time cluster load data of the server cluster. When the total real-time load of the server cluster is less than the first threshold, a static load balancing algorithm is used; when the total real-time load of the server cluster is greater than or equal to the first threshold, an adaptive dynamic load balancing algorithm is used. Furthermore, if the load change of any node in the cluster exceeds the balancing threshold... The weight of the node will be adjusted if the node's weight is adjusted; otherwise, the node's weight will remain unchanged. The solution adopted in this application helps improve the overall load balancing efficiency of the server cluster.

[0082] Figure 2 Here is a flowchart of another load balancing method according to an embodiment of this application, such as... Figure 2 As shown, the process includes: Step 201: Determine the initial values ​​of the weights of the server nodes.

[0083] The implementation method for this step has been explained in the aforementioned content and will not be repeated here.

[0084] Step 202: Receive the client's task assignment request.

[0085] Step 203: Determine to use the static load balancing algorithm. Then, you can execute steps 204 and 207.

[0086] Step 204: Determine whether the total real-time load of the server cluster is greater than or equal to the first threshold. If not, return to step 203; if yes, proceed to step 205.

[0087] Step 205: Determine which dynamic load balancing algorithm to use.

[0088] Step 206: Update the weight of each server node based on its real-time load.

[0089] Step 207: Distribute task requests to the corresponding server nodes according to their weights, and then end the process.

[0090] The beneficial effects of the embodiments of this application are illustrated below.

[0091] The load evaluation function proposed in this application not only comprehensively considers the impact of different load indicators, but also assigns different weights to each indicator based on its importance, thereby more accurately assessing the load status of server nodes. This method provides a solid theoretical foundation and technical support for achieving efficient load balancing.

[0092] In high-load scenarios, the dynamic load balancing algorithm proposed in this application not only considers the load evaluation indicators of the current server nodes, but also combines their real-time performance utilization and set thresholds to ensure more reasonable task allocation and more even load distribution. This not only effectively avoids excessive concentration or dispersion of resources within the cluster and reduces service quality degradation caused by uneven load, but also significantly reduces the risk of server cluster jitter, improving the overall system stability and reliability.

[0093] This application's embodiments optimize the fitness function calculation method for server cluster load evaluation metrics by improving the Cuckoo algorithm. This improvement enables the algorithm to more effectively help the cuckoo population escape local optima and iteratively calculate towards the global optimum. The ultimate goal is to determine the first threshold for the server cluster to transition from a static load balancing algorithm to a dynamic load balancing algorithm. This method not only enhances the algorithm's ability to search for the global optimum but also ensures that the server cluster can automatically and efficiently adjust its load balancing strategy under different load conditions, thereby achieving optimal resource utilization efficiency and service performance.

[0094] This application introduces an adaptive weight adjustment mechanism. By setting up a load monitoring and acquisition module, it collects the load information of server nodes in real time. When the load change of a node exceeds a set threshold, the weight of the node is dynamically adjusted to avoid server cluster jitter. This mechanism ensures that under high load conditions, task allocation is more reasonable and the load is more balanced, thereby enhancing the stability and performance of the cluster.

[0095] This application improves the Cuckoo Algorithm by introducing population entropy to control the step size factor, thereby enhancing the algorithm's global search capability and optimization accuracy. The improved Cuckoo Algorithm can more effectively escape local optima, avoid premature convergence, and thus find the global optimum. This enables the algorithm to more accurately determine the optimal load balancing strategy under high concurrency and high load conditions.

[0096] This application proposes a method for calculating a first threshold based on an improved cuckoo algorithm. By calculating the optimal time to switch from a static load balancing algorithm to a dynamic load balancing algorithm, the algorithm can flexibly adapt to different load conditions. This dynamic switching mechanism not only improves the algorithm's flexibility and adaptability but also reduces unnecessary resource consumption under low load conditions, thereby improving the overall efficiency of the system.

[0097] The technical solution of this application has a very broad market prospect. This technical solution innovatively combines an improved cuckoo algorithm and an adaptive weight adjustment mechanism, significantly improving the load balancing effect of server clusters under high concurrency and high load conditions, and making up for the shortcomings of related load balancing algorithms. This technical solution is characterized by low cost, high efficiency, and ease of promotion and application, and has extremely high practical value. It is not only suitable for large data centers and cloud service providers, but can also be extended to other industries that require high performance and high availability.

[0098] The solution adopted in this application can improve the performance and stability of the server cluster. By adaptively adjusting the weights of server nodes and using a dynamic weighted round-robin algorithm, cluster jitter can be effectively prevented, load balancing can be ensured, and the performance and stability of the server cluster can be improved. This will reduce service interruptions and performance degradation caused by uneven load, and enhance the user experience. For example, e-commerce platforms can achieve efficient load balancing during peak periods through this algorithm, ensuring that the user's shopping experience is not affected, thereby improving user satisfaction.

[0099] The solution adopted in this application embodiment can reduce the operation and maintenance costs of server clusters. The solution in this application embodiment can automatically adapt to different load conditions, reducing the workload of manual intervention and configuration management, and lowering operation and maintenance costs. By dynamically adjusting the weights of server nodes, the lifespan of hardware devices is extended, further saving on hardware replacement and maintenance costs.

[0100] The solutions adopted in this application can improve user experience. Efficient load balancing algorithms ensure high availability and low latency of services, enhancing user satisfaction. This is particularly important for enterprises that rely on highly reliable and high-performance services, helping to improve their market competitiveness and brand image. For example, online service platforms can use the solutions in this application to ensure service continuity and reliability, thereby improving user satisfaction.

[0101] In this embodiment of the application, by optimizing resource utilization, the overall efficiency of the server cluster can be improved, existing hardware resources can be better utilized, unnecessary hardware investment can be reduced, and the overall return on investment of assets can be increased.

[0102] The application scenarios of this application embodiment can include large enterprises and data centers. For example, this application embodiment can be applied to critical infrastructure such as cloud computing platforms, storage platforms, and financial transaction systems. These scenarios typically face high concurrency and high load demands. Adopting the solution of this application embodiment can significantly improve system performance and stability. For example, data centers can achieve efficient load balancing, ensuring that high-concurrency requests during shopping festivals can be processed quickly.

[0103] When using the solutions described in this application, customized load balancing solutions can also be provided to some industries. Although these industries are relatively small in scale, they still require efficient load balancing technology to ensure service quality and user experience. For example, online learning platforms can use this algorithm to ensure a smooth experience during peak hours, improving learning efficiency and teaching effectiveness.

[0104] In summary, the solutions presented in this application have broad market prospects, strong commercial application potential, and widespread market demand. These solutions significantly reduce operational costs and enhance user experience while improving server cluster performance and stability, and are expected to play a significant role in future server cluster management and load balancing.

[0105] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.

[0106] Based on the load balancing method proposed in the foregoing embodiments, this application also proposes a load balancing device, such as... Figure 3 As shown, the device includes: The determination module 301 is used to determine the real-time load of each server node based on the index values ​​of each load index of each server node in the current server cluster and the weight coefficient of each load index. The processing module 302 is configured to determine a first threshold based on the real-time load of each server node in the server cluster, wherein the first threshold is used to determine the target load balancing algorithm to be used; compare the current total real-time load of the server cluster with the first threshold, and determine the target load balancing algorithm to be used based on the comparison result; and allocate task requests based on the target load balancing algorithm.

[0107] In some embodiments, the processing module 302 determines a first threshold based on the real-time load of each server node, including: The fitness function of the Cuckoo algorithm is optimized based on the real-time load of each server node, the weight of each server node, and the preset initial hardware load index of the server cluster. The first threshold is solved using the optimized fitness function and the Cuckoo algorithm.

[0108] In some embodiments, the value of the optimized fitness function is negatively correlated with the sum of squares of the real-time loads of each server node, and positively correlated with the sum of the differences obtained by subtracting the initial hardware load metric from the real-time loads of each server node.

[0109] In some embodiments, the processing module 302 solves for the first threshold using the optimized fitness function and based on the cuckoo algorithm, including: The step size factor of the cuckoo algorithm is optimized based on the distribution entropy of the cuckoo population in the optimization search space. The first threshold is solved using the optimized fitness function, the optimized step size factor, and the cuckoo algorithm.

[0110] In some embodiments, the processing module 302 is further configured to determine the resource utilization rate of each server node based on the real-time load of each service node and the weight of each server node; determine a load dispersion parameter characterizing the load dispersion state of the server cluster based on the resource utilization rate of each server node and the average resource utilization rate of each server node; and update the weight of each server node if the load dispersion parameter is greater than or equal to a preset threshold.

[0111] In some embodiments, the processing module 302 updates the weight of each server node, including updating the weight of each server node according to the real-time load of each server node.

[0112] In some embodiments, the processing module 302 determines a load dispersion parameter characterizing the load dispersion state of the server cluster based on the resource utilization rate of each server node and the average resource utilization rate of each server node, including: determining a load balancing degree to describe the dispersion of the resource utilization rate of each server node based on the resource utilization rate of each server node and the average resource utilization rate of each server node; and determining the load dispersion parameter based on the average resource utilization rate of each server node and the load balancing degree.

[0113] In practical applications, the determination module 301 and the processing module 302 can be implemented based on a processor and a communication device.

[0114] It should be noted that the description of the above device embodiments is similar to the description of the above method embodiments, and has similar beneficial effects. For technical details not disclosed in the device embodiments of this application, please refer to the description of the method embodiments of this application for understanding.

[0115] It should be noted that, in the embodiments of this application, if the above-described methods are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, 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 and includes several instructions to cause a computer device (which may be a terminal, server, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware and software combination.

[0116] Correspondingly, this application embodiment further provides a computer program product, the computer program product including computer executable instructions, which are used to implement any of the load balancing methods provided in this application embodiment.

[0117] Accordingly, this application embodiment further provides a computer storage medium storing computer-executable instructions, which are used to implement any of the load balancing methods provided in the above embodiments.

[0118] This application also provides an electronic device. Figure 4 This is a schematic diagram of the composition structure of an electronic device provided in an embodiment of this application, as shown below. Figure 4 As shown, the electronic device 40 may include: Memory 401 is used to store executable instructions; The processor 402 is used to implement any of the above-described load balancing methods when executing executable instructions stored in the memory 401.

[0119] The processor 402 mentioned above can be at least one of ASIC, DSP, DSPD, PLD, FPGA, CPU, controller, microcontroller, and microprocessor.

[0120] The aforementioned computer-readable storage medium and memory 401 may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM), etc.; or it may be various terminals including one or any combination of the above-mentioned memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc.

[0121] In some embodiments, the functions or modules of the apparatus provided in this application can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0122] The description of the various embodiments above tends to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to, and for the sake of brevity, they will not be repeated here.

[0123] The methods disclosed in the various method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.

[0124] The features disclosed in the various product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.

[0125] The features disclosed in the various method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method or device embodiments.

[0126] 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 this application, in essence, 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, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0127] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application 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 this application without departing from the spirit and scope of the claims. All of these forms are within the protection scope of this application.

Claims

1. A load balancing method, characterized in that, The method includes: The real-time load of each server node is determined based on the load metric values ​​of each server node in the current server cluster and the weight coefficient of each load metric. A first threshold is determined based on the real-time load of each server node in the server cluster, and the first threshold is used to determine the target load balancing algorithm to be used. The total real-time load of the current server cluster is compared with a first threshold, and the target load balancing algorithm is determined based on the comparison result. Task requests are allocated based on the target load balancing algorithm.

2. The method according to claim 1, characterized in that, The step of determining the first threshold based on the real-time load of each server node includes: The fitness function of the Cuckoo algorithm is optimized based on the real-time load of each server node, the weight of each server node, and the preset initial hardware load index of the server cluster. The first threshold is solved using the optimized fitness function and the Cuckoo algorithm.

3. The method according to claim 2, characterized in that, The value of the optimized fitness function is negatively correlated with the sum of squares of the real-time loads of each server node, and positively correlated with the sum of the differences obtained by subtracting the initial hardware load index from the real-time loads of each server node.

4. The method according to claim 2, characterized in that, The step of solving the first threshold using the optimized fitness function and based on the cuckoo algorithm includes: The step size factor of the cuckoo algorithm is optimized based on the distribution entropy of the cuckoo population in the optimization search space. The first threshold is solved using the optimized fitness function, the optimized step size factor, and the cuckoo algorithm.

5. The method according to claim 2, characterized in that, The method further includes: The resource utilization rate of each server node is determined based on the real-time load of each service node and the weight of each server node. Based on the resource utilization rate of each server node and the average resource utilization rate of each server node, a load dispersion parameter characterizing the load dispersion state of the server cluster is determined. If the load dispersion parameter is greater than or equal to a preset threshold, the weight of each server node is updated.

6. The method according to claim 5, characterized in that, The updating of the weight of each server node includes: The weight of each server node is updated based on its real-time load.

7. The method according to claim 5, characterized in that, The step of determining the load dispersion parameter characterizing the load dispersion state of the server cluster based on the resource utilization rate of each server node and the average resource utilization rate of each server node includes: Based on the resource utilization of each server node and the average resource utilization of each server node, a load balancing degree is determined to describe the dispersion of the resource utilization of each server node. The load dispersion parameter is determined based on the average resource utilization of each server node and the load balancing degree.

8. An electronic device, characterized in that, The electronic device includes a processor and a memory for storing computer programs capable of running on the processor; wherein, The processor is used to run the computer program to perform the method according to any one of claims 1 to 7.

9. A computer storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the method described in any one of claims 1 to 7.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1 to 7.