Load balancing method and device, storage medium and electronic equipment

By clustering and task grouping of computing nodes, and optimizing task allocation with performance weights, the problem of low load balancing efficiency in high concurrency scenarios is solved, and efficient load balancing and dynamic load balancing are achieved.

CN118885293APending Publication Date: 2024-11-01BEIJING HOLYZONE TECH CORP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410945485.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-15
Publication Date
2024-11-01

AI Technical Summary

Technical Problem

In high concurrency scenarios, genetic algorithms have low load balancing efficiency due to their high complexity, making it difficult to effectively allocate a large number of tasks to multiple computing nodes.

Method used

By determining the current performance parameters of the calculation node, clustering and generating node groups, and sorting and grouping tasks according to the load, parallel processing is used to allocate the target tasks within the task group to the corresponding node group, and optimize task allocation using performance weights.

Benefits of technology

It improves load balancing efficiency, ensures that the load balancing strategies of different task groups are similar, realizes dynamic load balancing, and improves system performance as a whole.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118885293A_ABST
    Figure CN118885293A_ABST
Patent Text Reader

Abstract

The invention provides a load balancing method and device, a storage medium and electronic device.The method comprises the steps that current performance parameters of multiple computing nodes at the current moment are determined, and the load capacity corresponding to multiple to-be-distributed target tasks is determined; clustering the plurality of computing nodes according to the current performance parameters to generate a plurality of node groups; the node group comprises at least one computing node; sorting the plurality of target tasks according to the load capacity, and dividing the sorted target tasks to generate a plurality of task groups of which the number is the same as that of the node groups; the task group comprises a plurality of continuously arranged target tasks; and carrying out load balancing processing on the plurality of task groups in parallel, and distributing the plurality of target tasks in the task groups to the computing nodes of the corresponding node groups. Through the technical scheme provided by the embodiment of the invention, parallel load balancing can be carried out on each task group, and the load balancing efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of load balancing, and in particular to a load balancing method, device, storage medium and electronic device. Background Art

[0002] As the scale of the network continues to expand and user demand continues to increase, it is necessary to use load balancing technology to distribute network traffic to multiple servers on demand, and to expand the throughput capacity of the application system by distributing traffic to different back-end servers to improve network performance and reliability.

[0003] Genetic algorithms find the optimal solution to a problem through operations such as selection, crossover, and mutation, and play an important role in load balancing. However, due to the high complexity of genetic algorithms, especially in high-concurrency scenarios, the load balancing efficiency is low due to the large number of tasks to be assigned. Summary of the invention

[0004] To solve the above problems, an object of the embodiments of the present invention is to provide a load balancing method, device, storage medium and electronic device.

[0005] In a first aspect, an embodiment of the present invention provides a load balancing method, including:

[0006] Determine the current performance parameters of multiple computing nodes at the current moment, and determine the load corresponding to multiple target tasks to be assigned;

[0007] Clustering the plurality of computing nodes according to the current performance parameter to generate a plurality of node groups; the node group includes at least one computing node;

[0008] Sorting the plurality of target tasks according to the load, and dividing the sorted target tasks to generate a plurality of task groups having the same number as the node groups; the task group includes a plurality of continuously arranged target tasks;

[0009] Load balancing is performed on the plurality of task groups in parallel, and the plurality of target tasks in the task groups are allocated to the computing nodes of the corresponding node groups.

[0010] In some optional implementations, dividing the sorted target tasks to generate a plurality of task groups having the same number as the node groups includes:

[0011] Determine the performance weight of the node group according to the current performance parameters of all computing nodes in the node group; there is a positive correlation between the performance weight and the load that can be processed by all computing nodes in the node group;

[0012] The sorted target tasks are divided according to the performance weights of the multiple node groups to generate multiple task groups corresponding to the node groups one by one; the sum of the loads of all target tasks in the task group is positively correlated with the performance weight.

[0013] In some optional implementations, dividing the sorted target tasks according to the performance weights of the plurality of node groups to generate a plurality of task groups corresponding to the node groups one by one includes:

[0014] Determine the total load D of all the target tasks SUM ; d i represents the load of the i-th target task after sorting, and n is the number of target tasks to be assigned;

[0015] The sum of the expected loads of the corresponding task groups is determined according to the performance weights of the node groups; where D' j =w j D SUM , w j is the performance weight of the jth node group determined in order of performance weight from small to large, D' j represents the sum of the expected load of the jth task group;

[0016] In order of performance weight from small to large, the sorted target tasks are divided according to the sum of the expected loads corresponding to the node groups, and a plurality of task groups corresponding to the node groups are determined in sequence.

[0017] In some optional implementations, the sorted target tasks are divided according to the sum of the expected loads corresponding to the node groups in order of performance weight from small to large, and a plurality of task groups corresponding to the node groups are sequentially determined, including:

[0018] According to the load of the sorted target tasks, the corresponding sum of load is generated; among them, S k represents the sum of the kth load, and k = 1, 2, ..., n;

[0019] Determine a first task index index1 corresponding to the first task group, and determine a plurality of target tasks belonging to the first task group with the first task index index1 as a boundary;

[0020] in,

[0021] In order of performance weight from small to large, for the jth node group, according to the sum of the expected loads corresponding to the jth node group D' j, determine the j-th task index indexj corresponding to the j-th task group;

[0022] in, D i represents the sum of the actual loads of all target tasks in the i-th task group;

[0023] Taking the j-1th task index indexj-1 and the jth task index indexj as boundaries, a plurality of target tasks belonging to the jth task group are determined.

[0024] In some optional implementations, the performance weight of the node group is:

[0025]

[0026] Among them, w j is the performance weight of the jth node group, R j is the sum or mean of the current performance parameters of all computing nodes in the jth node group, and m is the number of node groups.

[0027] In some optional implementations, determining current performance parameters of the plurality of computing nodes at the current moment includes:

[0028] Determine a plurality of current performance indicators of each computing node at the current moment;

[0029] The multiple current performance indicators of the computing node are weighted to determine the current performance parameter of the computing node.

[0030] In some optional implementations, allocating the multiple target tasks in the task group to the computing nodes of the corresponding node group includes:

[0031] According to the genetic algorithm, the corresponding relationship between the multiple target tasks in the task group and the computing nodes of the corresponding node group is determined, and the tasks are allocated.

[0032] In a second aspect, an embodiment of the present invention further provides a load balancing device, including:

[0033] A determination module, used to determine the current performance parameters of multiple computing nodes at the current moment, and determine the load corresponding to multiple target tasks to be assigned;

[0034] A node grouping module, configured to cluster the plurality of computing nodes according to the current performance parameter to generate a plurality of node groups; the node group includes at least one computing node;

[0035] A task grouping module, used to sort the multiple target tasks according to the load, and divide the sorted target tasks to generate a plurality of task groups with the same number as the node groups; the task group includes a plurality of continuously arranged target tasks;

[0036] The parallel processing module is used to perform load balancing processing on the multiple task groups in parallel and distribute the multiple target tasks in the task groups to the computing nodes of the corresponding node groups.

[0037] In a third aspect, an embodiment of the present invention further provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are used in any one of the load balancing methods described above.

[0038] In a fourth aspect, an embodiment of the present invention further provides an electronic device, including:

[0039] at least one processor; and,

[0040] a memory communicatively connected to the at least one processor; wherein,

[0041] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform any one of the load balancing methods described above.

[0042] In the solution provided in the first aspect of the embodiment of the present invention, multiple computing nodes are clustered according to current performance parameters, so that computing nodes with the same or similar performance are divided into the same group, and the target tasks sorted by load are grouped into task groups corresponding to the node groups one by one, so that each task group can be load balanced in parallel to improve the load balancing efficiency. Target tasks with similar loads will be assigned to a group of identical or similar computing nodes, so that the load balancing strategies of different task groups can be relatively similar, and the overall load balancing can be basically achieved; and as the performance of the computing nodes changes, dynamic load balancing can basically be achieved.

[0043] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0045] Figure 1 A flow chart of a load balancing method provided by an embodiment of the present invention is shown;

[0046] Figure 2 A schematic diagram showing a load balancing server allocation task provided by an embodiment of the present invention is shown;

[0047] Figure 3 A schematic diagram of grouping provided by an embodiment of the present invention is shown;

[0048] Figure 4 A schematic diagram showing the structure of a load balancing device provided by an embodiment of the present invention is shown;

[0049] Figure 5 A schematic diagram of the structure of an electronic device for executing a load balancing method provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0050] In the description of the present invention, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0051] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0052] The load balancing method provided by the embodiment of the present invention can be executed by a load balancing server. Figure 1 As shown, the method includes:

[0053] Step 101: Determine current performance parameters of multiple computing nodes at the current moment, and determine the load corresponding to multiple target tasks to be assigned.

[0054] In the embodiment of the present invention, the load balancing server maintains multiple computing nodes, which may be servers in a cluster. The load balancing server may obtain task requests initiated by multiple clients by monitoring or other means, and then determine the tasks that need to be processed by the computing nodes, namely, the target tasks.

[0055] Figure 2 A schematic diagram showing the load balancing server allocation task. Figure 2 As shown in the figure, the load balancing server receives 6 target tasks to be assigned. If there are three servers that can handle these tasks, namely servers A, B, and C, then the corresponding target tasks can be assigned to the appropriate servers based on the load balancing strategy. Figure 2 As shown, target tasks 1 and 2 are assigned to server A, target task 4 is assigned to server B, and target tasks 3, 5, and 6 are assigned to server C. In general, the number of target tasks is greater than the number of computing nodes.

[0056] Each target task has a corresponding load, which indicates the load level of the target task. The larger the load, the more processing resources are required, or the longer the processing time required for the same computing node. In addition, each computing node has a corresponding performance parameter, which indicates the processing capability of the computing node for the task. The larger the performance parameter, the stronger the processing capability of the computing node for the task. Since the processing capability of the computing node changes in real time, that is, the performance parameter of the computing node changes dynamically, in this embodiment, the performance parameter determined at the current moment is referred to as the current performance parameter.

[0057] Optionally, for any computing node, there are multiple indicators that can characterize its processing capability, and the performance parameters of the computing node can be determined by combining these indicators. Specifically, the above step 101 "determining the current performance parameters of multiple computing nodes at the current moment" can include the following steps A1 to A2.

[0058] Step A1: Determine a plurality of current performance indicators of each computing node at the current moment.

[0059] Step A2: Perform weighted processing on multiple current performance indicators of the computing node to determine the current performance parameters of the computing node.

[0060] In the embodiment of the present invention, for each computing node, multiple performance indicators at the current moment, i.e., multiple current performance indicators, can be determined. The current performance indicators can include, for example, CPU utilization, memory utilization, bandwidth utilization, hard disk utilization, etc. of the computing node, which can be determined based on actual needs. In addition, a corresponding weight is set for each performance indicator, and these current performance indicators are weighted based on the weight, and the current performance parameters of the computing node can be determined according to the corresponding weighted processing results.

[0061] Among them, since the larger the current performance indicators such as CPU utilization (generally the ratio of CPU used), the fewer the remaining available CPU resources are, and the corresponding performance is worse; and the larger the current performance parameter is, the better the performance of the computing node is, so there is a negative correlation between the weighted processing result and the current performance parameter.

[0062] Step 102: Cluster multiple computing nodes according to current performance parameters to generate multiple node groups; a node group includes at least one computing node.

[0063] In the embodiment of the present invention, computing nodes with the same or similar current performance parameters are grouped together in a clustering manner to form a corresponding node group. For example, based on the size relationship of the current performance parameters, one or more computing nodes with similar sizes can be grouped together to form a corresponding node group.

[0064] Alternatively, if the current performance parameter includes multiple ones, each current performance parameter can be used as an attribute of a computing node, and the multiple computing nodes can be clustered based on a clustering algorithm such as K-means, thereby generating multiple node groups.

[0065] Step 103: sorting the multiple target tasks according to the load, and dividing the sorted target tasks to generate multiple task groups with the same number as the node groups; the task group includes multiple consecutively arranged target tasks.

[0066] In the embodiment of the present invention, after determining multiple node groups, the target tasks can be grouped to form multiple task groups, and the number of task groups is the same as the number of the node groups, and the task groups correspond to the node groups one by one. For example, if the computing nodes are divided into m node groups, then the target tasks also need to be divided into m task groups.

[0067] Specifically, according to the load of the target task, the multiple target tasks to be assigned are sorted to form a task sequence; then the task sequence is divided to divide multiple task groups with the same number as the node groups. Since the division is based on the task sequence, multiple target tasks are arranged continuously in the divided task group, and the load of these target tasks is also relatively close.

[0068] If the number of target tasks is n and the number of node groups (or task groups) is m, then n>m; and in order to ensure that each task group includes multiple (greater than or equal to 2) target tasks, n>2m is required. When clustering computing nodes, the size of the number of node groups m can be limited.

[0069] Step 104: Load balancing is performed on multiple task groups in parallel, and multiple target tasks in the task groups are allocated to computing nodes of corresponding node groups.

[0070] In an embodiment of the present invention, there is a one-to-one correspondence between task groups and node groups. For corresponding task groups and node groups, load balancing processing can be performed on them to allocate multiple target tasks in the task group to the computing nodes of the corresponding node group; and each task group can achieve load balancing separately, that is, the load balancing process of each task group can be carried out in parallel. Compared with directly load balancing all target tasks, this group parallel load balancing method can reduce the processing volume of each group of load balancing, thereby improving the overall efficiency of load balancing.

[0071] Figure 3 A schematic diagram of grouping computing nodes and target tasks is shown in FIG. Figure 3 As shown, there are 5 computing nodes in total, and there are currently 12 target tasks that need to be assigned; these 5 computing nodes can be clustered according to the current performance parameters and divided into three node groups, namely node group 1, node group 2 and node group 3; and after sorting the 12 target tasks according to the load, target tasks 1 to 12 are determined, and the sorted 12 target tasks are divided into 3 groups, forming task group 1, task group 2 and task group 3. Among them, node group 1 corresponds to task group 1, node group 2 corresponds to task group 2, and node group 3 corresponds to task group 3. When performing load balancing, target tasks 1 to 4 in task group 1 are assigned to computing nodes 1 and computing nodes 2 of node group 1. Similar processes are performed for other task groups, which will not be repeated here.

[0072] Among them, although the overall load balancing strategy finally determined by this group load balancing method may not be optimal, resulting in a computing node being assigned relatively more target tasks, since the computing node is assigned relatively more target tasks, its current performance parameters will deteriorate, so that in the next load balancing process, it will be assigned relatively fewer target tasks, thereby ensuring that the assigned tasks are dynamically balanced.

[0073] Optionally, the above step 104 of "assigning multiple target tasks in the task group to computing nodes of the corresponding node group" may specifically include: determining the correspondence between multiple target tasks in the task group and computing nodes of the corresponding node group according to a genetic algorithm, and performing task assignment.

[0074] In an embodiment of the present invention, for each task group, an optimal load balancing strategy can be found based on a genetic algorithm through operations such as selection, crossover and mutation; since the task group contains a small number of tasks and the node group contains a relatively small number of computing nodes, the optimal solution for load balancing can be determined more quickly, that is, it can be determined more quickly to which computing node in the corresponding node group each target task in the task group needs to be assigned.

[0075] The load balancing method provided by the embodiment of the present invention clusters multiple computing nodes according to current performance parameters, thereby grouping computing nodes with the same or similar performance into the same group, and grouping target tasks sorted by load into task groups corresponding to node groups one by one, so that each task group can be load balanced in parallel, thereby improving load balancing efficiency. Target tasks with similar loads will be assigned to a group of identical or similar computing nodes, so that the load balancing strategies of different task groups can be relatively similar, and overall load balancing can be basically achieved; and, as the performance of computing nodes changes, dynamic load balancing can basically be achieved.

[0076] In some optional implementations, the above step 103 of "dividing the sorted target tasks to generate a plurality of task groups having the same number as the node groups" may include steps B1 to B2.

[0077] Step B1: Determine the performance weight of the node group based on the current performance parameters of all computing nodes in the node group; there is a positive correlation between the performance weight and the load that can be processed by all computing nodes in the node group.

[0078] In the embodiment of the present invention, a corresponding weight, namely, a performance weight, is set for each node group. The performance weight of the node group is determined according to the current performance parameters of all computing nodes in the node group; and there is a positive correlation between the performance weight and the load that can be processed by all computing nodes in the node group, that is, the greater the load that can be processed by all computing nodes in the node group, the greater the performance weight.

[0079] The sum of the performance weights of all node groups is 1.

[0080] Optionally, since the current performance parameter of the computing node can represent the load that the computing node can handle, and the higher the current performance parameter, the greater the load that it can handle, the current performance parameter of the computing node can be used to directly determine the corresponding performance weight. Specifically, the performance weight of the node group can be expressed as the following formula (1):

[0081]

[0082] Among them, w j is the performance weight of the jth node group, R j is the sum or mean of the current performance parameters of all computing nodes in the jth node group, and m is the number of node groups.

[0083] In the embodiment of the present invention, for the jth node group, the sum (or mean) of the current performance parameters of all computing nodes in the jth node group can be used as an overall performance parameter R of the jth node group. j , the performance parameter Rj The larger the value is, the higher the overall processing capacity of the j-th node group is, and its performance weight w j Based on the above formula (1), the performance weights of the m node groups can be determined, and the sum of the performance weights of the m node groups can be guaranteed to be 1, that is,

[0084] Step B2: Divide the sorted target tasks according to the performance weights of multiple node groups to generate multiple task groups corresponding to the node groups one by one; the sum of the loads of all target tasks in the task group is positively correlated with the performance weight.

[0085] In an embodiment of the present invention, a task group is obtained according to the sum of the loads of all target tasks in the task group and the corresponding performance weights, and there is a positive correlation between the sum of the loads of all target tasks in the task group and the performance weights, that is, the greater the performance weight, the greater the sum of the loads of all target tasks in the divided task group.

[0086] By grouping the target tasks in this way, the sum of the loads of multiple target tasks assigned to a node group can match the load that the node group can handle, ensuring that the load balancing results between the various groups are close and that the overall load balancing effect can be achieved.

[0087] Optionally, the above step B2 "dividing the sorted target tasks according to the performance weights of the multiple node groups to generate multiple task groups corresponding to the node groups one by one" may specifically include steps B21 to B23.

[0088] Step B21: Determine the total load D of all target tasks SUM ; d i It represents the load of the i-th target task after sorting, and n is the number of target tasks to be assigned.

[0089] In the embodiment of the present invention, if n target tasks need to be assigned at present, the load d of each target task after sorting can be determined. i , i = 1, 2, ..., n. And the sum of the loads of the n target tasks can be calculated, that is, the total load D SUM .like Figure 3 As shown, there are 12 target tasks to be assigned, that is, n=12.

[0090] Step B22: Determine the sum of the expected loads of the corresponding task groups according to the performance weights of the node groups; where D' j =w j D SUM , w jis the performance weight of the jth node group determined in order of performance weight from small to large, D' j Represents the sum of the expected loads of the jth task group.

[0091] In the embodiment of the present invention, if the computing nodes are divided into m node groups and the performance weight of each node group is determined, the m node groups can be sorted in order of performance weight from small to large, and the performance weight w of the jth node group is represented in this order. j , j = 1, 2, ..., m. It can be understood that w1 is the smallest, w m maximum.

[0092] Moreover, for each task group that needs to be divided, the expected value of the sum of the loads of all target tasks in the task group can be determined, that is, the sum of the expected loads. Taking the jth node group as an example, the sum of the expected loads of the jth task corresponding to it is D' j , and D' j =w j D SUM Since all performance weights w j The sum of all expected loads is 1, so the total load D SUM .

[0093] Step B23: Divide the sorted target tasks according to the sum of the expected loads corresponding to the node groups in order of performance weight from small to large, and determine a plurality of task groups corresponding to the node groups one by one.

[0094] In the embodiment of the present invention, the sum of the expected loads of each task group D' j As a standard, the sorted target tasks can be divided so that the sum of the actual loads of multiple target tasks in the divided task group is equal to the sum of the expected loads D' j are the same or similar.

[0095] Moreover, since the load of each target task is different, when dividing the task groups, it cannot be guaranteed that the sum of the actual load of all task groups is the sum of the expected load D' j are exactly the same; in this embodiment, for the node group with a higher ranking (i.e., the node group with a smaller j), since its performance parameters are relatively poor, the task group corresponding to the node group is first divided out, and then the task groups with a lower ranking are divided out in turn, so as to complete the division of all task groups and try to ensure that the sum of the loads of the task groups corresponding to the node groups with a higher ranking is relatively accurate, that is, the sum of the actual loads is relatively close to the sum of the expected loads, so as to be able to perform load balancing more accurately.

[0096] Optionally, the above step B23 "divides the sorted target tasks in order of performance weight from small to large and according to the sum of the expected loads corresponding to the node groups, and determines in turn a plurality of task groups corresponding one to one with the node groups" may include steps B231 to B234.

[0097] Step B231: Generate the corresponding sum of the loads according to the sorted target tasks; S k represents the sum of the kth load, and k = 1, 2, …, n.

[0098] In the embodiment of the present invention, based on the load d of n target tasks i , we can determine the sum of all loads S from the first target task to any kth target task k ,Right now The sum of these loads S k A sequence of the sum of the loads can be formed. It can be understood that a total of n sums of loads S can be determined k , and the sum of the first load S k That is, the load of the first target task d1, the sum of the last (i.e., the mth) load S k The total load D SUM .

[0099] Step B232: Determine the first task index index1 corresponding to the first task group, and determine multiple target tasks belonging to the first task group with the first task index index1 as the boundary. The first task index index1 satisfies the following formula (2):

[0100]

[0101] In the embodiment of the present invention, the task index index is used as a boundary for dividing multiple target tasks to obtain multiple task groups. The task index index represents the index value of the target task, that is, the task index index can be any integer between 1 and n.

[0102] First, determine where the expected load sum D'1 of the first task group is located in the load sum sequence; specifically, if D'1 = S k , then it represents the sum of the loads from the 1st to the kth target tasks S k It is exactly the sum of the expected load D'1, so "k" can be used as the first task index index1, and then the target tasks from the first to index1 (ie, the kth) are used as the first task group.

[0103] In addition, if the expected load sum D'1 is between the sums of two adjacent loads, that is, S k <D'1<S k+1 , then both k and k+1 can be used as the first task index index1. At this time, the appropriate one is selected based on the size of the expected load sum D'1. As shown in the above formula (2), if the expected load sum D'1 is too small, that is, This indicates that the expected load sum D'1 is closer to S k , so k is taken as the first task index index1, that is, index1 = k; on the contrary, if the sum of the expected loads D'1 is too large, that is This indicates that the expected load sum D'1 is closer to S k+1 , so k+1 is taken as the first task index index1, that is, index1=k+1.

[0104] Step B233: In order of performance weight from small to large, for the jth node group, according to the sum of the expected loads D' corresponding to the jth node group j , determine the jth task index indexj corresponding to the jth task group; wherein the jth task index indexj satisfies the following formula (3):

[0105]

[0106] Among them, D i Represents the sum of the actual loads of all target tasks in the i-th task group.

[0107] In the embodiment of the present invention, after the task group is obtained based on the task index index, the true value of the sum of the loads of all target tasks in the task group, that is, the sum of the actual loads D i For example, after obtaining the first task group, the sum of the actual loads of the first task group D1 is the sum of the loads of the target tasks from the first to the index1th, that is, the loads d1, d2, ..., d index1 The sum of index1 ,Right now

[0108] When dividing the second task group, it is necessary to combine the actual load sum D1 of the first task group to locate the task index used to divide the second task group, that is, the second task index index2. Specifically, as shown in the above formula (3), when j=2, it is necessary to determine between which two load sums D'2+D1 is located, and in S k ≤D'2+D1 k+1 When , based on the principle similar to the above formula (2), determine whether the second task index index2 is k or k+1. ​

[0109] Similarly, when dividing the remaining task groups, the corresponding task index can also be determined based on the above formula (3), which will not be repeated here. After the m-1th task group is divided, all the remaining target tasks can be used as the target tasks of the last mth task group.

[0110] Step B234: Taking the j-1th task index indexj-1 and the jth task index indexj as boundaries, determine a plurality of target tasks belonging to the jth task group.

[0111] In this embodiment, after determining the jth task index indexj, the j-1th task index indexj-1 determined last time can be combined to obtain multiple target tasks belonging to the jth task group. For example, the target tasks from (indexj-1)+1 to indexj are divided into the jth task group.

[0112] The load balancing method provided by the embodiment of the present invention first determines the first task index index1 in order of performance weight from small to large, and divides the first task group based on this, so that the sum of the actual load of the first task group can be determined, and then combined with the sum of the expected load of the current task group to be divided and the sum of the actual load of the previously divided task groups, new task groups can be further divided, and the sum of the actual load of each task group is as close as possible to the sum of the expected load, effectively ensuring that the sum of the actual load of each task group after division is consistent with the performance parameters of the node group, which is beneficial to group load balancing and basically achieving load balancing as a whole.

[0113] The above describes in detail the method flow of load balancing. The method can also be implemented by a corresponding device. The structure and function of the device are described in detail below.

[0114] Based on the same inventive concept, the embodiment of the present invention also provides a load balancing device, see Figure 4 As shown, the device comprises:

[0115] The determination module 401 is used to determine the current performance parameters of multiple computing nodes at the current moment, and determine the load corresponding to the multiple target tasks to be assigned;

[0116] A node grouping module 402, configured to cluster the plurality of computing nodes according to the current performance parameter to generate a plurality of node groups; the node group includes at least one computing node;

[0117] The task grouping module 403 is used to sort the multiple target tasks according to the load, and divide the sorted target tasks to generate multiple task groups with the same number as the node groups; the task group includes multiple consecutively arranged target tasks;

[0118] The parallel processing module 404 is used to perform load balancing processing on the multiple task groups in parallel, and allocate the multiple target tasks in the task groups to the computing nodes of the corresponding node groups.

[0119] In some optional implementations, the task grouping module 403 divides the sorted target tasks to generate a plurality of task groups having the same number as the node groups, including:

[0120] Determine the performance weight of the node group according to the current performance parameters of all computing nodes in the node group; there is a positive correlation between the performance weight and the load that can be processed by all computing nodes in the node group;

[0121] The sorted target tasks are divided according to the performance weights of the multiple node groups to generate multiple task groups corresponding to the node groups one by one; the sum of the loads of all target tasks in the task group is positively correlated with the performance weight.

[0122] In some optional implementations, the task grouping module 403 divides the sorted target tasks according to the performance weights of the plurality of node groups to generate a plurality of task groups corresponding to the node groups one by one, including:

[0123] Determine the total load D of all the target tasks SUM ; d i represents the load of the i-th target task after sorting, and n is the number of target tasks to be assigned;

[0124] The sum of the expected loads of the corresponding task groups is determined according to the performance weights of the node groups; where D' j =w j D SUM , w j is the performance weight of the jth node group determined in order of performance weight from small to large, D' j represents the sum of the expected load of the jth task group;

[0125] In order of performance weight from small to large, the sorted target tasks are divided according to the sum of the expected loads corresponding to the node groups, and a plurality of task groups corresponding to the node groups are determined in sequence.

[0126] In some optional implementations, the task grouping module 403 divides the sorted target tasks according to the sum of the expected loads corresponding to the node groups in order of performance weight from small to large, and sequentially determines a plurality of task groups corresponding to the node groups one by one, including:

[0127] According to the load of the sorted target tasks, the corresponding sum of load is generated; among them, S k represents the sum of the kth load, and k = 1, 2, ..., n;

[0128] Determine a first task index index1 corresponding to the first task group, and determine a plurality of target tasks belonging to the first task group with the first task index index1 as a boundary;

[0129] in,

[0130] In order of performance weight from small to large, for the jth node group, according to the sum of the expected loads corresponding to the jth node group D' j , determine the j-th task index indexj corresponding to the j-th task group;

[0131] in, D i represents the sum of the actual loads of all target tasks in the i-th task group;

[0132] Taking the j-1th task index indexj-1 and the jth task index indexj as boundaries, a plurality of target tasks belonging to the jth task group are determined.

[0133] In some optional implementations, the performance weight of the node group is:

[0134]

[0135] Among them, w j is the performance weight of the jth node group, R j is the sum or mean of the current performance parameters of all computing nodes in the jth node group, and m is the number of node groups.

[0136] In some optional implementations, the determining module 401 determines the current performance parameters of the plurality of computing nodes at the current moment, including:

[0137] Determine a plurality of current performance indicators of each computing node at the current moment;

[0138] The multiple current performance indicators of the computing node are weighted to determine the current performance parameter of the computing node.

[0139] In some optional implementations, the parallel processing module 404 distributes the multiple target tasks in the task group to the computing nodes of the corresponding node group, including:

[0140] According to the genetic algorithm, the corresponding relationship between the multiple target tasks in the task group and the computing nodes of the corresponding node group is determined, and the tasks are allocated.

[0141] An embodiment of the present invention further provides a computer storage medium storing computer executable instructions, which includes a program for executing the above-mentioned load balancing method. The computer executable instructions can execute the method in any of the above-mentioned method embodiments.

[0142] Among them, the computer storage medium can be any available medium or data storage device that can be accessed by the computer, including but not limited to magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc.), optical storage (such as CD, DVD, BD, HVD, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NANDFLASH), solid-state drive (SSD)), etc.

[0143] Figure 5 The block diagram of the structure of an electronic device of another embodiment of the present invention is shown. The electronic device 1100 may be a host server with computing capability, a personal computer PC, or a portable computer or terminal, etc. The specific embodiment of the present invention does not limit the specific implementation of the electronic device.

[0144] The electronic device 1100 includes at least one processor 1110, a communications interface 1120, a memory array 1130, and a bus 1140. The processor 1110, the communications interface 1120, and the memory array 1130 communicate with each other via the bus 1140.

[0145] The communication interface 1120 is used to communicate with network elements, where the network elements include, for example, a virtual machine management center, shared storage, etc.

[0146] The processor 1110 is used to execute programs. The processor 1110 may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention.

[0147] The memory 1130 is used for executable instructions. The memory 1130 may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory. The memory 1130 may also be a memory array. The memory 1130 may also be divided into blocks, and the blocks may be combined into virtual volumes according to certain rules. The instructions stored in the memory 1130 can be executed by the processor 1110, so that the processor 1110 can execute the load balancing method in any of the above method embodiments.

[0148] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A load balancing method, characterized in that: include: Determine the current performance parameters of multiple computing nodes at the current moment, and determine the load corresponding to multiple target tasks to be assigned; Clustering the multiple computing nodes according to the current performance parameters to generate multiple node groups; The node group includes at least one computing node; Sorting the multiple target tasks according to the load, and dividing the sorted target tasks to generate a plurality of task groups having the same number as the node groups; The task group includes a plurality of target tasks arranged in succession; Load balancing is performed on the plurality of task groups in parallel, and the plurality of target tasks in the task groups are allocated to the computing nodes of the corresponding node groups.

2. The method according to claim 1, characterized in that The step of dividing the sorted target tasks to generate a plurality of task groups having the same number as the node groups includes: Determine the performance weight of the node group according to the current performance parameters of all computing nodes in the node group; there is a positive correlation between the performance weight and the load that can be processed by all computing nodes in the node group; The sorted target tasks are divided according to the performance weights of the multiple node groups to generate multiple task groups corresponding to the node groups one by one; the sum of the loads of all target tasks in the task group is positively correlated with the performance weight.

3. The method according to claim 2, characterized in that The step of dividing the sorted target tasks according to the performance weights of the plurality of node groups to generate a plurality of task groups corresponding to the node groups one by one includes: Determine the total load D of all the target tasks SUM ; d i represents the load of the i-th target task after sorting, and n is the number of target tasks to be assigned; The sum of the expected loads of the corresponding task groups is determined according to the performance weights of the node groups; where D' j =w j D SUM , w j is the performance weight of the jth node group determined in order of performance weight from small to large, D' j represents the sum of the expected load of the jth task group; In order of performance weight from small to large, the sorted target tasks are divided according to the sum of the expected loads corresponding to the node groups, and a plurality of task groups corresponding to the node groups are determined in sequence.

4. The method according to claim 3, characterized in that The sorted target tasks are divided according to the sum of the expected loads corresponding to the node groups in the order of performance weight from small to large, and a plurality of task groups corresponding to the node groups are determined in sequence, including: According to the load of the sorted target tasks, the corresponding sum of load is generated; among them, S k represents the sum of the kth load, and k = 1, 2, ..., n; Determine a first task index index1 corresponding to the first task group, and determine a plurality of target tasks belonging to the first task group with the first task index index1 as a boundary; in, In order of performance weight from small to large, for the jth node group, according to the sum of the expected loads corresponding to the jth node group D' j , determine the j-th task index indexj corresponding to the j-th task group; in, D i represents the sum of the actual loads of all target tasks in the i-th task group; Taking the j-1th task index indexj-1 and the jth task index indexj as boundaries, a plurality of target tasks belonging to the jth task group are determined.

5. The method according to claim 2, characterized in that: The performance weight of the node group is: Among them, w j is the performance weight of the jth node group, R j is the sum or mean of the current performance parameters of all computing nodes in the jth node group, and m is the number of node groups.

6. The method according to claim 1, characterized in that The determining of current performance parameters of the plurality of computing nodes at the current moment includes: Determine a plurality of current performance indicators of each computing node at the current moment; The multiple current performance indicators of the computing node are weighted to determine the current performance parameters of the computing node.

7. The method according to claim 1, characterized in that The allocating the multiple target tasks in the task group to the computing nodes of the corresponding node group includes: According to the genetic algorithm, the corresponding relationship between the multiple target tasks in the task group and the computing nodes of the corresponding node group is determined, and the tasks are allocated.

8. A load balancing device, characterized in that: include: A determination module, used to determine the current performance parameters of multiple computing nodes at the current moment, and determine the load corresponding to multiple target tasks to be assigned; A node grouping module, configured to cluster the plurality of computing nodes according to the current performance parameter to generate a plurality of node groups; the node group includes at least one computing node; A task grouping module, used to sort the multiple target tasks according to the load, and divide the sorted target tasks to generate a plurality of task groups with the same number as the node groups; the task group includes a plurality of continuously arranged target tasks; The parallel processing module is used to perform load balancing processing on the multiple task groups in parallel and distribute the multiple target tasks in the task groups to the computing nodes of the corresponding node groups.

9. A computer storage medium, characterized in that The computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the load balancing method described in any one of claims 1 to 7.

10. An electronic device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the load balancing method described in any one of claims 1 to 7.