Cluster system load balancing method, device, equipment, storage medium and product

By obtaining resource information, calculating weights and dynamically scheduling in the cluster system, the problem of lack of flexibility and intelligence in the load balancing method in the existing technology is solved, and more dynamic and flexible load balancing and stability in the cluster system is achieved.

CN118885302BActive Publication Date: 2025-03-07JINAN INSPUR DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411355102.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-03-07
Estimated Expiration
2044-09-27

AI Technical Summary

Technical Problem

When the existing technology faces complex and changing application load requirements, the load balancing method lacks flexibility and intelligence, and is difficult to adapt to dynamically changing application load requirements, and cannot fully utilize the actual resource usage of nodes and application containers for refined load allocation.

Method used

By obtaining resource information of cluster nodes, determining the target cluster node and application container, calculating the location weight and classification weight based on the location information, node type and application container type, calculating the node weight in combination with preset scheduling rules, and dynamically scheduling the application container to the adaptive node.

Benefits of technology

It realizes more dynamic and flexible load balancing in the cluster system, ensures the stability and reliability of the cluster system, and can accurately allocate and dynamically adjust the load of different types of application containers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118885302B_ABST
    Figure CN118885302B_ABST
Patent Text Reader

Abstract

The present invention discloses a load balancing method, device, equipment, storage medium and product for a cluster system, which are applied to the field of cluster stability technology and are used to solve the problem that the load balancing of the cluster system in traditional technology is not flexible enough to ensure the stability of the system. The method is applied to a scheduling platform of the cluster system, including: determining a target cluster node and its target application container according to resource information of each cluster node; for each cluster node except the target cluster node in the cluster system, determining a location weight of the cluster node according to the location information of the cluster node, and determining a classification weight of the cluster node according to the node type of the cluster node and the application type of the target application container; calculating the location weight and classification weight of the cluster node according to a preset scheduling rule to obtain the node weight of the corresponding cluster node; determining an adapter node of the target application container according to the node weight of each cluster node, and scheduling the target application container to the adapter node.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of cluster stability, and in particular to a load balancing method for a cluster system, and also to a load balancing device, electronic equipment, computer-readable storage medium and computer program product for a cluster system. Background Art

[0002] In modern data centers and cloud computing environments, load balancing technology plays a vital role. The main goal of load balancing is to improve system performance, reliability, and scalability by distributing workloads across multiple computing resources.

[0003] With the popularization of containerization technology, Kubernetes, as a leading container orchestration platform, has become the first choice for many enterprises to deploy and manage applications in cloud computing environments. Traditional load balancing methods are mainly based on fixed strategies, such as polling, least connections, and weighted polling. Although these methods have solved the problem of load balancing to a certain extent, they are often powerless when faced with complex and changing application load requirements. They lack flexibility and intelligence, and are difficult to adapt to dynamically changing application load requirements. They cannot fully utilize the actual resource usage of nodes and application containers for refined load distribution. In addition, Kubernetes' load balancing is mainly aimed at the distribution of network traffic, and its load balancing optimization capabilities for compute-intensive, memory-intensive, and I / O-intensive applications are limited.

[0004] Therefore, how to achieve more dynamic and flexible load balancing in the cluster system and ensure the stability and reliability of the cluster system is an urgent problem to be solved by those skilled in the art. Summary of the invention

[0005] An object of the present invention is to provide a load balancing method for a cluster system, which can achieve more dynamic and flexible load balancing within the cluster system and ensure the stability and reliability of the cluster system; another object of the present invention is to provide a load balancing device, electronic device, computer-readable storage medium and computer program product for a cluster system, all of which have the above-mentioned beneficial effects.

[0006] In a first aspect, the present invention provides a load balancing method for a cluster system, wherein the cluster system comprises a scheduling platform and a plurality of cluster nodes, wherein the scheduling platform is communicatively connected with each of the cluster nodes, and the method is applied to the scheduling platform, comprising:

[0007] Acquire resource information of each of the cluster nodes, and determine a target cluster node and a target application container on the target cluster node among all cluster nodes according to each of the resource information;

[0008] For each cluster node in the cluster system except the target cluster node, determining a location weight of the cluster node according to the location information of the cluster node, and determining a classification weight of the cluster node according to the node type of the cluster node and the application type of the target application container;

[0009] Calculating the location weight and classification weight of the cluster node according to the preset scheduling rule to obtain the node weight of the corresponding cluster node;

[0010] The adapter node of the target application container is determined according to the node weight of each cluster node, and the target application container is scheduled to the adapter node.

[0011] Wherein, determining the location weight of the cluster node according to the location information of the cluster node includes:

[0012] Determine the network delay and node distance of the cluster node relative to the target cluster node according to the location information of the cluster node, and determine the geographic distance coefficient corresponding to the node distance;

[0013] The network delay and the geographic distance coefficient are calculated according to the position weight calculation formula to obtain the position weight of the cluster node; wherein the position weight calculation formula is:

[0014] ;

[0015] in, represents the position weight, represents the network delay, Represents the geographic distance coefficient.

[0016] The step of determining the classification weight of the cluster node according to the node type of the cluster node and the application type of the target application container includes:

[0017] Determine a required resource type of the target application container according to the application type of the target application container, and determine a required resource value of the target application container for the required resource type;

[0018] Determine the resource value that the cluster node can provide for the node type, and determine the resource adaptation coefficient between the required resource type and the node type;

[0019] The required resource value, the available resource value and the resource adaptation coefficient are calculated according to the classification weight calculation formula to obtain the classification weight of the cluster node; wherein the classification weight calculation formula is:

[0020] ;

[0021] in, represents the classification weight, Indicates the resource value that can be provided. represents the required resource value, Represents the resource adaptation coefficient.

[0022] The location weight and classification weight of the cluster node are calculated according to the preset scheduling rule to obtain the node weight of the corresponding cluster node, including:

[0023] When the preset scheduling rule is a location priority rule, the location weight of the cluster node is used as the node weight of the cluster node;

[0024] When the preset scheduling rule is a classification priority rule, the classification weight of the cluster node is used as the node weight of the cluster node;

[0025] When the preset scheduling rule is a comprehensive scheduling rule, the location weight and the classification weight of the cluster node are calculated according to the comprehensive scheduling formula to obtain the node weight of the corresponding cluster node;

[0026] Accordingly, determining the adapter node of the target application container according to the node weight of each cluster node includes:

[0027] Arrange the cluster nodes in descending order according to the node weight to obtain a cluster node sequence;

[0028] A preset proportion of cluster nodes ranked at the top in the cluster node sequence are used as adapter nodes for the target application container.

[0029] The location weight and the classification weight of the cluster node are calculated according to the comprehensive scheduling formula to obtain the node weight of the corresponding cluster node, including:

[0030] The location weight and the classification weight of the cluster node are calculated according to a preset scheduling formula to obtain the node weight of the corresponding cluster node; wherein the preset scheduling formula is:

[0031] ;

[0032] in, represents the node weight, represents the position weight, represents the classification weight; and Represents the weight adjustment coefficient.

[0033] Wherein, when the number of the target application containers is multiple, the method further includes:

[0034] When the target application containers are deployed on the same target cluster node, the preset scheduling rule adopts the classification priority rule;

[0035] When the required resource types of the target application containers are the same, the preset scheduling rule adopts the location priority rule;

[0036] When the target application containers are not deployed on the same target cluster node, and / or the required resource types of the target application containers are different, the preset scheduling rule adopts the comprehensive scheduling rule.

[0037] Wherein, when the number of the target application containers is multiple, scheduling the target application containers to the adapter node includes:

[0038] When the differences between the classification weights corresponding to the target application containers do not exceed the first threshold, scheduling the target application containers in descending order of position weight, so as to schedule the target application containers to the corresponding adaptation nodes;

[0039] When the differences between the position weights corresponding to the target application containers do not exceed the second threshold, the target application containers are scheduled in descending order of classification weights to schedule the target application containers to the corresponding adaptation nodes.

[0040] Wherein, determining a target cluster node and a target application container on the target cluster node among all cluster nodes according to each of the resource information includes:

[0041] Determine the resource utilization rate of each cluster node and the resource utilization rate of each application container on each cluster node according to each resource information;

[0042] Taking the cluster node whose resource utilization rate exceeds a third threshold as the target cluster node;

[0043] The application container whose resource usage exceeds the fourth threshold is used as the target application container.

[0044] Wherein, obtaining resource information of each of the cluster nodes includes:

[0045] Perform resource monitoring on the cluster nodes according to the node types of the cluster nodes to obtain resource usage rates corresponding to the node types;

[0046] When the resource usage rate reaches a preset threshold, resource information of each of the cluster nodes is obtained.

[0047] When the resource usage rate reaches a preset threshold, the method further includes:

[0048] The node weight of the cluster node whose resource usage rate reaches the preset threshold is adjusted according to the preset weight adjustment rule to reduce the node weight.

[0049] Wherein, obtaining resource information of each of the cluster nodes includes:

[0050] Respond to resource collection instructions at preset time intervals;

[0051] The resource information of each of the cluster nodes is obtained according to the resource acquisition instruction.

[0052] In a second aspect, the present invention further discloses a load balancing device for a cluster system, wherein the cluster system comprises a scheduling platform and a plurality of cluster nodes, wherein the scheduling platform is communicatively connected with each of the cluster nodes, and the method is applied to the scheduling platform, comprising:

[0053] An acquisition module, used to acquire resource information of each of the cluster nodes, and determine a target cluster node and a target application container on the target cluster node among all cluster nodes according to each of the resource information;

[0054] a determination module, configured to determine, for each cluster node in the cluster system except the target cluster node, a location weight of the cluster node according to the location information of the cluster node, and determine a classification weight of the cluster node according to a node type of the cluster node and an application type of the target application container;

[0055] A calculation module, used to calculate the location weight and classification weight of the cluster node according to a preset scheduling rule to obtain the node weight of the corresponding cluster node;

[0056] The scheduling module is used to determine the adapter node of the target application container according to the node weight of each cluster node, and schedule the target application container to the adapter node.

[0057] In a third aspect, the present invention further discloses an electronic device, comprising:

[0058] Memory for storing computer programs;

[0059] The processor is used to implement the steps of any of the load balancing methods for the cluster system as described above when executing the computer program.

[0060] In a fourth aspect, the present invention further discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the load balancing methods for the cluster system described above are implemented.

[0061] In a fifth aspect, the present invention further discloses a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of any of the load balancing methods for cluster systems as described above.

[0062] The present invention provides a load balancing method for a cluster system, wherein the cluster system comprises a scheduling platform and a plurality of cluster nodes, wherein the scheduling platform is in communication connection with each of the cluster nodes, and the method is applied to the scheduling platform, comprising: obtaining resource information of each of the cluster nodes, and determining a target cluster node and a target application container on the target cluster node among all cluster nodes according to each of the resource information; for each cluster node in the cluster system except the target cluster node, determining a location weight of the cluster node according to the location information of the cluster node, and determining a classification weight of the cluster node according to the node type of the cluster node and the application type of the target application container; calculating the location weight and classification weight of the cluster node according to a preset scheduling rule to obtain a node weight of the corresponding cluster node; determining an adapter node of the target application container according to the node weight of each of the cluster nodes, and scheduling the target application container to the adapter node.

[0063] By applying the technical solution provided by the present invention, the target cluster nodes that need to be scheduled in the cluster system and the target application containers that need to be scheduled therein are determined by collecting the resource information of each cluster node. For the target cluster node, its relative position with other cluster nodes can be used to calculate the position weight of each other cluster node, and the classification weight of each other cluster node can be calculated by using the adaptation between the node type of each other cluster node and the application type of the target application container. Thus, the node weight of each other cluster node can be calculated by combining the two, so that the adaptation node of the target application container can be determined according to the weight of each node, so as to schedule the target application container to the corresponding adaptation node. It can be seen that the technical solution realizes the precise allocation and dynamic adjustment of different types of application containers by introducing location information and classification information, combined with dynamic calculation based on intelligent load balancing scheduling, and realizes more dynamic and flexible load balancing in the cluster system, effectively ensuring the stability and reliability of the cluster system.

[0064] The load balancing device, electronic device, computer-readable storage medium and computer program product of the cluster system provided by the present invention also have the above-mentioned technical effects, and the present invention will not be described in detail here. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] In order to more clearly illustrate the technical solutions in the prior art and the embodiments of the present invention, the following briefly introduces the drawings required for describing the prior art and the embodiments of the present invention. Of course, the drawings related to the embodiments of the present invention described below are only part of the embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without creative work, and the obtained other drawings also belong to the protection scope of the present invention.

[0066] Figure 1 A schematic diagram of the structure of a cluster system provided by an embodiment of the present invention;

[0067] Figure 2 A schematic diagram of a flow chart of a load balancing method for a cluster system provided by an embodiment of the present invention;

[0068] Figure 3 A schematic diagram of the structure of another cluster system provided by an embodiment of the present invention;

[0069] Figure 4 A schematic diagram of the structure of a load balancing device for a cluster system provided by an embodiment of the present invention;

[0070] Figure 5 The present invention is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0071] The core of the present invention is to provide a load balancing method for a cluster system, which can achieve more dynamic and flexible load balancing within the cluster system and ensure the stability and reliability of the cluster system; another core of the present invention is to provide a load balancing device, electronic device, computer-readable storage medium and computer program product for a cluster system, all of which have the above-mentioned beneficial effects.

[0072] In order to describe the technical solutions in the embodiments of the present invention more clearly and completely, the technical solutions in the embodiments of the present invention will be introduced below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0073] An embodiment of the present invention provides a load balancing method for a cluster system.

[0074] First, please refer to Figure 1 , Figure 1A structural diagram of a cluster system provided in an embodiment of the present invention, the cluster system may include a scheduling platform and multiple cluster nodes, and the scheduling platform and each cluster node can be communicatively connected, and load balancing between the cluster nodes in the cluster system can be achieved through the scheduling platform.

[0075] For further information, please refer to Figure 2 , Figure 2 A schematic diagram of a load balancing method for a cluster system provided by an embodiment of the present invention. The load balancing method for the cluster system is applied to Figure 1 The scheduling platform shown may include the following S101 to S104.

[0076] S101: Obtain resource information of each cluster node, and determine a target cluster node and a target application container on the target cluster node among all cluster nodes according to each resource information.

[0077] This step is intended to determine the target cluster node and its target application container. The target cluster node is the cluster node that needs to be load-scheduled in the cluster system, and the target application container is the application container that needs to be load-scheduled in the target cluster node. It is understandable that the number of target cluster nodes in the cluster system and the number of target application containers on each target cluster node are not unique, and are specifically determined by the resource information on each cluster node in the cluster system. Among them, resource information refers to the usage of various node resources on the corresponding cluster node, including but not limited to CPU (Central Processing Unit / Processor) utilization, memory usage, network bandwidth, I / O (Input / Output) load, response time, throughput, etc.

[0078] In one embodiment of the present invention, determining a target cluster node and a target application container on the target cluster node among all cluster nodes according to each resource information includes:

[0079] Determine the resource utilization rate of each cluster node and the resource utilization rate of each application container on each cluster node according to each resource information;

[0080] The cluster node whose resource utilization exceeds the third threshold is used as the target cluster node;

[0081] The application container whose resource usage exceeds the fourth threshold is used as the target application container.

[0082] An embodiment of the present invention provides an implementation method for determining a target cluster node and its target application container within a system cluster. Specifically, a cluster node whose resource utilization rate in the cluster system reaches a certain threshold (third threshold) can be used as a target cluster node, and an application container whose resource utilization rate on the target cluster node exceeds a certain threshold (fourth threshold) can be used as a target application container. Among them, the resource utilization rate of the cluster node and the resource utilization rate of the application container can both be calculated based on the resource information on the corresponding cluster node. In addition, the specific values ​​of the third threshold and the fourth threshold do not affect the implementation of the present technical solution, and can be set by technical personnel according to actual needs, and the present invention does not limit this.

[0083] S102: For each cluster node in the cluster system except the target cluster node, determine a location weight of the cluster node according to location information of the cluster node, and determine a classification weight of the cluster node according to a node type of the cluster node and an application type of the target application container.

[0084] This step aims to realize the position weight and classification weight of each cluster node other than the target cluster node in the cluster system, compared with the target cluster node, wherein the position weight represents the relative position information between the corresponding other cluster nodes and the target cluster node, which can be determined based on the position information of the other cluster nodes relative to the target cluster node; the classification weight represents the matching of the supply and demand resource types between the corresponding other cluster nodes and the target cluster node, which can be determined based on the node type of the other cluster nodes and the application type of the target application container. Therefore, by introducing the position information and classification information, it is convenient to realize the dynamic calculation based on intelligent load balancing scheduling, and then realize the precise allocation and dynamic adjustment of different types of application containers.

[0085] In one embodiment of the present invention, determining the location weight of the cluster node according to the location information of the cluster node may include:

[0086] Determine the network delay and node distance of the cluster node relative to the target cluster node according to the location information of the cluster node, and determine the geographic distance coefficient corresponding to the node distance;

[0087] The network delay and geographic distance coefficient are calculated according to the location weight calculation formula to obtain the location weight of the cluster node; the location weight calculation formula is:

[0088] ;

[0089] in, represents the position weight, Indicates network delay, Represents the geographic distance coefficient.

[0090] Among them, different node locations correspond to different network delays and node distances, and different node distances correspond to different geographical distance coefficients.

[0091] In one embodiment of the present invention, determining the classification weight of the cluster node according to the node type of the cluster node and the application type of the target application container may include:

[0092] Determine the required resource type of the target application container according to the application type of the target application container, and determine the required resource value of the target application container for the required resource type;

[0093] Determine the resource value that the cluster node can provide for the node type, and determine the resource adaptation coefficient between the required resource type and the node type;

[0094] According to the classification weight calculation formula, the required resource value, the available resource value and the resource adaptation coefficient are calculated to obtain the classification weight of the cluster node; wherein, the classification weight calculation formula is:

[0095] ;

[0096] in, represents the classification weight, Indicates that resource values ​​can be provided. Indicates the required resource value, Indicates the resource fitness coefficient.

[0097] It is understandable that the node types in the cluster system may not be unique. For example, they may include storage nodes (mainly used to provide storage resources), computing nodes (mainly used to provide computing resources), network nodes (mainly used to provide network resources), etc. Therefore, the resource values ​​corresponding to the node types can be counted, such as the storage resource values ​​that can be provided by storage nodes, the computing resource values ​​that can be provided by computing nodes, and the network resource values ​​that can be provided by network nodes; the application types of each application container on the cluster node may also be different, such as memory-intensive applications, computing-intensive applications, I / O-intensive applications, etc. Correspondingly, the resource types required by different types of application containers are also different, such as memory-intensive applications have high requirements for storage resources, computing-intensive applications have high requirements for computing resources, and I / O-intensive applications have high requirements for network resources. Therefore, the required resource values ​​of each application container for its own required resource type can be counted. On this basis, the classification weight of each other cluster node relative to the target cluster node can be calculated by combining the resource adaptation coefficient between the required resource type and the node type. Obviously, the classification weight is used to represent the matching of the supply and demand resource types between the corresponding other cluster nodes and the target cluster node.

[0098] S103: Calculate the location weight and classification weight of the cluster node according to the preset scheduling rule to obtain the node weight of the corresponding cluster node.

[0099] This step aims to realize the calculation of the node weights of other cluster nodes in the cluster system relative to the target cluster node, that is, the position weights and classification weights of other cluster nodes relative to the target cluster node can be taken into account at the same time to calculate the corresponding node weights, which are essentially comprehensive weights containing position information and classification information.

[0100] S104: Determine an adapter node for the target application container according to the node weight of each cluster node, and schedule the target application container to the adapter node.

[0101] This step aims to achieve reasonable scheduling of the target application container on the target cluster node. Specifically, the adapter node of the target application container can be selected from all other cluster nodes according to the node weight of each other cluster node relative to the target cluster node, so as to schedule the target application container to the corresponding adapter node, thereby achieving reasonable scheduling of the target application container on the target cluster node.

[0102] In one embodiment of the present invention, when there are multiple target application containers, scheduling the target application container to the adapter node may include:

[0103] When the differences between the classification weights corresponding to the target application containers do not exceed the first threshold, the target application containers are scheduled in descending order of the position weights, so as to schedule the target application containers to the corresponding adaptation nodes;

[0104] When the differences between the position weights corresponding to the target application containers do not exceed the second threshold, the target application containers are scheduled in descending order of classification weights to schedule each target application container to a corresponding adaptation node.

[0105] It is understandable that the number of target application containers that need to be scheduled in the system cluster is not unique. When the number of target application containers is multiple, these target application containers may be deployed on different target cluster nodes and may be different application types. On this basis, in order to further ensure the rationality and efficiency of the target application container scheduling, the scheduling order of each target application container can be set.

[0106] It can be imagined that when the differences between the classification weights corresponding to each target application container do not exceed the first threshold, it means that the resource requirements of each target application container are similar. At this time, each target application container can be scheduled in order of position weight from large to small, that is, the target application container with a higher position weight is scheduled first; when the differences between the position weights corresponding to each target application container do not exceed the second threshold, it means that each target application container is basically located at the same position. At this time, each target application container can be scheduled in order of classification weight from large to small, that is, the target application container with a higher classification weight (that is, a higher degree of adaptability of supply and demand resources) is scheduled first.

[0107] It can be seen that the load balancing method of the cluster system provided by the embodiment of the present invention determines the target cluster node that needs to be scheduled in the cluster system and the target application container that needs to be scheduled therein by collecting the resource information of each cluster node. For the target cluster node, the relative position between it and other cluster nodes can be used to calculate the position weight of each other cluster node, and the adaptation between the node type of each other cluster node and the application type of the target application container can be used to calculate the classification weight of each other cluster node. Thus, the node weight of each other cluster node can be calculated by combining the two, so that the adaptation node of the target application container can be determined according to the weight of each node, so as to schedule the target application container to the corresponding adaptation node. It can be seen that the technical solution realizes the precise allocation and dynamic adjustment of different types of application containers by introducing location information and classification information, combined with dynamic calculation based on intelligent load balancing scheduling, and realizes more dynamic and flexible load balancing in the cluster system, effectively ensuring the stability and reliability of the cluster system.

[0108] Based on the above embodiments:

[0109] In one embodiment of the present invention, calculating the location weight and classification weight of the cluster node according to the preset scheduling rule to obtain the node weight of the corresponding cluster node may include:

[0110] When the preset scheduling rule is the location priority rule, the location weight of the cluster node is used as the node weight of the cluster node;

[0111] When the preset scheduling rule is a classification priority rule, the classification weight of the cluster node is used as the node weight of the cluster node;

[0112] When the preset scheduling rule is a comprehensive scheduling rule, the location weight and classification weight of the cluster node are calculated according to the comprehensive scheduling formula to obtain the node weight of the corresponding cluster node;

[0113] Accordingly, determining the adapter node of the target application container according to the node weight of each cluster node may include:

[0114] Arrange the cluster nodes in descending order according to the node weight to obtain the cluster node sequence;

[0115] A preset proportion of cluster nodes that are ranked first in the cluster node sequence are used as adapter nodes for the target application container.

[0116] The embodiment of the present invention provides different preset scheduling rules for selection, namely the above-mentioned position priority rule, classification priority rule and comprehensive scheduling rule. The position priority rule can only consider the relative position information between cluster nodes, the classification priority rule can only consider the matching information of supply and demand resources between cluster nodes, and the comprehensive scheduling rule can take the above two types of information into consideration at the same time. On this basis, when selecting the adapter node of the target application container in the cluster system, the higher the value of the node weight, the higher its adaptability to the target application container. Therefore, a certain proportion of cluster nodes with a front node weight value can be selected as the adapter node of the target application container to achieve reasonable scheduling of the target application container. Among them, the specific value of the preset ratio does not affect the implementation of the present technical solution, and can be set by technical personnel according to actual needs, and the present invention is not limited here.

[0117] The location weight and classification weight of the cluster node are calculated according to the comprehensive scheduling formula to obtain the node weight of the corresponding cluster node, which may include:

[0118] The location weight and classification weight of the cluster node are calculated according to the preset scheduling formula to obtain the node weight of the corresponding cluster node; wherein the preset scheduling formula is:

[0119] ;

[0120] in, represents the node weight, represents the position weight, represents the classification weight; and Represents the weight adjustment coefficient.

[0121] It can be understood that by dynamically adjusting the weight adjustment coefficient, the node weight of the cluster node can be dynamically adjusted. Increasing the node weight of the cluster node can increase the probability of being deployed to the target application container, and reducing the node weight of the cluster node can reduce the probability of being deployed to the target application container.

[0122] Wherein, when the number of target application containers is multiple, the load balancing method may further include:

[0123] When each target application container is deployed on the same target cluster node, the preset scheduling rule adopts the classification priority rule;

[0124] When the required resource types of each target application container are the same, the preset scheduling rule adopts the location priority rule;

[0125] When the target application containers are not deployed on the same target cluster node, and / or the required resource types of the target application containers are different, the preset scheduling rule adopts the comprehensive scheduling rule.

[0126] The embodiment of the present invention provides a method for selecting preset scheduling rules to facilitate more dynamic and flexible load balancing scheduling. When each target application container is deployed on the same target cluster node, it means that the position weights of other cluster nodes relative to the target cluster node are the same. At this time, the classification priority rule can be used to prioritize the scheduling of target application containers with higher adaptability of supply and demand resource categories; when the required resource types of each target application container are the same, it means that the classification weights of other cluster nodes relative to the target cluster node are basically the same (that is, the adaptability of supply and demand resource categories is consistent). At this time, the location priority rule can be used to prioritize the scheduling of target application containers with a relatively closer distance; in addition to the above two situations, a comprehensive scheduling rule can be used to take both location information and classification information into consideration to achieve more accurate load balancing scheduling.

[0127] In one embodiment of the present invention, obtaining resource information of each cluster node may include:

[0128] Respond to resource collection instructions at preset time intervals;

[0129] Obtain resource information of each cluster node according to the resource collection instruction.

[0130] The embodiment of the present invention provides a method for obtaining resource information of each cluster node, that is, a method for periodically and automatically triggering, that is, periodically triggering load balancing scheduling within the cluster system. Specifically, it can automatically respond to resource collection instructions periodically, thereby triggering the collection of resource information of each cluster node. Among them, the specific value of the time interval for periodically collecting resource information (that is, the above-mentioned preset time interval) does not affect the implementation of the present technical solution, and can be set by technical personnel according to actual needs, and the present invention does not limit this.

[0131] In one embodiment of the present invention, obtaining resource information of each cluster node may include:

[0132] Monitor the resources of cluster nodes according to their node types and obtain the resource usage rates corresponding to the node types;

[0133] When the resource usage reaches a preset threshold, the resource information of each cluster node is obtained.

[0134] The embodiment of the present invention provides another implementation method for obtaining resource information of each cluster node, namely, an automatic triggering method based on real-time monitoring. As described above, the node types of each cluster node may be different. Based on this, the corresponding cluster nodes can be monitored for resources according to the node types of the cluster nodes. If the resource utilization rate corresponding to the corresponding node type on the cluster node is monitored to reach a preset threshold, the automatic collection of cluster node resource information can be automatically triggered, that is, load balancing scheduling is triggered. It can be understood that when the resource utilization rate reaches the preset threshold, it means that the resource usage of the current node type on the cluster node has been overloaded and load balancing scheduling is required. Similarly, the specific value of the above-mentioned preset threshold does not affect the implementation of the present technical solution, and can be set by technical personnel according to actual needs. The present invention does not limit this.

[0135] When the resource usage rate reaches a preset threshold, the load balancing method may further include: adjusting the node weights of the cluster nodes whose resource usage rate reaches the preset threshold according to a preset weight adjustment rule to reduce the node weights.

[0136] As described above, the higher the node weight of the cluster node in the cluster system, the greater the possibility of being used as an adapter node to provide scheduling services for the target application container. On this basis, when the resource utilization rate of the corresponding node type of the cluster node exceeds the preset threshold and load balancing scheduling needs to be triggered, it is necessary to go through the above process calculations from S101 to S104, and this calculation process will inevitably take a certain amount of time. In order to avoid the cluster node whose resource utilization rate exceeds the preset threshold during this time period from being scheduled to allocate the target application container, before triggering a new round of load balancing scheduling, the node weight of the cluster node whose resource utilization rate reaches the preset threshold can be directly adjusted according to the preset weight adjustment rule to reduce the node weight, thereby achieving the purpose of avoiding the cluster node from being scheduled to the target application container. Among them, the specific content of the preset weight adjustment rule is not unique, and the purpose of reducing the node weight of the cluster node can be achieved. The present invention will not be repeated here. For example, a certain value can be directly reduced, or the weight adjustment coefficient in the preset scheduling formula can be adjusted to achieve the purpose of reducing the node weight of the cluster node.

[0137] In one embodiment of the present invention, the load balancing method of the cluster system may further include:

[0138] Monitor each cluster node in real time to determine the node status of the cluster node;

[0139] When the node status of the cluster node is abnormal, determining a backup node list of the abnormal cluster node;

[0140] Select the target standby node of the abnormal cluster node in the standby node list, and migrate each application container on the abnormal cluster node to the target standby node.

[0141] The load balancing method provided by the embodiment of the present invention further realizes the abnormal detection and backup processing of cluster nodes. It can be understood that by performing real-time abnormal monitoring of each cluster node in the cluster system, the node status of each cluster node can be obtained in real time, so as to migrate the load of the abnormal cluster node to the corresponding target backup node, avoid the loss of data on the abnormal cluster node, ensure the normal operation of the contact point business and ensure the stability of the cluster system. It should be noted that the above-mentioned implementation process of selecting the target backup node of the abnormal cluster node in the backup node list and migrating each application container on the abnormal cluster node to the target backup node can specifically refer to the above-mentioned implementation process of S101 to S104.

[0142] The embodiment of the present invention takes the Kubernetes cluster as an example and provides another load balancing method for the cluster system.

[0143] Please refer to Figure 3 , Figure 3 This is a structural diagram of another cluster system provided by an embodiment of the present invention, in which a configuration controller and an intelligent load balancing scheduling and calculation controller are combined into a scheduling platform of the cluster system, and each cluster node in the cluster system includes a host machine, an application container (Pod) deployed on the host machine, a collection controller, a configuration controller, and a synchronization controller. Based on the cluster system, the implementation process of the load balancing method provided by an embodiment of the present invention is as follows:

[0144] 1. Add location tags: Add location tags to each cluster node, including the computer room and rack location, and use these tags as the first priority factor for load balancing calculations. Each location tag has a corresponding weight (for example, the closer the distance, the greater the weight; the farther the distance, the smaller the weight). Load balancing rules are applied based on the weight calculation to ensure balanced allocation of node resources at different locations.

[0145] 2. Add classification labels: Add classification labels at the application level, including computing-intensive (such as machine learning, video encoding and other applications), memory-intensive (such as big data processing, cache services and other applications), I / O-intensive applications (such as database services and file processing tasks and other applications), etc., and use these labels as the second priority factor for load balancing calculation. Each classification label has a corresponding weight, and the load balancing rules are applied according to the weight calculation to ensure balanced allocation of node resources of different categories.

[0146] 3. Configure collection thresholds and time intervals: Configure a series of collection parameters for each cluster node and Pod, including CPU utilization, memory usage, network bandwidth, I / O load, response time, throughput, etc., and configure the time interval for data collection.

[0147] 4. Data collection and upload: Cluster nodes can actively collect their own and Pod's operating data according to set time intervals or when the usage of a certain type of resource exceeds a threshold (for example, CPU utilization and task execution time for compute-intensive applications; memory and bandwidth utilization for memory-intensive applications; network bandwidth, I / O throughput and latency for I / O-intensive applications, etc.), and upload the collected data to the intelligent load balancing scheduling computing controller through the synchronization controller for centralized processing and analysis.

[0148] 5. Intelligent load balancing scheduling: The intelligent load balancing scheduling calculation controller dynamically calculates load balancing information based on real-time collected data. Specifically, it can recalculate the weights of cluster nodes and Pods by analyzing location tags and classification tags, and send the new load balancing configuration to each cluster node.

[0149] First, the location label and classification label represent the physical topology and application load type, respectively. The weights of cluster nodes and Pods need to be calculated taking these two labels into consideration.

[0150] (1) The role of location labels: Location labels identify the physical location of Pods and cluster nodes, such as computer rooms, racks, regions, etc. This helps reduce data transmission latency and bandwidth usage across racks and regions. When load balancing, the system will give priority to cluster nodes that are physically close to each other, thereby reducing network latency. The physical location of each cluster node and the latency parameters of the connection topology can affect its weight.

[0151] (2) The role of classification labels: Classification labels are used to mark Pods according to their application type and load characteristics (such as compute-intensive, memory-intensive, I / O-intensive, etc.). By analyzing application characteristics, the system can allocate resource types that suit different Pods to maximize resource utilization efficiency. For example, compute-intensive applications require nodes with sufficient CPU resources, and memory-intensive applications require nodes with high memory.

[0152] Furthermore, through the weight calculation formula, the weight can be dynamically adjusted according to the classification label of each Pod and its resource requirements, combined with the remaining resources of the cluster nodes (CPU, memory, network bandwidth, etc.). The weight calculation formula is as follows:

[0153] ;

[0154] in, represents the node weight, represents the position weight, represents the classification weight; and Represents the weight adjustment coefficient.

[0155] In addition, the dynamic calculation of weights can be updated based on real-time monitoring data. When the system detects that the resource usage of a cluster node is close to a critical value, the weight can be adjusted accordingly to reduce the priority of the cluster node in receiving new loads.

[0156] Finally, after calculating the weights of the cluster nodes / Pods, the system will dynamically generate a new load balancing configuration based on these weights and send it to each cluster node. The specific operation process is as follows:

[0157] (1) Weight sorting: According to the weight value, cluster nodes and Pods are sorted from high to low. The cluster node with a higher weight value is more suitable for the current load demand and has a higher priority.

[0158] (2) Load balancing configuration generation: Based on the weight sorting results, a Pod that is appropriate to its weight is assigned to each cluster node to form a new load balancing configuration. This configuration not only considers the weight of the cluster node, but also combines the resource requirements and actual usage of the Pod, where:

[0159] a. Prioritize high-weight cluster nodes: Based on the weight ranking, the system first selects cluster nodes with sufficient resources, close physical locations, and that meet the Pod load requirements;

[0160] b. Dynamically adjust the allocation ratio: Cluster nodes with higher weights can be allocated more Pods, but when the resource usage of cluster nodes reaches a certain set threshold, the system will dynamically adjust the allocation to avoid overload;

[0161] c. Fault tolerance and redundant configuration: In order to enhance the fault tolerance of the system, node redundancy is also considered in the load balancing configuration. For example, different Pods of the same application are assigned to different physical machines or racks to prevent single point failures.

[0162] 6. Send the configuration to each cluster node: After generating the new load balancing configuration, you can send it to each cluster node, and the cluster node will execute the new scheduling strategy according to the received configuration.

[0163] 7. Real-time monitoring and feedback: After the load balancing configuration is implemented, the system will monitor the operating status of each cluster node in real time (such as CPU usage, memory usage, network traffic, etc.), provide timely feedback and make fine-tuning to ensure continuous optimization of load balancing.

[0164] 8. Adjust load weight: For cluster nodes whose resource usage exceeds the threshold of 90%, their weight can be directly reduced to 10% to prevent resource overload. At the same time, the system recalculates the weights of other cluster nodes to ensure a more balanced resource allocation for the entire system.

[0165] 9. Calculation and sorting of position weight and classification weight:

[0166] (1) Generate location load balancing configuration based on location tags:

[0167] The core of generating location load balancing configuration based on location tags is to maximize geographic proximity to reduce network latency and data transmission costs. The specific process is as follows:

[0168] a. Position weight calculation:

[0169] ;

[0170] in, represents the position weight, Indicates network delay, Represents the geographic distance coefficient. Obviously, the smaller the network latency and the closer the geographical distance of the cluster node, the higher its weight.

[0171] b. Sort by location weight: All cluster nodes are sorted from high to low according to their weight.

[0172] c. Generate location load balancing configuration: Based on the sorting results, the system prioritizes cluster nodes with high location weights and allocates Pods that are closer to these cluster nodes. This allocation can be distributed to each cluster node through the configuration file generated by the intelligent load balancing scheduling computing controller, thereby optimizing network performance.

[0173] (2) Generate the final load balancing configuration based on the classification label:

[0174] The classification weight is calculated based on the matching degree between the Pod's resource requirements and the cluster node's resource capabilities. The specific process is as follows:

[0175] a. Classification weight calculation:

[0176] ;

[0177] in, represents the classification weight, Indicates that resource values ​​can be provided. Indicates the required resource value, Indicates the resource adaptation coefficient. Obviously, the closer the cluster node resources are to the Pod requirements, the higher the weight.

[0178] b. Sorting and generating load balancing configuration: The system sorts the cluster nodes from high to low according to the classification weight, and preferentially allocates Pods with large resource requirements to cluster nodes with high classification weight. The final load balancing configuration generated will combine the location weight and classification weight to ensure that the best cluster node can receive the appropriate Pod.

[0179] 10. Configuration control: The configuration controller sends the final load balancing configuration to each cluster node to achieve real-time adjustment and optimization of the system. In addition, data can be continuously collected and uploaded in a periodic and event-driven manner to ensure real-time update and accuracy of load balancing information.

[0180] It should be noted that the "load balancing configuration" ultimately sent to each cluster node is a set of instructions and parameters generated by the intelligent load balancing scheduling and computing controller based on the collected data, which is used to distribute and manage the load on cluster nodes to ensure that the overall performance of the system and resource utilization are maximized.

[0181] The load balancing policy parameters include the specific rules and behaviors for cluster nodes to perform load balancing. These parameters can be:

[0182] (1) Load distribution strategy: Determine how to dynamically distribute load based on the real-time load status of cluster nodes, for example, using polling distribution, least connection or weight-based distribution;

[0183] (2) Load migration strategy: When node resources are tight or overloaded, how to migrate some Pods to other cluster nodes. The configuration will include the condition threshold for triggering migration, such as triggering migration when the CPU usage exceeds 90%;

[0184] (3) Priority scheduling strategy: Determine the scheduling order and resource allocation priority of the Pod based on its priority (such as real-time application, batch processing task, etc.).

[0185] Furthermore, the load balancing policy parameters can also include priority scheduling guidelines based on location weights and classification weights, which determine which Pod the system will prioritize when there are multiple Pods waiting to be scheduled on a cluster node. For example, if multiple Pods on a cluster node have similar resource requirements, the Pod with a high location weight can be prioritized; if multiple Pods are located in the same location, the Pod with a high resource requirement and node resource adaptability can be prioritized based on the classification weight.

[0186] In addition to the above, the cluster system can further realize the following functions:

[0187] (1) Resource threshold and warning mechanism:

[0188] To prevent a cluster node from being overloaded, you can also set resource thresholds that trigger automatic adjustments or alarm mechanisms, for example:

[0189] a. CPU usage threshold: defines the maximum allowable value of CPU usage (such as 90%). When this value is exceeded, the cluster node will issue a warning or trigger Pod migration;

[0190] b. Memory usage threshold: defines the maximum value of memory usage to prevent service crash caused by memory exhaustion;

[0191] c. Network bandwidth threshold: Define the maximum allowed network traffic based on the network link to which the cluster nodes are connected.

[0192] (2) Fault detection and backup processing:

[0193] a. Fault detection: When a cluster node fails or is unavailable, the system can automatically identify and trigger load migration. The conditions for fault triggering can be configured in advance through configuration files (such as the number of cluster node health check failures reaching a certain upper limit);

[0194] b. Backup processing: You can pre-configure the list of standby nodes for each cluster node through the configuration file. When a cluster node cannot handle more load, the Pod can be migrated to these standby nodes.

[0195] It can be seen that the load balancing method of the cluster system provided by the embodiment of the present invention determines the target cluster node that needs to be scheduled in the cluster system and the target application container that needs to be scheduled therein by collecting the resource information of each cluster node. For the target cluster node, the relative position between it and other cluster nodes can be used to calculate the position weight of each other cluster node, and the adaptation between the node type of each other cluster node and the application type of the target application container can be used to calculate the classification weight of each other cluster node. Thus, the node weight of each other cluster node can be calculated by combining the two, so that the adaptation node of the target application container can be determined according to the weight of each node, so as to schedule the target application container to the corresponding adaptation node. It can be seen that the technical solution realizes the precise allocation and dynamic adjustment of different types of application containers by introducing location information and classification information, combined with dynamic calculation based on intelligent load balancing scheduling, and realizes more dynamic and flexible load balancing in the cluster system, effectively ensuring the stability and reliability of the cluster system.

[0196] An embodiment of the present invention provides a load balancing device for a cluster system.

[0197] Please refer to Figure 4 , Figure 4This is a schematic diagram of the structure of a load balancing device of a cluster system provided by the present invention. The load balancing device of the cluster system may include:

[0198] The acquisition module 1 is used to acquire resource information of each cluster node, and determine the target cluster node and the target application container on the target cluster node among all cluster nodes according to the resource information;

[0199] Determining module 2, for determining, for each cluster node in the cluster system except the target cluster node, a location weight of the cluster node according to the location information of the cluster node, and determining a classification weight of the cluster node according to the node type of the cluster node and the application type of the target application container;

[0200] Calculation module 3, used to calculate the location weight and classification weight of the cluster node according to the preset scheduling rules to obtain the node weight of the corresponding cluster node;

[0201] The scheduling module 4 is used to determine the adapter node of the target application container according to the node weight of each cluster node, and schedule the target application container to the adapter node.

[0202] It can be seen that the load balancing device of the cluster system provided by the embodiment of the present invention determines the target cluster node that needs to be scheduled in the cluster system and the target application container that needs to be scheduled therein by collecting the resource information of each cluster node. For the target cluster node, the relative position between it and other cluster nodes can be used to calculate the position weight of each other cluster node, and the adaptation between the node type of each other cluster node and the application type of the target application container can be used to calculate the classification weight of each other cluster node. Thus, the node weight of each other cluster node can be calculated by combining the two, so that the adaptation node of the target application container can be determined according to the weight of each node, so as to schedule the target application container to the corresponding adaptation node. It can be seen that the technical solution realizes the precise allocation and dynamic adjustment of different types of application containers by introducing location information and classification information, combined with dynamic calculation based on intelligent load balancing scheduling, and realizes more dynamic and flexible load balancing in the cluster system, which effectively guarantees the stability and reliability of the cluster system.

[0203] In one embodiment of the present invention, the determination module 2 can be specifically used to determine the network delay and node distance of the cluster node relative to the target cluster node according to the location information of the cluster node, and determine the geographical distance coefficient corresponding to the node distance; calculate the network delay and geographical distance coefficient according to the location weight calculation formula to obtain the location weight of the cluster node; wherein the location weight calculation formula is:

[0204] ;

[0205] in, represents the position weight, Indicates network delay, Represents the geographic distance coefficient.

[0206] In one embodiment of the present invention, the determination module 2 can be specifically used to determine the required resource type of the target application container according to the application type of the target application container, and determine the required resource value of the target application container for the required resource type; determine the available resource value of the cluster node for the node type, and determine the resource adaptation coefficient between the required resource type and the node type; calculate the required resource value, the available resource value and the resource adaptation coefficient according to the classification weight calculation formula to obtain the classification weight of the cluster node; wherein the classification weight calculation formula is:

[0207] ;

[0208] in, represents the classification weight, Indicates that resource values ​​can be provided. Indicates the required resource value, Indicates the resource fitness coefficient.

[0209] In one embodiment of the present invention, the calculation module 3 may include:

[0210] A first calculation unit, configured to use the location weight of the cluster node as the node weight of the cluster node when the preset scheduling rule is a location priority rule;

[0211] A second calculation unit, configured to use the classification weight of the cluster node as the node weight of the cluster node when the preset scheduling rule is a classification priority rule;

[0212] a third calculation unit, configured to calculate the location weight and classification weight of the cluster node according to the comprehensive scheduling formula to obtain the node weight of the corresponding cluster node when the preset scheduling rule is a comprehensive scheduling rule;

[0213] Accordingly, the scheduling module 4 can be specifically used to arrange the cluster nodes in descending order of node weight to obtain a cluster node sequence; and use a preset proportion of cluster nodes ranked high in the cluster node sequence as adapter nodes for the target application container.

[0214] In one embodiment of the present invention, the third calculation unit may be specifically used to calculate the location weight and classification weight of the cluster node according to a preset scheduling formula to obtain the node weight of the corresponding cluster node; wherein the preset scheduling formula is:

[0215] ;

[0216] in, represents the node weight, represents the position weight, represents the classification weight; and Represents the weight adjustment coefficient.

[0217] In one embodiment of the present invention, when the number of target application containers is multiple, the load balancing device of the cluster system may further include a selection module, which is used for, when each target application container is deployed on the same target cluster node, the preset scheduling rule adopts a classification priority rule; when the required resource types of each target application container are the same, the preset scheduling rule adopts a location priority rule; when each target application container is not deployed on the same target cluster node, and / or the required resource types of each target application container are different, the preset scheduling rule adopts a comprehensive scheduling rule.

[0218] In one embodiment of the present invention, when there are multiple target application containers, the above-mentioned scheduling module 4 can be specifically used to schedule each target application container in the order of position weight from large to small when the difference between the classification weights corresponding to each target application container does not exceed the first threshold, so as to schedule each target application container to the corresponding adaptation node; when the difference between the position weights corresponding to each target application container does not exceed the second threshold, schedule each target application container in the order of classification weight from large to small, so as to schedule each target application container to the corresponding adaptation node.

[0219] In one embodiment of the present invention, the above-mentioned acquisition module 1 can be specifically used to determine the resource utilization of each cluster node and the resource utilization of each application container on each cluster node based on various resource information; take the cluster node whose resource utilization exceeds the third threshold as the target cluster node; and take the application container whose resource utilization exceeds the fourth threshold as the target application container.

[0220] In one embodiment of the present invention, the acquisition module 1 can be specifically used to monitor the resources of cluster nodes according to the node types of the cluster nodes to obtain the resource utilization rate corresponding to the node types; when the resource utilization rate reaches a preset threshold, the resource information of each cluster node is obtained.

[0221] In one embodiment of the present invention, the acquisition module 1 may also be used to adjust the node weights of cluster nodes whose resource utilization reaches a preset threshold according to a preset weight adjustment rule when the resource utilization reaches a preset threshold, so as to reduce the node weights.

[0222] In one embodiment of the present invention, the acquisition module 1 can be specifically used to respond to a resource acquisition instruction at a preset time interval; and acquire resource information of each cluster node according to the resource acquisition instruction.

[0223] For an introduction to the device provided in the embodiment of the present invention, please refer to the above method embodiment, and the present invention will not be elaborated here.

[0224] An embodiment of the present invention provides an electronic device.

[0225] Please refer to Figure 5 , Figure 5 This is a schematic diagram of the structure of an electronic device provided by the present invention, and the electronic device may include:

[0226] A memory 11, used for storing computer programs;

[0227] The processor 10 can implement the steps of any of the above-mentioned load balancing methods for the cluster system when executing the computer program.

[0228] like Figure 5 , which is a schematic diagram of the composition structure of an electronic device, the electronic device may include: a processor 10, a memory 11, a communication interface 12 and a communication bus 13. The processor 10, the memory 11 and the communication interface 12 all communicate with each other through the communication bus 13.

[0229] In the embodiment of the present invention, the processor 10 may be a central processing unit (CPU), an application specific integrated circuit, a digital signal processor, a field programmable gate array or other programmable logic devices.

[0230] The processor 10 may call a program stored in the memory 11. Specifically, the processor 10 may execute operations in an embodiment of the load balancing method for a cluster system.

[0231] The memory 11 is used to store one or more programs, which may include program codes, and the program codes include computer operation instructions. In the embodiment of the present invention, the memory 11 at least stores programs for implementing the following functions:

[0232] Obtain resource information of each cluster node, and determine a target cluster node and a target application container on the target cluster node among all cluster nodes according to the resource information;

[0233] For each cluster node in the cluster system except the target cluster node, determining a location weight of the cluster node according to the location information of the cluster node, and determining a classification weight of the cluster node according to the node type of the cluster node and the application type of the target application container;

[0234] Calculate the location weight and classification weight of the cluster node according to the preset scheduling rules to obtain the node weight of the corresponding cluster node;

[0235] The adapter node of the target application container is determined according to the node weight of each cluster node, and the target application container is scheduled to the adapter node.

[0236] In a possible implementation, the memory 11 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function, etc.; the data storage area may store data created during use.

[0237] In addition, the memory 11 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device or other volatile solid-state storage device.

[0238] The communication interface 12 may be an interface of a communication module, and is used to connect to other devices or systems.

[0239] Of course, it should be noted that Figure 5 The structure shown does not constitute a limitation on the electronic device in the embodiment of the present invention. In actual applications, the electronic device may include Figure 5 More or fewer components than shown, or combinations of certain components.

[0240] An embodiment of the present invention provides a computer-readable storage medium.

[0241] The computer-readable storage medium provided in the embodiment of the present invention stores a computer program, and when the computer program is executed by a processor, the steps of any of the above-mentioned load balancing methods for a cluster system can be implemented.

[0242] Among them, the computer-readable storage medium can be any available medium that can be stored in a computer or a data storage device such as a server or data center that includes one or more available media integrated. For example, it can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape, etc.), an optical medium (such as a DVD) or a semiconductor medium (such as a solid-state hard disk) and other media that can store computer program codes.

[0243] For an introduction to the computer-readable storage medium provided in an embodiment of the present invention, please refer to the above method embodiment, and the present invention will not elaborate on it here.

[0244] An embodiment of the present invention provides a computer program product.

[0245] The computer program product provided in the embodiment of the present invention includes a computer program / instruction. When the computer program / instruction is executed by a processor, the steps of any of the above-mentioned load balancing methods for a cluster system can be implemented.

[0246] Specifically, in the above embodiments, all or part of them can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of them can be implemented in the form of a computer program product.

[0247] Among them, the computer program product may include one or more computer programs / instructions, and when the computer program / instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention may be generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. Computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line, etc.) or wireless (e.g., infrared, wireless, microwave, etc.) means.

[0248] For an introduction to the computer program product provided by the embodiment of the present invention, please refer to the above method embodiment, and the present invention will not be elaborated here.

[0249] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.

[0250] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0251] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0252] The technical solution provided by the present invention is described in detail above. Specific examples are used herein to illustrate the principle and implementation of the present invention, and the description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, the present invention can also be improved and modified, and these improvements and modifications also fall within the scope of protection of the present invention.

Claims

1. A load balancing method for a cluster system, characterized in that: The cluster system includes a scheduling platform and a plurality of cluster nodes. The scheduling platform is in communication connection with each of the cluster nodes. The method is applied to the scheduling platform and includes: Acquire resource information of each of the cluster nodes, and determine a target cluster node and a target application container on the target cluster node among all cluster nodes according to each of the resource information; For each cluster node in the cluster system except the target cluster node, determining a location weight of the cluster node according to the location information of the cluster node, and determining a classification weight of the cluster node according to the node type of the cluster node and the application type of the target application container; Calculating the location weight and classification weight of the cluster node according to the preset scheduling rule to obtain the node weight of the corresponding cluster node; Determine the adapter node of the target application container according to the node weight of each cluster node, and schedule the target application container to the adapter node; Determining the location weight of the cluster node according to the location information of the cluster node includes: Determine the network delay and node distance of the cluster node relative to the target cluster node according to the location information of the cluster node, and determine the geographic distance coefficient corresponding to the node distance; The network delay and the geographic distance coefficient are calculated according to the position weight calculation formula to obtain the position weight of the cluster node; wherein the position weight calculation formula is: ; in, represents the position weight, represents the network delay, represents the geographic distance coefficient; Determining the classification weight of the cluster node according to the node type of the cluster node and the application type of the target application container includes: Determine a required resource type of the target application container according to the application type of the target application container, and determine a required resource value of the target application container for the required resource type; Determine the resource value that the cluster node can provide for the node type, and determine the resource adaptation coefficient between the required resource type and the node type; The required resource value, the available resource value and the resource adaptation coefficient are calculated according to the classification weight calculation formula to obtain the classification weight of the cluster node; wherein the classification weight calculation formula is: ; in, represents the classification weight, Indicates the resource value that can be provided. represents the required resource value, Represents the resource adaptation coefficient.

2. The load balancing method of a cluster system according to claim 1, characterized in that: Calculating the location weight and classification weight of the cluster node according to the preset scheduling rule to obtain the node weight of the corresponding cluster node includes: When the preset scheduling rule is a location priority rule, the location weight of the cluster node is used as the node weight of the cluster node; When the preset scheduling rule is a classification priority rule, the classification weight of the cluster node is used as the node weight of the cluster node; When the preset scheduling rule is a comprehensive scheduling rule, the location weight and the classification weight of the cluster node are calculated according to the comprehensive scheduling formula to obtain the node weight of the corresponding cluster node; Accordingly, determining the adapter node of the target application container according to the node weight of each cluster node includes: Arrange the cluster nodes in descending order according to the node weight to obtain a cluster node sequence; A preset proportion of cluster nodes ranked at the top in the cluster node sequence are used as adapter nodes for the target application container.

3. The load balancing method of the cluster system according to claim 2, characterized in that: The location weight and the classification weight of the cluster node are calculated according to the comprehensive scheduling formula to obtain the node weight of the corresponding cluster node, including: The location weight and the classification weight of the cluster node are calculated according to a preset scheduling formula to obtain the node weight of the corresponding cluster node; wherein the preset scheduling formula is: ; in, represents the node weight, represents the position weight, represents the classification weight; and Represents the weight adjustment coefficient.

4. The load balancing method of a cluster system according to claim 2, characterized in that: When there are multiple target application containers, the method further includes: When the target application containers are deployed on the same target cluster node, the preset scheduling rule adopts the classification priority rule; When the required resource types of the target application containers are the same, the preset scheduling rule adopts the location priority rule; When the target application containers are not deployed on the same target cluster node, and / or the required resource types of the target application containers are different, the preset scheduling rule adopts the comprehensive scheduling rule.

5. The load balancing method of a cluster system according to claim 1, characterized in that: When there are multiple target application containers, scheduling the target application containers to the adapter node includes: When the differences between the classification weights corresponding to the target application containers do not exceed the first threshold, scheduling the target application containers in descending order of position weight, so as to schedule the target application containers to the corresponding adaptation nodes; When the differences between the position weights corresponding to the target application containers do not exceed the second threshold, the target application containers are scheduled in descending order of classification weights to schedule the target application containers to the corresponding adaptation nodes.

6. The load balancing method of a cluster system according to claim 1, characterized in that: Determining a target cluster node and a target application container on the target cluster node among all cluster nodes according to each of the resource information includes: Determine the resource utilization rate of each cluster node and the resource utilization rate of each application container on each cluster node according to each resource information; Taking the cluster node whose resource utilization rate exceeds a third threshold as the target cluster node; The application container whose resource usage exceeds the fourth threshold is used as the target application container.

7. The load balancing method of a cluster system according to claim 1, characterized in that: Obtain resource information of each of the cluster nodes, including: Perform resource monitoring on the cluster nodes according to the node types of the cluster nodes to obtain resource usage rates corresponding to the node types; When the resource usage rate reaches a preset threshold, resource information of each of the cluster nodes is obtained.

8. The load balancing method of the cluster system according to claim 7, characterized in that: When the resource usage rate reaches a preset threshold, the method further includes: The node weight of the cluster node whose resource usage rate reaches the preset threshold is adjusted according to the preset weight adjustment rule to reduce the node weight.

9. The load balancing method of a cluster system according to claim 1, characterized in that: Obtain resource information of each of the cluster nodes, including: Respond to resource collection instructions at preset time intervals; The resource information of each of the cluster nodes is obtained according to the resource acquisition instruction.

10. A load balancing device for a cluster system, characterized in that: The cluster system includes a scheduling platform and a plurality of cluster nodes. The scheduling platform is communicatively connected with each of the cluster nodes. The device is applied to the scheduling platform and includes: An acquisition module, used to acquire resource information of each of the cluster nodes, and determine a target cluster node and a target application container on the target cluster node among all cluster nodes according to each of the resource information; a determination module, configured to determine, for each cluster node in the cluster system except the target cluster node, a location weight of the cluster node according to the location information of the cluster node, and determine a classification weight of the cluster node according to a node type of the cluster node and an application type of the target application container; A calculation module, used to calculate the location weight and classification weight of the cluster node according to a preset scheduling rule to obtain the node weight of the corresponding cluster node; A scheduling module, used to determine the adapter node of the target application container according to the node weight of each cluster node, and schedule the target application container to the adapter node; The determination module is specifically used to determine the network delay and node distance of the cluster node relative to the target cluster node according to the location information of the cluster node, and determine the geographical distance coefficient corresponding to the node distance; calculate the network delay and the geographical distance coefficient according to the location weight calculation formula to obtain the location weight of the cluster node; wherein the location weight calculation formula is: ; in, represents the position weight, represents the network delay, represents the geographic distance coefficient; The determination module is specifically used to determine the required resource type of the target application container according to the application type of the target application container, and determine the required resource value of the target application container for the required resource type; determine the available resource value of the cluster node for the node type, and determine the resource adaptation coefficient between the required resource type and the node type; calculate the required resource value, the available resource value and the resource adaptation coefficient according to the classification weight calculation formula to obtain the classification weight of the cluster node; wherein the classification weight calculation formula is: ; in, represents the classification weight, Indicates the resource value that can be provided. represents the required resource value, Represents the resource adaptation coefficient.

11. An electronic device, characterized in that: include: Memory for storing computer programs; A processor is used to implement the steps of the load balancing method of the cluster system as described in any one of claims 1 to 9 when executing the computer program.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the load balancing method for a cluster system according to any one of claims 1 to 9 are implemented.

13. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the load balancing method for the cluster system according to any one of claims 1 to 9 are implemented.

Citation Information

Patent Citations

  • Container group deployment method and device, equipment and storage medium

    CN113342477A

  • Resource scheduling method and device, equipment, storage medium and product

    CN118193123A