CN116431331A - Load balancing method and device, electronic equipment and computer readable medium - Google Patents

Load balancing method and device, electronic equipment and computer readable medium Download PDF

Info

Publication number
CN116431331A
CN116431331A CN202310256860.0A CN202310256860A CN116431331A CN 116431331 A CN116431331 A CN 116431331A CN 202310256860 A CN202310256860 A CN 202310256860A CN 116431331 A CN116431331 A CN 116431331A
Authority
CN
China
Prior art keywords
node
target
balance
list
receiving
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310256860.0A
Other languages
Chinese (zh)
Inventor
王宝
金均生
齐浩
李健
王昆垚
戴移胜
张国威
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202310256860.0A priority Critical patent/CN116431331A/en
Publication of CN116431331A publication Critical patent/CN116431331A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Abstract

The disclosure provides a load balancing method and device. One embodiment of the method comprises the following steps: determining at least one equalization target and a priority of each equalization target in response to receiving an access request stream to an initial node cluster; sequentially layering and sorting at least one balance target according to the order of the priority to obtain a target level; receiving load feedback information of an initial node cluster; based on balance targets and load feedback information except for the last layer of balance targets in the target level, carrying out hierarchical screening on the initial node clusters to obtain final node clusters meeting the target level; and obtaining a shunting result of each node in the final node cluster based on the final layer of balance target, the load feedback information of the final node cluster and the access request stream. This embodiment improves the efficiency of load balancing.

Description

Load balancing method and device, electronic equipment and computer readable medium
Technical Field
The present disclosure relates to the field of computer technology, and in particular, to a load balancing method and apparatus, an electronic device, and a computer readable medium.
Background
The existing dynamic load balancing technology can balance a single optimization target or balance a plurality of optimization targets simultaneously. The single-target load balancing technology dynamically adjusts the shunt weight of each node by collecting and analyzing the real-time change condition of each node in the cluster on the target to be balanced, thereby realizing the balancing of the optimization target. Based on the method, the multi-objective load balancing technology integrates a plurality of optimization objectives by setting integration weights for each single optimization objective, and finally realizes the overall balance of the multi-optimization objectives.
In actual operation, in the multi-target load balancing technology, weight proportion setting is seriously dependent on early-stage experiments, and proper weight proportion setting is difficult and complex; meanwhile, the weight ratios of different service applications are often different from each other and are difficult to multiplex, and when a new optimization balance target needs to be added, the integration weight needs to be reset, so that the scalability is poor.
Disclosure of Invention
Embodiments of the present disclosure provide a load balancing method and apparatus, an electronic device, and a computer readable medium.
In a first aspect, embodiments of the present disclosure provide a load balancing method, the method comprising: determining at least one equalization target and a priority of each equalization target in response to receiving an access request stream to an initial node cluster; sequentially layering and sorting at least one balance target according to the order of the priority to obtain a target level; receiving load feedback information of an initial node cluster; based on balance targets and load feedback information except for the last layer of balance targets in the target level, carrying out hierarchical screening on the initial node clusters to obtain final node clusters meeting the target level; and obtaining a shunting result of each node in the final node cluster based on the final layer of balance target, the load feedback information of the final node cluster and the access request stream.
In some embodiments, the step of hierarchically filtering the initial node cluster based on the balance targets and the load feedback information except for the balance target of the last layer in the target hierarchy to obtain a final node cluster satisfying the target hierarchy includes: aiming at a first-layer balance target in the target level, executing a screening strategy corresponding to the first-layer balance target on the initial node cluster based on load feedback information to obtain a node cluster screened by the first-layer balance target; aiming at each middle layer balance target in the target level, executing a screening strategy corresponding to the middle layer balance target on the node cluster screened by the middle layer balance target on the basis of load feedback information to obtain a middle node cluster meeting the middle layer balance target, wherein the middle layer balance target is all layers of balance targets except the first layer balance target and the last layer balance target in the target level; and responding to the completion of the execution of the screening strategies corresponding to all middle-layer balance targets in the target level, and obtaining the final node cluster meeting the target level.
In some embodiments, the above screening strategy comprises: calculating the average target index value of the middle layer balance target of each node in the current period based on the load feedback information of each node in the node cluster screened by the upper layer balance target; calculating average target index values of all nodes in the node cluster; and screening the load meeting the average target index value of all the nodes in the node cluster based on the difference between the average target index value of each node in the node cluster and the average target index value of all the nodes to obtain an intermediate node cluster.
In some embodiments, the obtaining the shunting result of each node in the final node cluster based on the final layer balancing target, the load feedback information of the final node cluster, and the access request stream includes: initializing initial shunt proportion of each node in a final node cluster and list attribute as a reject list and a receiving list; calculating a first expected value of a final layer of balance target based on load feedback information of the final node cluster; obtaining refusing balance degree based on load feedback information and a first expected value of each node in the refusing list, and adjusting list attribute of each node in the refusing list based on the refusing balance degree; obtaining the refused shunt proportion of each node in the refused list based on the initial shunt proportion and refused equilibrium degree of each node in the refused list, and replacing the initial shunt proportion of each node in the refused list by adopting the obtained refused shunt proportion; obtaining receiving balance degree based on load feedback information of each node in the receiving list and the first expected value, and adjusting list attribute of each node in the receiving list based on the receiving balance degree; based on the initial shunt proportion and the receiving balance degree of each node in the receiving list, obtaining the receiving shunt proportion of each node in the receiving list, and replacing the initial shunt proportion of each node in the receiving list by adopting the obtained refusing shunt proportion; and distributing access request streams to each node in the final node cluster based on the reject split ratio and the receive split ratio.
In some embodiments, the obtaining the rejection balancing degree based on the load feedback information and the first expected value of each node in the rejection list includes: determining the actual value of each node in the reject list corresponding to the balance target of the last layer based on the load feedback information of each node in the reject list; and obtaining the rejection equilibrium degree of each node in the rejection list based on the actual value and the first expected value of each node in the rejection list.
In some embodiments, the obtaining the receiving balance based on the load feedback information and the first expected value of each node in the receiving list includes: determining the actual value of each node in the receiving list corresponding to the balance target of the last layer based on the load feedback information of each node in the receiving list; and obtaining the receiving balance degree of each node in the receiving list based on the actual value and the first expected value of each node in the receiving list.
In some embodiments, the at least one equalization target comprises: the service availability and priority are lower than the central processor availability of the service availability; the receiving load feedback information of the initial node cluster comprises the following steps: receiving the success number and the failure number of each node in the initial node cluster in the current period in response to the service request; and receiving the utilization rate of the central processing unit fed back by each node in the initial node cluster in the current period.
In a second aspect, embodiments of the present disclosure provide a load balancing apparatus, the apparatus comprising: a determining unit configured to determine at least one equalization target and a priority of each equalization target in response to receiving an access request stream to the initial node cluster; the obtaining unit is configured to sequentially sort at least one balance target in a layering manner according to the order of the priority, so as to obtain a target level; the receiving unit is configured to receive load feedback information of the initial node cluster; the screening unit is configured to screen the initial node clusters in a layered manner based on the balance targets except the balance target of the last layer and the load feedback information in the target level to obtain a final node cluster meeting the target level; and the shunting unit is configured to obtain shunting results of all nodes in the final node cluster based on the final layer of balance target, the load feedback information of the final node cluster and the access request stream.
In some embodiments, the screening unit is further configured to: aiming at a first-layer balance target in the target level, executing a screening strategy corresponding to the first-layer balance target on the initial node cluster based on load feedback information to obtain a node cluster screened by the first-layer balance target; aiming at each middle layer balance target in the target level, executing a screening strategy corresponding to the middle layer balance target on the node cluster screened by the middle layer balance target on the basis of load feedback information to obtain a middle node cluster meeting the middle layer balance target, wherein the middle layer balance target is all layers of balance targets except the first layer balance target and the last layer balance target in the target level; and responding to the completion of the execution of the screening strategies corresponding to all middle-layer balance targets in the target level, and obtaining the final node cluster meeting the target level.
In some embodiments, the above screening strategy comprises: calculating the average target index value of the middle layer balance target of each node in the current period based on the load feedback information of each node in the node cluster screened by the upper layer balance target; calculating average target index values of all nodes in the node cluster; and screening the load meeting the average target index value of all the nodes in the node cluster based on the difference between the average target index value of each node in the node cluster and the average target index value of all the nodes to obtain an intermediate node cluster.
In some embodiments, the above-mentioned branching unit includes: the grouping module is configured to initialize initial distribution proportion and list attribute of each node in the final node cluster into a reject list and a receiving list; the calculating module is configured to calculate a first expected value of the balance target of the last layer based on the load feedback information; the rejection attribute module is configured to obtain rejection equalization degree based on the load feedback information and the first expected value of each node in the rejection list, and adjust list attributes of each node in the rejection list based on the rejection equalization degree; the rejection proportion module is configured to obtain rejection shunt proportions of all nodes in the rejection list based on the initial shunt proportions and rejection equilibrium degrees of all nodes in the rejection list, and replace the initial shunt proportions of all nodes in the rejection list by the obtained rejection shunt proportions; the receiving attribute module is configured to obtain receiving balance degree based on load feedback information and a first expected value of each node in the receiving list, and adjust list attributes of each node in the receiving list based on the receiving balance degree; the receiving proportion module is configured to obtain receiving proportion of each node in the receiving list based on the initial proportion of each node in the receiving list and the receiving balance degree, and replace the initial proportion of each node in the receiving list by the obtained refusing proportion; and the allocation module is configured to allocate access request streams to each node in the final node cluster based on the reject split ratio and the receive split ratio.
In some embodiments, the reject attribute module is further configured to: determining the actual value of each node in the reject list corresponding to the balance target of the last layer based on the load feedback information of each node in the reject list; and obtaining the rejection equilibrium degree of each node in the rejection list based on the actual value and the first expected value of each node in the rejection list.
In some embodiments, the above-described reception attribute module is further configured to: determining the actual value of each node in the receiving list corresponding to the balance target of the last layer based on the load feedback information of each node in the receiving list; and obtaining the receiving balance degree of each node in the receiving list based on the actual value and the first expected value of each node in the receiving list.
In some embodiments, the at least one equalization target comprises: the service availability and priority are lower than the central processor availability of the service availability; the above-mentioned receiving unit is further configured to: receiving the success number and the failure number of each node in the initial node cluster in the current period in response to the service request; and receiving the utilization rate of the central processing unit fed back by each node in the initial node cluster in the current period.
In a third aspect, embodiments of the present disclosure provide an electronic device comprising: one or more processors; a storage device having one or more programs stored thereon; the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method as described in any of the implementations of the first aspect.
In a fourth aspect, embodiments of the present disclosure provide a computer readable medium having stored thereon a computer program which, when executed by a processor, implements a method as described in any of the implementations of the first aspect.
The embodiment of the disclosure provides a load balancing method and device, firstly, determining at least one balancing target and priority of each balancing target in response to receiving an access request stream to an initial node cluster; secondly, sequentially layering and sequencing at least one balance target according to the order of priority to obtain a target level; thirdly, receiving load feedback information of the initial node cluster; from time to time, based on balance targets and load feedback information except for the last layer of balance targets in the target level, the initial node cluster is screened in a layered manner, and a final node cluster meeting the target level is obtained; and finally, obtaining a shunting result of each node in the final node cluster based on the final layer of balance target, the load feedback information of the final node cluster and the access request stream. Therefore, at least one equalization target is ranked in a grading manner from large to small according to the importance degree of the application service, the suboptimal equalization target is required to be processed after the load screening of the suboptimal equalization target is completed, no additional integration weight is required to be considered, optimal node selection is estimated for the flow request, the overall load equalization of the node cluster on the equalization targets with different priorities is realized, and the resource utilization rate and the performance of the node cluster are improved; for the newly added balancing target, the newly added balancing target can be processed by nesting the newly added balancing target to the corresponding position of the target level in a layered manner according to the priority order, so that the efficiency of load balancing is improved.
Drawings
Other features, objects and advantages of the present disclosure will become more apparent upon reading of the detailed description of non-limiting embodiments, made with reference to the following drawings:
FIG. 1 is an exemplary system architecture diagram in which an embodiment of the present disclosure may be applied;
FIG. 2 is a flow chart of one embodiment of a load balancing method according to the present disclosure;
FIG. 3 is a corresponding multi-objective load balancing block diagram according to the load balancing method of the present disclosure;
FIG. 4 is a schematic diagram of a dual target load balancing architecture of the present disclosure;
FIG. 5 is a schematic structural view of one embodiment of a load balancing apparatus according to the present disclosure;
fig. 6 is a schematic structural diagram of an electronic device suitable for use in implementing embodiments of the present disclosure.
Detailed Description
The present disclosure is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings.
It should be noted that, without conflict, the embodiments of the present disclosure and features of the embodiments may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 illustrates an exemplary system architecture 100 in which the load balancing methods of the present disclosure may be applied.
As shown in fig. 1, a system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used as a medium to provide communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, and may generally include wireless communication links, and the like.
The terminal devices 101, 102, 103 interact with the server 105 via the network 104 to receive or send messages or the like. Various communication client applications, such as an instant messaging tool, a mailbox client, etc., may be installed on the terminal devices 101, 102, 103.
The terminal devices 101, 102, 103 may be hardware or software; when the terminal devices 101, 102, 103 are hardware, they may be user devices having communication and control functions, and the above-mentioned user settings may be communicated with the server 105. When the terminal devices 101, 102, 103 are software, they may be installed in the above-mentioned user devices; the terminal devices 101, 102, 103 may be implemented as a plurality of software or software modules (e.g. software or software modules for providing distributed services) or as a single software or software module. The present invention is not particularly limited herein.
The server 105 may be a server providing various services, such as a background server providing message bodies for load balancing systems on the terminal devices 101, 102, 103. The background server can determine a target level based on the obtained balance target and the priority of the balance target after receiving the access request stream to the initial node cluster, and perform hierarchical screening on the initial node cluster (all terminal devices connected with the server) based on the target level to obtain a final node cluster meeting the target level, and obtain a distribution result of the final node cluster based on the balance of the last layer, the load feedback information of the final node cluster and the access request stream.
The server may be hardware or software. When the server is hardware, the server may be implemented as a distributed server cluster formed by a plurality of servers, or may be implemented as a single server. When the server is software, it may be implemented as a plurality of software or software modules (e.g., software or software modules for providing distributed services), or as a single software or software module. The present invention is not particularly limited herein.
It should be noted that, the load balancing method provided by the embodiments of the present disclosure is generally performed by the server 105.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With the increasing complexity of business logic and the increasing size of systems, distributed service architecture has become the mainstay in practical production environments today. Meanwhile, in order to avoid the problems of resource waste caused by uneven resource distribution and cluster performance degradation caused by service overload in the distributed clusters, an effective load balancing strategy needs to be designed to improve the resource utilization rate and performance of the service clusters so as to better provide services for users.
Based on the principle that whether cluster load information can be predetermined, the existing load balancing technology can be divided into static and dynamic types, such as: a static load balancing technology such as Round Robin (Round Robin) and Random (Random) on the premise that the load processing capacities of all nodes of the cluster are the same, and a dynamic load balancing technology such as minimum link number (Least Connections) and minimum delay (Locality Aware) by dynamically collecting load information of all nodes in real time. The static load balancing technology has the advantages of simple processing strategy, high timeliness and the like, but a large-scale distributed service cluster in an actual production environment often has poor load balancing effect due to factors such as mixed deployment of containerized applications. The dynamic load balancing technology adjusts the shunt strategy in real time based on the load information feedback of each node in the cluster, so that the influence of non-homogeneous application deployment can be effectively avoided, and the utilization rate of cluster resources and the overall performance of service are improved.
Dynamic load balancing technology of single-target balancing: in order to realize a high-availability, high-concurrency and high-performance distributed cluster system, the performance index of each node of the cluster is concerned, and meanwhile, the stability of business service indexes is considered. Because the single-target equalization technology only focuses on equalization stability of a certain system optimization target, the single-target equalization technology is slightly insufficient in application services with complex requirements.
The dynamic load balancing technology of multi-objective balancing is based on single-objective balancing, and integrates a plurality of targets to be optimized by setting corresponding integration weights for different optimization targets, so that the overall balancing is realized. In the processing mode, a plurality of optimization targets are treated in the same level in parallel, and the differentiated requirements of specific services on different optimization targets are distinguished by setting the integration weight. However, in actual operation, the weight proportion setting is seriously dependent on the early-stage experiment, and the proper weight proportion setting is difficult and complicated; meanwhile, the weight proportions of different service applications are often different from each other, and the service applications are difficult to multiplex with each other; finally, when a new optimization balancing target needs to be added, the integration weight needs to be reset, and the expandability is poor.
Aiming at the defects, the disclosure provides a load balancing method, which mainly solves the problem that weight proportions among different service applications are often different and are difficult to multiplex in a multi-target balanced dynamic load balancing technology, and the method estimates optimal node selection for a flow request at the current moment by collecting and analyzing related load information fed back by each node of a downstream service cluster in real time, so as to dynamically adjust a shunting strategy of each node of the cluster to adapt to complex and changeable online cluster environments; the equalization targets are ranked in a grading manner from large to small according to priority based on the importance degree of the application service, the sub-optimal equalization targets need to be processed after the optimal equalization targets complete load information feedback, and different equalization targets are mutually nested according to the priority order. Therefore, additional integration weight is not needed to be considered, and for the newly added balance target, the newly added balance target is only needed to be processed by being nested to the corresponding position in a layered manner according to the priority order. Referring to fig. 2, a flow 200 of one embodiment of a load balancing method according to the present disclosure is shown, the load balancing method comprising the steps of:
in response to receiving the access request stream to the initial node cluster, at least one equalization target and a priority of each equalization target is determined 201.
In this embodiment, the initial node cluster is a plurality of nodes connected to a server in a distributed architecture, where the server may be an execution body that runs the load balancing method of the present disclosure, the access request flow is a request of at least one access party to access a node in the initial node cluster, such as an access request flow F in fig. 3, and the execution body distributes the access request flow to at least one node in the initial node cluster, where the node in the node cluster in fig. 3 includes: client 1, client 2 … client n (n > 2), and the load of each node needs to be balanced when distributing to improve the resource utilization and performance of the initial node cluster.
Step 202, sequentially layering and sorting at least one balance target according to the order of priority to obtain a target level.
In this embodiment, based on the influence degree of each balance target on the performance and service of the initial node cluster, the balance targets are ranked to obtain the priority order of the balance targets.
In this embodiment, the priority levels of the equalization targets in the target hierarchy are ordered from high to low, and when the equalization targets are considered, the equalization target with the highest priority is determined first, and then the equalization targets with lower priorities are executed sequentially. The target hierarchy includes: and (3) judging whether the A-level balance target is met or not according to the A-level balance target and the B-level balance target (A > B), and considering the B-level balance target after the A-level balance target is met.
Optionally, the target hierarchy comprises: two different equalization targets C1, C2 with the same hierarchy are regarded as the same equalization target, and the equalization targets C1, C2 need to be considered simultaneously at this layer.
And 203, receiving load feedback information of the initial node cluster.
In this embodiment, the load feedback information refers to load information of each node in the initial node cluster, and for different balancing targets, the load feedback information corresponds to the balancing target. For example, the balance target is the service availability (such as request processing delay, stand-alone availability), then the load feedback information is the successful number of successful responses to the service requests and the unsuccessful number of unsuccessful responses to the service requests. For another example, if the balance target is a machine performance index, the load feedback information includes: the CPU utilization and memory occupancy of each node are specified values.
Step 204, hierarchical screening is performed on the initial node clusters based on the balance targets and load feedback information except for the balance target of the last layer in the target hierarchy, so as to obtain final node clusters meeting the target hierarchy.
In this embodiment, hierarchical screening is performed on the nodes in the initial node cluster by the balance targets except for the balance target of the last layer in the target hierarchy, and then the final node cluster is shunted by the balance target of the last layer, so that the shunted nodes can simultaneously meet the requirements of all the balance targets in the target hierarchy.
In this embodiment, from the equalization target with the highest priority in the target hierarchy, the equalization targets of different hierarchies are checked sequentially according to the priority order, and the low-priority target can be regarded as the supplementary correction term of the high-priority target adjustment shunt policy, so as to realize hierarchical feedback adjustment.
In this embodiment, the splitting policy is a policy that allocates the size or proportion of the access request flow to each node in the node cluster, and for a node with a high load in the node cluster, allocates a small amount of access request flow to the node with a high load; for low-load nodes in the node cluster, a large number of access request flows are allocated to the low-load nodes.
Optionally, for the balance target of the current level, if the node in the middle node cluster cannot meet the current balance target, directly adjusting the balance target to the current shunting strategy of node shunting, otherwise, traversing all balance targets in the target level in sequence; meanwhile, the load information of the service node at the current moment feeds the grades back to the processing process of each balance target of the next period one by one, and then the adjustment of the distribution strategy at the next moment is determined.
Step 205, obtaining a shunting result of each node in the final node cluster based on the final layer balancing target, the load feedback information of the final node cluster and the access request stream.
In this embodiment, for the final node cluster, load feedback information of each node history request in the final node cluster on balance targets of different levels is counted and analyzed, so as to dynamically adjust a current time request splitting strategy, further optimize load differences of different nodes in the cluster, and finally realize gradual convergence of each node of the cluster on the balance targets through periodic feedback information.
According to the load balancing method provided by the embodiment, different balancing targets are ordered in a layered mode according to the priorities, and load information fed back by each node in real time is counted and processed in sequence in the processing process, so that overall balancing of cluster nodes on the balancing targets with different priorities is achieved.
The load balancing method provided by the embodiment of the disclosure includes the steps of firstly, responding to received access request streams to an initial node cluster, and determining at least one balancing target and priority of each balancing target; secondly, sequentially layering and sequencing at least one balance target according to the order of priority to obtain a target level; thirdly, receiving load feedback information of the initial node cluster; from time to time, based on balance targets and load feedback information except for the last layer of balance targets in the target level, the initial node cluster is screened in a layered manner, and a final node cluster meeting the target level is obtained; and finally, obtaining a shunting result of each node in the final node cluster based on the final layer of balance target, the load feedback information of the final node cluster and the access request stream. Therefore, at least one equalization target is ranked in a grading manner from large to small according to the importance degree of the application service, the suboptimal equalization target is required to be processed after the load screening of the suboptimal equalization target is completed, no additional integration weight is required to be considered, optimal node selection is estimated for the flow request, the overall load equalization of the node cluster on the equalization targets with different priorities is realized, and the resource utilization rate and the performance of the node cluster are improved; for the newly added balancing target, the newly added balancing target can be processed by nesting the newly added balancing target to the corresponding position of the target level in a layered manner according to the priority order, so that the efficiency of load balancing is improved.
In some optional implementations of the disclosure, the step of hierarchically screening the initial node cluster based on the balance targets and the load feedback information except for the balance target of the last layer in the target hierarchy to obtain a final node cluster meeting the target hierarchy includes:
aiming at a first-layer balance target in the target level, executing a screening strategy corresponding to the first-layer balance target on the initial node cluster based on load feedback information to obtain a node cluster screened by the first-layer balance target; aiming at each middle layer balance target in the target level, executing a screening strategy corresponding to the middle layer balance target on the node cluster screened by the middle layer balance target on the basis of load feedback information to obtain a middle node cluster meeting the middle layer balance target, wherein the middle layer balance target is all layers of balance targets except the first layer balance target and the last layer balance target in the target level; and responding to the completion of the execution of the screening strategies corresponding to all middle-layer balance targets in the target level, and obtaining the final node cluster meeting the target level.
In this embodiment, the filtering policy is a policy of filtering loads in the node cluster, the balancing targets are different, the filtering policies are different, the load which has deviated from the balancing target can be accurately identified through the filtering policy, and removed, so as to obtain the load which meets the balancing target, for example, the balancing target is a service index, the filtering policy corresponding to the balancing target is a policy related to the value of the service index, and the node cluster which meets the optimal service index can be filtered through the filtering policy corresponding to the service index.
In this embodiment, the target hierarchy may include: the method comprises the steps of executing a screening strategy corresponding to a first-layer balance target on an initial node cluster from the first-layer balance target (highest in priority) of a target level to determine the initial node cluster meeting the requirement of the first balance target; and executing a screening strategy corresponding to the middle layer balance target on the initial node cluster meeting the first balance target requirement in a layered manner to obtain a final node cluster meeting all the middle layer balance targets.
According to the method for hierarchical screening of the initial node clusters, which is provided by the alternative implementation mode, aiming at the first-layer balance target in the target level, the screening strategy corresponding to the first-layer balance target is executed on the initial node clusters to obtain node clusters screened by the first-layer balance target, aiming at the middle-layer balance targets except the first-layer balance target in the target level, the screening strategy corresponding to the middle-layer balance target is executed on the node clusters screened by the middle-layer balance target in the last layer to obtain final node clusters meeting all balance targets in the target level, the reliability of hierarchical screening is improved, and the load in the final node clusters is guaranteed to be the optimal load.
Optionally, the step of hierarchically screening the initial node cluster based on the balance targets and the load feedback information except for the balance target of the last layer in the target hierarchy, to obtain a final node cluster meeting the target hierarchy includes: determining expected values of balance targets of all layers in the target level based on load feedback information of all nodes in the initial node cluster; and for all layers of balance targets except the last layer of balance target in the target hierarchy, sequentially detecting whether load feedback information of all nodes in the initial node cluster is larger than or equal to expected values of all layers of balance targets according to the priority order of the hierarchy, and aggregating loads larger than or equal to the expected values of all layers of balance targets to obtain the final node cluster in response to the load being larger than or equal to the expected values of all layers of balance targets.
In some optional implementations of the disclosure, the screening policy includes: calculating the average target index value of the middle layer balance target of each node in the current period based on the load feedback information of each node in the node cluster screened by the upper layer balance target; calculating average target index values of all nodes in the node cluster; and screening the load meeting the average target index value of all the nodes in the node cluster based on the difference between the average target index value of each node in the node cluster and the average target index value of all the nodes to obtain an intermediate node cluster.
In this alternative implementation manner, the above-mentioned upper layer balancing target is a balancing target adjacent to the middle layer balancing target in the target hierarchy, and the priority level is greater than the middle layer balancing target, as in fig. 3, where the target hierarchy includes: layer L1, layer L2 … layer Ln (n is greater than 2), where layer L1 is the upper layer equalization target of layer L2, layer L1 has a priority greater than layer L2, and in fig. 3, layer Ln is the lowest priority equalization target in the target hierarchy, which is also the last layer equalization target.
In this optional implementation manner, calculating the average target index value of the balance target of each node in the current period based on the load feedback information of each node in the node cluster screened by the balance target of the previous layer includes: and determining the actual value of a second-layer balance target of each node in the node cluster screened by the first-layer balance target based on the load feedback information of the node cluster screened by the first-layer balance target, and averaging all the actual values in the current period (preset time period) to obtain an average target index value of each node in the node cluster screened by the first-layer balance target, wherein the second-layer balance target is a balance target which is positioned behind the first-layer balance target in a target level and has a priority lower than that of the first-layer balance target.
In the alternative implementation manner, the actual values of the balance targets of all the nodes are collected in the current period, all the actual values in the current period are averaged, and the average target index values (corresponding to a plurality of average target index values of all the nodes) of all the nodes are obtained; the average target index values of all nodes are averaged to obtain an average target index value (one total average target index value corresponding to all nodes) corresponding to all nodes.
In this optional implementation manner, the screening the load meeting the average target index value of all the nodes in the node cluster based on the difference between the average target index value of each node in the node cluster and the average target index value of all the nodes, to obtain the intermediate node cluster includes: and respectively differencing the average target index value of each node in the node cluster with the average target index value of all the nodes, and taking the load, in which the difference value between the average target index value and the average target index value of all the nodes is smaller than or equal to a preset difference value, as an intermediate node cluster, wherein the loads in the intermediate node cluster all meet the balance target.
According to the screening strategy provided by the alternative implementation mode, firstly, the average target index value of the balance target of each node is calculated, then the average target index value of all nodes is calculated, and based on the difference value between the average target index value of each node and the average target index value of all nodes, the intermediate node cluster is screened out, so that the node which has deviated from the balance target can be accurately identified, and the reliability of node load screening is improved.
In some optional implementations of the disclosure, the obtaining the shunting result of each node in the final node cluster based on the final layer balancing target, the load feedback information of the final node cluster, and the access request flow includes: initializing initial shunt proportion of each node in a final node cluster and list attribute as a reject list and a receiving list; calculating a first expected value of a final layer of balance target based on load feedback information of the final node cluster; obtaining refusing balance degree based on load feedback information and a first expected value of each node in the refusing list, and adjusting list attribute of each node in the refusing list based on the refusing balance degree; obtaining the refused shunt proportion of each node in the refused list based on the initial shunt proportion and refused equilibrium degree of each node in the refused list, and replacing the initial shunt proportion of each node in the refused list by adopting the obtained refused shunt proportion; obtaining receiving balance degree based on load feedback information of each node in the receiving list and the first expected value, and adjusting list attribute of each node in the receiving list based on the receiving balance degree; based on the initial shunt proportion and the receiving balance degree of each node in the receiving list, obtaining the receiving shunt proportion of each node in the receiving list, and replacing the initial shunt proportion of each node in the receiving list by adopting the obtained refusing shunt proportion; and distributing access request streams to each node in the final node cluster based on the reject split ratio and the receive split ratio.
In this embodiment, the equalization degree corresponds to the list and is used for measuring whether the node belongs to the parameter of the list, wherein the rejection equalization degree is used for measuring whether the node belongs to the parameter of the rejection list, and the receiving equalization degree is used for measuring whether the node belongs to the parameter of the receiving list.
In this optional implementation manner, the obtaining the rejection balancing degree based on the load feedback information and the first expected value of each node in the rejection list, and adjusting the list attribute of each node in the rejection list based on the rejection balancing degree includes: based on the difference between feedback information of each node corresponding to the last layer of balance target in the reject list and the first expected value, the calculated reject balance degree, and determining that the list attribute of the node belongs to the reject list in response to the reject balance degree of the node being smaller than or equal to a preset reject threshold; otherwise, determining that the list attribute of the node belongs to the received list.
In this optional implementation manner, the obtaining the receiving equalization degree based on the load feedback information and the first expected value of each node in the receiving list, and adjusting the list attribute of each node in the receiving list based on the receiving equalization degree includes: based on the difference between the feedback information of the node corresponding to the last layer of balance target in the receiving list and the first expected value, the calculated receiving balance degree, and determining that the list attribute of the node belongs to the receiving list in response to the receiving balance degree of the node being smaller than or equal to a preset receiving threshold value; otherwise, determining that the list attribute of the node belongs to the reject list.
In this optional implementation manner, the obtaining the reject splitting ratio of each node in the reject list based on the initial splitting ratio and the reject balancing degree of each node in the reject list includes: and inputting the initial shunt proportion and rejection equilibrium degree of each node in the absolute list into a rejection proportion calculation formula to obtain the rejection shunt proportion.
The rejection ratio calculation formula is shown in formula (1):
ratio new =ratio old +(1-ratio old )*diff pos (1)
in formula (1), ratio new To reject split ratio old For initial split ratio, diff pos To reject the equalization.
In this optional implementation manner, the obtaining the receive split ratio of each node in the receive list based on the initial split ratio and the receive equalization degree of each node in the receive list includes: and inputting the initial split ratio of each node in the receiving list, and receiving the balance degree into a receiving ratio calculation formula to obtain the receiving split ratio.
The calculation formula of the receiving split ratio is shown in formula (2):
ratio new ′=ratio old ’*(1-diff neg ) (2)
in formula (2), ratio new ' for receiving split ratio old ' is the initial split ratio, diff pos For receiving the degree of equalization.
In this embodiment, the allocating the access request stream to each node in the final node cluster based on the reject split ratio and the receive split ratio includes: determining the flow size of an access request stream; adding all refused split proportion and receiving split proportion to obtain total split proportion; for each node, dividing the split ratio (reject split ratio or receive split ratio) of the node by the total split ratio and multiplying by the flow size to obtain the flow size of the node.
In this embodiment, all nodes of the whole final node cluster at any moment are divided into two parts of a reject list and a receive list based on a first expected value of a final layer of balance target, and a numerical difference between an actual value of a node and the first expected value characterizes the "balance degree" of a current node on the final layer of balance target. The nodes in the reject list adopt a policy of reducing the split ratio, the nodes in the receive list increase the split ratio, and the specific change ratio of the split ratio is determined by the balance of the current node.
Specifically, the high load node feeds back the load information to the processing logic of the convergence strategy in real time; then, the processing strategy calculates the balance degree of the corresponding node based on the difference between the actual load of the node and the balance target expected load, and further determines the list attribute of the current node; then, adopting a mode of reducing or increasing the shunt proportion according to the list attribute of the current node so as to gradually reduce the load of the current node; finally, if the load of the current node is reduced too much after the current node is adjusted by the shunting strategy due to factors such as cluster abnormal fluctuation, the node is immediately transited to a low-load node, and the real-time load information of the node is fed back to the processing logic of the convergence strategy in the next processing period so as to adopt a proper shunting proportion adjustment mode in the follow-up process. The whole processing flow integrally forms closed-loop logic, and can adaptively adjust the shunting strategy of the corresponding node according to the dynamic change of the load of each node in the cluster, thereby realizing the gradual convergence of the load of the node of the whole cluster.
According to the method for obtaining the shunting results of the nodes in the final node cluster, the node cluster is divided into the reject list and the receive list, and the balance degree is calculated based on the real-time load feedback information periodically fed back by the nodes, so that the self-adaptive iterative updating of the node shunting strategy is realized, the severe influence of abnormal jitter of the node load on the shunting results can be effectively reduced, and the stability of the balance effect is further maintained.
In some optional implementations of the disclosure, obtaining the rejection balancing degree based on the load feedback information and the first expected value of each node in the rejection list includes: determining the actual value of each node in the reject list corresponding to the balance target of the last layer based on the load feedback information of each node in the reject list; and obtaining the rejection equilibrium degree of each node in the rejection list based on the actual value and the first expected value of each node in the rejection list.
In this optional implementation manner, the actual values of the nodes in the reject list and the first expected value are input into a reject equilibrium calculation formula to obtain the reject equilibrium.
The formula of the rejection equalization degree calculation is shown as (3):
diff pos =(load cur -load ref )/load cur (3)
In formula (3), load cur Load for rejecting each node in list to actually take value ref To take the first expected value, diff pos To reject the equalization.
According to the method for obtaining the refused shunt proportion, which is provided by the alternative implementation mode, the refused equilibrium degree of the current node is obtained according to the actual value and the first expected value of the current node, the list attribute of the nodes in the refused list can be effectively judged by calculating the refused equilibrium degree in real time, and a reliable basis is provided for attribute division of different nodes.
Optionally, the obtaining the rejection balancing degree based on the load feedback information and the first expected value of each node in the rejection list includes: determining the actual value of each node in the reject list corresponding to the balance target of the last layer based on the load feedback information of each node in the reject list; and comparing the actual value of each node in the reject list with the first expected value to obtain the reject equilibrium degree of each node in the reject list.
In some optional implementations of the disclosure, obtaining the receive equalization degree based on the load feedback information and the first expected value of each node in the receive list includes: determining the actual value of each node in the receiving list corresponding to the balance target of the last layer based on the load feedback information of each node in the receiving list; and obtaining the receiving balance degree of each node in the receiving list based on the actual value and the first expected value of each node in the receiving list.
In this optional implementation manner, the actual values of the nodes in the receiving list and the first expected value are input into the receiving balance calculation formula to obtain the receiving balance.
The receiving equalization degree calculation formula is shown in formula (4):
diff neg =(load cur ’-load ref )/load ref (4)
in formula (4), load cur ' actually takes value for each node in the receiving list, load ref To take the first expected value, diff neg For receiving the degree of equalization.
According to the method for obtaining the receiving shunt proportion, which is provided by the alternative implementation mode, the receiving balance degree of the current node is obtained according to the actual value and the first expected value of the current node, the list attribute of the nodes in the receiving list can be effectively judged by calculating the receiving balance degree in real time, and a reliable basis is provided for attribute division of different nodes.
Optionally, based on the load feedback information and the first expected value of each node in the receiving list, obtaining the receiving balance degree includes: determining the actual value of each node in the receiving list corresponding to the balance target of the last layer based on the load feedback information of each node in the receiving list; and comparing the actual value of each node in the receiving list corresponding to the balance target of the last layer with the first expected value to obtain the receiving balance degree of each node in the receiving list.
In one embodiment of the present disclosure, the at least one equalization target comprises: the service availability and priority are lower than the central processor availability of the service availability; the receiving load feedback information of the initial node cluster comprises the following steps: receiving the success number and the failure number of each node in the initial node cluster in the current period in response to the service request; and receiving the utilization rate of the central processing unit fed back by each node in the initial node cluster in the current period.
As shown in fig. 4, for the online service application scenario, the service availability index often has a higher priority, i.e., L1 level, and compared to the central processing unit (Central Processing Unit, CPU) utilization, is used as an L2 level balancing target.
When balancing the service availability targets, firstly, counting the successful number (i.e. successful request statistics in fig. 4) and the failed number (i.e. failed request statistics in fig. 4) of each node request of the cluster in the current period to calculate the average availability of a single service node (i.e. the average availability of a single node in fig. 4); then, the average availability of all nodes in the initial node cluster is summarized to obtain the average availability of the initial node cluster (namely the average availability of the node cluster in fig. 4), and the average availability is taken as an expected value of an availability balance target in the current period; and then, based on the difference between the average availability of each node and the average availability of the initial node cluster, determining a final node cluster with the service availability meeting the expected value, and carrying out L2-level CPU utilization rate target equalization on the final node cluster.
The processing procedure for the L2 level CPU utilization balance target is as follows: first, the list attribute of all nodes in the final node cluster is initialized to be a reject list, and the initial splitting ratio of each node is set to be 0. And then, the CPU utilization rate periodically fed back by each node of the final node cluster is collected, and the CPU utilization rate average value of the whole final node cluster is calculated, so that a first expected value of a CPU utilization rate balance target is obtained. Finally, for cluster nodes with different attributes in the actual iteration scene, the actual rejection equalization degree and the actual receiving equalization degree of the node CPU utilization rate are obtained according to the formulas (3) and (4), and then the rejection split ratio and the receiving split ratio (namely, the rejection ratio adjustment and the receiving ratio adjustment in fig. 4) are obtained through the formulas (1) and (2).
For the nodes in the reject list, the current CPU utilization value is obtained by reducing the split for the nodes based on the reject split proportion of the previous period; and meanwhile, the newly added flow of each node in the receiving list is obtained by directly distributing the reduced flow of the nodes in the rejecting list in proportion based on the receiving and distributing proportion of the last period. Thus, the nodes rejecting the list update the splitting policy with equation (3) (1), which has the physical meaning: and the influence of other factors except the current node on the node shunting strategy is adjusted through the balance degree of the current node while the influence of the last period shunting proportion on the current node shunting strategy is reserved. Naturally, the receiving list node updates the split ratio by the equation (4) (2), and since the nodes in the receiving list split only proportionally, the node balance degree can be directly used as an influence factor to update the split ratio of the last period of the node. Notably, for different influencing factors which cause the change of the CPU utilization rate of each node in the reject list and the receiving list, the balance degree obtained by the formula (3) not only reflects the absolute difference between the actual CPU utilization rate of the node and the first expected value, but also considers the actual difference of the CPU utilization rates of different nodes; and the formula (4) is based on a first expected value of the cluster CPU utilization rate, so as to avoid the influence of the actual size difference of the CPU utilization rates of different nodes on the balance degree.
In summary, in service availability and CPU utilization dual-objective hierarchical feedback load balancing, after related node resources and data structure initialization is completed, all nodes in a cluster are divided into two parts of low availability and high availability by counting success/failure states of each node request. For the nodes in low availability, directly selecting to skip, while for the nodes in high availability, further considering CPU utilization index, dividing the high availability nodes into a CPU reject list and a CPU receive list based on the formulas (1) - (4), if the current node is in the CPU receive list, hitting the current request and ending, namely, the current request is shunted to the node; otherwise, the current node in the CPU reject list will be skipped and the next node is tried to repeat the above procedure. Finally, if the number of attempts reaches the upper limit or all candidate nodes (e.g., node 1, node 2, …, node n in fig. 4) have been traversed, the current requested splitting process will end directly and return a failure; after all candidate nodes change the list, the traffic of the access request flow is distributed to each candidate node based on the splitting strategy.
The load balancing method provided by the embodiment has the advantages that the service availability of the online node cluster and the utilization rate of the central processing unit of each node of the cluster are used as the direct representation of the high availability and high performance characteristics of the distributed online service, and are always the main targets concerned in the online system design, so that the service availability and the utilization rate of the central processing unit of each node of the cluster are used as the optimization targets of the state load balancing, the method has important practical significance and application value, and the load balancing of the online node cluster is effectively ensured.
With further reference to fig. 5, as an implementation of the task generating method shown in the foregoing figures, the present disclosure provides an embodiment of a load balancing apparatus, where an embodiment of the apparatus corresponds to the method embodiment shown in fig. 2, and the apparatus may be specifically applied to various electronic devices.
As shown in fig. 5, an embodiment of the present disclosure provides a load balancing apparatus 500, the apparatus 500 comprising: a determining unit 501, an obtaining unit 502, a receiving unit 503, a screening unit 504, and a splitting unit 505. Wherein the determining unit 501 may be configured to determine at least one equalization target and a priority of each equalization target in response to receiving an access request stream to an initial node cluster. The obtaining unit 502 may be configured to sequentially rank the at least one equalization target in order of priority, to obtain a target hierarchy. The receiving unit 503 may be configured to receive load feedback information of the initial node cluster. The filtering unit 504 may be configured to perform hierarchical filtering on the initial node cluster based on the balance targets and the load feedback information except for the balance target of the last layer in the target hierarchy, so as to obtain a final node cluster that meets the target hierarchy. The shunting unit 505 may be configured to obtain a shunting result of each node in the final node cluster based on the last layer of balancing target, load feedback information of the final node cluster, and an access request stream.
In the load balancing apparatus 500 of the present embodiment, the specific processes of the determining unit 501, the obtaining unit 502, the receiving unit 503, the screening unit 504, and the splitting unit 505 and the technical effects thereof may refer to steps 201, 202, 203, 204, and 205 in the corresponding embodiment of fig. 2, respectively.
In some embodiments, the screening unit 504 is further configured to: aiming at a first-layer balance target in the target level, executing a screening strategy corresponding to the first-layer balance target on the initial node cluster based on load feedback information to obtain a node cluster screened by the first-layer balance target; aiming at each middle layer balance target in the target level, executing a screening strategy corresponding to the middle layer balance target on the node cluster screened by the middle layer balance target on the basis of load feedback information to obtain a middle node cluster meeting the middle layer balance target, wherein the middle layer balance target is all layers of balance targets except the first layer balance target and the last layer balance target in the target level; and responding to the completion of the execution of the screening strategies corresponding to all middle-layer balance targets in the target level, and obtaining the final node cluster meeting the target level.
In some embodiments, the above screening strategy comprises: calculating the average target index value of the middle layer balance target of each node in the current period based on the load feedback information of each node in the node cluster screened by the upper layer balance target; calculating average target index values of all nodes in the node cluster; and screening the load meeting the average target index value of all the nodes in the node cluster based on the difference between the average target index value of each node in the node cluster and the average target index value of all the nodes to obtain an intermediate node cluster.
In some embodiments, the splitting unit 505 includes: grouping module (not shown), calculating module (not shown), rejecting attribute module (not shown), rejecting proportion module (not shown), receiving attribute module (not shown), receiving proportion module (not shown), and distributing module (not shown). The grouping module is configured to initialize initial distribution proportion and list attribute of each node in the final node cluster as a reject list and a receiving list; the calculating module is configured to calculate a first expected value of the balance target of the last layer based on the load feedback information; the rejection attribute module is configured to obtain rejection equalization degree based on the load feedback information and the first expected value of each node in the rejection list, and adjust list attributes of each node in the rejection list based on the rejection equalization degree; the rejection proportion module is configured to obtain rejection shunt proportions of all nodes in the rejection list based on the initial shunt proportions and rejection equilibrium degrees of all nodes in the rejection list, and replace the initial shunt proportions of all nodes in the rejection list by the obtained rejection shunt proportions; the receiving attribute module is configured to obtain receiving balance degree based on load feedback information and a first expected value of each node in the receiving list, and adjust list attributes of each node in the receiving list based on the receiving balance degree; the receiving proportion module is configured to obtain receiving proportion of each node in the receiving list based on the initial proportion of each node in the receiving list and the receiving balance degree, and replace the initial proportion of each node in the receiving list by the obtained refusing proportion; and the allocation module is configured to allocate access request streams to each node in the final node cluster based on the reject split ratio and the receive split ratio.
In some embodiments, the reject attribute module is further configured to: determining the actual value of each node in the reject list corresponding to the balance target of the last layer based on the load feedback information of each node in the reject list; and obtaining the rejection equilibrium degree of each node in the rejection list based on the actual value and the first expected value of each node in the rejection list.
In some embodiments, the above-described reception attribute module is further configured to: determining the actual value of each node in the receiving list corresponding to the balance target of the last layer based on the load feedback information of each node in the receiving list; and obtaining the receiving balance degree of each node in the receiving list based on the actual value and the first expected value of each node in the receiving list.
In some embodiments, the at least one equalization target comprises: the service availability and priority are lower than the central processor availability of the service availability; the above-mentioned receiving unit is further configured to: receiving the success number and the failure number of each node in the initial node cluster in the current period in response to the service request; and receiving the utilization rate of the central processing unit fed back by each node in the initial node cluster in the current period.
The load balancing apparatus provided by the embodiments of the present disclosure, first, a determining unit 501 determines at least one balancing target and priorities of the balancing targets in response to receiving an access request stream to an initial node cluster; secondly, the obtaining unit 502 sequentially sorts at least one balance target in a layered manner according to the order of priority, and obtains a target level; again, the receiving unit 503 receives load feedback information of the initial node cluster; from time to time, the screening unit 504 screens the initial node cluster in layers based on the balance targets except the balance target of the last layer and the load feedback information in the target level, so as to obtain a final node cluster meeting the target level; finally, the splitting unit 505 obtains a splitting result of each node in the final node cluster based on the final layer balancing target, the load feedback information of the final node cluster, and the access request stream. Therefore, at least one equalization target is ranked in a grading manner from large to small according to the importance degree of the application service, the suboptimal equalization target is required to be processed after the load screening of the suboptimal equalization target is completed, no additional integration weight is required to be considered, optimal node selection is estimated for the flow request, the overall load equalization of the node cluster on the equalization targets with different priorities is realized, and the resource utilization rate and the performance of the node cluster are improved; for the newly added balancing target, the newly added balancing target can be processed by nesting the newly added balancing target to the corresponding position of the target level in a layered manner according to the priority order, so that the efficiency of load balancing is improved.
Referring now to fig. 6, a schematic diagram of an electronic device 600 suitable for use in implementing embodiments of the present disclosure is shown.
As shown in fig. 6, the electronic device 600 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 601, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM603, various programs and data required for the operation of the electronic apparatus 600 are also stored. The processing device 601, the ROM 602, and the RAM603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
In general, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touchpad, keyboard, mouse, etc.; an output device 607 including, for example, a liquid crystal display (LCD, liquid Crystal Display), a speaker, a vibrator, and the like; storage 608 including, for example, magnetic tape, hard disk, etc.; and a communication device 609. The communication means 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. While fig. 6 shows an electronic device 600 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead. Each block shown in fig. 6 may represent one device or a plurality of devices as needed.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via communication means 609, or from storage means 608, or from ROM 602. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing means 601.
It should be noted that the computer readable medium of the embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In an embodiment of the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. Whereas in embodiments of the present disclosure, the computer-readable signal medium may comprise a data signal propagated in baseband or as part of a carrier wave, with computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (Radio Frequency), and the like, or any suitable combination thereof.
The computer readable medium may be contained in the server; or may exist alone without being assembled into the server. The computer readable medium carries one or more programs which, when executed by the server, cause the server to: determining at least one equalization target and a priority of each equalization target in response to receiving an access request stream to an initial node cluster; sequentially layering and sorting at least one balance target according to the order of the priority to obtain a target level; receiving load feedback information of an initial node cluster; based on balance targets and load feedback information except for the last layer of balance targets in the target level, carrying out hierarchical screening on the initial node clusters to obtain final node clusters meeting the target level; and obtaining a shunting result of each node in the final node cluster based on the final layer of balance target, the load feedback information of the final node cluster and the access request stream.
Computer program code for carrying out operations of embodiments of the present disclosure may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments described in the present disclosure may be implemented by means of software, or may be implemented by means of hardware. The described units may also be provided in a processor, for example, described as: a processor includes a determining unit, an obtaining unit, a receiving unit, a screening unit, and a shunting unit. Wherein the names of the units do not constitute a limitation of the unit itself in some cases, for example, the determining unit may also be described as a unit configured to determine at least one equalization target and a priority of each equalization target in response to receiving an access request stream to the initial node cluster.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above technical features, but encompasses other technical features formed by any combination of the above technical features or their equivalents without departing from the spirit of the invention. Such as the above-described features, are mutually substituted with (but not limited to) the features having similar functions disclosed in the embodiments of the present disclosure.

Claims (11)

1. A method of load balancing, the method comprising:
determining at least one equalization target and a priority of each equalization target in response to receiving an access request stream to an initial node cluster;
sequentially layering and sorting the at least one balance target according to the order of the priorities to obtain a target level;
receiving load feedback information of the initial node cluster;
based on the balance targets except the balance target of the last layer in the target level and the load feedback information, the initial node cluster is subjected to layered screening to obtain a final node cluster meeting the target level;
And obtaining a shunting result of each node in the final node cluster based on the final layer balance target, the load feedback information of the final node cluster and the access request stream.
2. The method of claim 1, wherein the hierarchically screening the initial node cluster based on the balance objectives in the target hierarchy other than the last-layer balance objective and the load feedback information to obtain a final node cluster that meets the target hierarchy comprises:
aiming at a first-layer balance target in the target level, executing a screening strategy corresponding to the first-layer balance target on the initial node cluster based on the load feedback information to obtain a node cluster screened by the first-layer balance target;
aiming at each middle layer balance target in the target level, based on the load feedback information, executing a screening strategy corresponding to the middle layer balance target on node clusters screened by the middle layer balance target in the last layer to obtain middle node clusters meeting the middle layer balance target, wherein the middle layer balance target is all layers of balance targets except the first layer balance target and the last layer balance target in the target level;
And responding to the completion of the execution of the screening strategies corresponding to all middle-layer balance targets in the target level, and obtaining the final node cluster meeting the target level.
3. The method of claim 2, wherein the screening policy comprises:
calculating the average target index value of the middle layer balance target of each node in the current period based on the load feedback information of each node in the node cluster screened by the upper layer balance target;
calculating average target index values of all nodes in the node cluster;
and screening the load meeting the average target index value of all the nodes in the node cluster based on the difference between the average target index value of each node in the node cluster and the average target index value of all the nodes to obtain an intermediate node cluster.
4. The method of claim 1, wherein the obtaining the split result for each node in the final node cluster based on the last layer balancing target, the load feedback information of the final node cluster, and the access request stream comprises:
initializing initial shunt proportion of each node in the final node cluster and list attribute as a reject list and a receiving list;
Calculating a first expected value of the final layer of balance targets based on the load feedback information of the final node cluster;
obtaining rejection balancing degree based on the load feedback information of each node in the rejection list and the first expected value, and adjusting list attributes of each node in the rejection list based on the rejection balancing degree;
obtaining the refused shunt proportion of each node in the refused list based on the initial shunt proportion of each node in the refused list and the refused equilibrium degree, and replacing the initial shunt proportion of each node in the refused list by adopting the obtained refused shunt proportion;
obtaining receiving balance degree based on load feedback information of each node in the receiving list and the first expected value, and adjusting list attribute of each node in the receiving list based on the receiving balance degree;
based on the initial shunt proportion of each node in the receiving list and the receiving balance degree, obtaining the receiving shunt proportion of each node in the receiving list, and adopting the obtained refusing shunt proportion to replace the initial shunt proportion of each node in the receiving list;
and distributing the access request flow to each node in the final node cluster based on the refusal diversion proportion and the receiving diversion proportion.
5. The method of claim 4, wherein the obtaining the rejection balancing degree based on the load feedback information of each node in the rejection list and the first expected value comprises:
determining the actual value of each node in the reject list corresponding to the balance target of the last layer based on the load feedback information of each node in the reject list;
and obtaining rejection equalization degree of each node in the rejection list based on the actual value of each node in the rejection list and the first expected value.
6. The method of claim 4, wherein the obtaining the receive equalization based on the load feedback information of each node in the receive list and the first expected value comprises:
determining the actual value of each node in the receiving list corresponding to the balance target of the last layer based on the load feedback information of each node in the receiving list;
and obtaining the receiving balance degree of each node in the receiving list based on the actual value of each node in the receiving list and the first expected value.
7. The method of claim 1, wherein the at least one equalization target comprises: the service availability and priority are lower than the central processor availability of the service availability; the receiving the load feedback information of the initial node cluster comprises the following steps: receiving the success number and the failure number of each node in the initial node cluster in the current period in response to the service request; and receiving the utilization rate of the central processing unit fed back by each node in the initial node cluster in the current period.
8. A load balancing apparatus, the apparatus comprising:
a determining unit configured to determine at least one equalization target and a priority of each equalization target in response to receiving an access request stream to the initial node cluster;
the obtaining unit is configured to sequentially rank the at least one balance target in a layering manner according to the priority order to obtain a target level;
a receiving unit configured to receive load feedback information of the initial node cluster;
a screening unit configured to screen the initial node cluster in layers based on the balance targets except for the last balance target and the load feedback information in the target level, so as to obtain a final node cluster meeting the target level;
and the shunting unit is configured to obtain shunting results of all nodes in the final node cluster based on the final layer of balance target, the load feedback information of the final node cluster and the access request stream.
9. The apparatus of claim 8, wherein the screening unit is further configured to: aiming at a first-layer balance target in the target level, executing a screening strategy corresponding to the first-layer balance target on the initial node cluster based on the load feedback information to obtain a node cluster screened by the first-layer balance target;
Aiming at each middle layer balance target in the target level, based on the load feedback information, executing a screening strategy corresponding to the middle layer balance target on node clusters screened by the middle layer balance target in the last layer to obtain middle node clusters meeting the middle layer balance target, wherein the middle layer balance target is all layers of balance targets except the first layer balance target and the last layer balance target in the target level;
and responding to the completion of the execution of the screening strategies corresponding to all middle-layer balance targets in the target level, and obtaining the final node cluster meeting the target level.
10. An electronic device, comprising:
one or more processors;
a storage device having one or more programs stored thereon;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1-7.
11. A computer readable medium having stored thereon a computer program, wherein the program when executed by a processor implements the method of any of claims 1-7.
CN202310256860.0A 2023-03-08 2023-03-08 Load balancing method and device, electronic equipment and computer readable medium Pending CN116431331A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310256860.0A CN116431331A (en) 2023-03-08 2023-03-08 Load balancing method and device, electronic equipment and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310256860.0A CN116431331A (en) 2023-03-08 2023-03-08 Load balancing method and device, electronic equipment and computer readable medium

Publications (1)

Publication Number Publication Date
CN116431331A true CN116431331A (en) 2023-07-14

Family

ID=87093420

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310256860.0A Pending CN116431331A (en) 2023-03-08 2023-03-08 Load balancing method and device, electronic equipment and computer readable medium

Country Status (1)

Country Link
CN (1) CN116431331A (en)

Similar Documents

Publication Publication Date Title
CN107770096B (en) SDN/NFV network dynamic resource allocation method based on load balancing
CN101167054B (en) Methods and apparatus for selective workload off-loading across multiple data centers
CN109714263B (en) Path selection method and device in satellite communication network
US20140089510A1 (en) Joint allocation of cloud and network resources in a distributed cloud system
Chiti et al. Virtual functions placement with time constraints in fog computing: A matching theory perspective
CN103401947A (en) Method and device for allocating tasks to multiple servers
US11356338B2 (en) Dynamic inter-cloud placement of virtual network functions for a slice
US11329901B2 (en) Dynamic inter-cloud placement of virtual network functions for a slice
CN113904923B (en) Service function chain joint optimization method based on software defined network
CN111614754B (en) Fog-calculation-oriented cost-efficiency optimized dynamic self-adaptive task scheduling method
CN102970379A (en) Method for realizing load balance among multiple servers
JP2017204712A (en) Virtual resource automatic selection system and method
CN111131486A (en) Load adjustment method and device of execution node, server and storage medium
Shukla et al. Fault tolerance based load balancing approach for web resources in cloud environment.
CN114205317B (en) SDN and NFV-based service function chain SFC resource allocation method and electronic equipment
Zhang et al. A survey of VNF forwarding graph embedding in B5G/6G networks
CN114625500A (en) Method and application for scheduling micro-service application based on topology perception in cloud environment
Godinho et al. A reconfigurable resource management framework for fog environments
CN112423041B (en) Video stream processing method and system based on QoS constraint under distributed computing platform
Elsharkawey et al. Mlrts: multi-level real-time scheduling algorithm for load balancing in fog computing environment
Azimzadeh et al. Placement of IoT services in fog environment based on complex network features: a genetic-based approach
CN110430236B (en) Method for deploying service and scheduling device
Bunyakitanon et al. HELICON: Orchestrating low-latent & load-balanced Virtual Network Functions
CN116431331A (en) Load balancing method and device, electronic equipment and computer readable medium
CN117056064A (en) Resource allocation method, device, server, storage medium and program product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination