Load balancing method and device, electronic equipment, storage medium and product
By introducing Gausscauchy's mutation strategy and parameter adaptive strategy into the differential evolution algorithm, the load balancing and link load balancing are optimized, and the server processing request with the largest dynamic weight is determined, which solves the load of the differential evolution algorithm in high concurrency situations. The problem of unsatisfactory balance effect improves the load balancing effect.
Patent Information
- Application Number
- CN202410989367.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2044-07-23
AI Technical Summary
Dynamic load balancing based on differential evolution algorithm is not effective when the number of concurrent connection requests increases, resulting in a large gap between the actual number of concurrent connections and the number of concurrent connection requests, affecting the load balancing effect.
The Gausscaucasian mutation strategy and parameter adaptive strategy are used to process the differential evolution algorithm, optimize the mutation operation and scale factor and cross probability, obtain the load balancing value and link load balancing value of the server cluster, determine the dynamic weight, and finally determine the The server with the largest dynamic weights handles the current connection request.
By optimizing the differential evolution algorithm, the server with the largest dynamic weight in the server cluster can be found faster and more accurately, reducing the gap between the number of concurrent connection requests and the actual number of concurrent connections, and improving the effect of load balancing.
Smart Images

Figure CN118945169A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of load balancing, and in particular to a load balancing method, device, electronic device, storage medium and product. Background Art
[0002] In related dynamic load balancing solutions based on differential evolution algorithms, the load balancing effect is usually measured based on the difference between the number of concurrent connection requests and the actual number of concurrent connections. When the number of concurrent connection requests is small, the number of concurrent connection requests and the actual number of concurrent connections are not much different, and the dynamic load balancing effect based on the differential evolution algorithm is better; however, as the number of concurrent connection requests increases, the number of concurrent connection requests and the actual number of concurrent connections differ greatly, resulting in unsatisfactory dynamic load balancing effect based on the differential evolution algorithm. Summary of the invention
[0003] The present disclosure provides a load balancing method, device, electronic device, storage medium and product to solve the problems in the related art.
[0004] A first aspect of the present disclosure provides a load balancing method, the method comprising:
[0005] A Gaussian-Cauchy mutation strategy is used to perform a first process on a mutation operation in a differential evolution algorithm, and a parameter adaptive strategy is used to perform a second process on a proportional factor and a crossover probability in the differential evolution algorithm to obtain a processed differential evolution algorithm;
[0006] Obtain the load balance value of the server cluster and the link load balance value of the server cluster;
[0007] Adding the load balance value of the server cluster and the link load balance value of the server cluster to obtain the objective function value of the differential evolution algorithm after processing;
[0008] Using the processed differential evolution algorithm to obtain the dynamic weight of each server in the server cluster when the objective function value is minimum;
[0009] The server with the largest dynamic weight in the server cluster is determined as the server for processing the current connection request.
[0010] In one embodiment, a first process is performed on a mutation operation in a differential evolution algorithm using a Gaussian Cauchy mutation strategy, including:
[0011] Obtaining an objective function value of each individual in the differential evolution algorithm, and a first random number corresponding to each individual in a first preset number of individuals in the differential evolution algorithm, wherein the objective function value of each individual is determined by the sum of the load balance value of the server cluster and the link load balance value of the server cluster, and the first preset number of individuals is used to indicate individuals whose objective function values are not lower than a preset objective function threshold;
[0012] If the first random number corresponding to the individual is less than a first preset threshold, a Gaussian mutation strategy is used to perform a first process on the mutation operation of the individual in the differential evolution algorithm;
[0013] If the first random number corresponding to the individual is not less than a first preset threshold, a Cauchy mutation strategy is used to perform a first process on the mutation operation of the individual in the differential evolution algorithm.
[0014] In one embodiment, a second process is performed on the scale factor and the crossover probability in the differential evolution algorithm using a parameter adaptive strategy, including:
[0015] Obtaining an objective function value of each individual in the differential evolution algorithm, and a second random number, a third random number, and a fourth random number corresponding to each individual in a second preset number of individuals in the differential evolution algorithm, wherein the objective function value of each individual is determined by the sum of the load balance value of the server cluster and the link load balance value of the server cluster, and the second preset number of individuals is used to indicate individuals whose objective function values are lower than a preset objective function threshold;
[0016] If the selection operation in the differential evolution algorithm fails and the second random number corresponding to the individual is less than the second preset threshold, the fourth random number corresponding to the individual is used as a new proportional factor in the parameter adaptive strategy; and if the selection operation in the differential evolution algorithm fails and the third random number corresponding to the individual is less than the third preset threshold, the third random number corresponding to the individual is used as a new crossover probability in the parameter adaptive strategy;
[0017] If the selection operation in the differential evolution algorithm fails and the second random value corresponding to the individual is not less than the second preset threshold, the original proportional factor of the individual is used as the new proportional factor in the parameter adaptive strategy; and if the selection operation in the differential evolution algorithm fails and the third random value corresponding to the individual is not less than the third preset threshold, the original crossover probability of the individual is used as the new crossover probability in the parameter adaptive strategy;
[0018] The new proportional factor in the parameter adaptive strategy and the new crossover probability in the parameter adaptive strategy are used to perform a second process on the proportional factor and the crossover probability of the individual in the differential evolution algorithm.
[0019] In one embodiment, obtaining a load balancing value of a server cluster includes:
[0020] Get the number of servers in the server cluster and the real-time utilization of each server in the server cluster;
[0021] Comparing the sum of the real-time utilization of each server in the server cluster with the number of servers in the server cluster to obtain an average value of the real-time utilization of all servers in the server cluster;
[0022] Subtracting an average of the real-time utilization rates of all servers in the server cluster from the real-time utilization rate of each server in the server cluster to obtain a first difference value of each server in the server cluster;
[0023] Sum the squares of the first difference values of each server in the server cluster to obtain a first sum value of the server cluster;
[0024] The first sum value of the server cluster is compared with the number of servers in the server cluster to obtain a load balancing value of the server cluster.
[0025] In one embodiment, obtaining a link load balancing value of a server cluster includes:
[0026] Obtain the number of servers in the server cluster and the used bandwidth of each link in the server cluster;
[0027] Comparing the sum of the used bandwidths of each link of the server cluster with the number of servers in the server cluster to obtain an average value of the used bandwidths of all links of the server cluster;
[0028] Subtracting an average value of the used bandwidths of all links of the server cluster from the used bandwidth of each link of the server cluster to obtain a second difference value of each link of the server cluster;
[0029] The sum of the second difference values of each link of the server cluster is compared with the number of servers in the server cluster to obtain a link load balancing degree value of the server cluster.
[0030] In one embodiment, the dynamic weight of each server in the server cluster is obtained by using the processed differential evolution algorithm when the objective function value is minimized, including:
[0031] Using the processed differential evolution algorithm to obtain the real-time utilization rate of each server in the server cluster and the comprehensive performance of each server in the server cluster when the objective function value is minimum;
[0032] Multiplying the comprehensive performance of each server in the server cluster by the real-time utilization rate of each server in the server cluster to obtain a first product of each server in the server cluster;
[0033] Subtract 1 from the first product of each server in the server cluster to obtain a third difference value for each server in the server cluster;
[0034] Sum the third difference value of each server in the server cluster to obtain a second sum value of the server cluster;
[0035] The third difference value of each server in the server cluster is compared with the second sum value of the server cluster to obtain the dynamic weight of each server in the server cluster.
[0036] A second aspect of the present disclosure provides a load balancing device, the device comprising:
[0037] A processing unit, used to perform a first processing on the mutation operation in the differential evolution algorithm using a Gaussian Cauchy mutation strategy, and to perform a second processing on the proportional factor and the crossover probability in the differential evolution algorithm using a parameter adaptive strategy, to obtain a processed differential evolution algorithm;
[0038] A first acquisition unit, used to acquire a load balance value of a server cluster and a link load balance value of the server cluster;
[0039] a summing unit, configured to sum the load balancing degree value of the server cluster and the link load balancing degree value of the server cluster to obtain a processed objective function value of the differential evolution algorithm;
[0040] A second acquisition unit is used to use the processed differential evolution algorithm to acquire the dynamic weight of each server in the server cluster when the objective function value is minimum;
[0041] The determination unit is used to determine that the server with the largest dynamic weight in the server cluster is the server for processing the current connection request.
[0042] A third aspect of the present disclosure provides an electronic device, including:
[0043] At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in the embodiment of the first aspect of the present disclosure.
[0044] The fourth aspect embodiment of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method described in the first aspect embodiment of the present disclosure.
[0045] The fifth aspect embodiment of the present disclosure provides a computer program product, including a computer program, which implements the method described in the first aspect embodiment of the present disclosure when executed by a processor.
[0046] In summary, the present disclosure proposes a load balancing method, which includes: using a Gaussian Cauchy mutation strategy to perform a first processing on the mutation operation in the differential evolution algorithm, and using a parameter adaptive strategy to perform a second processing on the proportional factor and the crossover probability in the differential evolution algorithm to obtain a processed differential evolution algorithm; obtaining a load balancing value of a server cluster and a link load balancing value of the server cluster; summing the load balancing value of the server cluster and the link load balancing value of the server cluster to obtain an objective function value of the processed differential evolution algorithm; using the processed differential evolution algorithm to obtain the dynamic weight of each server in the server cluster when the objective function value is minimum; determining the server with the largest dynamic weight in the server cluster as the server that processes the current connection request.
[0047] According to the scheme provided by the present disclosure, a differential evolution algorithm is obtained by first processing the mutation operation in the differential evolution algorithm using a Gaussian Cauchy mutation strategy, and a proportional factor and a crossover probability in the differential evolution algorithm are second processed using a parameter adaptive strategy; a load balancing value of a server cluster and a link load balancing value of a server cluster are obtained; the load balancing value of the server cluster and the link load balancing value of the server cluster are summed to obtain an objective function value of the differential evolution algorithm after processing; the dynamic weight of each server in the server cluster is obtained by using the processed differential evolution algorithm when the objective function value is minimum; and the server is determined. The server with the largest dynamic weight in the cluster is the server that processes the current connection request. Since the mutation operation in the differential evolution algorithm is related to the search range in the differential evolution algorithm, and the proportional factor and crossover probability in the differential evolution algorithm are related to the convergence speed of the differential evolution algorithm search, the processed differential evolution algorithm can find the server with the largest dynamic weight in the server cluster more quickly and accurately. By using the server with the largest dynamic weight in the server cluster as the server that processes the current connection request each time, the actual number of concurrent connections in the server cluster can be increased, and the gap between the number of concurrent connection requests and the actual number of concurrent connections can be reduced, thereby improving the load balancing effect.
[0048] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0050] Figure 1 A flow chart of a load balancing method provided in an embodiment of the present disclosure;
[0051] Figure 2 A schematic flow chart of a method for performing a first processing on a mutation operation of an individual in a differential evolution algorithm provided by an embodiment of the present disclosure;
[0052] Figure 3 A flow chart of a method for performing a second processing on a proportional factor and a crossover probability of an individual in a differential evolution algorithm provided by an embodiment of the present disclosure;
[0053] Figure 4 A flow chart of a method for obtaining a load balancing value of a server cluster provided in an embodiment of the present disclosure;
[0054] Figure 5 A flow chart of a method for obtaining a link load balancing value of a server cluster provided in an embodiment of the present disclosure;
[0055] Figure 6 A flowchart of a method for obtaining a dynamic weight of each server in a server cluster provided by an embodiment of the present disclosure;
[0056] Figure 7 A flow chart of a load balancing method provided for an application example of the present disclosure;
[0057] Figure 8 A schematic diagram of the structure of a load balancing device provided in an embodiment of the present disclosure;
[0058] Fig. 9 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0059] Embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.
[0060] In related dynamic load balancing solutions based on differential evolution algorithms, the load balancing effect is usually measured based on the difference between the number of concurrent connection requests and the actual number of concurrent connections. When the number of concurrent connection requests is small, the number of concurrent connection requests and the actual number of concurrent connections are not much different, and the dynamic load balancing effect based on the differential evolution algorithm is better; however, as the number of concurrent connection requests increases, the number of concurrent connection requests and the actual number of concurrent connections differ greatly, resulting in unsatisfactory dynamic load balancing effect based on the differential evolution algorithm.
[0061] The following is a brief introduction to a load balancing method in related technologies:
[0062] The scheme proposes load balancing indicators including the comprehensive load balancing degree of the server group and the link load balancing degree of the server group; in response to any load balancing indicator exceeding the corresponding set threshold, the differential evolution algorithm is used for dynamic load balancing; the differential evolution algorithm aims to minimize the sum of all load balancing indicators, the dynamic weight of the server is the optimization amount, and the mutation rate and crossover rate in the differential evolution algorithm are adaptively adjusted mutation rates and crossover rates. When the comprehensive load balancing degree of the server group and the link load balancing degree of the server group do not exceed the preset threshold, the server with the smallest load is selected for request processing.
[0063] The above solution has the following defects:
[0064] In the dynamic load balancing method and system based on the differential evolution algorithm, the basic differential evolution algorithm is used to minimize the sum of load balancing indicators, that is, to minimize the sum of the comprehensive load balancing degree of the server group and the link load balancing degree of the server group. The related scheme has a better effect when the number of concurrent request connections is small, but with the increase in the number of connection requests and the increase in scale, the actual number of concurrent connections and the number of concurrent request connections differ greatly, resulting in unsatisfactory load balancing effect.
[0065] In order to solve the defects in the related art, the present invention uses a Gaussian Cauchy mutation strategy to perform a first processing on the mutation operation in the differential evolution algorithm, and uses a parameter adaptive strategy to perform a second processing on the proportional factor and the crossover probability in the differential evolution algorithm to obtain a processed differential evolution algorithm; obtains a load balancing value of a server cluster and a link load balancing value of the server cluster; sums the load balancing value of the server cluster and the link load balancing value of the server cluster to obtain an objective function value of the processed differential evolution algorithm; uses the processed differential evolution algorithm to obtain the dynamic weight of each server in the server cluster when the objective function value is minimum; determines the server The server with the largest dynamic weight in the server cluster is the server that processes the current connection request. Since the mutation operation in the differential evolution algorithm is related to the search range in the differential evolution algorithm, and the proportional factor and crossover probability in the differential evolution algorithm are related to the convergence speed of the differential evolution algorithm search, the processed differential evolution algorithm can find the server with the largest dynamic weight in the server cluster more quickly and accurately. By using the server with the largest dynamic weight in the server cluster as the server that processes the current connection request each time, the actual number of concurrent connections in the server cluster can be increased, and the gap between the number of concurrent connection requests and the actual number of concurrent connections can be reduced, thereby improving the load balancing effect.
[0066] The present disclosure is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0067] like Figure 1 As shown, Figure 1 The load balancing method provided by the embodiment of the present disclosure comprises the following steps:
[0068] Step 101, using a Gaussian Cauchy mutation strategy to perform a first process on the mutation operation in the differential evolution algorithm, and using a parameter adaptive strategy to perform a second process on the proportional factor and the crossover probability in the differential evolution algorithm, to obtain a processed differential evolution algorithm;
[0069] In one embodiment, the differential evolution algorithm includes a population initialization operation, a mutation operation, a crossover operation, and a selection operation, wherein the population initialization operation is used to generate possible solutions, the mutation operation uses the differential information between individuals in the population to guide the search process, the crossover operation is used to increase the diversity of the population, and the selection operation is used to retain better individuals in the population.
[0070] In one embodiment, the Gaussian-Cauchy mutation strategy includes a Gaussian mutation strategy and a Cauchy mutation strategy.
[0071] In one embodiment, the parameter adaptation strategy includes a scaling factor adaptation strategy and a crossover probability adaptation strategy.
[0072] In one embodiment, the size of the proportional factor in the differential evolution algorithm affects the search step size of individuals in the population. Specifically, when the proportional factor in the differential evolution algorithm is too large, the convergence speed of the differential evolution algorithm will be too fast. When the proportional factor in the differential evolution algorithm is too small, the convergence speed of the differential evolution algorithm will be too slow.
[0073] In one embodiment, the crossover probability in the differential evolution algorithm affects the diversity of the population. Specifically, when the crossover probability in the differential evolution algorithm is large, the diversity of the population is good. However, when the crossover probability in the differential evolution algorithm is too large, it will cause the differential evolution algorithm to mature prematurely.
[0074] Step 102, obtaining a load balance value of the server cluster and a link load balance value of the server cluster;
[0075] In one embodiment, the load balance value of the server cluster can be obtained by obtaining the difference between the real-time utilization and the average utilization of each server in the server cluster, and the link load balance value of the server cluster can be obtained by obtaining the difference between the used bandwidth of each link in the server cluster and the average used bandwidth of all links.
[0076] In one embodiment, the load balance value of the server cluster is used to indicate the degree of deviation between the real-time utilization and the average utilization of the server cluster within a specified sampling time. The link load balance value of the server cluster is equivalent to indicating the degree of deviation between the used bandwidth of each link in the server cluster and the average used bandwidth of all links within the specified sampling time.
[0077] Step 103, summing the load balance value of the server cluster and the link load balance value of the server cluster to obtain the objective function value of the differential evolution algorithm after processing;
[0078] In one embodiment, by summing the load balance value of the server cluster and the link load balance value of the server cluster, the processed objective function value of the differential evolution algorithm is obtained, and the individual in the population corresponding to the objective function value can be directly selected according to the size of the objective function value.
[0079] Step 104, using the processed differential evolution algorithm to obtain the dynamic weight of each server in the server cluster when the objective function value is minimum;
[0080] In one embodiment, the size of the dynamic weight of each server in the server cluster is determined by the real-time utilization of each server in the server cluster and the size of the comprehensive performance of each server in the server cluster.
[0081] In one embodiment, the processed differential evolution algorithm is used to obtain the individual in the population corresponding to the minimum objective function value when the objective function value is minimum, and the dynamic weight of each server in the server cluster corresponding to the individual dimension is determined.
[0082] Step 105: determine the server with the largest dynamic weight in the server cluster as the server for processing the current connection request.
[0083] In one embodiment, the server with the largest dynamic weight is used to indicate the server with the smallest current load.
[0084] In one embodiment, by determining each time that the server with the largest dynamic weight in the server cluster is the server that processes the current connection request, the actual number of concurrent connections in the server cluster can be increased, and the gap between the number of concurrent connection requests and the actual number of concurrent connections can be reduced, thereby improving the load balancing effect.
[0085] In one embodiment, if Figure 2 As shown, the Gaussian Cauchy mutation strategy is used to perform the first processing on the mutation operation in the differential evolution algorithm, including:
[0086] Step 201, obtaining an objective function value of each individual in the differential evolution algorithm, and a first random number corresponding to each individual in a first preset number of individuals in the differential evolution algorithm;
[0087] In one embodiment, the objective function value of each individual is determined by the sum of the load balance value of the server cluster and the link load balance value of the server cluster.
[0088] In one embodiment, the first preset number of individuals is used to indicate individuals whose objective function values are not lower than a preset objective function threshold.
[0089] In one embodiment, a random number function may be used to obtain a first random number corresponding to each individual in a first preset number of individuals in the differential evolution algorithm.
[0090] Step 202: If the first random number corresponding to the individual is less than a first preset threshold, a Gaussian mutation strategy is used to perform a first process on the mutation operation of the individual in the differential evolution algorithm;
[0091] In one embodiment, the first preset threshold is a preset random number threshold, and the first preset threshold is usually 0.5, indicating that the probability of using a Gaussian mutation strategy to perform a first processing on the mutation operation of the individual in the differential evolution algorithm is the same as the probability of using a Cauchy mutation strategy to perform a first processing on the mutation operation of the individual in the differential evolution algorithm.
[0092] In one embodiment, since the Gaussian distribution is relatively concentrated and the search step size is small, by adopting the Gaussian mutation strategy to perform the first processing on the mutation operation of the first preset number of individuals in the differential evolution algorithm, the global optimal individual can be searched finely near the local optimal individual, thereby speeding up the search.
[0093] Step 203: If the first random number corresponding to the individual is not less than a first preset threshold, a Cauchy mutation strategy is used to perform a first process on the mutation operation of the individual in the differential evolution algorithm.
[0094] In one embodiment, since the Cauchy distribution is relatively dispersed and the search step is large, the Cauchy mutation strategy is used to perform a first process on the mutation operation of the individual in the differential evolution algorithm, so that the search range can be expanded around the optimal individual and the population diversity can be improved.
[0095] In one embodiment, if Figure 3 As shown, the proportional factor and crossover probability in the differential evolution algorithm are processed in the second step using a parameter adaptive strategy, including:
[0096] Step 301, obtaining the objective function value of each individual in the differential evolution algorithm, and the second random number, the third random number, and the fourth random number corresponding to each individual in the second preset number of individuals in the differential evolution algorithm;
[0097] In one embodiment, the objective function value of each individual is determined by the sum of the load balance value of the server cluster and the link load balance value of the server cluster.
[0098] In one embodiment, the second preset number of individuals is used to indicate individuals whose objective function values are lower than a preset objective function threshold.
[0099] In one embodiment, a random number function may be used to obtain a second random number, a third random number, and a fourth random number corresponding to each individual in a second preset number of individuals in the differential evolution algorithm.
[0100] In one embodiment, the second random number, the third random number, and the fourth random number corresponding to the same individual may be the same or different. Taking the use of a random number function to generate a value between 0 and 1 as an example, a random number function may be used to obtain a value between 0 and 1, and the value may be used as the second random number, the third random number, and the fourth random number corresponding to the individual. Alternatively, a random number function may be used to obtain three values between 0 and 1, and the aforementioned three values may be used as the second random number, the third random number, and the fourth random number corresponding to the individual, respectively.
[0101] In one embodiment, the second random number, the third random number, and the fourth random number corresponding to different individuals may be the same or different. Taking the use of a random number function to generate a value between 0 and 1 as an example, a random number function may be used to obtain three values between 0 and 1, and the above three values may be respectively used as the second random number, the third random number, and the fourth random number corresponding to multiple individuals.
[0102] Step 302, if the selection operation in the differential evolution algorithm fails and the second random number corresponding to the individual is less than the second preset threshold, the fourth random number corresponding to the individual is used as a new proportional factor in the parameter adaptive strategy; and if the selection operation in the differential evolution algorithm fails and the third random number corresponding to the individual is less than the third preset threshold, the third random number corresponding to the individual is used as a new crossover probability in the parameter adaptive strategy;
[0103] In one embodiment, the selection operation failure in the differential evolution algorithm refers to that the individual performance after the mutation operation is not better than the individual performance before the mutation operation.
[0104] In one embodiment, the second preset threshold and the third preset threshold are both preset random number thresholds.
[0105] In one embodiment, the second preset threshold and the third preset threshold may be the same or different. For example, the second preset threshold and the third preset threshold may both be determined to be 0.1, or the second preset threshold may be determined to be 0.1 and the third preset threshold may be determined to be 0.5. This is not limited in the present disclosure.
[0106] In one embodiment, if the selection operation in the differential evolution algorithm fails and the second random number corresponding to the individual is less than the second preset threshold, the fourth random number corresponding to the individual is used as the new proportional factor in the parameter adaptive strategy; and if the selection operation in the differential evolution algorithm fails and the third random number value corresponding to the individual is less than the third preset threshold, the third random number corresponding to the individual is used as the new crossover probability in the parameter adaptive strategy.
[0107] In one embodiment, if the selection operation in the differential evolution algorithm fails and the second random number corresponding to the individual is less than the second preset threshold, the sum of the fourth random number corresponding to the individual and the first preset coefficient may be used as a new proportional factor in the parameter adaptation strategy; and if the selection operation in the differential evolution algorithm fails and the third random number value corresponding to the individual is less than the third preset threshold, the sum of the third random number corresponding to the individual and the second preset coefficient may be used as a new crossover probability in the parameter adaptation strategy.
[0108] In one embodiment, if the selection operation in the differential evolution algorithm fails and the second random number corresponding to the individual is less than the second preset threshold, the weighted sum of the fourth random number corresponding to the individual and the first preset coefficient can also be used as a new proportional factor in the parameter adaptation strategy; and if the selection operation in the differential evolution algorithm fails and the third random number value corresponding to the individual is less than the third preset threshold, the weighted sum of the third random number corresponding to the individual and the second preset coefficient can also be used as a new crossover probability in the parameter adaptation strategy.
[0109] Step 303, if the selection operation in the differential evolution algorithm fails and the second random value corresponding to the individual is not less than the second preset threshold, the original proportional factor of the individual is used as the new proportional factor in the parameter adaptive strategy; and if the selection operation in the differential evolution algorithm fails and the third random value corresponding to the individual is not less than the third preset threshold, the original crossover probability of the individual is used as the new crossover probability in the parameter adaptive strategy;
[0110] In one embodiment, if the selection operation in the differential evolution algorithm fails and the second random value corresponding to the individual is not less than the second preset threshold, the original proportional factor of the individual is used as the new proportional factor in the parameter adaptive strategy; and if the selection operation in the differential evolution algorithm fails and the third random value corresponding to the individual is not less than the third preset threshold, the original crossover probability of the individual is used as the new crossover probability in the parameter adaptive strategy, so that the original population information can be retained while speeding up the search for the optimal individual.
[0111] Step 304: perform a second process on the scale factor and crossover probability of the individual in the differential evolution algorithm using the new scale factor in the parameter adaptive strategy and the new crossover probability in the parameter adaptive strategy.
[0112] In one embodiment, by performing a second process on the scale factor and crossover probability of the individual in the differential evolution algorithm using a new scale factor in the parameter adaptive strategy and a new crossover probability in the parameter adaptive strategy, the original population information can be retained while speeding up the search for the optimal individual.
[0113] In one embodiment, if Figure 4 As shown, obtain the load balancing value of the server cluster, including:
[0114] Step 401, obtaining the number of servers in the server cluster and the real-time utilization rate of each server in the server cluster;
[0115] In one embodiment, the number of servers in the server cluster is usually two or more.
[0116] In one embodiment, the number of servers in the server cluster may be obtained from server management software.
[0117] In one embodiment, the number of servers in the server cluster may also be obtained by querying network devices (routers, switches, etc.).
[0118] In one embodiment, the real-time utilization of each server in the server cluster may be obtained by determining the sum of the CPU utilization, memory utilization, disk utilization, and bandwidth utilization of each server in the current cycle.
[0119] In one embodiment, the real-time utilization of each server in the server cluster may also be obtained by determining the weighted sum of the CPU utilization, memory utilization, disk utilization, and bandwidth utilization of each server in the current cycle.
[0120] In one embodiment, the sum of the weight of CPU utilization, the weight of memory utilization, the weight of disk utilization, and the weight of bandwidth utilization is 1.
[0121] In one embodiment, the CPU utilization and memory utilization of the server may be obtained by using the top command, the disk utilization may be obtained by using the df command, and the bandwidth utilization may be obtained by using the nload command.
[0122] In one embodiment, the real-time utilization of each server in the server cluster may be the same or different.
[0123] Step 402, comparing the sum of the real-time utilization of each server in the server cluster with the number of servers in the server cluster to obtain an average value of the real-time utilization of all servers in the server cluster;
[0124] In one embodiment, a larger average value of the real-time utilization of all servers indicates a higher efficiency of the server cluster in computing, storing, and utilizing network resources.
[0125] Step 403, subtracting the average value of the real-time utilization of all servers in the server cluster from the real-time utilization of each server in the server cluster to obtain a first difference value of each server in the server cluster;
[0126] In one embodiment, by subtracting the average value of the real-time utilization of all servers in the server cluster from the real-time utilization of each server in the server cluster, a first difference value of each server in the server cluster is obtained, and the deviation between the real-time utilization of each server and the average value of the real-time utilization of all servers can be determined.
[0127] Step 404, summing the squares of the first difference values of each server in the server cluster to obtain a first sum value of the server cluster;
[0128] Step 405: Compare the first sum value of the server cluster with the number of servers in the server cluster to obtain a load balance value of the server cluster.
[0129] In one embodiment, the load balancing degree value of the server cluster is used to measure the load balancing capability of the server cluster.
[0130] In one embodiment, after obtaining the load balance value of the server cluster, the load balance value of the server cluster in the current sampling time can be obtained by determining the sum of the load balance values of the server cluster at each moment in the sampling time.
[0131] In one embodiment, if Figure 5 As shown, obtain the link load balancing value of the server cluster, including:
[0132] Step 501, obtaining the number of servers in the server cluster and the used bandwidth of each link of the server cluster;
[0133] In one embodiment, the used bandwidth of each link of the server cluster may be obtained by using the top command.
[0134] In one embodiment, the used bandwidth of each link of the server cluster may also be obtained by using the nload command.
[0135] In one embodiment, the used bandwidth of each link of the server cluster may be the same or different.
[0136] Step 502, comparing the sum of the used bandwidths of each link of the server cluster with the number of servers in the server cluster to obtain an average value of the used bandwidths of all links of the server cluster;
[0137] In one embodiment, a larger average value of the used bandwidths of all links indicates less remaining available bandwidth in the server cluster.
[0138] Step 503: Subtract the average value of the used bandwidths of all links of the server cluster from the used bandwidth of each link of the server cluster to obtain a second difference value of each link of the server cluster;
[0139] In one embodiment, by subtracting the average value of the used bandwidth of all links in the server cluster from the used bandwidth of each link in the server cluster to obtain a second difference value for each link in the server cluster, the deviation between the used bandwidth of each link in the server cluster and the average value of the used bandwidth of all links in the server cluster can be obtained.
[0140] Step 504: compare the sum of the second difference values of each link of the server cluster with the number of servers in the server cluster to obtain a link load balancing value of the server cluster.
[0141] In one embodiment, the link load balance value of the server cluster is used to indicate the degree of balance of distribution of connection requests on different links of the server cluster.
[0142] In one embodiment, after obtaining the link load balance value of the server cluster, the link load balance value of the server cluster in the current sampling time can be obtained by determining the link load balance value of the server cluster at each moment in the sampling time.
[0143] In one embodiment, if Figure 6 As shown, the dynamic weight of each server in the server cluster is obtained by using the processed differential evolution algorithm when the objective function value is minimum, including:
[0144] Step 601, using the processed differential evolution algorithm to obtain the real-time utilization rate of each server in the server cluster and the comprehensive performance of each server in the server cluster when the objective function value is minimum;
[0145] In one embodiment, the comprehensive performance of each server in the server cluster is determined by the server's CPU load capacity, memory load capacity, disk load capacity and bandwidth load capacity. Specifically, the comprehensive performance of each server in the server cluster can be obtained by the sum of the products of the server's CPU load capacity, memory load capacity, disk load capacity and bandwidth load capacity and the corresponding impact weights.
[0146] Step 602, multiplying the comprehensive performance of each server in the server cluster and the real-time utilization rate of each server in the server cluster to obtain a first product of each server in the server cluster;
[0147] In one embodiment, by multiplying the comprehensive performance of each server in the server cluster and the real-time utilization of each server in the server cluster, the load size of each server in the server cluster can be obtained, that is, the size of the first product of each server reflects the load size of the corresponding server.
[0148] Step 603, subtracting 1 from the first product of each server in the server cluster to obtain a third difference value of each server in the server cluster;
[0149] In one embodiment, the remaining load capacity of each server can be obtained by subtracting 1 from the first product of each server in the server cluster, that is, the size of the third difference value of each server in the server cluster reflects the size of the remaining load capacity of each server.
[0150] Step 604, summing the third difference value of each server in the server cluster to obtain a second sum value of the server cluster;
[0151] In one embodiment, the size of the second sum value of the server cluster reflects the size of the remaining total load capacity of the server cluster.
[0152] Step 605: Compare the third difference value of each server in the server cluster with the second sum value of the server cluster to obtain the dynamic weight of each server in the server cluster.
[0153] In one embodiment, the lower the real-time utilization of the servers in the server cluster, the higher the comprehensive performance of the servers in the server cluster, and the higher the dynamic weight of the servers in the server cluster.
[0154] In one embodiment, the smaller the load of the server in the server cluster, the greater the dynamic weight of the server in the server cluster.
[0155] In one embodiment, the sum of the dynamic weights of all servers in the server cluster is 1.
[0156] In one embodiment, each time after the dynamic weight of each server in the server cluster is obtained, it is necessary to find the server with the smallest dynamic weight in the server cluster.
[0157] In summary, the solution provided by the present disclosure is:
[0158] Firstly, the mutation operation in the differential evolution algorithm is first processed by using the Gaussian Cauchy mutation strategy, and the proportional factor and the crossover probability in the differential evolution algorithm are second processed by using the parameter adaptive strategy to obtain the processed differential evolution algorithm; the load balancing degree value of the server cluster and the link load balancing degree value of the server cluster are obtained; the load balancing degree value of the server cluster and the link load balancing degree value of the server cluster are summed to obtain the objective function value of the processed differential evolution algorithm; the dynamic weight of each server in the server cluster is obtained when the objective function value is minimum by using the processed differential evolution algorithm; and the dynamic weight of each server in the server cluster is determined. The server with the largest dynamic weight is the server that processes the current connection request. Since the mutation operation in the differential evolution algorithm is related to the search range in the differential evolution algorithm, and the proportional factor and crossover probability in the differential evolution algorithm are related to the convergence speed of the differential evolution algorithm search, the processed differential evolution algorithm can find the server with the largest dynamic weight in the server cluster more quickly and accurately. By using the server with the largest dynamic weight in the server cluster as the server that processes the current connection request each time, the actual number of concurrent connections in the server cluster can be increased, and the gap between the number of concurrent connection requests and the actual number of concurrent connections can be reduced, thereby improving the load balancing effect.
[0159] Secondly, by using the new proportional factor in the parameter adaptive strategy and the new crossover probability in the parameter adaptive strategy to perform a second processing on the proportional factor and the crossover probability of the individual in the differential evolution algorithm, the original population information can be retained while speeding up the search for the optimal individual.
[0160] The load balancing method provided by the present disclosure is further described below with an application example:
[0161] like Figure 7 As shown, Figure 7 A flow chart of a load balancing method provided for an application example of the present disclosure. The load balancing method provided for an application example of the present disclosure comprises the following steps:
[0162] Step 701, obtaining the objective function value of each individual in the differential evolution algorithm and a first random number corresponding to each individual in a first preset number of individuals in the differential evolution algorithm;
[0163] Step 702: If the first random number corresponding to the individual is less than a first preset threshold, a Gaussian mutation strategy is used to perform a first process on the mutation operation of the individual in the differential evolution algorithm;
[0164] Step 703: if the first random number corresponding to the individual is not less than a first preset threshold, a Cauchy mutation strategy is used to perform a first process on the mutation operation of the individual in the differential evolution algorithm;
[0165] Step 704, obtaining the objective function value of each individual in the differential evolution algorithm, and the second random number, the third random number, and the fourth random number corresponding to each individual in the second preset number of individuals in the differential evolution algorithm;
[0166] Step 705, if the selection operation in the differential evolution algorithm fails and the second random number corresponding to the individual is less than the second preset threshold, the fourth random number corresponding to the individual is used as a new proportional factor in the parameter adaptive strategy; and if the selection operation in the differential evolution algorithm fails and the third random number corresponding to the individual is less than the third preset threshold, the third random number corresponding to the individual is used as a new crossover probability in the parameter adaptive strategy;
[0167] Step 706, if the selection operation in the differential evolution algorithm fails and the second random value corresponding to the individual is not less than the second preset threshold, the original proportional factor of the individual is used as the new proportional factor in the parameter adaptive strategy; and if the selection operation in the differential evolution algorithm fails and the third random value corresponding to the individual is not less than the third preset threshold, the original crossover probability of the individual is used as the new crossover probability in the parameter adaptive strategy;
[0168] Step 707, performing a second process on the scale factor and the crossover probability of the individual in the differential evolution algorithm using the new scale factor in the parameter adaptive strategy and the new crossover probability in the parameter adaptive strategy to obtain a processed differential evolution algorithm;
[0169] Step 708, obtaining the load balance value of the server cluster and the link load balance value of the server cluster;
[0170] Step 709, summing the load balance value of the server cluster and the link load balance value of the server cluster to obtain the objective function value of the differential evolution algorithm after processing;
[0171] Step 710, using the processed differential evolution algorithm to obtain the real-time utilization rate of each server in the server cluster and the comprehensive performance of each server in the server cluster when the objective function value is minimum;
[0172] Step 711, multiplying the comprehensive performance of each server in the server cluster by the real-time utilization rate of each server in the server cluster to obtain a first product of each server in the server cluster;
[0173] Step 712, subtract 1 from the first product of each server in the server cluster to obtain a third difference value for each server in the server cluster;
[0174] Step 713, summing the third difference value of each server in the server cluster to obtain a second sum value of the server cluster;
[0175] Step 714, comparing the third difference value of each server in the server cluster with the second sum value of the server cluster to obtain a dynamic weight of each server in the server cluster;
[0176] Step 715: determine the server with the largest dynamic weight in the server cluster as the server for processing the current connection request.
[0177] In order to implement the load balancing method provided by the embodiment of the present disclosure, the embodiment of the present disclosure also provides a load balancing device, such as Figure 8 shown. Figure 8 A schematic diagram of the structure of a load balancing device provided in an embodiment of the present disclosure, the load balancing device 800 includes:
[0178] The processing unit 801 is used to perform a first processing on the mutation operation in the differential evolution algorithm using the Gaussian Cauchy mutation strategy, and to perform a second processing on the proportional factor and the crossover probability in the differential evolution algorithm using the parameter adaptive strategy, so as to obtain a processed differential evolution algorithm;
[0179] A first acquisition unit 802 is used to acquire a load balance value of a server cluster and a link load balance value of the server cluster;
[0180] A summing unit 803 is used to sum the load balancing degree value of the server cluster and the link load balancing degree value of the server cluster to obtain the objective function value of the differential evolution algorithm after processing;
[0181] A second acquisition unit 804 is used to acquire the dynamic weight of each server in the server cluster when the objective function value is minimum by using the processed differential evolution algorithm;
[0182] The determining unit 805 is configured to determine the server with the largest dynamic weight in the server cluster as the server for processing the current connection request.
[0183] In one embodiment, the processing unit 801 is specifically configured to:
[0184] Obtaining an objective function value of each individual in the differential evolution algorithm, and a first random number corresponding to each individual in a first preset number of individuals in the differential evolution algorithm, wherein the objective function value of each individual is determined by the sum of the load balance value of the server cluster and the link load balance value of the server cluster, and the first preset number of individuals is used to indicate individuals whose objective function values are not lower than a preset objective function threshold;
[0185] If the first random number corresponding to the individual is less than a first preset threshold, a Gaussian mutation strategy is used to perform a first process on the mutation operation of the individual in the differential evolution algorithm;
[0186] If the first random number corresponding to the individual is not less than a first preset threshold, a Cauchy mutation strategy is used to perform a first process on the mutation operation of the individual in the differential evolution algorithm.
[0187] In one embodiment, the processing unit 801 is specifically configured to:
[0188] Obtaining an objective function value of each individual in the differential evolution algorithm, and a second random number, a third random number, and a fourth random number corresponding to each individual in a second preset number of individuals in the differential evolution algorithm, wherein the objective function value of each individual is determined by the sum of the load balance value of the server cluster and the link load balance value of the server cluster, and the second preset number of individuals is used to indicate individuals whose objective function values are lower than a preset objective function threshold;
[0189] If the selection operation in the differential evolution algorithm fails and the second random number corresponding to the individual is less than the second preset threshold, the fourth random number corresponding to the individual is used as a new proportional factor in the parameter adaptive strategy; and if the selection operation in the differential evolution algorithm fails and the third random number corresponding to the individual is less than the third preset threshold, the third random number corresponding to the individual is used as a new crossover probability in the parameter adaptive strategy;
[0190] If the selection operation in the differential evolution algorithm fails and the second random value corresponding to the individual is not less than the second preset threshold, the original proportional factor of the individual is used as the new proportional factor in the parameter adaptive strategy; and if the selection operation in the differential evolution algorithm fails and the third random value corresponding to the individual is not less than the third preset threshold, the original crossover probability of the individual is used as the new crossover probability in the parameter adaptive strategy;
[0191] The new proportional factor in the parameter adaptive strategy and the new crossover probability in the parameter adaptive strategy are used to perform a second process on the proportional factor and the crossover probability of the individual in the differential evolution algorithm.
[0192] In one embodiment, the first acquisition unit 802 is specifically configured to:
[0193] Get the number of servers in the server cluster and the real-time utilization of each server in the server cluster;
[0194] Comparing the sum of the real-time utilization of each server in the server cluster with the number of servers in the server cluster to obtain an average value of the real-time utilization of all servers in the server cluster;
[0195] Subtracting an average of the real-time utilization rates of all servers in the server cluster from the real-time utilization rate of each server in the server cluster to obtain a first difference value of each server in the server cluster;
[0196] Sum the squares of the first difference values of each server in the server cluster to obtain a first sum value of the server cluster;
[0197] The first sum value of the server cluster is compared with the number of servers in the server cluster to obtain a load balancing value of the server cluster.
[0198] In one embodiment, the first acquisition unit 802 is specifically configured to:
[0199] Obtain the number of servers in the server cluster and the used bandwidth of each link in the server cluster;
[0200] Comparing the sum of the used bandwidths of each link of the server cluster with the number of servers in the server cluster to obtain an average value of the used bandwidths of all links of the server cluster;
[0201] Subtracting an average value of the used bandwidths of all links of the server cluster from the used bandwidth of each link of the server cluster to obtain a second difference value of each link of the server cluster;
[0202] The sum of the second difference values of each link of the server cluster is compared with the number of servers in the server cluster to obtain a link load balancing degree value of the server cluster.
[0203] In one embodiment, the second obtaining unit 804 is specifically configured to:
[0204] Using the processed differential evolution algorithm to obtain the real-time utilization rate of each server in the server cluster and the comprehensive performance of each server in the server cluster when the objective function value is minimum;
[0205] Multiplying the comprehensive performance of each server in the server cluster by the real-time utilization rate of each server in the server cluster to obtain a first product of each server in the server cluster;
[0206] Subtract 1 from the first product of each server in the server cluster to obtain a first difference value of each server in the server cluster;
[0207] Sum the third difference value of each server in the server cluster to obtain a second sum value of the server cluster;
[0208] The third difference value of each server in the server cluster is compared with the second sum value of the server cluster to obtain the dynamic weight of each server in the server cluster.
[0209] It should be noted that: the load balancing device provided in the above embodiment only uses the division of the above program modules as an example when performing load balancing. In actual applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the load balancing device is divided into different program modules to complete all or part of the processing described above. In addition, the load balancing device provided in the above embodiment and the load balancing method embodiment provided in the embodiment of the present disclosure belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0210] Fig. 9 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure is shown in FIG. Fig. 9 As shown, the electronic device 900 includes at least one processor 902; and a memory 901 that is communicatively connected to the at least one processor 902; wherein the memory 901 stores instructions that can be executed by the at least one processor 902, and the instructions are executed by the at least one processor 902 to implement the steps of the load balancing method of the embodiment of the present disclosure.
[0211] Optionally, the electronic device may specifically be a load balancing device in an embodiment of the present application, and the electronic device may implement the corresponding processes implemented by the load balancing device in each method in the embodiment of the present application, which will not be described in detail here for the sake of brevity.
[0212] It is understood that the electronic device also includes a communication interface 903. The various components in the electronic device are coupled together through a bus system 904. It is understood that the bus system 904 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 904 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Fig. 9 Various buses are labeled as bus system 904.
[0213] It can be understood that the memory 901 can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can 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); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM, SyncLink Dynamic Random Access Memory), and direct RAM bus random access memory (DRRAM, Direct Rambus Random Access Memory).The memory 901 described in the embodiment of the present invention is intended to include but is not limited to these and any other suitable types of memories.
[0214] The method disclosed in the above embodiment of the present disclosure can be applied to the processor 902, or implemented by the processor 902. The processor 902 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 902 or an instruction in the form of software. The above processor 902 may be a general-purpose processor, a DSP, or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 902 can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiment of the present invention, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in the memory 901, and the processor 902 reads the information in the memory 901 and completes the steps of the above method in combination with its hardware.
[0215] In an exemplary embodiment, the electronic device may be implemented by one or more application specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), FPGAs, general purpose processors, controllers, MCUs, microprocessors, or other electronic components to execute the aforementioned method.
[0216] The present embodiment also provides a non-transitory computer-readable storage medium storing computer instructions, which are used to implement the steps of the load balancing method of the embodiment of the present invention when executed by a computer.
[0217] Optionally, the computer-readable storage medium can be applied to the load balancing device in the embodiments of the present application, and the computer instructions enable the computer to execute the corresponding processes implemented by the load balancing device in the various methods of the embodiments of the present application. For the sake of brevity, they are not repeated here.
[0218] The embodiment of the present disclosure also provides a computer program product, including a computer program, which implements the steps of the load balancing method provided by the embodiment of the present invention when executed by a processor.
[0219] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0220] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.
[0221] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0222] A person of ordinary skill in the art can understand that: all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium, which, when executed, executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, disks or optical disks.
[0223] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention can be essentially or partly reflected in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods of each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
[0224] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A load balancing method, characterized in that: include: A Gaussian-Cauchy mutation strategy is used to perform a first process on a mutation operation in a differential evolution algorithm, and a parameter adaptive strategy is used to perform a second process on a proportional factor and a crossover probability in the differential evolution algorithm to obtain a processed differential evolution algorithm; Obtain the load balance value of the server cluster and the link load balance value of the server cluster; Adding the load balance value of the server cluster and the link load balance value of the server cluster to obtain the objective function value of the differential evolution algorithm after processing; Using the processed differential evolution algorithm to obtain the dynamic weight of each server in the server cluster when the objective function value is minimum; The server with the largest dynamic weight in the server cluster is determined as the server for processing the current connection request.
2. The method according to claim 1, characterized in that The first processing of the mutation operation in the differential evolution algorithm using the Gaussian Cauchy mutation strategy includes: Obtaining an objective function value of each individual in the differential evolution algorithm, and a first random number corresponding to each individual in a first preset number of individuals in the differential evolution algorithm, wherein the objective function value of each individual is determined by the sum of the load balance value of the server cluster and the link load balance value of the server cluster, and the first preset number of individuals is used to indicate individuals whose objective function values are not lower than a preset objective function threshold; If the first random number corresponding to the individual is less than a first preset threshold, a Gaussian mutation strategy is used to perform a first processing on the mutation operation of the individual in the differential evolution algorithm; If the first random number corresponding to the individual is not less than a first preset threshold, a Cauchy mutation strategy is used to perform a first processing on the mutation operation of the individual in the differential evolution algorithm.
3. The method according to claim 1, characterized in that The second processing of the proportional factor and the crossover probability in the differential evolution algorithm by using the parameter adaptive strategy includes: Obtaining an objective function value of each individual in the differential evolution algorithm, and a second random number, a third random number, and a fourth random number corresponding to each individual in a second preset number of individuals in the differential evolution algorithm, wherein the objective function value of each individual is determined by the sum of the load balance value of the server cluster and the link load balance value of the server cluster, and the second preset number of individuals is used to indicate individuals whose objective function values are lower than a preset objective function threshold; If the selection operation in the differential evolution algorithm fails and the second random number corresponding to the individual is less than the second preset threshold, the fourth random number corresponding to the individual is used as a new proportional factor in the parameter adaptive strategy; and if the selection operation in the differential evolution algorithm fails and the third random number corresponding to the individual is less than the third preset threshold, the third random number corresponding to the individual is used as a new crossover probability in the parameter adaptive strategy; If the selection operation in the differential evolution algorithm fails and the second random value corresponding to the individual is not less than the second preset threshold, the original proportional factor of the individual is used as the new proportional factor in the parameter adaptive strategy; and if the selection operation in the differential evolution algorithm fails and the third random value corresponding to the individual is not less than the third preset threshold, the original crossover probability of the individual is used as the new crossover probability in the parameter adaptive strategy; The new proportional factor in the parameter adaptive strategy and the new crossover probability in the parameter adaptive strategy are used to perform a second process on the proportional factor and the crossover probability of the individual in the differential evolution algorithm.
4. The method according to claim 1, characterized in that The step of obtaining the load balancing value of the server cluster includes: Get the number of servers in the server cluster and the real-time utilization of each server in the server cluster; Comparing the sum of the real-time utilization of each server in the server cluster with the number of servers in the server cluster to obtain an average value of the real-time utilization of all servers in the server cluster; Subtracting an average of the real-time utilization rates of all servers in the server cluster from the real-time utilization rate of each server in the server cluster to obtain a first difference value of each server in the server cluster; Sum the squares of the first difference values of each server in the server cluster to obtain a first sum value of the server cluster; The first sum value of the server cluster is compared with the number of servers in the server cluster to obtain a load balancing value of the server cluster.
5. The method according to claim 1, characterized in that The step of obtaining the link load balancing value of the server cluster includes: Obtain the number of servers in the server cluster and the used bandwidth of each link in the server cluster; Comparing the sum of the used bandwidths of each link of the server cluster with the number of servers in the server cluster to obtain an average value of the used bandwidths of all links of the server cluster; Subtracting an average value of the used bandwidths of all links of the server cluster from the used bandwidth of each link of the server cluster to obtain a second difference value of each link of the server cluster; The sum of the second difference values of each link of the server cluster is compared with the number of servers in the server cluster to obtain a link load balancing degree value of the server cluster.
6. The method according to claim 1, characterized in that The method of using the processed differential evolution algorithm to obtain the dynamic weight of each server in the server cluster when the objective function value is minimized includes: Using the processed differential evolution algorithm to obtain the real-time utilization rate of each server in the server cluster and the comprehensive performance of each server in the server cluster when the objective function value is minimum; Multiplying the comprehensive performance of each server in the server cluster by the real-time utilization rate of each server in the server cluster to obtain a first product of each server in the server cluster; Subtract 1 from the first product of each server in the server cluster to obtain a third difference value for each server in the server cluster; Sum the third difference value of each server in the server cluster to obtain a second sum value of the server cluster; The third difference value of each server in the server cluster is compared with the second sum value of the server cluster to obtain the dynamic weight of each server in the server cluster.
7. A load balancing device, characterized in that: include: A processing unit, used to perform a first processing on the mutation operation in the differential evolution algorithm using a Gaussian Cauchy mutation strategy, and to perform a second processing on the proportional factor and the crossover probability in the differential evolution algorithm using a parameter adaptive strategy, to obtain a processed differential evolution algorithm; A first acquisition unit, configured to acquire a load balancing degree value of a server cluster and a link load balancing degree value of the server cluster; An addition unit, configured to add the load balancing degree value of the server cluster and the link load balancing degree value of the server cluster to obtain a processed objective function value of a differential evolution algorithm; A second acquisition unit, configured to use the processed differential evolution algorithm to acquire dynamic weights of each server in the server cluster when the objective function value is the smallest; A determination unit, configured to determine the server with the largest dynamic weight in the server cluster as the server for processing a current connection request.
8. An electronic device, characterized in that: Comprising: At least one processor; And A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method according to any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, wherein the computer program implements the method according to any one of claims 1 to 6 when executed by a processor.
Citation Information
Patent Citations
Dynamic load balancing method and system based on differential evolution algorithm
CN113268339A
Function test method based on improved multi-objective particle swarm optimization
CN114444646A
Cloud computing load balancing method and system based on adaptive variation differential evolution
CN115408154A
Permanent magnet synchronous wind driven generator parameter identification method based on genetic algorithm
CN116743009A
Micro-service dynamic adaptive client load balancing method and system
CN117155942A
