Load balancing method, device, electronic device and computer readable medium

By calculating the utilization rate of Kubernetes system nodes and migrating container collections, the problem of load imbalance in the system is solved, and dynamic load adjustment and stable system operation are achieved.

CN112181605BActive Publication Date: 2025-03-11BEIJING CHENGSHI WANGLIN INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011165021.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-27
Publication Date
2025-03-11
Estimated Expiration
2040-10-27

AI Technical Summary

Technical Problem

The Kubernetes system cannot realize dynamic scheduling of resources, resulting in uneven distribution of container sets between nodes and unbalanced loads, which is prone to abnormal node operation or downtime, affecting the stability of the system operation.

Method used

By calculating the utilization rate of nodes in the Kubernetes system, identify high-utilization nodes and low-utilization nodes, and migrating migable containers on high-utilization nodes to low-utilization nodes, dynamic adjustment of node load is achieved.

Benefits of technology

Dynamic adjustment of node load in Kubernetes system is achieved, load balancing between nodes is improved, and system operation stability is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112181605B_ABST
    Figure CN112181605B_ABST
Patent Text Reader

Abstract

This disclosure discloses load balancing methods, apparatuses, electronic devices, and computer-readable media. One specific implementation of the method includes: calculating the utilization of at least one node in a Kubernetes system to obtain a node utilization sequence; calculating an average node utilization of the Kubernetes system based on the node utilization sequence; responding to the existence of node utilizations in the node utilization sequence whose difference from the average node utilization is greater than a first preset threshold, determining a first number of high-utilization nodes and a second number of low-utilization nodes based on the node utilization sequence; determining a set of migrateable containers on the high-utilization nodes, and migrating the set of migrateable containers to the low-utilization nodes. This implementation achieves dynamic adjustment of the load on nodes in a Kubernetes system, which is beneficial for load balancing among nodes in the Kubernetes system and improves the operational stability of the Kubernetes system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the field of computer technology, and in particular to a load balancing method, device, electronic device, and computer-readable medium. Background Art

[0002] The Kubernetes system is an open source system for managing containerized applications on multiple hosts in a cloud platform. The traditional way to deploy applications is to install applications through plug-ins or scripts. The disadvantage of this is that the operation, configuration, management, and all life cycles of the application will be bound to the current operating system, which is not conducive to application upgrades / rollbacks. The Kubernetes system implements application operation by deploying containers. The Kubernetes system can include multiple nodes, each of which can be set with multiple container sets. Each container set can contain multiple containers. Containers are isolated from each other, processes do not affect each other, and their respective computing resources can be distinguished.

[0003] In practice, the containers connected to the Kubernetes system change dynamically, which in turn causes the container collection and node load to change dynamically. However, the Kubernetes system itself cannot implement dynamic resource scheduling, which leads to uneven distribution of container collections between nodes, unbalanced loads between nodes, and prone to node operation abnormalities or downtime. In order to ensure the normal operation of the container, the container collection on the node with abnormal operation or downtime needs to be migrated to other nodes. This may further aggravate the load imbalance between other nodes, cause abnormal operation or downtime of other nodes, and even affect the stable operation of the entire Kubernetes system. Summary of the invention

[0004] The content of this disclosure is used to introduce concepts in a brief form, which will be described in detail in the detailed implementation section below. The content of this disclosure is not intended to identify the key features or essential features of the technical solution claimed for protection, nor is it intended to limit the scope of the technical solution claimed for protection.

[0005] Some embodiments of the present disclosure propose a load balancing method, an apparatus, an electronic device, and a computer-readable medium to solve the technical problems mentioned in the above background technology section.

[0006] In a first aspect, some embodiments of the present disclosure provide a load balancing method, the method comprising: calculating the utilization of at least one node in a Kubernetes system to obtain a node utilization sequence, the node being provided with at least one container set; calculating the node utilization mean of the Kubernetes system based on the node utilization sequence; in response to the presence of a node utilization in the node utilization sequence whose difference from the node utilization mean is greater than a first set threshold, determining a first number of high-utilization nodes and a second number of low-utilization nodes according to the node utilization sequence; determining a set of migratable containers on the high-utilization node, and migrating the migratable container set to the low-utilization node.

[0007] In a second aspect, some embodiments of the present disclosure provide a load balancing device, which includes: a utilization calculation unit, configured to calculate the utilization of at least one node in a Kubernetes system to obtain a node utilization sequence, wherein the node is provided with at least one container set; a node utilization mean calculation unit, configured to calculate the node utilization mean of the Kubernetes system based on the node utilization sequence; a node selection unit, in response to the presence of a node utilization in the node utilization sequence whose difference with the node utilization mean is greater than a first set threshold, configured to determine a first number of high-utilization nodes and a second number of low-utilization nodes according to the node utilization sequence; a migration unit, configured to determine a set of migratable containers on the high-utilization node and migrate the migratable container set to the low-utilization node.

[0008] In a third aspect, some embodiments of the present disclosure provide an electronic device, comprising: one or more processors; and a memory on which one or more programs are stored, wherein when the one or more programs are executed by the one or more processors, the one or more processors execute the load balancing method of the first aspect.

[0009] In a fourth aspect, some embodiments of the present disclosure provide a computer-readable medium having a computer program stored thereon, characterized in that when the program is executed by a processor, the load balancing method of the first aspect is implemented.

[0010] One of the above-mentioned various embodiments of the present disclosure has the following beneficial effects: first, the utilization of at least one node in the Kubernetes system is calculated to obtain a node utilization sequence. Then, based on the above-mentioned node utilization sequence, the node utilization mean of the above-mentioned Kubernetes system is calculated. The node utilization mean can reflect the overall performance of the Kubernetes system, which is conducive to making judgments on the migration of node loads. When there is a node utilization in the node utilization sequence whose difference with the above-mentioned node utilization mean is greater than the first set threshold, the nodes that can be migrated out and migrated in are determined according to the first number of high-utilization nodes and the second number of low-utilization nodes determined in the node utilization sequence. Finally, the set of migratable containers on the high-utilization node is determined, and the migratable container set is migrated to the low-utilization node. In this way, the dynamic adjustment of the load of the nodes in the Kubernetes system is realized, which is conducive to the load balancing between the nodes in the Kubernetes system and improves the operational stability of the Kubernetes system. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0012] Figure 1 is a schematic diagram of an application scenario of a load balancing method according to some embodiments of the present disclosure;

[0013] Figure 2 is a flow chart of some embodiments of the load balancing method according to the present disclosure;

[0014] Figure 3 is a flow chart of other embodiments of the load balancing method according to the present disclosure;

[0015] Figure 4 are flow charts of some further embodiments of the load balancing method according to the present disclosure;

[0016] Figure 5 is a schematic diagram of the structure of some embodiments of the load balancing device according to the present disclosure;

[0017] Figure 6 It is a schematic diagram of the structure of an electronic device suitable for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION

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

[0019] It should also be noted that, for ease of description, only the parts related to the invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present disclosure can be combined with each other.

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

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

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

[0023] The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.

[0024] Figure 1 It is a schematic diagram of an application scenario of the load balancing method according to some embodiments of the present disclosure.

[0025] There are multiple nodes 101, 102, and 103 in the Kubernetes system, and each node has a corresponding container set. For example, node 101 contains container sets 1011, 1012, and 1013. Nodes 101, 102, and 103 can be connected to a load balancing server 104, and the load balancing server 104 can calculate the utilization of each node in real time or at set intervals, and sort the node utilization to obtain a node utilization sequence. The load balancing server 104 can calculate the node utilization mean based on the node utilization sequence. In practice, the loads of nodes 101, 102, and 103 are usually different. When there is no node utilization in the node utilization sequence and the difference from the node utilization mean is greater than the first set threshold, it means that in the current Kubernetes system, the loads of each node are relatively balanced, and the load balancing server 104 may not adjust the node load. When there is a node utilization in the node utilization sequence whose difference from the node utilization mean is greater than the first set threshold, it means that there are nodes with large load differences in the current Kubernetes system, which may affect the normal operation of the nodes and the stability of the Kubernetes system. At this time, the load balancing server 104 can determine at least one high-utilization node and at least one low-utilization node from the node utilization sequence. Afterwards, the load balancing server 104 can migrate the set of migratable containers on the high-utilization node to the low-utilization node. Figure 1 As shown, the load balancing server 104 determines that the node 101 is a high-utilization node and the node 102 is a low-utilization node. Then the load balancing server 104 can migrate the container set 1011 on the node 101 to the node 102. After the container set 1011 is migrated to the node 102, it becomes the container set 1024 on the node 102. In this way, the dynamic adjustment of the node load in the Kubernetes system is realized, and the operation stability of the Kubernetes system can be improved.

[0026] It should be understood that Figure 1 The number of nodes and load balancing servers in the example is only for reference. Any number of nodes and load balancing servers may be provided as required.

[0027] Continue to refer Figure 2 , Figure 2 A process 200 of some embodiments of the load balancing method according to the present disclosure is shown. The load balancing method comprises the following steps:

[0028] Step 201, calculate the utilization of at least one node in the Kubernetes system to obtain a node utilization sequence.

[0029] In some embodiments, the execution body of the load balancing method (eg Figure 1 The load balancing server 104 shown in the figure can obtain information from the nodes of the Kubernetes system through a wired connection or a wireless connection. It should be noted that the above wireless connection method may include but is not limited to 3G / 4G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods currently known or to be developed in the future.

[0030] The above-mentioned node can be provided with at least one container set, and each container set can occupy multiple resources of the node. The execution subject can obtain the relevant information of each node in the Kubernetes system in real time, and calculate the utilization of each node based on the relevant information, thereby obtaining a node utilization sequence. Among them, the node utilization in the node utilization sequence can be arranged in order from large to small, or in order from small to large.

[0031] Step 202: Calculate the average node utilization of the Kubernetes system based on the node utilization sequence.

[0032] In some embodiments, the execution subject may sum the node utilizations in the node utilization sequence, and then divide the summed result by the number of node utilizations to obtain the node utilization mean. The execution subject may also perform weighted summation of the node utilizations according to the characteristics of the nodes themselves, and then divide the weighted summation result by the number of node utilizations to obtain the node utilization mean. For example, the container set on some nodes may be: the container set requires long-term trouble-free operation, high security level operation, and does not allow other container sets to join the node, etc. For nodes containing these types of container sets, different weights from other nodes may be configured, thereby affecting the calculation result of the node utilization mean. In this way, the overall performance of the Kubernetes system can be truly reflected by the node utilization mean, which is conducive to making accurate judgments on the migration of node loads. For example, when the node utilization mean is 50%, it means that the load of the Kubernetes system is not large at this time, and the overall performance is stable. Even if the load of some nodes exceeds 80%, far exceeding 50% of the node utilization mean, there is no need to migrate the container sets on these nodes to other nodes. When the node utilization mean is 80%, it means that the load of the Kubernetes system is large at this time, and the overall performance is unstable. Even if the load of some nodes is 85%, which is not much different from the average node utilization of 80%, the container collections on these nodes need to be migrated to other nodes to maintain the stability of the Kubernetes system. It can be seen that the average node utilization determines whether to migrate the container collection.

[0033] Step 203, in response to the presence of a node utilization in the node utilization sequence whose difference from the node utilization mean is greater than a first set threshold, determine a first number of high utilization nodes and a second number of low utilization nodes according to the node utilization sequence.

[0034] When the difference between the utilization of some nodes and the average utilization of the nodes in the node utilization sequence is greater than the first set threshold, it indicates that there is a load imbalance between the nodes in the Kubernetes system. The execution entity can select a first number of high-utilization nodes and a second number of low-utilization nodes from the node utilization sequence. Among them, the value of the first set threshold is determined according to actual needs. The high-utilization nodes can be all nodes whose node utilization is higher than the average node utilization, or they can be some nodes selected from all nodes whose node utilization is higher than the average node utilization. Low-utilization nodes can be obtained in the same way. The corresponding first and second values ​​are determined according to actual needs.

[0035] Step 204: determine a set of migratable containers on the high-utilization node, and migrate the set of migratable containers to the low-utilization node.

[0036] Container sets can have different properties. For example, some container sets store a variety of data locally on the node, and these data are needed for the normal operation of the container set. These container sets are non-migratable container sets, and the corresponding attribute can be: non-migratable. Other container sets can run without relying on local data on the node. These container sets are usually migratable container sets, and the corresponding attribute can be: migratable. The executor can first determine the migratable container set on the high-utilization node, and then migrate the migratable container set to the above-mentioned low-utilization node. In this way, the load of the nodes in the Kubernetes system can be adjusted, which is beneficial to the load balancing between the nodes in the Kubernetes system and improves the operating stability of the Kubernetes system.

[0037] The load balancing method disclosed in some embodiments of the present disclosure first calculates the utilization of at least one node in the Kubernetes system to obtain a node utilization sequence. Then, based on the above node utilization sequence, the node utilization mean of the above Kubernetes system is calculated. The node utilization mean can reflect the overall performance of the Kubernetes system, which is conducive to making a judgment on the migration of node load. When there is a node utilization in the node utilization sequence whose difference with the above node utilization mean is greater than the first set threshold, the nodes that can be migrated out and migrated in are determined according to the first number of high-utilization nodes and the second number of low-utilization nodes determined in the node utilization sequence. Finally, the set of migratable containers on the high-utilization node is determined, and the set of migratable containers is migrated to the low-utilization node. In this way, the dynamic adjustment of the load of the nodes in the Kubernetes system is realized, which is conducive to the load balancing between the nodes in the Kubernetes system and improves the operational stability of the Kubernetes system.

[0038] Further references Figure 3 , which shows a process 300 of another embodiment of the load balancing method. The process 300 of the load balancing method includes the following steps:

[0039] Step 301, filter out at least one node from the Kubernetes system, whose node migration attribute allows migration of container sets.

[0040] The node may include a node migration attribute, which may be used to identify whether the node is allowed to migrate a container set. The execution subject may filter out nodes that are allowed to migrate a container set according to the node migration attribute.

[0041] Step 302: Calculate the utilization of each node in the at least one node to obtain the node utilization sequence.

[0042] The execution subject can calculate the utilization of each node that allows the migration of the container set and obtain a node utilization sequence.

[0043] In an optional implementation manner of some embodiments, calculating the utilization rate of each node in the at least one node to obtain the node utilization rate sequence may include the following steps:

[0044] In the first step, the utilization rate of each node in the at least one node is calculated at set time intervals.

[0045] The execution subject may calculate the utilization rate of each node in the at least one node at set intervals, and the interval time may be set as required.

[0046] The second step is to sort the nodes in descending order of utilization to generate a node utilization sequence.

[0047] The execution entities can be sorted in descending order of utilization to generate a node utilization sequence.

[0048] In an optional implementation of some embodiments, calculating the utilization rate of each node in the at least one node at the set interval may include the following steps:

[0049] The first step is to obtain the specified information of each node at set intervals.

[0050] In order to calculate the utilization of the node, the execution subject can obtain the specified information of each node at a set interval, wherein the specified information may include: the processor utilization of the container set, the memory utilization of the container set, and the number of the container set.

[0051] The second step is to build the status information of each node based on the above specified information.

[0052] The execution subject can calculate multiple characteristic information of the node through the specified information, and then construct the state information of the node through the characteristic information. The state information can be represented in the form of a matrix.

[0053] The third step is to calculate the utilization of each node based on the above status information.

[0054] The execution subject can perform matrix calculation and other processing on the information contained in the status information to obtain the utilization rate of the node.

[0055] In an optional implementation of some embodiments, the above-mentioned calculation of the utilization rate of each node according to the above-mentioned state information may include the following steps:

[0056] In the first step, based on the above status information, the node processor utilization rate, node memory utilization rate and node container set deployment rate are calculated respectively.

[0057] The load of a node is mainly characterized by the processor usage, memory usage, and the number of container sets. Correspondingly, the execution subject can calculate the node processor usage, node memory usage, and node container set deployment rate through the information contained in the status information.

[0058] In the second step, the node utilization rate is obtained by weighted summing the node processor utilization rate, node memory utilization rate and node container set deployment rate.

[0059] Different container sets may have different requirements for processors and content. Correspondingly, the execution subject can weightedly sum the above-mentioned node processor usage, node memory usage, and node container set deployment rate to obtain the node utilization. The performance of the processor, memory, and container set deployment rate can be balanced by weighting, so that the obtained node utilization can reflect the overall operation status of the node.

[0060] Step 303: Calculate the average node utilization of the Kubernetes system based on the node utilization sequence.

[0061] Step 304, in response to the presence of a node utilization in the node utilization sequence whose difference from the node utilization mean is greater than a first set threshold, determine a first number of high utilization nodes and a second number of low utilization nodes according to the node utilization sequence.

[0062] Step 305: determine a set of migratable containers on the high-utilization node, and migrate the set of migratable containers to the low-utilization node.

[0063] The contents of step 303 to step 305 are the same as those of step 202 and step 204, and are not described in detail here.

[0064] Further references Figure 4 , which shows a process 400 of another embodiment of the load balancing method. The process 400 of the load balancing method includes the following steps:

[0065] Step 401, calculate the utilization of at least one node in the Kubernetes system to obtain a node utilization sequence.

[0066] Step 402: Calculate the average node utilization of the Kubernetes system based on the node utilization sequence.

[0067] Step 403, in response to the presence of a node utilization in the node utilization sequence whose difference from the node utilization mean is greater than a first set threshold, determine a first number of high utilization nodes and a second number of low utilization nodes according to the node utilization sequence.

[0068] The contents of step 401 to step 403 are the same as those of step 201 and step 203, and are not described in detail here.

[0069] Step 404: query the container migration attribute of each container set on the high-utilization node.

[0070] In order to migrate the container set, the execution subject can query the container migration attribute of each container set on the above-mentioned high-utilization node. Among them, the above-mentioned container migration attribute is used to identify whether the container set is allowed to migrate. For example, the container migration attribute that allows migration can be identified by "1", and the container migration attribute that does not allow migration can be identified by "0". The container migration attribute can also be represented by characters and the like, which will not be repeated here.

[0071] Step 405: Mark the container set whose container migration attribute is that migration is allowed as a migratable container set.

[0072] The execution subject may mark a container set whose container migration attribute is to allow migration as a migratable container set.

[0073] Step 406: Migrate the migratable container set to the low-utilization node.

[0074] It should be noted that all containers on a node may be allowed to migrate. The execution entity usually does not migrate all containers allowed to migrate to other nodes, but migrates the containers allowed to migrate while ensuring the load balance of the nodes as much as possible.

[0075] In an optional implementation of some embodiments, migrating the migratable container set to the low-utilization node may include the following steps:

[0076] In the first step, first operation mode information of the migratable container set and second operation mode information of the low-utilization node are respectively obtained.

[0077] The migratable container sets can have different operation modes. For example, some migratable container sets can run for a long time, some migratable container sets can run for a short time, and some migratable container sets can run on a scheduled basis. Corresponding to different operation modes, the occupancy of various node resources (such as processors, memory, etc.) is also different. To this end, the execution subject can respectively obtain the first operation mode information of the above-mentioned migratable container set and the second operation mode information of the above-mentioned low-utilization node. Among them, the first operation mode information can be the above-mentioned long-term operation, short-term operation or scheduled operation, etc. The second operation mode information can be the same as the first operation mode information, or it can be different.

[0078] In a second step, in response to the first operation mode information matching the second operation mode information, the migratable container set is migrated to the low utilization node.

[0079] The execution subject may match the first operation mode information with the second operation mode information. When the first operation mode information matches the second operation mode information, the execution subject may migrate the above-mentioned set of migratable containers to the above-mentioned low utilization node. For example, if the first operation mode information and the second operation mode information are both short-term operations, the first operation mode information matches the second operation mode information. When the second operation mode information is long-term operation, any operation mode of the first operation mode information matches the second operation mode information.

[0080] In an optional implementation of some embodiments, migrating the migratable container set to the low-utilization node may include the following steps:

[0081] In the first step, the container set load of the migratable container set is calculated according to the processor usage and memory usage of the migratable container set.

[0082] The execution subject may calculate the container set load of the migratable container set according to the processor usage and memory usage of the migratable container set.

[0083] In the second step, in response to the difference between the utilization of the low-utilization node after increasing the load of the container set and the average utilization of the node being less than or equal to a second set threshold, the migratable container set is migrated to the low-utilization node.

[0084] The execution entity can calculate the utilization of the low-utilization node after increasing the load of the above-mentioned container set. When the difference between the utilization and the above-mentioned node utilization mean is less than or equal to the second set threshold, it means that after the low-utilization node adds the migratable container set, there will be no node load imbalance. At this time, the execution entity can migrate the above-mentioned migratable container set to the above-mentioned low-utilization node. It should be noted that the second set threshold here can be a numerical range. For example, the second set threshold can be (-1,1). When the difference is within the range of (-1,1), it can be considered that the added migratable container set will not cause load imbalance to the low-utilization node.

[0085] In an optional implementation of some embodiments, migrating the migratable container set to the low-utilization node may include the following steps:

[0086] In the first step, a first difference between the utilization of the high-utilization node after migrating the set of migratable containers and the above-mentioned node utilization average is calculated.

[0087] The execution subject may calculate a first difference between the utilization of the high-utilization node and the average node utilization after migrating the set of migratable containers.

[0088] In the second step, a second difference between the utilization of the low-utilization node after migrating the set of migratable containers and the above-mentioned average node utilization is calculated.

[0089] Similar to the calculation process of the first difference, the execution subject can calculate the second difference corresponding to the low utilization node.

[0090] In a third step, in response to the first difference and the second difference being both smaller than or equal to the second set threshold, the migration of the set of migratable containers is stopped.

[0091] When both the first difference and the second difference are less than or equal to the second set threshold, it means that the load difference between the nodes is not much, and load balancing is basically achieved. At this time, the execution subject can stop migrating the above-mentioned set of migratable containers. In this way, dynamic adjustment of node load is achieved, which is conducive to load balancing between nodes in the Kubernetes system and improves the operational stability of the Kubernetes system.

[0092] In an optional implementation of some embodiments, when the Kubernetes system accesses a new container set, the execution entity may preferentially access the new container set to a low-utilization node to improve the stability of the node load.

[0093] Further references Figure 5 As an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a load balancing device. These device embodiments are similar to Figure 2 Corresponding to the method embodiments shown, the device can be specifically applied to various electronic devices.

[0094] like Figure 5 As shown, the load balancing device 500 of some embodiments includes: a utilization calculation unit 501, a node utilization mean calculation unit 502, a node selection unit 503 and a migration unit 504. Among them, the utilization calculation unit 501 is configured to calculate the utilization of at least one node in the Kubernetes system to obtain a node utilization sequence, and the above-mentioned node is provided with at least one container set; the node utilization mean calculation unit 502 is configured to calculate the node utilization mean of the above-mentioned Kubernetes system based on the above-mentioned node utilization sequence; the node selection unit 503, in response to the node utilization in the above-mentioned node utilization sequence, the difference between which is greater than the first set threshold value and the node utilization mean, is configured to determine a first number of high utilization nodes and a second number of low utilization nodes according to the above-mentioned node utilization sequence; the migration unit 504 is configured to determine the set of migratable containers on the above-mentioned high utilization node, and migrate the above-mentioned migratable container set to the above-mentioned low utilization node.

[0095] In an optional implementation of some embodiments, the above-mentioned node includes a node migration attribute, and the above-mentioned node migration attribute is used to identify whether the node allows the migration of a container set, and the above-mentioned utilization calculation unit 501 may include: a node screening subunit (not shown in the figure) and a utilization calculation subunit (not shown in the figure). Among them, the node screening subunit is configured to filter out at least one node from the above-mentioned Kubernetes system, and the node migration attribute is that the migration of the container set is allowed; the utilization calculation subunit is configured to calculate the utilization of each node in the above-mentioned at least one node to obtain the above-mentioned node utilization sequence.

[0096] In an optional implementation of some embodiments, the utilization calculation subunit may include: a utilization calculation module (not shown in the figure) and a node utilization sequence generation module (not shown in the figure). The utilization calculation module is configured to calculate the utilization of each node in the at least one node at a set interval; the node utilization sequence generation module is configured to sort the nodes in descending order of utilization to generate a node utilization sequence.

[0097] In an optional implementation of some embodiments, the utilization calculation module may include: an information acquisition submodule (not shown in the figure), a state information construction submodule (not shown in the figure), and a utilization calculation submodule (not shown in the figure). The information acquisition submodule is configured to obtain the specified information of each node at a set interval, and the specified information includes: the processor utilization of the container set, the memory utilization of the container set, and the number of container sets; the state information construction submodule is configured to construct the state information of each node based on the specified information; the utilization calculation submodule is configured to calculate the utilization of each node based on the state information.

[0098] In an optional implementation of some embodiments, the utilization calculation submodule may include: an information calculation module (not shown in the figure) and a utilization calculation module (not shown in the figure). The information calculation module is configured to calculate the node processor utilization, node memory utilization and node container set deployment rate based on the above state information; the utilization calculation module is configured to perform a weighted sum of the above node processor utilization, node memory utilization and node container set deployment rate to obtain the node utilization.

[0099] In an optional implementation of some embodiments, the migration unit 504 may include: a migration attribute query subunit (not shown in the figure), a marking subunit (not shown in the figure) and a migration subunit (not shown in the figure). The migration attribute query subunit is configured to query the container migration attribute of each container set on the high-utilization node, and the container migration attribute is used to identify whether the container set is allowed to migrate; the marking subunit is configured to mark the container set whose container migration attribute is allowed to migrate as a migratable container set; the migration subunit is configured to migrate the migratable container set to the low-utilization node.

[0100] In an optional implementation of some embodiments, the migration subunit may include: an operation mode acquisition module (not shown in the figure) and a migration module (not shown in the figure). The operation mode acquisition module is configured to respectively acquire the first operation mode information of the above-mentioned set of migratable containers and the second operation mode information of the above-mentioned low-utilization node; the migration module is configured to migrate the above-mentioned set of migratable containers to the above-mentioned low-utilization node in response to the first operation mode information matching the second operation mode information.

[0101] In an optional implementation of some embodiments, the migration module may include: a container set load calculation submodule (not shown in the figure) and a migration submodule (not shown in the figure). The container set load calculation submodule is configured to calculate the container set load of the above-mentioned migratable container set based on the processor utilization and memory utilization of the above-mentioned migratable container set; the migration submodule is configured to migrate the above-mentioned migratable container set to the above-mentioned low-utilization node in response to the difference between the utilization of the above-mentioned low-utilization node after adding the above-mentioned container set load and the above-mentioned node utilization average being less than or equal to a second set threshold.

[0102] In an optional implementation of some embodiments, the migration submodule may include: a first difference calculation module (not shown in the figure), a second difference calculation module (not shown in the figure) and a migration module (not shown in the figure). The first difference calculation module is configured to calculate the first difference between the utilization of the high-utilization node after migrating the set of migratable containers and the above-mentioned node utilization mean; the second difference calculation module is configured to calculate the second difference between the utilization of the low-utilization node after migrating the set of migratable containers and the above-mentioned node utilization mean; the migration module is configured to stop migrating the above-mentioned set of migratable containers in response to the first difference and the second difference being less than or equal to the above-mentioned second set threshold.

[0103] It is understood that the units described in the device 500 are similar to those described in the reference Figure 2Therefore, the operations, features and beneficial effects described above for the method are also applicable to the device 500 and the units included therein, and will not be described in detail here.

[0104] like Figure 6 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0105] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 6 Each block shown in the figure may represent one device, or may represent multiple devices as required.

[0106] In particular, according to some embodiments of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, some embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In some such embodiments, the computer program can be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of some embodiments of the present disclosure are executed.

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

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

[0109] The computer-readable medium may be included in the electronic device; or it may exist independently without being installed in the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: calculates the utilization of at least one node in the Kubernetes system to obtain a node utilization sequence, wherein the node is provided with at least one container set; calculates the node utilization mean of the Kubernetes system based on the node utilization sequence; in response to the node utilization in the node utilization sequence, the difference between the node utilization mean and the node utilization is greater than a first set threshold, determines a first number of high-utilization nodes and a second number of low-utilization nodes according to the node utilization sequence; determines a set of migratable containers on the high-utilization node, and migrates the migratable container set to the low-utilization node.

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

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

[0112] The units described in some embodiments of the present disclosure may be implemented by software or hardware. The described units may also be set in a processor, for example, it may be described as: a processor includes a utilization calculation unit, a node utilization mean calculation unit, a node selection unit, and a migration unit. The names of these units do not constitute a limitation on the unit itself in some cases, for example, the migration unit may also be described as a "unit for migrating a set of containers".

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

[0114] According to one or more embodiments of the present disclosure, a load balancing method is provided, including: calculating the utilization of at least one node in a Kubernetes system to obtain a node utilization sequence, wherein the node is provided with at least one container set; calculating the node utilization mean of the Kubernetes system based on the node utilization sequence; in response to the presence of a node utilization in the node utilization sequence whose difference from the node utilization mean is greater than a first set threshold, determining a first number of high-utilization nodes and a second number of low-utilization nodes according to the node utilization sequence; determining a migratable container set on the high-utilization node, and migrating the migratable container set to the low-utilization node.

[0115] According to one or more embodiments of the present disclosure, the above-mentioned node includes a node migration attribute, and the above-mentioned node migration attribute is used to identify whether the node allows the migration of a container set, and the above-mentioned calculation of the utilization of at least one node in the Kubernetes system to obtain the node utilization sequence includes: screening out at least one node from the above-mentioned Kubernetes system, whose node migration attribute is to allow the migration of a container set; calculating the utilization of each node in the above-mentioned at least one node to obtain the above-mentioned node utilization sequence.

[0116] According to one or more embodiments of the present disclosure, the above-mentioned calculation of the utilization of each node in the at least one node to obtain the above-mentioned node utilization sequence includes: calculating the utilization of each node in the at least one node at a set time interval; sorting in order from large to small in utilization to generate a node utilization sequence.

[0117] According to one or more embodiments of the present disclosure, the above-mentioned interval setting time calculates the utilization of each node in the above-mentioned at least one node, including: obtaining specified information of each node at the interval setting time, the above-mentioned specified information includes: processor utilization of the container set, memory utilization of the container set, and the number of container sets; constructing status information of each node based on the above-mentioned specified information; and calculating the utilization of each node according to the above-mentioned status information.

[0118] According to one or more embodiments of the present disclosure, the above-mentioned calculation of the utilization of each node based on the above-mentioned status information includes: respectively calculating the node processor utilization rate, the node memory utilization rate and the node container set deployment rate based on the above-mentioned status information; taking the weighted sum of the above-mentioned node processor utilization rate, the node memory utilization rate and the node container set deployment rate to obtain the node utilization rate.

[0119] According to one or more embodiments of the present disclosure, the above-mentioned determining the migratable container set on the above-mentioned high-utilization node and migrating the above-mentioned migratable container set to the above-mentioned low-utilization node includes: querying the container migration attribute of each container set on the above-mentioned high-utilization node, the above-mentioned container migration attribute is used to identify whether the container set is allowed to migrate; marking the container set whose container migration attribute is that migration is allowed as a migratable container set; and migrating the above-mentioned migratable container set to the above-mentioned low-utilization node.

[0120] According to one or more embodiments of the present disclosure, the migrating the migratable container set to the low-utilization node includes: respectively acquiring first operating mode information of the migratable container set and second operating mode information of the low-utilization node; in response to a match between the first operating mode information and the second operating mode information, migrating the migratable container set to the low-utilization node.

[0121] According to one or more embodiments of the present disclosure, migrating the migratable container set to the low-utilization node includes: calculating the container set load of the migratable container set according to the processor utilization and memory utilization of the migratable container set; in response to the difference between the utilization of the low-utilization node after increasing the container set load and the average utilization of the node being less than or equal to a second set threshold, migrating the migratable container set to the low-utilization node.

[0122] According to one or more embodiments of the present disclosure, migrating the above-mentioned migratable container set to the above-mentioned low-utilization node includes: calculating a first difference between the utilization of the high-utilization node after migrating the migratable container set and the above-mentioned node utilization average; calculating a second difference between the utilization of the low-utilization node after migrating the migratable container set and the above-mentioned node utilization average; in response to the above-mentioned first difference and the second difference being both less than or equal to the above-mentioned second set threshold, stopping the migration of the above-mentioned migratable container set.

[0123] According to one or more embodiments of the present disclosure, a load balancing device is provided, including: a utilization calculation unit, configured to calculate the utilization of at least one node in a Kubernetes system to obtain a node utilization sequence, wherein the node is provided with at least one container set; a node utilization mean calculation unit, configured to calculate the node utilization mean of the Kubernetes system based on the node utilization sequence; a node selection unit, in response to the presence of a node utilization in the node utilization sequence whose difference from the node utilization mean is greater than a first set threshold, configured to determine a first number of high-utilization nodes and a second number of low-utilization nodes according to the node utilization sequence; a migration unit, configured to determine a set of migratable containers on the high-utilization node and migrate the migratable container set to the low-utilization node.

[0124] According to one or more embodiments of the present disclosure, the above-mentioned node includes a node migration attribute, and the above-mentioned node migration attribute is used to identify whether the node allows the migration of a container set, and the above-mentioned utilization calculation unit includes: a node screening subunit, configured to screen out at least one node from the above-mentioned Kubernetes system, whose node migration attribute is to allow the migration of a container set; a utilization calculation subunit, configured to calculate the utilization of each node in the above-mentioned at least one node to obtain the above-mentioned node utilization sequence.

[0125] According to one or more embodiments of the present disclosure, the utilization calculation subunit includes: a utilization calculation module, configured to calculate the utilization of each node in the at least one node at set intervals; and a node utilization sequence generation module, configured to sort the nodes in descending order of utilization to generate a node utilization sequence.

[0126] According to one or more embodiments of the present disclosure, the utilization calculation module includes: an information acquisition submodule, configured to acquire specified information of each node at set intervals, wherein the specified information includes: processor utilization of a container set, memory utilization of a container set, and the number of container sets; a status information construction submodule, configured to construct status information of each node based on the specified information; and a utilization calculation submodule, configured to calculate the utilization of each node based on the status information.

[0127] According to one or more embodiments of the present disclosure, the utilization calculation submodule includes: an information calculation module, which is configured to calculate the node processor utilization rate, the node memory utilization rate and the node container set deployment rate based on the above-mentioned status information; and a utilization calculation module, which is configured to perform a weighted summation of the above-mentioned node processor utilization rate, node memory utilization rate and node container set deployment rate to obtain the utilization rate of the node.

[0128] According to one or more embodiments of the present disclosure, the migration unit includes: a migration attribute query subunit, configured to query the container migration attribute of each container set on the high-utilization node, the container migration attribute is used to identify whether the container set is allowed to migrate; a marking subunit, configured to mark the container set whose container migration attribute is allowed to migrate as a migratable container set; and a migration subunit, configured to migrate the migratable container set to the low-utilization node.

[0129] According to one or more embodiments of the present disclosure, the migration sub-unit includes: an operation mode acquisition module, configured to respectively acquire the first operation mode information of the above-mentioned migratable container set and the second operation mode information of the above-mentioned low-utilization node; a migration module, in response to the first operation mode information matching the second operation mode information, configured to migrate the above-mentioned migratable container set to the above-mentioned low-utilization node.

[0130] According to one or more embodiments of the present disclosure, the migration module includes: a container set load calculation submodule, configured to calculate the container set load of the migratable container set according to the processor utilization and memory utilization of the migratable container set; a migration submodule, in response to the difference between the utilization of the low-utilization node after increasing the container set load and the average utilization of the node being less than or equal to a second set threshold, configured to migrate the migratable container set to the low-utilization node.

[0131] According to one or more embodiments of the present disclosure, the above-mentioned migration submodule includes: a first difference calculation module, configured to calculate the utilization of high-utilization nodes after migrating the set of migratable containers, and a first difference between the utilization of the above-mentioned node utilization average; a second difference calculation module, configured to calculate the utilization of low-utilization nodes after migrating the set of migratable containers, and a second difference between the utilization of the above-mentioned node utilization average; a migration module, in response to the above-mentioned first difference and the second difference being less than or equal to the above-mentioned second set threshold, configured to stop migrating the above-mentioned set of migratable containers.

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

Claims

1. A load balancing method, comprising: Calculate the utilization of at least one node in the Kubernetes system to obtain a node utilization sequence, where the node is provided with at least one container set; Calculate the node utilization mean of the Kubernetes system based on the node utilization sequence; In response to the presence of a node utilization in the node utilization sequence whose difference from the node utilization mean is greater than a first set threshold, determining a first number of high-utilization nodes and a second number of low-utilization nodes according to the node utilization sequence, wherein the high-utilization nodes are all nodes whose node utilization is higher than the node utilization mean, and the low-utilization nodes are all nodes whose node utilization is lower than the node utilization mean; A migratable container set on the high-utilization node is determined, and the migratable container set is migrated to the low-utilization node, where an attribute corresponding to the container set is migratable or non-migratable.

2. A load balancing method according to claim 1, wherein: The node includes a node migration attribute, and the node migration attribute is used to identify whether the node allows migration of a container set; as well as The calculating the utilization of at least one node in the Kubernetes system to obtain a node utilization sequence includes: Filter out at least one node from the Kubernetes system, whose node migration attribute is to allow migration of container sets; The utilization rate of each node in the at least one node is calculated to obtain the node utilization rate sequence.

3. A load balancing method according to claim 2, wherein: The calculating the utilization rate of each node in the at least one node to obtain the node utilization rate sequence includes: Calculating the utilization rate of each node in the at least one node at set intervals; Sort the nodes in descending order of utilization to generate a node utilization sequence.

4. A load balancing method according to claim 3, wherein: The step of calculating the utilization rate of each node in the at least one node at an interval setting time includes: Acquire specified information of each node at set intervals, the specified information including: processor usage of the container set, memory usage of the container set, and the number of container sets; Constructing status information of each node based on the specified information; The utilization rate of each node is calculated according to the state information.

5. A load balancing method according to claim 4, wherein: The calculating the utilization rate of each node according to the state information includes: Based on the state information, respectively calculate the node processor usage rate, the node memory usage rate and the node container set deployment rate; The node utilization rate is obtained by weighted summing the node processor utilization rate, the node memory utilization rate and the node container set deployment rate.

6. A load balancing method according to claim 1, wherein: The determining the set of migratable containers on the high-utilization node and migrating the set of migratable containers to the low-utilization node includes: Querying a container migration attribute of each container set on the high-utilization node, where the container migration attribute is used to identify whether the container set is allowed to migrate; Mark the container set whose container migration attribute is to allow migration as a migratable container set; The set of migratable containers is migrated to the low-utilization node.

7. A load balancing method according to claim 6, wherein: The migrating the set of migratable containers to the low-utilization node includes: Respectively obtain first operation mode information of the migratable container set and second operation mode information of the low-utilization node; In response to the first operating mode information matching the second operating mode information, migrating the set of migratable containers to the low utilization node.

8. A load balancing method according to claim 6, wherein: The migrating the set of migratable containers to the low-utilization node includes: Calculating a container set load of the migratable container set according to a processor usage rate and a memory usage rate of the migratable container set; In response to the difference between the utilization of the low-utilization node after the container set load is increased and the node utilization average being less than or equal to a second set threshold, the migratable container set is migrated to the low-utilization node.

9. A load balancing method according to claim 8, wherein: The migrating the set of migratable containers to the low-utilization node includes: Calculate a first difference between the utilization of the high-utilization node after migrating the set of migratable containers and the average utilization of the node; Calculate a second difference between the utilization of the low-utilization node after migrating the set of migratable containers and the average utilization of the node; In response to the first difference and the second difference being both smaller than or equal to the second set threshold, migrating the set of migratable containers is stopped.

10. A load balancing device, comprising: A utilization calculation unit is configured to calculate the utilization of at least one node in the Kubernetes system to obtain a node utilization sequence, wherein the node is provided with at least one container set; A node utilization mean calculation unit, configured to calculate a node utilization mean of the Kubernetes system based on the node utilization sequence; a node selection unit, in response to the presence of a node utilization in the node utilization sequence whose difference from the node utilization mean is greater than a first set threshold, configured to determine a first number of high-utilization nodes and a second number of low-utilization nodes according to the node utilization sequence, wherein the high-utilization nodes are all nodes whose node utilization is higher than the node utilization mean, and the low-utilization nodes are all nodes whose node utilization is lower than the node utilization mean; The migration unit is configured to determine a set of migratable containers on the high-utilization node and migrate the set of migratable containers to the low-utilization node, wherein the attribute corresponding to the container set is migratable or non-migratable.

11. An electronic device, comprising: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 9.

12. A computer readable medium having a computer program stored thereon, wherein: When the program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Local dynamic migration method and control system based on Docker container technology

    CN108182105A