Load balancing method, system and readable storage medium

By collecting and evaluating load information within the service mesh in real time, and dynamically scheduling requests to the pod with the highest load score, the problem of node overload and insufficient resource utilization in microservice architecture is solved, thereby optimizing service quality and reducing operation and maintenance costs.

CN118606002BActive Publication Date: 2026-04-07NANJING UNIV OF AERONAUTICS & ASTRONAUTICS
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing microservice architectures struggle to achieve real-time responses in load balancing, leading to node overload or underutilization of resources and impacting service quality.

Method used

By periodically collecting load information of nodes and pods within the service mesh in real time, schedulable nodes are selected based on the load information, and a load assessment algorithm is used to calculate the load score, dynamically scheduling requests to the pod with the highest load score.

Benefits of technology

It enables dynamic response to load changes, avoids node overload and resource waste, optimizes service quality, and reduces operation and maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118606002B_ABST
    Figure CN118606002B_ABST
Patent Text Reader

Abstract

The application discloses a load balancing method, system and readable storage medium, the method comprising: obtaining the load information of each node in the cluster and each pod in the node, the load information comprising multiple load usage amounts; determining whether each pod in the cluster is in a load balanced state; if not, screening schedulable nodes based on the load information of each node and preset load usage threshold values; calculating the first load scores of each node and pod based on a preset load evaluation algorithm and calculating the second load scores of each pod based on the first load scores of each node and pod; and scheduling the to-be-scheduled request to the pod corresponding to the maximum second load score. Compared with the prior art, the application can avoid the blocking caused by node overload and alleviate the problem of resource underutilization and waste. Furthermore, the automatic service mesh distribution can reduce operation and maintenance costs, make real-time load feedback, maintain load balance, optimize service quality and have high scalability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of microservice technology, specifically relating to a load balancing method, system, and readable storage medium. Background Technology

[0002] Most frameworks and open-source software in microservice architectures have an intrusive design that necessitates the integration of related service governance components into the business logic. In a service mesh architecture, inter-service communication is handled through a mesh proxy. All traffic between applications and its management and control are implemented within the service mesh via this proxy. Furthermore, container virtualization technology can standardize microservice deployment. This containerized microservice architecture is not only widely used in cloud computing but also adapts well to the diverse needs of edge computing scenarios. Deploying containerized microservice applications in a cloud-edge environment allows users to simultaneously benefit from the low latency of edge nodes and the high computing power of cloud data centers. Based on traffic policies, requests for each service can be routed to different instances of different versions of the target service on specific nodes.

[0003] Because the configuration of cluster nodes is heterogeneous, different nodes have different processing capabilities, and edge nodes have limited resources, different types of microservice chains have different resource requirements. At the same time, the dynamism of services in the cluster also affects scheduling decisions. The resources of the cluster and the load of microservices are usually in a state of dynamic change and iteration, which causes the distribution of user requests to change constantly. Existing scheduling schemes are difficult to make real-time dynamic responses to changes in service load in a short period of time, and the lack of dynamic service response will inevitably lead to difficulties in guaranteeing service quality.

[0004] Therefore, to address the aforementioned technical problems, it is necessary to provide an improved load balancing-based scheduling scheme.

[0005] The information disclosed in this background section is intended only to enhance the understanding of the overall background of the invention and should not be construed as an admission or in any way implying that the information constitutes prior art known to those skilled in the art. Summary of the Invention

[0006] The purpose of this invention is to provide a load balancing method, system, and readable storage medium that can avoid the problem of node overload causing blockage and alleviate the problem of underutilization of resources leading to waste.

[0007] To achieve the above objectives, a specific embodiment of the present invention provides the following technical solution:

[0008] In a first aspect, the present invention provides a load balancing method, comprising:

[0009] Obtain the load information of each node in the cluster and each pod within the node, the load information including multiple load usages;

[0010] Determine whether the pods in the cluster are in a load-balanced state;

[0011] If not, then based on the load information of each node and the preset load usage thresholds, scheduleable nodes are selected.

[0012] Based on the preset load assessment algorithm, the first load score of each node and pod is calculated, and the second load score of each pod is calculated based on the first load scores of each node and pod.

[0013] Obtain the pod corresponding to the maximum value of the second load score, and schedule the request to be scheduled to the pod.

[0014] In one or more embodiments of the present invention, the step of filtering schedulable nodes based on the load information of each node and preset load usage thresholds includes:

[0015] If at least one item in the node load information has a load usage greater than the corresponding load usage threshold, then the node is an unschedulable node.

[0016] If all the load usages in the node load information are less than or equal to the corresponding load usage threshold, then the node is a schedulable node.

[0017] In one or more embodiments of the present invention, the method further includes:

[0018] Obtain the timestamp corresponding to the load information, and calculate the difference between the current time and the time recorded in the timestamp;

[0019] If the difference between the current time and the time recorded by the timestamp is greater than a preset valid threshold, the load information is invalid.

[0020] If the difference between the current time and the time recorded by the timestamp is less than or equal to a preset valid threshold, then the load information is valid.

[0021] In one or more embodiments of the present invention, the load assessment algorithm is:

[0022]

[0023] finalScore = (nodeScore × γ) node +podScore×γ pod ) / (γ node +γ pod )

[0024] Where, α i The usage of each load recorded in the node load information; γ i For α i The corresponding weight value; b j The usage of each load recorded in the pod load information; γ j For b j The corresponding weight value; MaxScore is the preset maximum score; γ node γ represents the weight of the node's first load score in the second load score. pod `finalScore` represents the weight of the pod's first load score in relation to its second load score, and `finalScore` represents the load score corresponding to the pod.

[0025] In one or more embodiments of the present invention, the method further includes:

[0026] Real-time monitoring of the workload of each node and pod within the cluster;

[0027] Based on a preset monitoring strategy, load information of each node in the cluster and each pod within the node is collected periodically.

[0028] The corresponding pod is labeled based on the average value of the load information collected within a preset time interval, and a timestamp is added to the average value based on the time interval.

[0029] In one or more embodiments of the present invention, the method further includes:

[0030] Real-time monitoring of the workload of each node and pod within the cluster;

[0031] Based on a preset monitoring strategy, load information of each node in the cluster and each pod within the node is periodically collected.

[0032] The corresponding pod is labeled based on the most recently collected load information, and a timestamp is added to the load information based on the collection time.

[0033] In one or more embodiments of the present invention, the method further includes:

[0034] If the cluster is load balanced, the scheduling request is scheduled based on a round-robin algorithm, a least-connection algorithm, or a random selection of healthy instances.

[0035] In a second aspect, the present invention provides a load balancing system, comprising:

[0036] The acquisition module is used to acquire the load information of each node in the cluster and each pod within the node. The load information includes multiple load usages.

[0037] The judgment module is used to determine whether each pod in the cluster is in a load-balanced state;

[0038] The filtering module is used to filter schedulable nodes based on the load information of each node and preset load usage thresholds when the cluster load is unbalanced.

[0039] The calculation module is used to calculate the first load score of each node and pod based on a preset load assessment algorithm, and to calculate the second load score of each pod based on the first load scores of each node and pod.

[0040] The scheduling module is used to obtain the pod corresponding to the maximum value of the second load score and schedule the request to be scheduled to the pod.

[0041] Thirdly, the present invention provides a load balancing system, comprising:

[0042] The monitoring module is used to monitor the workload of each node and pod in the cluster in real time. Based on the preset monitoring strategy, it periodically collects the load information of each node in the cluster and the pods in each node.

[0043] The data input module is used to update the load information in real time, process the load information based on a preset monitoring strategy, and send it to the optimization processing module.

[0044] The optimization module is used to dynamically select a load balancing strategy based on the variance of the load usage of each pod.

[0045] The file read / write module is used to read the selected load balancing strategy;

[0046] The application deployment module is used to write command lines based on the selected load balancing strategy to complete the application modification and deployment.

[0047] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to perform the load balancing method described above.

[0048] Compared to existing technologies, the load balancing method provided by this invention, based on a service mesh load balancing request scheduling strategy, filters and selects service mesh nodes according to the actual workload and resource utilization of the production environment. This avoids the problem of node overload causing congestion. Furthermore, considering node heterogeneity and service differences, it can alleviate the problem of underutilization and waste to some extent. Moreover, the adaptive application system can dynamically update the optimal load balancing strategy, and the automatic distribution of service mesh can reduce operational costs. Real-time load awareness provides feedback to maintain load balance and optimize service quality. Based on this load balancing method, the automatic configuration information distribution module completes the entire dynamic optimization strategy process without intruding on the source code, offering high scalability. Attached Figure Description

[0049] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0050] Figure 1 This is a schematic diagram of the load information acquisition and processing architecture in one embodiment of the present invention;

[0051] Figure 2 This is a flowchart illustrating a load balancing method according to one embodiment of the present invention;

[0052] Figure 3 This is a structural block diagram of a load balancing system according to one embodiment of the present invention;

[0053] Figure 4 This is a structural block diagram of an electronic device according to one embodiment of the present invention;

[0054] Figure 5 This is an application system architecture diagram according to one embodiment of the present invention. Detailed Implementation

[0055] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings, but it should be understood that the scope of protection of the present invention is not limited to the specific embodiments.

[0056] Unless otherwise expressly stated, throughout the specification and claims, the term "comprising" or its variations such as "including" or "comprises" shall be understood to include the stated elements or components without excluding other elements or other components.

[0057] To facilitate understanding of the technical solutions of this application, the technical terms that may appear in this invention will be explained in detail below.

[0058] Microservice architecture is an architectural concept that aims to reduce system coupling and provide more flexible service support by decomposing functionality into discrete services. It breaks down a large, single application and service into several or even dozens of supporting microservices. It scales individual components rather than the entire application stack to meet service level agreements (SLAs). Applications are created around business domain components that can be developed, managed, and iterated independently. Using cloud architecture and platform-based deployment, management, and service capabilities across distributed components simplifies product delivery. Essentially, it uses well-defined, streamlined services to solve larger, more practical problems.

[0059] Service Mesh: Using a service mesh eliminates the need to worry about the details of service governance. All non-business functionalities are handled by the service mesh. The service mesh clearly delineates the boundaries between business logic and service governance logic, making it the most thorough method of decoupling and reusability among all architectural patterns. In a service mesh architecture, communication between services is handled through a mesh proxy. All traffic between applications and its management and control are implemented within the service mesh via the proxy. Each microservice instance in the service mesh is configured with a Sidecar proxy, whose primary responsibility is to handle the inbound and outbound traffic of its respective service. All service governance functions, such as service subscription, service discovery, circuit breaking, rate limiting, degradation, and distributed tracing, are handled by the Sidecar. Inter-service communication between applications only requires communication with the Sidecar. As a large number of Sidecars are deployed in microservices, these Sidecar nodes naturally form a service mesh.

[0060] In existing technical solutions, there are various methods for scheduling requests in service meshes. One method is to schedule requests using a single, fixed request scheduling strategy. However, this strategy is difficult to meet application requirements and cannot achieve excellent real-time response. Given the common occurrence of real-time load changes, the inability to perceive the current load distribution can easily lead to overload and congestion on low-performance nodes, while high-performance nodes may experience underutilization and wasted resources.

[0061] Secondly, a manual update strategy is used for scheduling. Manual scheduling can alleviate the problem of uneven load on pods on different nodes of the service mesh to some extent. However, in real-world application scenarios, manual adjustment of strategies is extremely inefficient and still cannot guarantee service quality. The large amount of human resources consumed leads to a surge in operation and maintenance costs.

[0062] The inventors of this invention have identified the main shortcomings of existing technologies and, based on these shortcomings, proposed a new technical approach: By periodically collecting load information on nodes and / or pods within the service mesh in real time, and filtering nodes within the service framework whose load has reached a threshold based on this load information, scheduling requests are no longer sent to those nodes. A new evaluation system is established to normalize the load status of pods on each schedulable node. An algorithm is used to calculate the load score of each pod, and scheduling requests are then directed to the pod with the highest load score.

[0063] Please refer to Figure 2 The diagram shown is a flowchart of a load balancing method according to an embodiment of the present invention. The load balancing method specifically includes the following steps:

[0064] S201: Obtain the load information of each node in the cluster and each pod within the node;

[0065] It should be noted that in a cloud-edge environment, the performance loss of a microservice architecture is distributed across various parts. Furthermore, due to the differences in node resource configurations and service characteristics within the system, cluster resources and microservice loads are typically in a state of dynamic change and iteration. Therefore, the load information of each node and / or pod changes irregularly at all times. To achieve load balancing, the load balancing method provided in this invention needs to obtain the load information of each node and pod when a scheduling request is made, thereby identifying the most suitable pod for scheduling at the current moment and the node corresponding to that pod.

[0066] It is understood that the embodiments of the present invention do not restrict the location of recording load information for each node and pod. Preferably, the load information on each node and pod can be recorded on the corresponding node's CRD. CRD stands for Custom Resource Definition, which is a Kubernetes API extension mechanism. It allows users to create and manage custom resources that are not part of the standard Kubernetes API. CRD enables Kubernetes to support user-defined resource types in addition to built-in resources (such as Pods and Services).

[0067] It is understandable that, before performing the above step of "obtaining the load information of each node and each pod in the service mesh, including multiple load usages", the load balancing method provided by the present invention also includes monitoring and collecting the load information of each node and pod, and recording the load information in the corresponding node or pod.

[0068] Specifically, in an exemplary embodiment, monitoring and collecting load information of each node and pod, and recording the load information in the corresponding node or pod, includes: real-time monitoring of the workload of each node and pod in the service mesh; periodically collecting load information of each node and each pod in the service mesh based on a preset monitoring strategy, and storing the load information in an intermediate variable; labeling the corresponding pod based on the average value of the load information collected within a preset time interval, and adding a timestamp to the average value based on the time interval.

[0069] It should be noted that adding a timestamp to the average value based on a time interval includes: marking the average value based on the length of the time interval; writing the average value with the length of the time interval as a comment into the CRD of the corresponding node or pod, and adding the time when the average value was obtained as a timestamp to the comment.

[0070] For example, such as Figure 1 The diagram illustrates the architecture for acquiring and processing load information in a specific embodiment. In this embodiment, the cluster workload is monitored in real-time using the Metrics-server component and log files. This records the `cpu_usage` (CPU usage), `cpu_percent` (CPU utilization), `mem_usage` (memory usage), and `mem_percent` (memory utilization) of all nodes in the cluster, as well as the `cpu_usage` (CPU usage), `mem_usage` (memory usage), and `RC` (requests per second) of all Pods. The required load information is periodically retrieved from the Metrics-server component and log files. Since the Metrics-server provides the most recent real-time data, the Metrics-annotator supports user-defined performance metrics. For example, if the average and maximum CPU usage over a recent period are needed, the data must be continuously acquired within a preset time interval and stored in intermediate variables. Calculations are then performed according to the set formulas, outputting values ​​in the form of `cpu_usage_avg_t` or `cpu_usage_max_t`, where `t` represents a preset time interval.

[0071] Furthermore, the mean value, marked with the time length, is written into the corresponding node or pod in the form of an annotation, and a timestamp is added after the annotation to mark the time when the mean value was obtained.

[0072] In another exemplary embodiment, monitoring and collecting load information of each node and pod, and recording the load information in the corresponding node or pod, includes: real-time monitoring of the workload of each node and pod in the service mesh; periodically collecting load information of each node and each pod in the service mesh based on a preset monitoring strategy; labeling the corresponding pod based on the most recently collected load information, and adding a timestamp to the load information based on the collection time.

[0073] It should also be noted that the load information includes the load usage of multiple nodes / pods. Specifically, the aforementioned load usage may include, but is not limited to: CPU utilization, CPU rate of utilization, memory utilization, memory rate of utilization, and the number of requests a pod makes within a time interval. This embodiment of the invention does not limit the types or quantity of load information recorded or acquired.

[0074] Meanwhile, it is understood that the longer the recording interval for the load information of each node and / or pod, the less pressure on data processing and the lower the system performance loss; conversely, the shorter the recording interval for load information, the stronger the timeliness of the data, and the more accurately it can reflect the load status of nodes / pods within a specified time. Therefore, the recording interval for load information can be adaptively adjusted based on the actual use scenario, and this embodiment of the invention does not impose any limitations on this.

[0075] S202: Based on the load information of each node and the preset load usage thresholds, select schedulable nodes;

[0076] Understandably, the principle of load balancing is to schedule more requests to pods with lower current loads, thereby reducing the burden on high-load nodes and achieving system load balancing. The load threshold is the criterion used to distinguish between schedulable and unschedulable nodes.

[0077] Specifically, based on the preset load thresholds corresponding to the load usage of each load, schedulable nodes are selected, including: if the load usage of at least one node's load information is greater than the corresponding load threshold, then the node is an unschedulable node; if the load usage of at least one node's load information is not greater than the corresponding load threshold, then the node is a schedulable node.

[0078] It should also be noted that the criterion for determining whether a node is schedulable is the relationship between the load usage in the node's corresponding load information and the preset load threshold. Therefore, the validity of the load information is crucial to the above judgment logic. Furthermore, before selecting schedulable nodes, the validity of the node load information needs to be further verified to avoid abnormal judgments of node status due to load information failures or other reasons.

[0079] In an exemplary embodiment, the above-mentioned validity detection of node load information includes: obtaining the timestamp corresponding to the load information and calculating the difference between the current time and the time recorded in the timestamp; if the difference between the current time and the time recorded in the timestamp is greater than a preset validity threshold, the load information is invalid; if the difference between the current time and the time recorded in the timestamp is less than or equal to the preset validity threshold, the load information is valid.

[0080] S203: Based on the preset load assessment algorithm, calculate the first load score of each node and pod respectively, and calculate the second load score of each pod based on the first load score of each node and pod;

[0081] It should be noted that, in an exemplary embodiment, the load assessment algorithm of the present invention can be:

[0082]

[0083] finalScore = (nodeScore × γ) node +podScore×γ pod ) / (γ node +γ pod )

[0084] Where, α i The usage of each load recorded in the node load information; γ i For α i The corresponding weight value; b j The usage of each load recorded in the pod load information; γ j For b j The corresponding weight value; MaxScore is the preset maximum score; γ node γ represents the weight of the node's first load score in the second load score. pod The first load score of a pod is weighted relative to the second load score. finalScore is the load score of the pod. L is the number of load usages in the node load information. L' is the number of load usages in the pod load information.

[0085] The magnitude of the weight value can affect the degree to which different load usages influence the load score. The larger the weight value, the greater the impact of the corresponding load usage on the load score, and vice versa. The magnitude of each weight value can be adaptively adjusted based on different implementation scenarios. This embodiment of the invention does not restrict the value of the weight values.

[0086] It can be understood that the first load scores of each node and pod can reflect the load conditions of the corresponding node / pod to a certain extent. However, in complex application scenarios, there may be a situation where the load pressure of a node is high while the load pressure of a certain pod in it is relatively low. Based on the above situation, whether from the perspective of the node or the pod, the unilateral score is difficult to accurately present the priority of scheduling. Therefore, in the load balancing method provided by the present invention, the first load score of the pod is comprehensively calculated with the first load score of the node where it is located, and the generated second load score is used as the criterion for selecting the scheduled pod.

[0087] S204: Obtain the pod corresponding to the maximum value of the second load score, and schedule the pending scheduling request to the corresponding pod.

[0088] It should be noted that the load balancing method provided by the present invention aims to provide a relief method that can be adopted when the load of each node / pod in the system is uneven. Therefore, it can be understood that before node screening, the non-load balancing method of the present invention further includes: calculating the variance of the load usage of each pod; if the above variance is greater than the preset balance threshold, then based on the load information of each node and the preset load usage thresholds, screen the schedulable nodes.

[0089] It can be understood that variance is a measure of the degree of dispersion of a random variable or a set of data. That is, variance is used to measure the deviation degree between a random variable and its mathematical expectation (i.e., mean). In the embodiments of the present invention, the variance of the load usage of each pod can measure the degree of load change. The larger the calculated variance, the more uneven the load of the corresponding pods.

[0090] Furthermore, when the above variance is greater than the preset balance threshold, it is considered that the system load is uneven at this time. Therefore, load balancing needs to be performed. Therefore, based on the load information of each node and the preset load usage thresholds, screen the schedulable nodes. Based on the preset load evaluation algorithm, calculate the first load scores of each node and pod respectively, and calculate the second load scores of each pod based on the first load scores of each node and pod; obtain the pod corresponding to the maximum value of the second load score, and schedule the pending scheduling request to the pod.

[0091] If the variance is less than or equal to the preset balance threshold, it means that the system load is uniform at this time, and dynamic optimization can be performed in the default load balancing strategy set according to the load balancing degree. In an exemplary embodiment, the following situations are dynamically adjusted: when D < 1, ROUND_ROBIN (round-robin algorithm) is selected; when D > 2, LEAST_CONN (least connection algorithm) is selected; when 1 < D < 2, RANDOM (randomly select healthy instances) is selected, where D is the calculated variance value.

[0092] Please refer to Figure 3 As shown, based on the same inventive concept as the aforementioned load balancing method, one embodiment of the present invention provides a load balancing system 300, including: an acquisition module 301, a filtering module 302, a calculation module 303, and a scheduling module 304.

[0093] Specifically, the acquisition module 301 is used to acquire the load information of each node in the cluster and each pod within the node. The load information includes multiple load usages. The filtering module 302 is used to filter schedulable nodes based on the load information of each node and preset load usage thresholds. The calculation module 303 is used to calculate the first load score of each node and pod based on a preset load evaluation algorithm, and calculate the second load score of each pod based on the first load score of each node and pod. The scheduling module 304 is used to acquire the pod corresponding to the maximum value of the second load score and schedule the request to be scheduled to the corresponding pod.

[0094] Please refer to Figure 5 As shown, based on the same inventive concept as the aforementioned load balancing method, another embodiment of the present invention provides a load balancing system 500, including: a monitoring module 501, a data input module 502, an optimization processing module 503, a file read / write module 504, and an application deployment module 505.

[0095] Specifically, the monitoring module 501 is used to monitor the workload of each node and pod in the cluster in real time. Based on the preset monitoring strategy, it periodically collects the load information of each node and each pod in the cluster. The data input module 502 is used to update the load information in real time, process the load information based on the preset monitoring strategy, and send it to the optimization processing module. The optimization processing module 503 is used to dynamically select the load balancing strategy based on the variance of the load usage of each pod. The file read and write module 504 is used to read the load balancing strategy. The application deployment module 505 is used to write command lines to complete the application modification and deployment.

[0096] It should be noted that the file read / write module modifies the load balancing field in the configuration file respectively; the application deployment module writes to the command line, adaptively updates the configuration to make the new configuration information of the application service effective, and completes the application modification and deployment.

[0097] In one exemplary embodiment, Istio represents a second-generation microservice governance framework. This framework uses a sidecar to decouple business logic from service governance in the form of a service mesh, with each service instance having a proxy. EdgeMesh is an extension and expansion of the service mesh in edge computing scenarios, gradually connecting to the standard Istio for service governance control. Each node has a proxy, making it more lightweight. The results obtained by optimizing the algorithm mechanism of the traffic management execution module need to be adaptively updated and applied to Istio and EdgeMesh in real time.

[0098] The automatic configuration information distribution module's processing flow consists of two steps. The first step, the YAML read / write module, modifies fields in a file named "destination-rule.yaml" by searching for their locations. Specifically, it modifies the loadBalancer field in the configuration file. The second step implements command-line writing of adaptive configuration updates to make the new configuration information for the application service effective. This is done by writing commands such as "kubectl apply -f file path / destination-rule.yaml" to the command line to complete the application modification and deployment.

[0099] Please refer to Figure 4 As shown, embodiments of the present invention also provide an electronic device 400, which includes at least one processor 401, a memory 402 (e.g., non-volatile memory), a memory 403, and a communication interface 404, wherein the at least one processor 401, the memory 402, the memory 403, and the communication interface 404 are connected together via a bus 405. The at least one processor 401 is configured to invoke at least one program instruction stored or encoded in the memory 402, causing the at least one processor 401 to perform various operations and functions of the load balancing methods described in the various embodiments of this specification.

[0100] In the embodiments of this specification, electronic device 400 may include, but is not limited to: personal computer, server computer, workstation, desktop computer, laptop computer, notebook computer, mobile electronic device, smartphone, tablet computer, cellular phone, personal digital assistant (PDA), handheld device, messaging device, wearable electronic device, consumer electronic device, etc.

[0101] This invention also provides a computer-readable medium carrying computer-executable instructions. When executed by a processor, these instructions can be used to implement various operations and functions of the load balancing methods described in the various embodiments of this specification.

[0102] The computer-readable medium in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0103] In this invention, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. This propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wireline, optical fiber, RF, etc., or any suitable combination thereof.

[0104] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0105] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus, systems, and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0106] The foregoing description of specific exemplary embodiments of the invention is for illustrative and explanatory purposes. These descriptions are not intended to limit the invention to the precise forms disclosed, and it will be apparent that many changes and variations can be made in accordance with the foregoing teachings. The exemplary embodiments were chosen and described in order to explain the specific principles of the invention and its practical application, thereby enabling those skilled in the art to implement and utilize various different exemplary embodiments of the invention, as well as various different choices and variations. The scope of the invention is intended to be defined by the claims and their equivalents.

Claims

1. A load balancing method, characterized in that, include: Obtain the load information of each node in the cluster and each pod within the node, the load information including multiple load usages; Determine whether the pods in the cluster are in a load-balanced state; If not, then based on the load information of each node and the preset load usage thresholds, scheduleable nodes are selected. Based on a preset load assessment algorithm, a first load score is calculated for each node and pod, and a second load score is calculated for each pod based on the first load scores for each node and pod. The load assessment algorithm is as follows: in, This refers to the usage of each load recorded in the node load information; for The corresponding weight value; This refers to the usage of each load recorded in the pod load information; for The corresponding weight value; The preset maximum score; This represents the weight of the node's first load score within the second load score. The weight of the pod's first load score in the second load score. L is the second load score corresponding to the pod; L is the number of load usages in the node load information, and L' is the number of load usages in the pod load information. This is the node's first load score; The first load score for the pod; Obtain the pod corresponding to the maximum value of the second load score, and schedule the request to be scheduled to the pod.

2. The load balancing method according to claim 1, characterized in that, The process of filtering schedulable nodes based on the load information of each node and preset load usage thresholds includes: If at least one item in the node load information has a load usage greater than the corresponding load usage threshold, then the node is an unschedulable node. If all the load usages in the node load information are less than or equal to the corresponding load usage threshold, then the node is a schedulable node.

3. The load balancing method according to claim 1, characterized in that, The method further includes: Obtain the timestamp corresponding to the load information, and calculate the difference between the current time and the time recorded in the timestamp; If the difference between the current time and the time recorded by the timestamp is greater than a preset valid threshold, the load information is invalid. If the difference between the current time and the time recorded by the timestamp is less than or equal to a preset valid threshold, then the load information is valid.

4. The load balancing method according to claim 1, characterized in that, The method further includes: Real-time monitoring of the workload of each node and pod within the cluster; Based on a preset monitoring strategy, load information of each node in the cluster and each pod within the node is collected periodically. The corresponding pod is labeled based on the average value of the load information collected within a preset time interval, and a timestamp is added to the average value based on the time interval.

5. The load balancing method according to claim 1, characterized in that, The method further includes: Real-time monitoring of the workload of each node and pod within the cluster; Based on a preset monitoring strategy, load information of each node in the cluster and each pod within the node is periodically collected. The corresponding pod is labeled based on the most recently collected load information, and a timestamp is added to the load information based on the collection time.

6. The load balancing method according to claim 1, characterized in that, The method further includes: If the cluster is load balanced, the scheduling request is scheduled based on a round-robin algorithm, a least-connection algorithm, or a random selection of healthy instances.

7. A load balancing system, employing the load balancing method as described in any one of claims 1-6, characterized in that, include: The acquisition module is used to acquire the load information of each node in the cluster and each pod within the node. The load information includes multiple load usages. The judgment module is used to determine whether each pod in the cluster is in a load-balanced state; The filtering module is used to filter schedulable nodes based on the load information of each node and preset load usage thresholds when the cluster load is unbalanced. The calculation module is used to calculate the first load score of each node and pod based on a preset load assessment algorithm, and to calculate the second load score of each pod based on the first load scores of each node and pod. The scheduling module is used to obtain the pod corresponding to the maximum value of the second load score and schedule the request to be scheduled to the pod.

8. A load balancing system, employing the load balancing method as described in any one of claims 1-6, characterized in that, include: The monitoring module is used to monitor the workload of each node and pod in the cluster in real time. Based on the preset monitoring strategy, it periodically collects the load information of each node in the cluster and the pods in each node. The data input module is used to update the load information in real time, process the load information based on a preset monitoring strategy, and send it to the optimization processing module. The optimization module is used to dynamically select a load balancing strategy based on the variance of the load usage of each pod. The file read / write module is used to read the selected load balancing strategy; The application deployment module is used to write command lines based on the selected load balancing strategy to complete the application modification and deployment.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the load balancing method according to any one of claims 1-6.