Load balancing method and device for distributed system, equipment and storage medium

By dividing the load intervals according to multi-dimensional resource indicators in a distributed system and selecting the best scheduling strategy, the problem of low resource utilization in the existing technology is solved, and multi-dimensional balance of load and efficient utilization of resources are achieved.

CN119225970AInactive Publication Date: 2024-12-31BEIJING VOLCANO ENGINE TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411389290.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2024-12-31
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing load balancing methods cannot effectively balance the utilization of various resources in distributed systems, resulting in low overall resource utilization and high system cost.

Method used

By determining the multi-dimensional load vector based on the multi-dimensional resource usage indicators of each service node in the distributed system, dividing high-load intervals and low-load intervals, determining candidate scheduling strategies and selecting the strategy with the greatest load balancing benefits, the scheduling of service replicas is realized. To reduce the distance between the multi-dimensional load vector and the target load vector.

Benefits of technology

It realizes comprehensive measurement of resource utilization from multiple load dimensions, improves system resource utilization, reduces system costs, and ensures balanced distribution of loads in each dimension.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119225970A_ABST
    Figure CN119225970A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a load balancing method and device for a distributed system, equipment and a storage medium. The method comprises the following steps: determining a multi-dimensional load vector of each service node according to a multi-dimensional resource use index of each service copy borne on each service node in the distributed system; the multi-dimensional load vector represents the resource utilization condition of the service node in multiple dimensions; dividing each service node into a plurality of load intervals according to the multi-dimensional load vector and the target load vector of each service node; determining a plurality of candidate scheduling strategies and corresponding load balancing benefits according to the plurality of load intervals; the candidate scheduling strategy indicates that a specified service copy borne by a specified service node in a high-load interval is scheduled to a specified service node in a low-load interval; and selecting the candidate scheduling strategy with the maximum load balancing income from the plurality of candidate scheduling strategies as a target scheduling strategy, and executing the target scheduling strategy. Therefore, the resource utilization rate of the system in multiple dimensions is balanced at the same time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a load balancing method, apparatus, device and storage medium for a distributed system. Background Art

[0002] Load balancing is an important mechanism in distributed systems. An excellent load balancing method can significantly improve system resource utilization and reduce costs.

[0003] The current load balancing methods mainly include: a load balancing method based on the number of replicas, which evenly hashes each user's replica to each physical machine; a load balancing method based on the query rate per second (QPS), which schedules replicas from a physical machine with high QPS to a physical machine with low QPS to achieve QPS balance among physical machines; a load balancing method based on disk space capacity, which schedules replicas from a physical machine with high disk space utilization to a physical machine with low disk space utilization to achieve disk space utilization balance among physical machines.

[0004] However, the above load balancing methods are unable to well balance the utilization of various resources in the distributed system, resulting in limited overall resource utilization of the distributed system and high system cost. Summary of the invention

[0005] In order to solve the above technical problems, the embodiments of the present disclosure provide a load balancing method, apparatus, device and storage medium for a distributed system.

[0006] In a first aspect, an embodiment of the present disclosure provides a load balancing method for a distributed system, the method comprising:

[0007] Determine a multi-dimensional load vector of each service node according to the multi-dimensional resource usage indicators of each service replica carried by each service node in the distributed system; wherein the multi-dimensional load vector represents the resource utilization of the service node in multiple dimensions;

[0008] According to the multi-dimensional load vector and the target load vector of each service node, each service node is divided into a plurality of load intervals; wherein the plurality of load intervals at least include a high load interval and a low load interval;

[0009] Determine multiple candidate scheduling strategies and corresponding load balancing benefits according to the multiple load intervals; wherein the candidate scheduling strategy indicates that the designated service replica carried by the designated service node in the high load interval is scheduled to the designated service node in the low load interval;

[0010] The candidate scheduling strategy with the largest load balancing benefit is selected from the multiple candidate scheduling strategies as the target scheduling strategy and the target scheduling strategy is executed; wherein, the maximum load balancing benefit indicates that the distance between the multi-dimensional load vector of the service node and the target load vector is reduced before and after participating in the service replica scheduling and the distance reduction value is the largest.

[0011] In a second aspect, an embodiment of the present disclosure further provides a load balancing device for a distributed system, the device comprising:

[0012] A multi-dimensional load vector determination module is used to determine the multi-dimensional load vector of each service node according to the resource usage indicators of each service replica carried by each service node in the distributed system in multiple dimensions; wherein the multi-dimensional load vector represents the resource utilization of the service node in multiple dimensions;

[0013] A load interval division module, configured to divide each of the service nodes into a plurality of load intervals according to the multi-dimensional load vector and the target load vector of each of the service nodes; wherein the plurality of load intervals at least include a high load interval and a low load interval;

[0014] A candidate scheduling strategy determination module, used to determine multiple candidate scheduling strategies and corresponding load balancing benefits according to the multiple load intervals; wherein the candidate scheduling strategy indicates that the designated service replica carried by the designated service node in the high load interval is scheduled to the designated service node in the low load interval;

[0015] A target scheduling strategy execution module is used to select the candidate scheduling strategy with the maximum load balancing benefit from the multiple candidate scheduling strategies as the target scheduling strategy and execute the target scheduling strategy; wherein, the maximum load balancing benefit represents that the distance between the multi-dimensional load vector of the service node and the target load vector before and after participating in the service replica scheduling is reduced and the distance reduction value is the largest.

[0016] In a third aspect, an embodiment of the present disclosure further provides an electronic device, the electronic device comprising:

[0017] processor;

[0018] A memory for storing executable instructions;

[0019] The processor is used to read executable instructions from the memory and execute the executable instructions to implement the load balancing method of the distributed system described in any embodiment of the present disclosure.

[0020] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the processor implements the load balancing method of the distributed system described in any embodiment of the present disclosure.

[0021] In a fifth aspect, an embodiment of the present disclosure further provides a computer program product, which is used to execute the load balancing method of the distributed system described in any embodiment of the present disclosure.

[0022] The load balancing method, apparatus, device and storage medium of the distributed system of the embodiments of the present disclosure can determine the multi-dimensional load vector of each service node in the distributed system according to the resource usage indicators of each service copy carried by each service node in the multi-dimensional manner; the multi-dimensional load vector represents the resource utilization of the service node in multiple dimensions; according to the multi-dimensional load vector and target load vector of each service node, each service node is divided into multiple load intervals; according to the multiple load intervals, multiple candidate scheduling strategies and corresponding load balancing benefits are determined; the candidate scheduling strategy indicates that the specified service copy carried by the specified service node in the high load interval is scheduled to the specified service node in the low load interval; the selected one is selected from the multiple candidate scheduling strategies The candidate scheduling strategy with the maximum load balancing benefit is used as the target scheduling strategy and the target scheduling strategy is executed; the maximum load balancing benefit indicates that the distance between the multi-dimensional load vector of the service node and the target load vector before and after participating in the service replica scheduling is reduced and the distance reduction value is the largest; it realizes a comprehensive measurement of the resource utilization of each service node from multiple load dimensions, and load balancing scheduling of service replicas is performed accordingly, so that service replicas with interactive characteristics of resource utilization in each load dimension are mixed and arranged in each service node, so that the load of each service node is distributed within the surrounding range of the balanced target load vector, so as to balance the resource utilization of the distributed system in each load dimension at the same time, thereby significantly improving the resource utilization of the system and reducing the system cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0024] Figure 1 A flow chart of a load balancing method for a distributed system provided in an embodiment of the present disclosure;

[0025] Figure 2A schematic diagram of the time distribution of resource usage indicators of two service nodes in the throughput dimension provided by an embodiment of the present disclosure;

[0026] Figure 3 A schematic diagram of the principle of scheduling multiple load intervals and service replicas provided in an embodiment of the present disclosure;

[0027] Figure 4 A schematic diagram of the distribution of service nodes with different multi-dimensional load vectors provided in an embodiment of the present disclosure;

[0028] Figure 5 for Figure 1 A detailed flow chart of S130 in a load balancing method for a distributed system is shown;

[0029] Figure 6 A schematic diagram of the principle of determining a candidate scheduling strategy in a load balancing method for a distributed system provided in an embodiment of the present disclosure;

[0030] Figure 7 A distribution comparison diagram of service replicas in a system before and after executing a load balancing method for a distributed system provided in an embodiment of the present disclosure;

[0031] Figure 8 A schematic diagram of the structure of a load balancing device for a distributed system provided in an embodiment of the present disclosure;

[0032] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0033] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0034] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0035] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0036] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0037] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0038] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0039] The load balancing method of the distributed system in the related art mainly schedules the service copies in the system from a single load dimension such as the number of service copies, the query rate per second (QPS) or CPU utilization, the disk space capacity or the disk space utilization. However, the load balancing method of a single dimension is difficult to use the resources of multiple dimensions of the service node at the same time, and it can only achieve the balance of service node resources on a single load dimension. For example, after the QPS is balanced, the disk space utilization rate may be tilted; after the disk space utilization rate is balanced, the resource utilization rate of the service node in dimensions such as QPS or CPU utilization may be tilted, etc.

[0040] In order to solve the technical problem that the overall resource utilization of the system is still low due to the above-mentioned single-dimensional load balancing, a multi-dimensional load balancing strategy can be adopted. However, there are at least the following problems in multi-dimensional load balancing that need to be solved: (1) How to correctly evaluate whether a service node is a high-load service node or a low-load service node? (2) How to balance multi-dimensional resources at the same time? (3) The load of the same service may be different in different time periods. How to quantify the dynamic load? (4) How to better support the expansion of the load dimension? Based on this, the embodiment of the present disclosure provides a load balancing solution for a distributed system to solve the various problems existing in the above-mentioned multi-dimensional load balancing method step by step. For specific solutions, please refer to the detailed description of the following embodiments.

[0041] The load balancing method of the distributed system provided in the embodiment of the present disclosure can be executed by a load balancing device of the distributed system, which can be implemented by software and / or hardware, and can be integrated in an electronic device with an overall control function in the distributed system, for example, an electronic device where the metadata service (Metadataservice) in the distributed system is located. The electronic device can include but is not limited to a laptop, a desktop computer or a server, etc.

[0042] Figure 1 FIG. 1 is a flow chart showing a load balancing method for a distributed system provided by an embodiment of the present disclosure. Figure 1 As shown, the load balancing method of the distributed system may include the following steps:

[0043] S110 . Determine a multi-dimensional load vector of each service node according to multi-dimensional resource usage indicators of each service replica carried on each service node in the distributed system.

[0044] Among them, the multi-dimensional load vector characterizes the resource utilization of the service node in multiple dimensions. Exemplarily, the multi-dimensional load vector includes load values ​​in multiple dimensions that measure the processing performance of the distributed system. The load value is a quantified result of resource usage. The multiple dimensions include at least two of the throughput dimension, the disk space utilization dimension, the disk input and output dimension, the disk access frequency dimension, the CPU utilization dimension, the QPS dimension, the memory utilization dimension, the network bandwidth utilization dimension, and the average response time dimension. The dimension here can also be referred to as the load dimension. It should be noted that the multiple dimensions in the embodiments of the present disclosure are extensible for convenience, and specific reference may be made to the relevant descriptions of the subsequent embodiments. The resource utilization here can be a dynamic load value at the current moment, or it can be a statistical load value taking into account historical loads and abnormal loads.

[0045] Specifically, the electronic device can collect the load value of each service node surviving in the system in each load dimension. On the one hand, if the multi-dimensional load vector is a dynamic load value at the current moment, then the multi-dimensional load vector can be directly determined by the collected load values ​​in multiple dimensions; if the multi-dimensional load vector is a statistical load value, then the load can be statistically calculated according to the load aggregation method (such as summing, maximum value, average, etc. according to each dimension) to obtain the multi-dimensional load vector. On the other hand, if the service node can report the load value in each load dimension, then the multi-dimensional load vector can be directly determined according to the reported load value; if the service node reports the load value of each service replica stored therein in each load dimension, then the multi-dimensional load values ​​of these service replicas can be summarized according to the load dimension according to the load aggregation method to obtain the multi-dimensional load vector of the corresponding service node.

[0046] In some embodiments, S110 includes:

[0047] Step A: obtaining the average value of the multi-dimensional resource usage indicators generated by each service replica carried by each service node within each statistical unit time.

[0048] The statistical unit time is a statistical duration of a preset minimum granularity, for example, half an hour, one hour, or two hours.

[0049] Specifically, for each service replica in each service node, the electronic device can perform mean statistics on the resource usage indicators collected by the service replica in each load dimension according to the statistical unit time, and obtain multiple statistical means of the service replica in each load dimension. For example, if the statistical unit time is 1 hour, the electronic device can obtain the mean of the resource usage indicators of each service replica in each service node in each load dimension per hour. In this way, the interference of occasional jitter load of the service replica can be shielded by setting the statistical unit time and the mean statistical processing, thereby improving the accuracy of load balancing to a certain extent.

[0050] Step B: Generate a multi-dimensional load vector for each service replica according to the maximum value of the mean value of the resource usage indicator generated by each statistical unit time.

[0051] Specifically, for each service replica in each service node in each load dimension, the electronic device can determine the mean of the resource usage index of each statistical unit time in each preset period, and each mean constitutes the initial load vector corresponding to the preset period. Then, the initial load vectors of the third preset number are compared element by element, the maximum value at each element position is determined, and the load vector of the service replica in the load dimension is constituted by each maximum value. Then, multiple load dimensions are processed in the above manner to obtain a multi-dimensional load vector for each service replica.

[0052] The preset period in the above process is a preset statistical duration of greater intensity, such as half a day or a day. The third preset number is a preset number, which can be set according to business needs. Exemplarily, the third preset number is greater than or equal to 7. In this way, the calculated multi-dimensional load vector of the service replica can cover at least one week of resource usage indicators, so as to count the change pattern of business traffic as much as possible, thereby further improving the accuracy of the multi-dimensional load vector, and further improving the accuracy of load balancing.

[0053] Take the load dimension as the QPS dimension, the third preset number as 7, the preset period as 1 day, and the statistical unit time as 1 hour as an example. The electronic device can collect all resource usage indicators of a service copy reported by a service node in the QPS dimension within 7 days. Then, the electronic device can extract the resource usage indicators of each hour of each day for mean calculation, obtain the mean of 24 resource usage indicators, and form a vector (i.e., resource usage indicator vector). In this way, 7 resource usage indicator vectors can be obtained, each resource usage indicator vector contains 24 elements, and each element value is the statistical mean of the resource usage indicator within 1 hour. After that, the electronic device can compare the 7 element values ​​corresponding to the same vector subscript in the 7 resource usage indicator vectors, obtain the maximum value corresponding to each vector subscript, and form the load vector of the service copy in the QPS dimension by these 24 maximum values. According to this process, the load vector of each service copy in each service node in each load dimension can be calculated, thereby obtaining a multi-dimensional load vector of each service copy in each service node. In this way, a more representative dynamic load situation of the service copy can be obtained.

[0054] Step C: performing dimension-by-dimension element-by-element summation on the multi-dimensional load vectors of each service replica of each service node, and generating a multi-dimensional load vector of the service node according to the maximum value of the summation results of each dimension.

[0055] Specifically, the service node contains multiple service replicas, and the sum of the loads of these service replicas can characterize the resource utilization of the service node. Therefore, the electronic device can sum the element values ​​of the same vector subscript in the multi-dimensional load vector of all service replicas in the service node calculated above, and the result constitutes the load vector of the service node in each load dimension, and the number of its elements is consistent with the number of elements of the multi-dimensional load vector of the service replica. Then, the maximum value in the load vector on each load dimension is counted as the load value of the service node on the load dimension. The load values ​​on multiple load dimensions constitute the multi-dimensional load vector of the service node.

[0056] Continuing with the above example, if a service node contains n service replicas, the electronic device can calculate the sum of the n maximum values ​​for each identical vector subscript in the load vector of the QPS dimension of the n service replicas, and obtain the sum of 24 maximum values ​​to form the load vector of the service node in the QPS dimension. Then, the electronic device compares the 24 element values ​​in the load vector and determines the maximum value as the load value of the service node in the QPS dimension. In this way, the load value of the service node in each load dimension can be calculated to form a multi-dimensional load vector of the service node.

[0057] In the above process, the load calculation of the service node is performed by first performing sum aggregation and then performing maximum value aggregation, which can solve the above problem (3) and improve the accuracy of the target load value.

[0058] For example, see Figure 2 , suppose there are 2 service replicas on a service node, and the throughput of these 2 service replicas is 500kb / s at 10:00 and 16:00, and 0 at other times. In this scenario, the peak throughput load of the service node is 500kb / s, so when calculating the load value of the service node in the throughput dimension, it is more reasonable to first perform sum aggregation in the vector dimension and then perform maximum value aggregation. If the maximum value is taken first and then sum aggregation is performed, the load value of the service node will be calculated to be 1000kb / s, which is an incorrect value.

[0059] S120 . Divide each service node into a plurality of load intervals according to the multi-dimensional load vector and the target load vector of each service node.

[0060] Among them, the target load vector is a vector composed of load values ​​when each load dimension reaches a balanced state of resource utilization. The load interval corresponds to a certain load value range. The multiple load intervals include at least a high load interval and a low load interval. The high load interval is a load value interval where the overall load of the service node is too high. The low load interval is a load value interval where the overall load of the service node is too low.

[0061] Specifically, the electronic device can divide each service node into different load intervals according to the difference between the multi-dimensional load vector of each service node and the target load vector. For example, when the multi-dimensional load vector is much larger than the target load vector, the corresponding service node can be divided into a high load interval; when the multi-dimensional load vector is much smaller than the target load vector, the corresponding service node can be divided into a low load interval; and when the difference between the multi-dimensional load vector and the target load vector is relatively small, the corresponding service node can be divided into a relatively balanced load interval (called a balanced load interval). In this way, the service nodes that need to participate in the scheduling of service replicas can be screened out.

[0062] In specific implementation, the comprehensive load judgment of multiple dimensions is relatively complex and has high uncertainty. In the embodiment of the present disclosure, the load interval can be divided for each load dimension. In this way, the target load vector can also be split according to the load dimension, and a reference load value participating in the interval division on each load dimension is provided. Then, the load value of each service node on each load dimension is compared with the high load threshold and the low load threshold determined based on the reference load value. If the load value is greater than the high load threshold, the service node is divided into a high load interval under the load dimension. If the load value is less than or equal to the low load threshold, the service node is divided into a low load interval under the load dimension. In this way, all service nodes can be divided into different load intervals, and possible high-load service nodes and possible low-load service nodes under all load dimensions are obtained.

[0063] In some embodiments, S120 includes: if the load value of any dimension in the multi-dimensional load vector of the service node is less than or equal to the difference between the load value of the corresponding dimension in the target load vector and the first load tilt amount, the service node is divided into a low load interval; if the load value of any dimension in the multi-dimensional load vector of the service node is greater than the sum of the load value of the corresponding dimension in the target load vector and the second load tilt amount, the service node is divided into a high load interval; if the load value of any dimension in the multi-dimensional load vector of the service node is greater than the sum of the load value of the corresponding dimension in the target load vector and the first load tilt amount, and less than or equal to the sum of the load value of the corresponding dimension in the target load vector and the second load tilt amount, the service node is divided into a balanced load interval.

[0064] Among them, the first load tilt amount and the second load tilt amount are both pre-set load tilt amounts, which can be set according to business requirements. For example, if the business requirement is that the CPU utilization is allowed to tilt by 10%, then the first load tilt amount and the second load tilt amount of the CPU utilization dimension can both be set to 5%. It should be noted that the first load tilt amount and the second load tilt amount can also be set to different values.

[0065] Specifically, for each load dimension, the electronic device may use the difference between the corresponding reference load value in the target load vector and the first load tilt amount (such as the reference load value-5% tilt amount) as the low load threshold, and the sum of the reference load value and the second load tilt amount (such as the reference load value+5% tilt amount) as the high load threshold. Figure 3The electronic device can first determine the optimal reference load value corresponding to any load dimension, then subtract the first load tilt amount from the reference load value to determine the low load threshold, and add the second load tilt amount to the reference load value to determine the high load threshold. In this way, the load interval can be divided from the load dimension to obtain the high load interval of the twill filling example part, the low load interval of the black dot filling example part, and the balanced load interval of the white filling example part.

[0066] On this basis, the load value of the multi-dimensional load vector of each service node in the load dimension is compared with the high load threshold and the low load threshold. When the load value is between (reference load value -5% inclination, reference load value +5% inclination], the service node can be divided into a balanced load interval, and it can be considered that the load distribution of the service node in this load dimension is relatively balanced, and the present disclosure may not perform additional processing on it. When the load value is between (-∞, reference load value -5% inclination], the service node can be divided into a low load interval, and a service copy needs to be scheduled to the service node for load balancing scheduling. When the load value is between (reference load value +5% inclination, +∞], the service node can be divided into a high load interval, and a service copy needs to be scheduled from the service node for load balancing scheduling.

[0067] See also Figure 4, taking the throughput dimension and the disk space usage dimension as examples, the reference load values ​​corresponding to the two dimensions can constitute the origin of the two-dimensional space coordinate system (black filled dot example), which contains four quadrants: the throughput and disk space usage in quadrant 1 are both higher than the reference load values ​​of the corresponding dimensions; the throughput in quadrant 2 is higher than the reference load value of the corresponding dimension, while the disk space usage is lower than the reference load value of the corresponding dimension; the throughput and disk space usage in quadrant 3 are both lower than the reference load value of the corresponding dimension; the throughput in quadrant 4 is lower than the reference load value of the corresponding dimension, while the disk space usage is higher than the reference load value of the corresponding dimension. It can be determined that service node 1 in quadrant 1 belongs to the service node with overall high load, and it can be divided into the high load interval corresponding to the throughput dimension and the disk space usage dimension. Service node 3 in quadrant 3 belongs to the service node with overall low load, and it can be divided into the low load interval corresponding to the throughput dimension and the disk space usage dimension. Service node 2 in quadrant 2 and service node 4 in quadrant 4 may belong to service nodes with an overall high load or a service node with an overall low load. It is not easy to make an overall load judgment on these two service nodes. Therefore, from the perspective of throughput, service node 2 can be classified into a high load interval and service node 4 can be classified into a low load interval; and from the perspective of disk space usage, service node 4 can be classified into a low load interval and service node 4 can be classified into a high load interval. In this way, in the embodiment of the present disclosure, all service nodes are classified and processed from each load dimension, which can ensure that potential low-load service nodes appear at least once in the low load interval, and that potential high-load service nodes appear at least once in the high load interval, thereby solving the aforementioned problem (1) and ensuring that any service node that may need to be load-balanced is not omitted during the load balancing process.

[0068] In some embodiments, the reference load value in any load dimension in the target load vector may be a preset load value.

[0069] In other embodiments, the reference load value on any load dimension in the target load vector can also be calculated based on the amount of business carried by the system and the total amount of resources of the system. Exemplarily, the reference load value is determined based on the average of the total amount of resources of the distributed system on the corresponding load dimension relative to the total amount of tasks on the corresponding load dimension. For example, for the throughput dimension, its reference load value = the total throughput of the business carried by the system / the sum of the throughputs of all service nodes in the system; for the disk space usage rate, its reference load value = the total amount of data of the business carried by the system / the sum of the capacity of the disk space of all service nodes in the system.

[0070] S130. Determine multiple candidate scheduling strategies and corresponding load balancing benefits according to multiple load intervals.

[0071] The candidate scheduling strategy indicates that the designated service replica carried by the designated service node in the high load interval is scheduled to the designated service node in the low load interval. The load balancing benefit is used to characterize the load change of the service node before and after the service replica is scheduled, which can be measured by the difference in the load vector of the service node before and after the scheduling.

[0072] Specifically, the goal of load balancing scheduling is to schedule service replicas from service nodes in a high-load interval to service nodes in a low-load interval to reduce the deviation between the multi-dimensional load vectors of the two service nodes and the target load vector. Therefore, the electronic device can predict multiple feasible candidate scheduling strategies and their load balancing benefits based on the multi-dimensional load vectors and target load vectors of the service nodes in the high-load interval and the low-load interval, so as to schedule service replicas based on the load balancing benefits. The feasible candidate scheduling strategy here refers to the multi-dimensional load vectors of the two service nodes approaching the target load vector after scheduling to reduce the degree of load deviation.

[0073] During specific implementation, the electronic device can determine the degree to which the load of the service node deviates from the balanced load (which can be called the first comprehensive deviation value) based on the multi-dimensional load vector and the target load vector of the service node in the high load interval. The electronic device can also determine the degree to which the load of the service node deviates from the balanced load (which can be called the second comprehensive deviation value) based on the multi-dimensional load vector and the target load vector of the service node in the low load interval. The comprehensive deviation value here is the degree of load deviation in multiple dimensions, which can be implemented as Euclidean distance or Mahalanobis distance, etc. The larger the comprehensive deviation value, the more unbalanced the resource usage of the service node in multiple dimensions, and the higher the demand for balanced scheduling. Based on this, the electronic device can schedule a service copy of a service node in the high load interval to a service node in the low load interval as a candidate scheduling strategy, and predict the difference in the comprehensive deviation values ​​generated by the two service nodes before and after scheduling as the load balancing benefit of the candidate scheduling strategy.

[0074] For example, taking the Euclidean distance as the metric of the comprehensive deviation value, Figure 4 The service nodes 1, 2, 3 and 4 shown in the figure can respectively calculate the Euclidean distance d1, the Euclidean distance d2, the Euclidean distance d3 and the Euclidean distance d4 in the above manner. The larger the value of the Euclidean distance, the greater the degree to which the corresponding service node deviates from the target load vector in multiple dimensions, and the more it should be balanced and scheduled. On this basis, the electronic device can determine the load balancing benefit of its corresponding candidate scheduling strategy by the difference in the Euclidean distance between the two service nodes before and after scheduling.

[0075] S140, selecting the candidate scheduling strategy with the largest load balancing benefit from multiple candidate scheduling strategies as the target scheduling strategy and executing the target scheduling strategy; the maximum load balancing benefit indicates that the distance between the multi-dimensional load vector of the service node and the target load vector before and after participating in the service replica scheduling is reduced and the distance reduction value is the largest.

[0076] Specifically, according to the above description, the load balancing benefits corresponding to each candidate load strategy are all such that the two service nodes participating in the scheduling are generally close to the target load vector, that is, the degree of deviation between the two service nodes and the target load vector after scheduling is less than the degree of deviation between the two service nodes and the target load vector. This process is manifested in a multidimensional space, that is, at least one of the two service nodes is close to the spatial point (i.e., the coordinate origin) where the target load vector is located. In order to solve the above problem (2) and to achieve load balancing of the entire system more quickly, the electronic device can select a candidate scheduling strategy with the largest load balancing benefit as the service copy scheduling strategy (i.e., the target scheduling strategy) that is finally executed in this load balancing scheduling process. Then, the target scheduling strategy can be executed.

[0077] The scheduling of service replicas is continuously performed according to the above process until the number of service nodes in the high load interval and the number of service nodes in the low load interval are both less than the first preset number. The first preset number is another preset value, which can be a smaller value. For example, for an ideal load balancing effect, the first preset number can be set to 0; considering various factors in actual operation, such as the rationality of the setting of the first load tilt amount and the second load tilt amount, the actual operation of the system, etc., the first preset number can be set to a smaller positive integer greater than 0 to improve the load balancing fault tolerance of the system.

[0078] See also Figure 3 After the above load balancing processing, service replicas can be scheduled from each service node in the high load interval to each service node in the low load interval, so that the load inclination of each service node in the high load interval and each service node in the low load interval gradually decreases until the vast majority of the service nodes in the system are divided into the balanced load interval.

[0079] It can be seen from this that the embodiment of the present disclosure calculates the comprehensive deviation value through multi-dimensional load vectors for load balancing, and will mix service copies with different resource utilizations in the same load dimension in the same service node, so as to fully utilize the resources of each dimension of the service node. For example, a certain type of service copy requires a higher CPU utilization and a lower disk space utilization, while another type of service copy requires a lower CPU utilization and a higher disk space utilization. If the same type of service copies are deployed on the same service node, it will cause the resources of the CPU utilization dimension or the disk space utilization dimension in the service node to be heavily occupied, while the resources of the other load dimension will be largely idle, causing the resources of each dimension of the service node to be seriously tilted, resulting in a low overall resource utilization. After processing by the embodiment of the present disclosure, the above-mentioned different types of service copies can be scheduled to the same service node for mixed deployment, so as to make full use of the resources of each load dimension as much as possible, and achieve better resource balance.

[0080] In addition, according to the description of the aforementioned embodiments, the load balancing strategy provided by the embodiment of the present disclosure is to divide the load intervals of the service nodes according to a single dimension, and to schedule service replicas according to a multi-dimensional load vector. Therefore, when the load dimension is expanded, it is only necessary to increase the corresponding first load tilt amount and second load tilt amount to divide the intervals of each service node. Therefore, the load balancing strategy provided by the embodiment of the present disclosure can solve the above problem (4), so as to quickly expand the load dimension, and can be easily extended to any distributed system.

[0081] The load balancing method for a distributed system provided by the above-mentioned embodiments of the present disclosure can determine the multi-dimensional load vector of each service node according to the multi-dimensional resource usage indicators of each service copy carried on each service node in the distributed system; the multi-dimensional load vector represents the resource utilization of the service node in multiple dimensions; according to the multi-dimensional load vector and the target load vector of each service node, each service node is divided into multiple load intervals; according to the multiple load intervals, multiple candidate scheduling strategies and corresponding load balancing benefits are determined; the candidate scheduling strategy indicates that the specified service copy carried by the specified service node in the high load interval is scheduled to the specified service node in the low load interval; and the service node with the maximum load balancing benefit is selected from multiple candidate scheduling strategies. The candidate scheduling strategy is used as the target scheduling strategy and the target scheduling strategy is executed; the maximum load balancing benefit represents that the distance between the multi-dimensional load vector of the service node and the target load vector before and after participating in the service replica scheduling is reduced and the distance reduction value is the largest; it realizes the comprehensive measurement of the resource utilization of each service node from multiple load dimensions, and performs load balancing scheduling of service replicas accordingly, so that the service replicas with interactive characteristics of resource utilization in each load dimension are mixed and arranged in each service node, so that the load of each service node is distributed within the surrounding range of the balanced target load vector, so as to balance the resource utilization of the distributed system in each load dimension at the same time, thereby significantly improving the resource utilization of the system and reducing the system cost.

[0082] Figure 5 The embodiment of the present disclosure provides Figure 1 The detailed flow chart of S130 in the load balancing method of the distributed system shown in FIG. 1 illustrates a load balancing strategy for scheduling service replicas. Figure 5 In S130, “determining multiple candidate scheduling strategies and corresponding load balancing benefits according to multiple load intervals” specifically includes the following steps:

[0083] S510: Determine multiple initial scheduling strategies according to the service replicas carried by the service nodes in the high-load interval and the service nodes in the low-load interval.

[0084] Specifically, the electronic device may formulate a scheduling strategy for scheduling any service copy from any service node in the high-load interval to any service node in the low-load interval as the initial scheduling strategy.

[0085] In some embodiments, S510 includes: scheduling any service replica carried by a service node in a high-load interval to any one of a randomly preset number of service nodes in a low-load interval, and determining multiple initial scheduling strategies.

[0086] The preset number is a preset value that is smaller than the total number of all service nodes in the low load interval corresponding to each load dimension.

[0087] Specifically, the electronic device can determine any service replica from any service node in the high-load interval to participate in the scheduling, and at the same time, can randomly select any one of a preset number of service nodes from the low-load intervals of all load dimensions to receive the scheduled service replica, thus forming an initial scheduling strategy. This can prevent a service node in a high-load interval from always scheduling a service replica to the same service node in the low-load interval, thereby preventing the problem that the service replica scheduling task cannot be completed normally when the service node in the low-load interval fails.

[0088] In some embodiments, S510 also includes: sorting the service nodes in the high load interval in descending order according to the distance between the multi-dimensional load vector of the service node in the high load interval and the target load vector; according to the sorting result, scheduling any service copy carried by the service node in the high load interval to the service node in the low load interval, and determining multiple initial scheduling strategies.

[0089] Specifically, in order to make the system achieve load balancing faster, the electronic device can first sort the service nodes in the high-load interval in descending order according to their distances from the target load vector, and then schedule the service replicas in the corresponding service nodes to the service nodes in the low-load interval in order according to the sorting results, so as to construct an initial scheduling strategy.

[0090] S520. For any initial scheduling strategy, the difference between the maximum value of the distance between the multidimensional load vector and the target load vector of the two service nodes participating in the scheduling before scheduling and the maximum value of the distance between the multidimensional load vector and the target load vector of the two service nodes after scheduling is determined as the load balancing benefit of the initial scheduling strategy.

[0091] Specifically, considering the complexity of the system operation process, the load inclinations of the service nodes in the high-load interval and the service nodes in the low-load interval can be processed comprehensively in this embodiment. Considering that the system performance depends on the maximum value of the distance between the multi-dimensional load vector and the target load vector, the electronic device can use the maximum value of the distance between the multi-dimensional load vector and the target load vector of the two service nodes participating in the scheduling before scheduling as the load inclination of the two service nodes before scheduling; and use the maximum value of the distance between the multi-dimensional load vector and the target load vector of the two service nodes after scheduling as the load inclination of the two service nodes after scheduling. Then, the comprehensive load inclination changes before and after scheduling are used as the load balancing benefit of the initial scheduling strategy.

[0092] For example, see Figure 6, a service node in the high load interval is marked as i, di represents the distance between its multidimensional load vector and the target load vector before scheduling, and di′ represents the distance between its multidimensional load vector and the target load vector after scheduling; a service node in the low load interval is marked as j, dj represents the distance between its multidimensional load vector and the target load vector before scheduling, and dj′ represents the distance between its multidimensional load vector and the target load vector after scheduling. Then the maximum value of the distance between the multidimensional load vector and the target load vector of the two service nodes participating in the scheduling before scheduling can be expressed as max(di,dj), and the maximum value of the distance between the multidimensional load vector and the target load vector of the two service nodes after scheduling can be expressed as max(di′,dj′). Based on this, the load balancing benefit of the initial scheduling strategy is expressed as max(di,dj)-max(di′,dj′).

[0093] S530: Determine the initial scheduling strategy and the corresponding load balancing benefit whose load balancing benefit is greater than a preset benefit threshold as the candidate scheduling strategy and the corresponding load balancing benefit respectively.

[0094] The preset benefit threshold is a pre-set load balancing benefit used to determine whether the distance between the multi-dimensional load vectors of two service nodes after the service replica scheduling and the target load vector tends to decrease as a whole. For example, the preset benefit threshold can be a positive number greater than or equal to 0.

[0095] Specifically, according to the above description, the electronic device should select an initial scheduling strategy with a reduced comprehensive load inclination of the two service nodes before and after scheduling, that is, select an initial scheduling strategy with a load balancing benefit greater than a preset benefit threshold as a candidate scheduling strategy. The load balancing benefit of the selected initial scheduling strategy is the load balancing benefit of the candidate scheduling strategy.

[0096] For example, the scheduling result of the initial scheduling strategy can be that one service node is slightly away from the spatial point corresponding to the target load vector and the other service node is closer to the spatial point corresponding to the target load vector to a greater extent, so as to ensure that the summary result of the two service nodes is close to the spatial point corresponding to the optimal target load vector as a whole. For another example, the scheduling result of the initial scheduling strategy can be that both service nodes are close to the spatial point corresponding to the target load vector to varying degrees. The load balancing benefit of such an initial scheduling strategy is greater than the preset benefit threshold, and it can be used as a candidate scheduling strategy.

[0097] If the load balancing benefit obtained by a certain initial scheduling strategy is that the distance between the multidimensional vector of the two service nodes after scheduling and the target load vector is greater than the distance between the multidimensional vector of the two service nodes before scheduling and the target load vector, it means that after scheduling, the two service nodes will have a greater deviation from the spatial points corresponding to the target load vector, which will aggravate the load inclination of the two service nodes. The load balancing benefit of such an initial scheduling strategy is less than or equal to the preset benefit threshold, and the initial scheduling strategy is discarded.

[0098] by Figure 6 Take the example of determining the candidate scheduling strategy as an example to explain the overall example.

[0099] See also Figure 6 (a), assuming that after the initial scheduling strategy is executed, the distance di′ between the multidimensional load vector and the target load vector of the service node i in the high load interval after scheduling is smaller than the distance di between the multidimensional load vector and the target load vector before scheduling, and the distance dj′ between the multidimensional load vector and the target load vector of the service node j in the low load interval after scheduling is smaller than the distance dj between the multidimensional load vector and the target load vector before scheduling, and the overall load inclination of the two service nodes is reduced. Therefore, the load balancing benefit of the initial scheduling strategy is greater than the preset benefit threshold, and the initial scheduling strategy is feasible. The electronic device can determine the initial scheduling strategy as a candidate scheduling strategy.

[0100] See also Figure 6 (b), assuming that after the initial scheduling strategy is executed, the distance di′ between the multidimensional load vector and the target load vector of the service node i in the high load interval after scheduling is less than the distance di between the multidimensional load vector and the target load vector before scheduling, and the distance dj′ between the multidimensional load vector and the target load vector of the service node j in the low load interval after scheduling is greater than the distance dj between the multidimensional load vector and the target load vector before scheduling, but the maximum dj′ after scheduling is still less than the maximum di before scheduling. Therefore, the overall load inclination of the two service nodes is still reduced, so the load balancing benefit of the initial scheduling strategy is greater than the preset benefit threshold, and the initial scheduling strategy is feasible. The electronic device can determine the initial scheduling strategy as a candidate scheduling strategy.

[0101] See also Figure 6(c), assuming that after the initial scheduling strategy is executed, the distance di′ between the multidimensional load vector and the target load vector of the service node i in the high load interval after scheduling is less than the distance di between the multidimensional load vector and the target load vector before scheduling, while the distance dj′ between the multidimensional load vector and the target load vector of the service node j in the low load interval after scheduling is greater than the distance dj between the multidimensional load vector and the target load vector before scheduling, and the maximum dj′ after scheduling is also greater than the maximum di before scheduling. That is, the maximum load inclination of the two service nodes after scheduling is greater than the maximum load inclination of the two service nodes before scheduling, indicating that the overall load inclination of the two service nodes has increased instead of decreased, exacerbating the load imbalance of the system. Therefore, the load balancing benefit of the initial scheduling strategy is less than the preset benefit threshold, and the initial scheduling strategy is not feasible. The electronic device can discard the initial scheduling strategy.

[0102] See also Figure 7 , the execution effect of the load balancing method of the embodiment of the present disclosure is described. Figure 7 As shown in (a), before executing the load balancing method of the embodiment of the present disclosure, the loads between the service nodes are highly skewed, and there are large deviations to varying degrees between the spatial points corresponding to their multi-dimensional load vectors and the target load vectors. There is also a significant skew in resource utilization rates of different dimensions between the service nodes. Some service nodes have high disk space utilization and low throughput, while other service nodes have high throughput and low disk space utilization. Figure 7 As shown in (b), after executing the load balancing method of the embodiment of the present disclosure, the loads of all service nodes are distributed within a rectangular range centered at the spatial point corresponding to the optimal target load vector. In addition, the length and width of the rectangle correspond to the first load tilt amount and the second load tilt amount corresponding to the two load dimensions, respectively.

[0103] The following is an embodiment of a load balancing device for a distributed system provided in an embodiment of the present invention. The device and the load balancing method for a distributed system in the above-mentioned embodiments belong to the same inventive concept. For details not described in detail in the embodiment of the load balancing device for a distributed system, reference can be made to the embodiment of the load balancing method for a distributed system in the above-mentioned embodiments.

[0104] Figure 8 FIG. 1 is a schematic diagram showing the structure of a load balancing device for a distributed system provided by an embodiment of the present disclosure. Figure 8 As shown, the load balancing device 800 of the distributed system may include:

[0105] The multi-dimensional load vector determination module 810 is used to determine the multi-dimensional load vector of each service node according to the resource usage indicators of each service replica carried by each service node in the distributed system in multiple dimensions; wherein the multi-dimensional load vector represents the resource utilization of the service node in multiple dimensions;

[0106] The load interval division module 820 is used to divide each service node into a plurality of load intervals according to the multi-dimensional load vector and the target load vector of each service node; wherein the plurality of load intervals at least include a high load interval and a low load interval;

[0107] The candidate scheduling strategy determination module 830 is used to determine multiple candidate scheduling strategies and corresponding load balancing benefits according to multiple load intervals; wherein the candidate scheduling strategy indicates that the designated service replica carried by the designated service node in the high load interval is scheduled to the designated service node in the low load interval;

[0108] The target scheduling strategy execution module 840 is used to select a candidate scheduling strategy with the maximum load balancing benefit from multiple candidate scheduling strategies as the target scheduling strategy and execute the target scheduling strategy; wherein, the maximum load balancing benefit represents that the distance between the multi-dimensional load vector of the service node before and after participating in the service replica scheduling and the target load vector is reduced and the distance reduction value is the largest.

[0109] In some embodiments, the load interval division module 820 is specifically used to:

[0110] If the load value of any dimension in the multi-dimensional load vector of the service node is less than or equal to the difference between the load value of the corresponding dimension in the target load vector and the first load tilt amount, the service node is classified into a low load interval;

[0111] If the load value of any dimension in the multi-dimensional load vector of the service node is greater than the sum of the load value of the corresponding dimension in the target load vector and the second load tilt, the service node is classified into a high load interval;

[0112] If the load value of any dimension in the multi-dimensional load vector of the service node is greater than the sum of the load value of the corresponding dimension in the target load vector and the first load tilt, and is less than or equal to the sum of the load value of the corresponding dimension in the target load vector and the second load tilt, the service node is divided into a balanced load interval.

[0113] In some embodiments, the candidate scheduling strategy determination module 830 includes:

[0114] An initial scheduling strategy determination submodule, used to determine multiple initial scheduling strategies according to the service replicas carried by the service nodes in the high-load interval and the service nodes in the low-load interval;

[0115] A load balancing benefit determination submodule, for determining, for any initial scheduling strategy, the difference between the maximum value of the distance between the multi-dimensional load vectors of the two service nodes participating in the scheduling and the target load vector before the scheduling and the maximum value of the distance between the multi-dimensional load vectors of the two service nodes after the scheduling and the target load vector as the load balancing benefit of the initial scheduling strategy;

[0116] The candidate scheduling strategy determination submodule is used to determine the initial scheduling strategy and the corresponding load balancing benefit whose load balancing benefit is greater than a preset benefit threshold as the candidate scheduling strategy and the corresponding load balancing benefit respectively.

[0117] In some embodiments, the initial scheduling strategy determination submodule is specifically used to:

[0118] Any service replica carried by a service node in a high-load interval is scheduled to any one of a randomly preset number of service nodes in a low-load interval, and a plurality of initial scheduling strategies are determined.

[0119] In some embodiments, the multi-dimensional load vector determination module 810 is specifically used to:

[0120] Obtain the average value of the multi-dimensional resource usage indicators generated by each service replica carried by each service node within each statistical unit time;

[0121] Generate a multi-dimensional load vector for each service replica based on the maximum value of the mean value of the resource usage indicator generated by each statistical unit time;

[0122] The multi-dimensional load vectors of each service replica of each service node are summed up dimension by dimension and element by element, and the multi-dimensional load vector of the service node is generated according to the maximum value of the summation results of each dimension.

[0123] In some embodiments, the multidimensional load vector includes load values ​​on multiple dimensions that measure the processing performance of the distributed system; the multiple dimensions include at least two of the throughput dimension, disk space utilization dimension, disk input and output dimension, disk access frequency dimension, CPU utilization dimension, memory utilization dimension, network bandwidth utilization dimension and average response time dimension.

[0124] In some embodiments, the initial scheduling strategy determination submodule is specifically used to:

[0125] According to the distance between the multi-dimensional load vector of the service node in the high load interval and the target load vector, the service nodes in the high load interval are sorted in descending order;

[0126] According to the sorting result, any service replica carried by the service node in the high-load interval is scheduled to the service node in the low-load interval, and multiple initial scheduling strategies are determined.

[0127] The load balancing device of a distributed system provided in an embodiment of the present invention can execute the load balancing method of a distributed system provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0128] It is worth noting that in the embodiment of the load balancing device of the above-mentioned distributed system, the various modules and sub-modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional modules / sub-modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present disclosure.

[0129] The present disclosure also provides an electronic device, which may include a processor and a memory, wherein the memory may be used to store executable instructions, wherein the processor may be used to read the executable instructions from the memory and execute the executable instructions to implement the load balancing method of the distributed system in the above embodiment.

[0130] Fig. 9 A schematic structural diagram of an electronic device provided by an embodiment of the present disclosure is shown.

[0131] like Fig. 9 As shown, the electronic device 900 may include a processing device 901 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage device 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the electronic device 900 are also stored. The processing device 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output interface (I / O interface) 905 is also connected to the bus 904.

[0132] Typically, the following devices may be connected to the I / O interface 905: an input device 906 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 907 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 908 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 909. The communication device 909 may allow the electronic device 900 to communicate with other devices wirelessly or by wire to exchange data.

[0133] It should be noted that Fig. 9 The electronic device 900 shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure. Fig. 9The electronic device 900 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0134] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 909, or installed from the storage device 908, or installed from the ROM 902. When the computer program is executed by the processing device 901, the above-mentioned functions defined in the load balancing method of the distributed system of any embodiment of the present disclosure are executed.

[0135] The embodiments of the present disclosure further provide a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the processor implements the load balancing method of the distributed system in any embodiment of the present disclosure.

[0136] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0137] In some embodiments, the client and server may communicate using any currently known or future developed network protocol such as HTTP, and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0138] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0139] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the load balancing method of the distributed system described in any embodiment of the present disclosure.

[0140] In embodiments of the present disclosure, computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including but not limited to object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on a user's computer, partially on a user's computer, as a separate software package, partially on a user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0141] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the equipment, method and computer program product according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0142] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0143] In the context of the present disclosure, a computer-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. A more specific example of a computer-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0144] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0145] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0146] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. A load balancing method for a distributed system, characterized in that: include: Determine a multi-dimensional load vector of each service node according to the multi-dimensional resource usage indicators of each service replica carried by each service node in the distributed system; wherein the multi-dimensional load vector represents the resource utilization of the service node in multiple dimensions; According to the multi-dimensional load vector and the target load vector of each service node, each service node is divided into a plurality of load intervals; wherein the plurality of load intervals at least include a high load interval and a low load interval; Determine multiple candidate scheduling strategies and corresponding load balancing benefits according to the multiple load intervals; wherein the candidate scheduling strategy indicates that the designated service replica carried by the designated service node in the high load interval is scheduled to the designated service node in the low load interval; The candidate scheduling strategy with the largest load balancing benefit is selected from the multiple candidate scheduling strategies as the target scheduling strategy and the target scheduling strategy is executed; wherein, the maximum load balancing benefit indicates that the distance between the multi-dimensional load vector of the service node and the target load vector is reduced before and after participating in the service replica scheduling and the distance reduction value is the largest.

2. The method according to claim 1, characterized in that: The dividing each of the service nodes into a plurality of load intervals according to the multi-dimensional load vector and the target load vector of each of the service nodes comprises: If the load value of any dimension in the multi-dimensional load vector of the service node is less than or equal to the difference between the load value of the corresponding dimension in the target load vector and the first load tilt amount, the service node is classified into the low load interval; If the load value of any dimension in the multi-dimensional load vector of the service node is greater than the sum of the load value of the corresponding dimension in the target load vector and the second load inclination, the service node is classified into the high load interval; If the load value of any dimension in the multi-dimensional load vector of the service node is greater than the sum of the load value of the corresponding dimension in the target load vector and the first load inclination, and is less than or equal to the sum of the load value of the corresponding dimension in the target load vector and the second load inclination, the service node is divided into a balanced load interval.

3. The method according to claim 1, characterized in that The determining, according to the multiple load intervals, multiple candidate scheduling strategies and corresponding load balancing benefits includes: Determining a plurality of initial scheduling strategies according to the service replicas carried by the service nodes in the high-load interval and the service nodes in the low-load interval; For any of the initial scheduling strategies, the difference between the maximum value of the distances between the multidimensional load vectors and the target load vector of the two service nodes participating in the scheduling before scheduling and the maximum value of the distances between the multidimensional load vectors and the target load vector of the two service nodes after scheduling is determined as the load balancing benefit of the initial scheduling strategy; The initial scheduling strategy and the corresponding load balancing benefit whose load balancing benefit is greater than a preset benefit threshold are respectively determined as the candidate scheduling strategy and the corresponding load balancing benefit.

4. The method according to claim 3, characterized in that The determining of a plurality of initial scheduling strategies according to the service replicas carried by the service nodes in the high load interval and the service nodes in the low load interval includes: Schedule any of the service replicas carried by the service node in the high-load interval to any one of a randomly preset number of the service nodes in the low-load interval, and determine the multiple initial scheduling strategies.

5. The method according to claim 1, characterized in that: Determining the multi-dimensional load vector of each service node according to the multi-dimensional resource usage indicators of each service replica carried by each service node in the distributed system includes: Obtaining the average value of the multi-dimensional resource usage indicators generated by each of the service replicas carried by each of the service nodes within each of the statistical unit times; Generate a multi-dimensional load vector for each of the service replicas according to the maximum value of the mean value of the resource usage indicator generated by each statistical unit time; The multi-dimensional load vectors of each of the service replicas of each of the service nodes are summed up dimension by dimension and element by element, and the multi-dimensional load vector of the service node is generated according to the maximum value of the summation results of each dimension.

6. The method according to claim 1, characterized in that The multidimensional load vector includes load values ​​on multiple dimensions for measuring the processing performance of the distributed system; the multiple dimensions include at least two of the throughput dimension, the disk space utilization dimension, the disk input and output dimension, the disk access frequency dimension, the CPU utilization dimension, the memory utilization dimension, the network bandwidth utilization dimension and the average response time dimension.

7. The method according to claim 3, characterized in that The determining of a plurality of initial scheduling strategies according to the service replicas carried by the service nodes in the high load interval and the service nodes in the low load interval includes: sorting the service nodes in the high load interval in descending order according to the distance between the multi-dimensional load vector of the service node in the high load interval and the target load vector; According to the sorting result, any of the service replicas carried by the service node in the high-load interval is scheduled to the service node in the low-load interval, and the multiple initial scheduling strategies are determined.

8. A load balancing device for a distributed system, characterized in that: include: A multi-dimensional load vector determination module is used to determine the multi-dimensional load vector of each service node according to the resource usage indicators of each service replica carried by each service node in the distributed system in multiple dimensions; wherein the multi-dimensional load vector represents the resource utilization of the service node in multiple dimensions; A load interval division module, configured to divide each of the service nodes into a plurality of load intervals according to the multi-dimensional load vector and the target load vector of each of the service nodes; wherein the plurality of load intervals at least include a high load interval and a low load interval; A candidate scheduling strategy determination module, used to determine multiple candidate scheduling strategies and corresponding load balancing benefits according to the multiple load intervals; wherein the candidate scheduling strategy indicates that the designated service replica carried by the designated service node in the high load interval is scheduled to the designated service node in the low load interval; A target scheduling strategy execution module is used to select the candidate scheduling strategy with the maximum load balancing benefit from the multiple candidate scheduling strategies as the target scheduling strategy and execute the target scheduling strategy; wherein, the maximum load balancing benefit represents that the distance between the multi-dimensional load vector of the service node and the target load vector before and after participating in the service replica scheduling is reduced and the distance reduction value is the largest.

9. An electronic device, characterized in that: include: processor; A memory for storing executable instructions; The processor is used to read the executable instructions from the memory and execute the executable instructions to implement the load balancing method of the distributed system described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the load balancing method for a distributed system according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Load balancing scheduling method and device

    CN110602156A

  • Computing resource scheduling method and device, electronic equipment and computer readable medium

    CN118567860A

  • Load balancing method and system and readable storage medium

    CN118606002A

  • Adaptive load balancing method and system based on multiple models

    CN118656211A