Load balancing method

By obtaining the performance data of the service node, determining the service type and applying the corresponding load balancing algorithm, adjusting the number of requests of the service nodes, the problem of low load balancing accuracy in the existing technology is solved, and more efficient and stable load balancing is achieved.

CN119576518APending Publication Date: 2025-03-07CHINA MOBILE INTERNET CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411340907.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-25
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

In the prior art, the accuracy of dynamic load balancing is low, mainly due to the large granularity of the calculation parameters and the rough calculation method, which leads to the impact of frequent adjustments on the load and the adverse impact on the service.

Method used

By obtaining the first performance data of each service node in the service module, the service module's service module's service module's service module is determined, and the request amount carried by each service node is adjusted based on the load balancing algorithm corresponding to the service type.

Benefits of technology

It improves the accuracy of dynamic load balancing, avoids the impact of frequent adjustments on load and adverse impact on services, and is suitable for service modules of different business types.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119576518A_ABST
    Figure CN119576518A_ABST
Patent Text Reader

Abstract

The invention discloses a load balancing method. The method comprises the following steps: acquiring first performance data of each service node in a service module; determining the business type of the service module based on the first performance data of each service node; determining the adjusted bearing request quantity of each service node based on a load balancing algorithm corresponding to the service type; and adjusting the request quantity borne by each service node based on the adjusted bearing request quantity of each service node.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of computer clusters, and in particular to a load balancing method. Background Art

[0002] Dynamic load balancing refers to dynamically balancing and distributing the load (work tasks) to multiple operating units for operation, such as FTP servers, Web servers, enterprise core application servers and other major task servers, so as to better coordinate and complete work tasks.

[0003] The dynamic load balancing method of the related technology usually calculates the performance score by weighted calculation based on the important performance parameters of the backend service node (such as central processing unit (CPU), memory, input / output (I / O), network card utilization and transmission control protocol (TCP) connection number, number of processes, Java virtual machine (JVM) and other performance parameters), and then dynamically adjusts the fixed gradient according to the performance score. When the above scheme is used for load balancing, the accuracy of dynamic load balancing is low due to the large granularity of calculation parameters and the rough calculation method. Summary of the invention

[0004] The present application discloses a load balancing method, which can improve the accuracy of dynamic load balancing.

[0005] In order to solve the above problems, this application adopts the following technical solutions: In a first aspect, an embodiment of the present application discloses a load balancing method, comprising: obtaining first performance data of each service node in a service module; determining a service type of the service module based on the first performance data of each service node; determining an adjusted load-bearing request amount of each service node based on a load balancing algorithm corresponding to the service type; and adjusting the request amount carried by each service node based on the adjusted load-bearing request amount of each service node.

[0006] In a second aspect, an embodiment of the present application discloses a load balancing device, comprising: an acquisition module, used to acquire first performance data of each service node in a service module; a determination module, used to determine the service type of the service module based on the first performance data of each service node; the determination module is also used to determine the adjusted load-bearing request amount of each service node based on a load balancing algorithm corresponding to the service type; and an adjustment module, used to adjust the request amount carried by each service node based on the adjusted load-bearing request amount of each service node.

[0007] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.

[0008] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0009] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions, which, when executed by a computer, cause the computer to execute: the steps of the method described in the first aspect.

[0010] The technical solution adopted in this application can achieve the following beneficial effects: The embodiment of the present application provides a load balancing method, by obtaining the first performance data of each service node in the service module, determining the service type of the service module based on the first performance data of each service node, and determining the adjusted load request amount of each service node based on the load balancing algorithm corresponding to the service type, and then adjusting the request amount carried by each service node based on the adjusted load request amount of each service node. The present application adopts different load balancing algorithms for service modules of different service types, which can improve the accuracy of dynamic load balancing. Moreover, compared with the solution of dynamic adjustment according to a fixed gradient in the related art, the solution of the present application can avoid the impact of frequent adjustments on the load caused by the gradient adjustment method, and avoid the adverse impact of frequent adjustments on the service. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 A flow chart of a load balancing method disclosed in an embodiment of the present application; Figure 2 A CS architecture diagram disclosed in an embodiment of the present application; Figure 3 A schematic diagram of the structure of a load balancing device disclosed in an embodiment of the present application; Figure 4 A schematic diagram of the structure of an electronic device disclosed in an embodiment of the present application. DETAILED DESCRIPTION

[0012] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0013] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way are interchangeable where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the electrically connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0014] The load balancing method disclosed in the embodiment of the present application is described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.

[0015] The present application discloses a load balancing method. Figure 1 FIG. 1 is a flow chart of a load balancing method disclosed in an embodiment of the present application. Figure 1 As shown, the method comprises the following steps: S120. Obtain first performance data of each service node in the service module.

[0016] In the present application, the load balancer can obtain the performance data of each service node in the service module at a preset time interval. Figure 2 As shown, the performance data of each service node can be obtained through the agent using tools such as iostat, free, vmstat, sar, top, cat, lsof, ps, fio, df, etc. at preset time intervals, where the agent is a plug-in on the service node for obtaining data, and the preset time interval can be 5 minutes, 10 minutes or 15 minutes. This application does not specifically limit the preset time interval.

[0017] Exemplarily, the obtained performance data of the service node is shown in the following table:

[0018] It should be noted that the first performance data of the present application may be part of the performance data in the above table.

[0019] S140: Determine the service type of the service module based on the first performance data of each service node.

[0020] After acquiring the first performance data of each service node in the service module, the service identification module of the load balancer determines the service type of the service module based on the first performance data of each service node, and sends the determined service type of the service module to the load algorithm module of the load balancer.

[0021] S160: Determine the adjusted bearer request amount of each service node based on a load balancing algorithm corresponding to the service type.

[0022] The load algorithm module of the load balancer determines the load balancing algorithm corresponding to the service type based on the service type of the service module. Then, the load algorithm module of the load balancer determines the adjusted load request amount of each service node in the service module based on the load balancing algorithm corresponding to the service type, and sends the adjusted load request amount of each service node to the distribution module of the load balancer.

[0023] S180: Adjust the request amount carried by each service node based on the adjusted bearer request amount of each service node.

[0024] The distribution module of the load balancer adjusts the request amount carried by each service node based on the adjusted load request amount of each service node.

[0025] The embodiment of the present application provides a load balancing method, by obtaining the first performance data of each service node in the service module, determining the service type of the service module based on the first performance data of each service node, and determining the adjusted load request amount of each service node based on the load balancing algorithm corresponding to the service type, and then adjusting the request amount carried by each service node based on the adjusted load request amount of each service node. The present application adopts different load balancing algorithms for service modules of different service types, which can improve the accuracy of dynamic load balancing. Moreover, compared with the solution of dynamic adjustment according to a fixed gradient in the related art, the solution of the present application can avoid the impact of frequent adjustments on the load caused by the gradient adjustment method, and avoid the adverse impact of frequent adjustments on the service.

[0026] In one implementation, determining the business type of the service module based on the first performance data of each service node may include: determining the average performance data of each service node based on the first performance data of each service node; determining the business type of the service module based on the average performance data of each service node.

[0027] Exemplarily, taking the example that the service module includes 10 service nodes, based on the first performance data corresponding to the 10 service nodes respectively, the average performance data corresponding to the 10 service nodes is determined, and then based on the average performance data, the business type of the service module is determined.

[0028] In one implementation, the first performance data may include at least one of CPU usage, waiting time for IO operation, memory usage, average IO operation ratio, data size called from disk to memory, and data size called from memory to disk, which can improve the accuracy of the business type of the determined service module. It should be noted that the data size called from disk to memory here is the Swap into memory size mentioned above, and the data size called from memory to disk here is the memory into Swap size mentioned above.

[0029] In an embodiment of the present application, the service type may include one of a no-adjustment class, a high-CPU-consumption class, a high-memory-consumption class, a high-disk-IO class, and a service-balancing class.

[0030] In the present application, it is possible to first determine whether the service module is in the category that does not require adjustment based on the CPU usage rate CPU%, the waiting IO operation time wa%, the memory usage rate used%, and the average IO operation ratio Util%. If the service module is not in the category that does not require adjustment, it is possible to continue to determine whether the service module is in the high-CPU category, high-memory category, high-disk IO category, or business-balanced category based on the CPU usage rate CPU%, the waiting IO operation time wa%, the memory usage rate used%, the average IO operation ratio Util%, the data size si called from the disk to the memory, and the data size so called from the memory to the disk.

[0031] The identification algorithm principle for determining the business type of a service module is as follows: BEGIN CPU%=sy%+us%+wa%; IOPS=IPS+OPS; If(CPU%<=40% and wa%<=10% and used%<=60% and util<=40%) ##Experience value {type==0;} ##No need to adjust, avoid frequent adjustments that may have adverse effects on the load balancer and business If(CPU%>40% or wa%>10% or used%>60% or util%>40%) if(CPU%>40% and wa%<=10% andused%<60% and util%<40%) {type==1;}# High CPU consumption type If((used%>60% and ( si>=40 or so>=40) and CPU%<40% and wa<=10%andutil<40%) ##Experience value {type==2;}##High memory consumption class If( (wa%>=10% or util%>40%) and used%<60% and CPU%<40%) {type==3;}##High-consumption disk IO type Else type==4;##Business balance class; Return type; END It should be noted that the specific values ​​in the above algorithm can be adjusted according to actual needs, and this application does not impose specific restrictions on this. In addition, high-computing business scenarios (such as back-end computing scenarios and real-time modeling computing scenarios) belong to the high-CPU consumption category, high-memory business scenarios belong to the high-memory consumption category, and high-IO read-write scenarios (such as frequent read-write scenarios and various large-scale query websites) belong to the high-disk IO consumption category.

[0032] Exemplarily, after determining the service type of the service module, the service identification module of the load balancer may send the type parameter (0, 1, 2, 3, 4) to the load algorithm module of the load balancer.

[0033] In one implementation, when the service type of the service module is the class that does not require adjustment, determining the adjusted bearer request amount of each service node based on the load balancing algorithm corresponding to the service type may include: using the current bearer request amount of each service node as the adjusted bearer request amount of each service node. That is, when the service type of the service module is the class that does not require adjustment, the original distribution configuration of the service node of the service module is maintained to avoid frequent adjustments that may have adverse effects on the load balancer and the service.

[0034] In one implementation, when the service type of the service module is the high-CPU consumption class, determining the adjusted bearer request amount of each service node based on the load balancing algorithm corresponding to the service type may include: determining the adjusted bearer request amount of each service node based on the CPU usage rate of each service node, a first preset threshold, and the current bearer request amount of each service node.

[0035] Exemplarily, for a service node in a service module whose CPU usage is greater than or equal to a first preset threshold, based on the current load-bearing request amount, CPU usage and first preset threshold of the service node, determine the request amount when the CPU usage of the service node is the first preset threshold, based on the current load-bearing request amount of the service node and the request amount when the CPU usage of the service node is the first preset threshold, determine the request amount that the service node needs to transfer to a service node in the service module whose CPU usage is less than the first preset threshold, and then determine the total request amount sum1 that the service node in the service module whose CPU usage is greater than or equal to the first preset threshold needs to transfer to a service node in the service module whose CPU usage is less than the first preset threshold; for a service node in the service module whose CPU usage is less than the first preset threshold, based on the current load-bearing request amount of the service node , CPU usage and a first preset threshold, determine the request volume when the CPU usage of the service node is the first preset threshold, determine the additional request volume that the service node can carry based on the request volume when the CPU usage of the service node is the first preset threshold and the current load-bearing request volume of the service node, and then determine the total amount of additional request volumes sum2 that the service nodes in the service module whose CPU usage is less than the first preset threshold can carry; when sum1 is greater than sum2, adjust the first preset threshold in a preset manner, and then recalculate sum1 and sum2 until sum1 is less than or equal to sum2, and then determine the actual additional request volume that the service node can carry based on the additional request volume that the service nodes in the service module whose CPU usage is less than the first preset threshold can carry, sum1 and sum2, and then determine the final load-bearing request volume of the service node. It should be noted that, for service nodes whose CPU usage in the service module is greater than or equal to the first preset threshold, the request amount determined when the CPU usage of the service node is the first preset threshold is the adjusted bearer request amount of the service node; for service nodes whose CPU usage in the service module is less than the first preset threshold, the final bearer request amount determined for the service node is the adjusted bearer request amount of the service node.

[0036] Based on the CPU usage rate of each service node, the first preset threshold, and the current bearer request amount of each service node, the algorithm principle corresponding to the adjusted bearer request amount of each service node is determined as follows: Begin C cpu ={CPU1, CPU2, ...CPU n}; #The collection of CPU usage of each service node; C free ={used1, used2, ...used n}; #The collection of memory usage of each service node; Ciops ={IOPS1,IOPS2,...IOPS n}; #The collection of disk usage of each service node; C Q ={Q1,Q2,...Q n};#The current load request volume of each service node disk; If(type==0){keep the original distribution configuration}; If(type==1) ###Dynamic load balancing algorithm for high CPU consumption {For(Threhold cpu =40; Threshold cpu <100;Threhold cpu +5) ##First preset threshold For(i=1;i <n;i++) {if(CPU n >=Threhold cpu) {CPU n ∈ C1;Q n ∈ C1Q; N∈C1num; ##Save CPU usage greater than or equal to Threhold cpu The cpu usage rate of the service node, the current load request volume and the node number are added to the set C1, C1Q and C1num.

[0037] Q1new n =(Q n / CPU n *Threhold cpu ); ##Calculate theoretically when the utilization rate of the service node is Threhold cpu The number of requests at that time.

[0038] Q1new n ∈ C1new; ##Save the calculated theoretical request amount to the new request amount set.

[0039] △Q1 n =Q n -Q1new n ; sum1=△Q1 n +sum1; ##For CPU usage exceeding Threhold cpu The total number of requests that need to be transferred to other service nodes with less CPU usage.} If(CPU n <threhold cpu) { { CPU n ∈ C2; Q n ∈ CQ2; N∈C2num; ##Save CPU usage less than Threhold cpu The service node CPU usage, request volume and node number are added to the new set C2, CQ2, C2num.

[0040] Q2new n =(Q n / CPU n *Threhold cpu ); ##Calculate theoretically when the utilization rate of the service node is Threhold cpu The number of requests at that time.

[0041] Q2new n ∈ C2new; ##Save the calculated theoretical request amount to the new collection.

[0042] △Q2 n =Q2new n -Q n ; ##Theoretically, this service node can handle more requests.

[0043] sum2=sum2+△Q2 n ;##For CPU usage less than Threhold cpu The service node reaches Threshold when the CPU usage reaches Threshold cpu The total number of requests that can be handled at the time.} }## Close the first for loop, calculate sum1, sum2, and save the CPU usage greater than or equal to Threhold cpu The service node information is transferred to a new set, including the original corresponding request volume set C1Q, the theoretically loaded request volume set C1new, and the CPU usage rate is less than Threhold. cpu The service node information is moved to a new set, including the original corresponding request volume set CQ2 and the theoretically carried request volume set C2new.

[0044] If(sum1>sum2) continue;##Return to adjust the first preset threshold If(sum1<=sum2) { for n∈ C2num {Qobj n =△Q2 n / sum2*sum1;##The nth CPU usage is less than the threshold cpuThe actual number of requests carried by the service node; Qact n =Qn+Qobj n ; ##The nth CPU usage is less than threshold cpu The number of requests that the service node ultimately carries; Qact n ∈ C3new; the original CPU usage is less than Threhold cpu The final load request volume of the service node is added to the set C3new; }##Close this loop.

[0045] Cobj cpu =ranker(C1new,C3new);##Sorting by node number n is the final ideal traffic distribution, that is, the adjusted load-bearing request volume of each service node.

[0046] }##Close the second outer loop.

[0047] In one implementation, when the service type of the service module is the high-memory consumption class, determining the adjusted bearer request amount of each service node based on the load balancing algorithm corresponding to the service type may include: determining the adjusted bearer request amount of each service node based on the memory utilization rate of each service node, a second preset threshold, and the current bearer request amount of each service node.

[0048] The specific implementation of determining the adjusted load request amount of each service node based on the memory usage rate of each service node, the second preset threshold, and the current load request amount of each service node is similar to the specific implementation of determining the adjusted load request amount of each service node based on the CPU usage rate of each service node, the first preset threshold, and the current load request amount of each service node. It is only necessary to replace the first preset threshold Threhold cpu Replaced by the second preset threshold Threshold free , Change the CPU usage CPU n Replaced with memory usage used n Then, Threshold free The starting point is changed to 60, the end point is 100, the step length is 5, and the adjusted load request volume of each service node is determined to be Cobj free , I will not repeat it here if I do not apply.

[0049] In one implementation, when the service type of the service module is the high-consumption disk IO class, determining the adjusted bearer request amount of each service node based on the load balancing algorithm corresponding to the service type may include: determining the adjusted bearer request amount of each service node based on the disk usage rate of each service node, a third preset threshold, and the current bearer request amount of each service node.

[0050] The specific implementation of determining the adjusted load request amount of each service node based on the disk usage rate of each service node, the third preset threshold, and the current load request amount of each service node is similar to the specific implementation of determining the adjusted load request amount of each service node based on the CPU usage rate of each service node, the first preset threshold, and the current load request amount of each service node. It is only necessary to replace the first preset threshold Threshold cpu Replaced with the third preset threshold Threshold iops , Change the CPU usage CPU n Replaced by disk usage IOPS n Then, Threshold iops The starting point is changed to 20, the end point is 100, the step length is 2, and the adjusted load request volume of each service node is determined to be Cobj iops , I will not repeat it here if I do not apply.

[0051] In one implementation, when the service type of the service module is the service balancing class, determining the adjusted bearer request amount of each service node based on the load balancing algorithm corresponding to the service type may include: determining a first adjustment request amount of each service node based on a CPU usage rate of each service node, a fourth preset threshold, and a current bearer request amount of each service node; determining a second adjustment request amount of each service node based on a memory usage rate of each service node, a fifth preset threshold, and a current bearer request amount of each service node; determining a third adjustment request amount of each service node based on a disk usage rate of each service node, a sixth preset threshold, and a current bearer request amount of each service node; determining the adjusted bearer request amount of each service node based on the first adjustment request amount of each service node, a first weight value corresponding to the first adjustment request amount, the second adjustment request amount of each service node, a second weight value corresponding to the second adjustment request amount, the third adjustment request amount of each service node, and a third weight value corresponding to the third adjustment request amount.

[0052] In the present application, the specific implementation of determining the first adjustment request amount of each service node here is similar to the specific implementation of determining the adjusted load request amount of each service node based on the CPU usage rate of each service node, the first preset threshold, and the current load request amount of each service node above, and the present application will not repeat it here; the specific implementation of determining the second adjustment request amount of each service node here is similar to the specific implementation of determining the adjusted load request amount of each service node based on the memory usage rate of each service node, the second preset threshold, and the current load request amount of each service node above, and the present application will not repeat it here; the specific implementation of determining the third adjustment request amount of each service node here is similar to the specific implementation of determining the adjusted load request amount of each service node based on the disk usage rate of each service node, the third preset threshold, and the current load request amount of each service node above, and the present application will not repeat it here. It should be noted that the fourth preset threshold can be the same as the first preset threshold, the fifth preset threshold can be the same as the second preset threshold, and the sixth preset threshold can be the same as the third preset threshold.

[0053] For example, when determining the first adjustment request amount Cobj of each service node cpu , the second adjustment request amount Cobj free and the third adjustment request amount Cobj iops Afterwards, the adjusted load request volume Cobj of each service node is determined type4 =Cobj cpu *First weight value + Cobj free * Second weight value + Cobj iops *The third weight value, the first weight value can be 40%, the second weight value can be 40%, and the third weight value can be 20%.

[0054] In an embodiment of the present application, before determining the service type of the service module based on the first performance data of each service node, the method may further include: obtaining the second performance data of each service node, wherein the second performance data includes one of the service port status, request response code, request response time, service log update status and system resource performance data; determining the abnormal service node based on the second performance data of each service node; determining the service type of the service module based on the first performance data of each service node may include: determining the service type of the service module based on the first performance data of each normal service node, wherein the normal service node is a service node in the service module other than the abnormal service node; determining the adjusted load request amount of each service node based on the load balancing algorithm corresponding to the service type may include: determining the adjusted load request amount of each normal service node based on the load balancing algorithm corresponding to the service type; adjusting the request amount carried by each service node based on the adjusted load request amount of each service node may include: adjusting the request amount carried by each normal service node based on the adjusted load request amount of each normal service node. That is, the scheme of the present application removes the abnormal service node and performs load balancing on the normal service node. In addition, the present application can determine abnormal service nodes by the health check module of the load balancer.

[0055] It should be noted that the second performance data of the service node of the present application can be obtained by the agent using tools such as iostat, free, vmstat, sar, top, cat, lsof, ps, fio, df, etc. at preset time intervals. In addition, in order to improve the accuracy of the service node health check, the service port status and request response code in the second performance data can be the latest obtained when performing the service node health check. Specifically, the test data including the service port status and request response code can be obtained by sending a test connection request.

[0056] For example, if the service port status of the service node is closed, or the request response code of the service node is 5** code, or the request response time of the service node has timed out for three consecutive times, or the service node has a request but the service log is not updated, or one of the system resource performance data reaches more than 99% for 15 minutes, then the service node is confirmed to be an abnormal service node and is removed from the distribution range. The solution of the present application can comprehensively evaluate whether the service node can provide services normally.

[0057] In the present application, the system resource performance data may be Linux system resource data.

[0058] The load balancing method provided in the embodiment of the present application can be executed by a load balancing device. In the embodiment of the present application, the load balancing method is executed by a load balancing device as an example to illustrate the device of the load balancing method provided in the embodiment of the present application.

[0059] Figure 3 FIG. 1 is a schematic diagram of the structure of a load balancing device disclosed in an embodiment of the present application. Figure 3 As shown, the load balancing device 300 includes: an acquisition module 310 , a determination module 320 and an adjustment module 330 .

[0060] In the present application, the acquisition module 310 is used to obtain the first performance data of each service node in the service module; the determination module 320 is used to determine the service type of the service module based on the first performance data of each service node; the determination module 320 is also used to determine the adjusted load-bearing request amount of each service node based on the load balancing algorithm corresponding to the service type; the adjustment module 330 is used to adjust the request amount carried by each service node based on the adjusted load-bearing request amount of each service node.

[0061] In one implementation, the determination module 320 determines the business type of the service module based on the first performance data of each service node, including: determining the average performance data of each service node based on the first performance data of each service node; determining the business type of the service module based on the average performance data of each service node.

[0062] In one implementation, the first performance data includes at least one of CPU usage, waiting time for IO operations, memory usage, average IO operation ratio, data size called from disk to memory, and data size called from memory to disk.

[0063] In one implementation, the service type includes one of a no-adjustment class, a high-CPU-consumption class, a high-memory-consumption class, a high-disk-IO class, and a service-balancing class.

[0064] In one implementation, when the service type of the service module is the class that does not require adjustment, the determination module 320 determines the adjusted bearer request amount of each service node based on the load balancing algorithm corresponding to the service type, including: using the current bearer request amount of each service node as the adjusted bearer request amount of each service node.

[0065] In one implementation, when the service type of the service module is the high-CPU consumption class, the determination module 320 determines the adjusted bearer request amount of each service node based on the load balancing algorithm corresponding to the service type, including: determining the adjusted bearer request amount of each service node based on the CPU utilization rate of each service node, a first preset threshold, and the current bearer request amount of each service node.

[0066] In one implementation, when the service type of the service module is the high-memory consumption class, the determination module 320 determines the adjusted bearer request amount of each service node based on the load balancing algorithm corresponding to the service type, including: determining the adjusted bearer request amount of each service node based on the memory utilization rate of each service node, a second preset threshold, and the current bearer request amount of each service node.

[0067] In one implementation, when the service type of the service module is the high-consumption disk IO class, the determination module 320 determines the adjusted bearer request volume of each service node based on the load balancing algorithm corresponding to the service type, including: determining the adjusted bearer request volume of each service node based on the disk usage rate of each service node, a third preset threshold, and the current bearer request volume of each service node.

[0068] In one implementation, when the service type of the service module is the service balancing class, the determination module 320 determines the adjusted bearer request amount of each service node based on the load balancing algorithm corresponding to the service type, including: determining the first adjustment request amount of each service node based on the CPU usage rate of each service node, the fourth preset threshold, and the current bearer request amount of each service node; determining the second adjustment request amount of each service node based on the memory usage rate of each service node, the fifth preset threshold, and the current bearer request amount of each service node; determining the third adjustment request amount of each service node based on the disk usage rate of each service node, the sixth preset threshold, and the current bearer request amount of each service node; determining the adjusted bearer request amount of each service node based on the first adjustment request amount of each service node, the first weight value corresponding to the first adjustment request amount, the second adjustment request amount of each service node, the second weight value corresponding to the second adjustment request amount, the third adjustment request amount of each service node, and the third weight value corresponding to the third adjustment request amount.

[0069] In one implementation, the acquisition module 310 is further used to acquire the second performance data of each service node before determining the service type of the service module based on the first performance data of each service node, wherein the second performance data includes one of a service port status, a request response code, a request response time, a service log update status, and system resource performance data; the determination module 320 is further used to determine an abnormal service node based on the second performance data of each service node; the determination module 320 determines the service type of the service module based on the first performance data of each service node, including: determining the abnormal service node based on the first performance data of each normal service node; According to the service type of the service module, wherein the normal service node is a service node in the service module other than the abnormal service node; the determination module 320 determines the adjusted load-bearing request amount of each service node based on the load balancing algorithm corresponding to the service type, including: determining the adjusted load-bearing request amount of each normal service node based on the load balancing algorithm corresponding to the service type; the adjustment module 330 adjusts the request amount carried by each service node based on the adjusted load-bearing request amount of each service node, including: adjusting the request amount carried by each normal service node based on the adjusted load-bearing request amount of each normal service node.

[0070] The load balancing device provided in the embodiment of the present application can implement each process implemented in the load balancing method embodiment. To avoid repetition, it will not be repeated here.

[0071] The load balancing method provided in the embodiment of the present application can be executed by a load balancing device. In the embodiment of the present application, the load balancing method is executed by a load balancing device as an example to illustrate the device of the load balancing method provided in the embodiment of the present application.

[0072] Alternatively, if Figure 4 As shown, an embodiment of the present application also provides an electronic device 400, including a processor 401 and a memory 402, wherein the memory 402 stores programs or instructions that can be executed on the processor 401, and when the program or instructions are executed by the processor 401, the various steps of the above-mentioned load balancing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not repeated here.

[0073] It should be noted that the electronic devices in the embodiments of the present application include mobile electronic devices and non-mobile electronic devices.

[0074] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned load balancing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0075] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0076] An embodiment of the present application also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes: the steps of the above-mentioned load balancing method.

[0077] The above embodiments of the present application focus on describing the differences between the various embodiments. As long as the different optimization features between the various embodiments are not contradictory, they can be combined to form a better embodiment. Considering the simplicity of the text, they will not be repeated here.

[0078] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. A load balancing method, characterized in that: include: Acquire first performance data of each service node in the service module; Determining a service type of the service module based on the first performance data of each service node; Determining the adjusted bearer request amount of each service node based on a load balancing algorithm corresponding to the service type; Based on the adjusted bearer request amount of each service node, the request amount carried by each service node is adjusted.

2. The method according to claim 1, characterized in that The determining the service type of the service module based on the first performance data of each service node includes: Determine average performance data of each service node based on the first performance data of each service node; Based on the average performance data of each service node, a service type of the service module is determined.

3. The method according to claim 1 or 2, characterized in that: The first performance data includes at least one of CPU usage, waiting time for IO operation, memory usage, average IO operation ratio, data size called from disk to memory, and data size called from memory to disk.

4. The method according to claim 1, characterized in that: The service type includes one of a no-adjustment type, a high-CPU-consumption type, a high-memory-consumption type, a high-disk-IO type, and a service-balancing type.

5. The method according to claim 4, characterized in that In a case where the service type of the service module is the class that does not require adjustment, determining the adjusted bearer request amount of each service node based on a load balancing algorithm corresponding to the service type includes: The current bearer request amount of each service node is used as the adjusted bearer request amount of each service node.

6. The method according to claim 4, characterized in that In the case where the service type of the service module is the high CPU consumption class, determining the adjusted bearer request amount of each service node based on a load balancing algorithm corresponding to the service type includes: Based on the CPU usage rate of each service node, the first preset threshold, and the current bearer request volume of each service node, the adjusted bearer request volume of each service node is determined.

7. The method according to claim 4, characterized in that In a case where the service type of the service module is the high memory consumption class, determining the adjusted bearer request amount of each service node based on a load balancing algorithm corresponding to the service type includes: Based on the memory usage rate of each service node, the second preset threshold, and the current bearer request volume of each service node, the adjusted bearer request volume of each service node is determined.

8. The method according to claim 4, characterized in that In the case where the service type of the service module is the high-consumption disk IO type, determining the adjusted bearer request amount of each service node based on a load balancing algorithm corresponding to the service type includes: Based on the disk usage rate of each service node, the third preset threshold, and the current bearer request volume of each service node, the adjusted bearer request volume of each service node is determined.

9. The method according to claim 4, characterized in that In a case where the service type of the service module is the service balancing class, determining the adjusted bearer request amount of each service node based on a load balancing algorithm corresponding to the service type includes: Determine a first adjustment request amount of each service node based on a CPU usage rate of each service node, a fourth preset threshold, and a current bearer request amount of each service node; Determine a second adjustment request amount of each service node based on a memory usage rate of each service node, a fifth preset threshold, and a current bearer request amount of each service node; Determine a third adjustment request amount of each service node based on the disk usage rate of each service node, a sixth preset threshold, and a current load request amount of each service node; Based on the first adjustment request amount of each service node, the first weight value corresponding to the first adjustment request amount, the second adjustment request amount of each service node, the second weight value corresponding to the second adjustment request amount, the third adjustment request amount of each service node and the third weight value corresponding to the third adjustment request amount, the adjusted bearer request amount of each service node is determined.

10. The method according to claim 1, characterized in that Before determining the service type of the service module based on the first performance data of each service node, the method further includes: Acquire second performance data of each service node, wherein the second performance data includes one of a service port status, a request response code, a request response time, a service log update status, and system resource performance data; Determining an abnormal service node based on the second performance data of each service node; The determining the service type of the service module based on the first performance data of each service node includes: Determine the service type of the service module based on the first performance data of each normal service node, wherein the normal service node is a service node in the service module other than the abnormal service node; The determining, based on the load balancing algorithm corresponding to the service type, the adjusted bearer request amount of each service node includes: Determine, based on a load balancing algorithm corresponding to the service type, an adjusted bearer request amount of each normal service node; The adjusting the request amount carried by each service node based on the adjusted request amount of the service node includes: Based on the adjusted bearer request amount of each normal service node, adjust the request amount carried by each normal service node.