A weighted load balancing method and system based on container cluster performance
By adopting a weighted load balancing method based on container cluster performance in a cloud computing environment, and dynamically allocating tasks using bee-inspired algorithm and weighted loop algorithm, the problem that load balancing in the existing technology is difficult to adapt to the heterogeneous performance changes of container clusters is achieved. Efficient load balancing and maximum utilization of container clusters.
Patent Information
- Application Number
- CN202111498346.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-09
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2041-12-09
AI Technical Summary
In existing cloud computing environments, load balancing technology is difficult to effectively and dynamically adjust to adapt to heterogeneous performance changes in container clusters, resulting in poor response time and processing time.
A weighted load balancing method based on container cluster performance is proposed. By obtaining container cluster and container data information, cyclically viewing container load, evaluating the performance of container underload, and dynamically allocating tasks using bee heuristic algorithm and weighted loop algorithm to achieve load balancing.
By dynamically adjusting task allocation, the minimum processing time and response time of the container cluster are achieved, the load balancing mechanism is optimized, and the container utilization is maximized.
Smart Images

Figure CN114253716B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud service technology, and in particular to a weighted load balancing method and system based on container cluster performance. Background Art
[0002] Cloud computing is an Internet-based service for storing, processing resources, and remotely accessing data. The services provided by cloud computing are SAAS (Software as a Service), PAAS (Platform as a Service), and IAAS (Infrastructure as a Service). Software as a Service is a model in which a third-party provider hosts applications and makes them available to all users. Platform as a Service provides a framework for developers to build and deploy applications on the web. Infrastructure as a Service provides security, networking, and servers for deploying applications. The types of clouds are private, public, and hybrid. Private clouds are owned by a single commercial enterprise and provide features such as flexibility, scalability, automation, and monitoring. Another type of cloud is a public cloud, which provides developers with resources such as applications and storage and is open to the public for free over the Internet. A hybrid cloud environment is a mix of public and private clouds.
[0003] In cloud computing, the number of users is growing rapidly, and the requests from users are also increasing day by day. For this reason, load balancing technology is introduced. Load balancing is to evenly distribute user requests to all available nodes to avoid the situation where some nodes are overloaded and others are underloaded, thereby reducing service quality factors such as response time, throughput, and execution time. The main goal of load balancing is to speed up the response time of requests and the execution of applications. The existing load balancing technologies are static load balancing and dynamic load balancing.
[0004] In static load balancing, the decision is made at compile time, that is, the performance of the virtual machines is calculated before execution. This technique can be used only when the load differences of the virtual machines are small. Therefore, this technique is not suitable for cloud environments where the load in each virtual machine varies at different times. The disadvantage of static load balancing is that once the load is assigned to the virtual machines, it cannot be modified.
[0005] In dynamic load balancing, allocation and reallocation are done at runtime, where no a priori information about the performance of the virtual machines is required, as it is impossible to decide which tasks to migrate and to which virtual machine. Therefore, dynamic load balancing is suitable for most cloud computing environments, where there are a large number of requests, which can be evenly distributed among virtual machines using dynamic load balancing techniques to reduce processing time and execution time. Summary of the invention
[0006] To address the deficiencies of the prior art, the present invention proposes a weighted load balancing method and system based on container cluster performance, which is suitable for a hybrid algorithm in a heterogeneous cloud environment. The algorithm dynamically balances the load. The algorithm allocates containers according to the resource requirements of the task, balances the load according to the priority of the task, and directly adopts weighted round-robin scheduling if no priority is assigned to the task.
[0007] To achieve the above objectives, the technical solutions adopted by the present invention include:
[0008] A weighted load balancing method based on container cluster performance, characterized by comprising the following steps:
[0009] Step S1, obtaining container cluster and container data information;
[0010] Step S2: Check in sequence whether the loads of all containers are balanced, and distinguish overloaded containers from underloaded containers;
[0011] Step S3: remove unexecuted tasks from the overloaded container and form an OTask task queue;
[0012] Step S4: Perform performance evaluation on the underloaded containers, execute a weight configuration calculation method to obtain a comprehensive score, and sort them from low to high according to the comprehensive score to form a queue. The lower the comprehensive score, the lower the degree of underload.
[0013] Step S5, determine whether the tasks in the OTask task queue have priority, and distinguish between tasks with priority and tasks without priority;
[0014] Step S6: For the tasks with priority, use the honey bee heuristic algorithm to sequentially assign them to the underloaded containers with comprehensive scores from low to high; for the tasks without priority, use the weighted round-robin algorithm to sequentially assign them to the underloaded containers with comprehensive scores from low to high;
[0015] Step S7: loop through the above steps until each container reaches load balancing.
[0016] Furthermore, the container cluster and container data information preferably include the number of container clusters, the number of containers, the container configuration, and the number of tasks.
[0017] Furthermore, the criterion for whether the load of the container is balanced is preferably whether the CPU occupancy of the container is greater than 80%. A CPU occupancy greater than 80% is an overloaded container, and a CPU occupancy less than or equal to 80% is an underloaded container.
[0018] Furthermore, the step S4 preferably includes the following sub-steps:
[0019] Step S41, obtaining attribute information of the underloaded container and forming a decision data table;
[0020] Step S42, normalizing the data in the decision data table;
[0021] Step S43, selecting attribute columns from the normalized decision data table to construct a decision matrix;
[0022] Step S44, normalizing the decision matrix to obtain a standardized matrix;
[0023] Step S45, calculating the weight coefficient of each attribute information;
[0024] Step S46, calculating the comprehensive score of each row of records in the decision data table;
[0025] Step S47: sort the underloaded containers from low to high according to the comprehensive scores to form a queue.
[0026] Furthermore, the attribute information preferably includes index, container name, CPU occupancy, memory occupancy, network throughput, and disk throughput.
[0027] Furthermore, the step S4 includes the following sub-steps:
[0028] Step S41, obtaining attribute information of the underloaded container and forming a decision data table;
[0029] Step S42: normalize the data in the decision data table using the log function, and the calculation formula is:
[0030] x i =lgv i / lg max(v i )
[0031] Among them, v i is the attribute value;
[0032] Step S43: Select attribute columns from the normalized decision data table to construct a decision matrix, and the calculation formula is:
[0033] X=|X ij | n*4
[0034] Step S44: normalize the decision matrix to obtain the following normalized matrix:
[0035]
[0036] in,
[0037] Step S45: Calculate the weight coefficients of each attribute information, including calculating the correlation coefficient matrix R=Y T The eigenvalue of Y / n gives the four eigenvalues of R, λ1, λ2, λ3, λ4,
[0038] The weight coefficient of each attribute information is calculated using the following formula:
[0039]
[0040] Step S46: Calculate the comprehensive score of each row of records in the decision data table. The formula is as follows:
[0041]
[0042] Among them, x i Refers to the value of each attribute information, w i Refers to the weight corresponding to each attribute information;
[0043] Step S47: sort the underloaded containers from low to high according to the comprehensive scores to form a queue.
[0044] The present invention also relates to a weighted load balancing system based on container cluster performance, characterized in that it includes:
[0045] The acquisition module is used to obtain container cluster and container data information;
[0046] A loop checking module is used to check in turn whether the loads of all containers are balanced, and to distinguish overloaded containers from underloaded containers;
[0047] The transfer module is used to remove unexecuted tasks from the overloaded container and form an OTask task queue;
[0048] A calculation module is used to evaluate the performance of underloaded containers, execute a weight configuration calculation method to obtain a comprehensive score, and sort the containers from low to high according to the comprehensive score to form a queue, wherein the lower the comprehensive score, the lower the degree of underload;
[0049] The judgment module is used to judge whether the tasks in the OTask task queue have priority and distinguish between tasks with priority and tasks without priority;
[0050] The allocation module is used to allocate the priority tasks to the underloaded containers with comprehensive scores from low to high in sequence using the bee-inspired algorithm; and to allocate the non-priority tasks to the underloaded containers with comprehensive scores from low to high in sequence using the weighted round-robin algorithm.
[0051] The present invention also relates to a computer-readable storage medium, characterized in that a computer program is stored on the storage medium, and the computer program implements the above method when executed by a processor.
[0052] The present invention also relates to an electronic device, characterized in that it comprises a processor and a memory;
[0053] The memory is used to store operation instructions;
[0054] The processor is used to execute the above method by calling the operation instruction.
[0055] The beneficial effects of the present invention are:
[0056] The weighted load balancing method and system based on the performance of the container cluster described in the present invention is adopted, combined with the weighted round-robin algorithm and the bee-inspired algorithm, to achieve the minimum processing time and response time of the container cluster, and to optimize the load balancing mechanism of the container cluster. By checking overloaded and underloaded containers, deleting tasks from overloaded containers and checking their priorities, using the bee-inspired algorithm for tasks with priorities and the weighted round-robin algorithm for tasks without priorities, and determining the order of assigned tasks by assigning weights to each container and calculating the comprehensive score of the current performance, the utilization of each container is maximized. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 The figure is a flow chart of a weighted load balancing method based on container cluster performance according to the present invention.
[0058] Figure 2 This is a schematic diagram of the structure of a weighted load balancing system based on container cluster performance in the present invention. DETAILED DESCRIPTION
[0059] In order to more clearly understand the content of the present invention, it will be described in detail with reference to the drawings and embodiments.
[0060] The first aspect of the present invention relates to a process of steps as follows Figure 1 The weighted load balancing method based on container cluster performance shown includes:
[0061] Step S1: Obtain container cluster and container data information;
[0062] Preferably, in this embodiment, the container cluster and container data information include the number of container clusters, the number of containers, the container configuration, and the number of tasks.
[0063] Step S2: Check in sequence whether the loads of all containers are balanced, and distinguish overloaded containers from underloaded containers;
[0064] Preferably, this embodiment loops through all containers (Docker) to see if their CPU occupancy is greater than 80%. A container with a CPU occupancy greater than 80% is an overloaded container (marked as ODocker), and a container with a CPU occupancy less than or equal to 80% is an underloaded container (marked as UDocker).
[0065] Step S3: remove unexecuted tasks from the overloaded container and form an OTask task queue;
[0066] Step S4: Perform performance evaluation on the underloaded containers, execute a weight configuration calculation method to obtain a comprehensive score, and sort them from low to high according to the comprehensive score to form a queue. The lower the comprehensive score, the lower the degree of underload.
[0067] Step S5, determine whether the tasks in the OTask task queue have priority, and distinguish between tasks with priority and tasks without priority;
[0068] Step S6: For the tasks with priority, use the honey bee heuristic algorithm to sequentially assign them to the underloaded containers with comprehensive scores from low to high; for the tasks without priority, use the weighted round-robin algorithm to sequentially assign them to the underloaded containers with comprehensive scores from low to high;
[0069] Step S7: loop through the above steps until each container reaches load balancing.
[0070] In this embodiment, preferably, the above step S4 includes the following sub-steps:
[0071] Step S41: Acquire attribute information of underloaded containers and form a decision data table.
[0072] Among them, the attribute information of UDocker includes index (Index), container name (Name), CPU usage (CPU%), memory usage (Mem%), network throughput (NET / IO) and disk throughput (BLOCK / IO).
[0073] Exemplarily, the decision data table is {[Index, Name, CPU %, Mem %, NET / IO, BLOCK / IO], …}.
[0074] Step S42: normalize the data in the decision data table using the log function, and the calculation formula is:
[0075] x i =lg v i / lg max(v i )
[0076] Among them, v i is the attribute value;
[0077] Preferably, CPU%, Mem%, NET / IO, and BLOCK / IO are normalized.
[0078] Step S43: Select attribute columns from the normalized decision data table to construct a decision matrix, and the calculation formula is:
[0079] X=|X ij | n*4
[0080] Preferably, CPU%, Mem%, NET / IO, and BLOCK / IO are used to construct a decision matrix.
[0081] Step S44: normalize the decision matrix to obtain the following normalized matrix:
[0082]
[0083] in,
[0084] Step S45: Calculate the weight coefficients of each attribute information, including calculating the correlation coefficient matrix R=Y T The eigenvalue of Y / n gives the four eigenvalues of R, λ1, λ2, λ3, λ4,
[0085] The weight coefficient of each attribute information is calculated using the following formula:
[0086]
[0087] For example,
[0088]
[0089] Step S46: Calculate the comprehensive score of each row of records in the decision data table. The formula is as follows:
[0090]
[0091] Among them, x i Refers to the value of each attribute information, w i Refers to the weight corresponding to each attribute information.
[0092] Preferably, w i After sorting in descending order, the corresponding attributes are assigned to the attributes sorted in descending order according to the attribute importance. The attribute importance needs to be manually determined according to the functional characteristics of the target container.
[0093] Step S47, sort the underloaded containers UDocker from low to high according to the comprehensive scores to form a queue UDockers.
[0094] Preferably, it is determined in turn whether the tasks in the OTask queue have priorities. The PRI and NI fields can be viewed by executing the "ps -l" command. If there is a priority, the priority P = PRI + NI is defined.
[0095] The weighted load balancing method based on the performance of the container cluster described in the present invention is adopted, combined with the weighted round-robin algorithm and the bee-inspired algorithm, to achieve the minimum processing time and response time of the container cluster, and to optimize the load balancing mechanism of the container cluster. By checking overloaded and underloaded containers, deleting tasks from the overloaded containers and checking their priorities, using the bee-inspired algorithm for tasks with priorities and the weighted round-robin algorithm for tasks without priorities, and determining the order of the assigned tasks by assigning weights to each container and calculating the comprehensive score of the current performance, the utilization of each container is maximized.
[0096] Another aspect of the present invention also relates to a weighted load balancing system based on container cluster performance, the structure of which is as follows: Figure 2 As shown, including:
[0097] The acquisition module is used to obtain container cluster and container data information;
[0098] A loop checking module is used to check in turn whether the loads of all containers are balanced, and to distinguish overloaded containers from underloaded containers;
[0099] The transfer module is used to remove unexecuted tasks from the overloaded container and form an OTask task queue;
[0100] A calculation module is used to evaluate the performance of underloaded containers, execute a weight configuration calculation method to obtain a comprehensive score, and sort the containers from low to high according to the comprehensive score to form a queue, wherein the lower the comprehensive score, the lower the degree of underload;
[0101] The judgment module is used to judge whether the tasks in the OTask task queue have priority and distinguish between tasks with priority and tasks without priority;
[0102] The allocation module is used to allocate the priority tasks to the underloaded containers with comprehensive scores from low to high in sequence using the bee-inspired algorithm; and to allocate the non-priority tasks to the underloaded containers with comprehensive scores from low to high in sequence using the weighted round-robin algorithm.
[0103] By using this system, the above-mentioned operation processing method can be executed and the corresponding technical effects can be achieved.
[0104] An embodiment of the present invention also provides a computer-readable storage medium capable of implementing all the steps in the method in the above embodiment, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, all the steps in the method in the above embodiment are implemented.
[0105] An embodiment of the present invention also provides an electronic device for executing the above method. As an implementation device of the method, the electronic device has at least a processor and a memory, and in particular, the memory stores data and related computer programs required for executing the method, such as etc., and the processor calls the data and programs in the memory to execute all the steps of the implementation method and obtains the corresponding technical effect.
[0106] Preferably, the electronic device may include a bus architecture, the bus may include any number of interconnected buses and bridges, and the bus will include various circuits linked together by one or more processors and memories. The bus may also link together various other circuits such as peripherals, voltage regulators, and power management circuits, which are all well known in the art and are therefore not further described herein. The bus interface provides an interface between the bus and the receiver and transmitter. The receiver and transmitter may be the same component, i.e., a transceiver, providing a unit for communicating with various other systems over a transmission medium. The processor is responsible for managing the bus and general processing, while the memory may be used to store data used by the processor when performing operations.
[0107] In addition, the electronic device may further include components such as a communication module, an input unit, an audio processor, a display, and a power supply. The processor (or controller, operation control) used may include a microprocessor or other processor device and / or a logic device, which receives input and controls the operation of various components of the electronic device; the memory may be one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory, or other suitable devices, which may store the above-mentioned related data information, and may also store a program for executing related information, and the processor may execute the program stored in the memory to realize information storage or processing, etc.; the input unit is used to provide input to the processor, for example, it may be a key or a touch input device; the power supply is used to provide power to the electronic device; the display is used to display display objects such as images and text, for example, it may be an LCD display. The communication module is a transmitter / receiver that sends and receives signals via an antenna. The communication module (transmitter / receiver) is coupled to the processor to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal. Based on different communication technologies, multiple communication modules may be provided in the same electronic device, such as a cellular network module, a Bluetooth module and / or a wireless local area network module, etc. The communication module (transmitter / receiver) is also coupled to a speaker and a microphone via an audio processor to provide an audio output via the speaker and receive an audio input from the microphone, thereby realizing a common telecommunication function. The audio processor may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor is also coupled to a central processor, so that recording can be performed on the machine through the microphone, and the sound stored on the machine can be played through the speaker.
[0108] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented 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.
[0109] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A system that specifies the functions of a box or multiple boxes.
[0110] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction system, which is implemented in the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0111] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps of the functions specified in a box or multiple boxes. Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they know the basic creative concept. Therefore, the attached claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0112] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A weighted load balancing method based on container cluster performance, characterized in that: The following steps are involved: Step S1: Obtain container cluster and container data information; Step S2: Check in sequence whether the loads of all containers are balanced, and distinguish overloaded containers from underloaded containers; Step S3: remove unexecuted tasks from the overloaded container and form an OTask task queue; Step S4: Perform performance evaluation on the underloaded containers, execute a weight configuration calculation method to obtain a comprehensive score, and sort them from low to high according to the comprehensive score to form a queue. The lower the comprehensive score, the lower the degree of underload. Step S5, determine whether the tasks in the OTask task queue have priority, and distinguish between tasks with priority and tasks without priority; Step S6: For the tasks with priority, use the honey bee heuristic algorithm to sequentially assign them to the underloaded containers with comprehensive scores from low to high; for the tasks without priority, use the weighted round-robin algorithm to sequentially assign them to the underloaded containers with comprehensive scores from low to high; Step S7: loop through the above steps until each container reaches load balancing.
2. The method according to claim 1, characterized in that The container cluster and container data information include the number of container clusters, the number of containers, container configuration, and the number of tasks.
3. The method according to claim 1, characterized in that The criterion for whether the load of the container is balanced is whether the CPU occupancy rate of the container is greater than 80%. A container with a CPU occupancy rate greater than 80% is an overloaded container, and a container with a CPU occupancy rate less than or equal to 80% is an underloaded container.
4. The method according to any one of claims 1 to 3, characterized in that The step S4 comprises the following sub-steps: Step S41, obtaining attribute information of the underloaded container and forming a decision data table; Step S42, normalizing the data in the decision data table; Step S43, selecting attribute columns from the normalized decision data table to construct a decision matrix; Step S44, normalizing the decision matrix to obtain a standardized matrix; Step S45, calculating the weight coefficient of each attribute information; Step S46, calculating the comprehensive score of each row of records in the decision data table; Step S47: sort the underloaded containers from low to high according to the comprehensive scores to form a queue.
5. The method according to claim 4, characterized in that The attribute information includes index, container name, CPU occupancy, memory occupancy, network throughput, and disk throughput.
6. The method according to claim 5, characterized in that The step S4 comprises the following sub-steps: Step S41, obtaining attribute information of the underloaded container and forming a decision data table; Step S42: normalize the data in the decision data table using the log function, and the calculation formula is: x i =lgv i / lgmax(v i ) Among them, v i is the attribute value; Step S43: Select attribute columns from the normalized decision data table to construct a decision matrix, and the calculation formula is: X=|X ij | n*4 Step S44: normalize the decision matrix to obtain the following normalized matrix: in, Step S45: Calculate the weight coefficients of each attribute information, including calculating the correlation coefficient matrix R=Y T The eigenvalue of Y / n gives the four eigenvalues of R, λ1, λ2, λ3, λ4, The weight coefficient of each attribute information is calculated using the following formula: Step S46: Calculate the comprehensive score of each row of records in the decision data table. The formula is as follows: Among them, x i Refers to the value of each attribute information, w i Refers to the weight corresponding to each attribute information; Step S47: sort the underloaded containers from low to high according to the comprehensive scores to form a queue.
7. A weighted load balancing system based on container cluster performance, characterized in that: include: The acquisition module is used to obtain container cluster and container data information; A loop checking module is used to check in turn whether the loads of all containers are balanced, and to distinguish overloaded containers from underloaded containers; The transfer module is used to remove unexecuted tasks from the overloaded container and form an OTask task queue; A calculation module is used to evaluate the performance of underloaded containers, execute a weight configuration calculation method to obtain a comprehensive score, and sort the containers from low to high according to the comprehensive score to form a queue, wherein the lower the comprehensive score, the lower the degree of underload; The judgment module is used to judge whether the tasks in the OTask task queue have priority and distinguish between tasks with priority and tasks without priority; The allocation module is used to allocate the priority tasks to the underloaded containers with comprehensive scores from low to high in sequence using the bee-inspired algorithm; and to allocate the non-priority tasks to the underloaded containers with comprehensive scores from low to high in sequence using the weighted round-robin algorithm.
8. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
9. An electronic device, characterized in that: including a processor and a memory; The memory is used to store operation instructions; The processor is used to execute the method according to any one of claims 1 to 6 by calling the operation instruction.
Citation Information
Patent Citations
Load balancing method for use in cloud computing environment
CN104917839A
Docker cloud platform based dynamic-priority-queue-feedback load-balanced resource scheduling method
CN106790726A