Load balancing method and device based on computing cluster, equipment and storage medium
By obtaining the load data of the computing node and sorting processing, determining the allocation priority and assigning tasks, the problem of unbalanced resource allocation of computing clusters is solved, and resource utilization and business stability are improved.
Patent Information
- Application Number
- CN202410925336.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2024-11-05
Smart Images

Figure CN118897730A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a load balancing method, device, equipment and storage medium based on a computing cluster. Background Art
[0002] In enterprise applications, with the rapid development of business, the number of business services based on computing clusters is increasing, and it is necessary to optimize enterprise application performance through load balancing.
[0003] In the prior art, the resource requirements of the business request task are evaluated through the resource information of each computing node in the target computing cluster, and a polling load balancing method is adopted to determine the target computing node for processing the business request task to be allocated.
[0004] However, in the above method, the polling-based load balancing method simply distributes traffic, resulting in unbalanced resource allocation in the computing cluster, causing some computing nodes to have too few resources while other servers have idle resources, thereby reducing the utilization rate of computing cluster resources and affecting enterprise application performance. Summary of the invention
[0005] The embodiments of the present application provide a load balancing method, apparatus, device and storage medium based on a computing cluster, which are used to solve the technical problem that the utilization rate of computing cluster resources is reduced due to the polling-based load balancing method.
[0006] In a first aspect, an embodiment of the present application provides a load balancing method based on a computing cluster, including:
[0007] Obtaining load data of each computing node in the target computing cluster; wherein the target computing cluster includes multiple computing nodes; the load data includes queue length and waiting time; the queue length is the task queue length of the central processing unit CPU in the computing node; the waiting time is the input and output waiting time of the CPU in the computing node;
[0008] According to the queue length and the waiting time, each computing node is sorted to obtain an ordered host list; wherein the computing node has an allocation priority, and the allocation priority represents the allocation priority of the task to be allocated to the computing node; the task to be allocated is a business request processing task to be allocated;
[0009] The target computing nodes with high allocation priority are determined from the ordered host list, and the newly added tasks to be allocated are allocated to each of the target computing nodes.
[0010] In a possible implementation, the computing nodes are sorted according to the queue length and the waiting time to obtain an ordered host list, including:
[0011] Determine the load information of the computing node according to the queue length and the waiting time; wherein the load information represents the load and resource utilization of the computing node;
[0012] Determining the allocation priority of the computing node according to the load information;
[0013] According to each of the allocation priorities, each of the computing nodes is sorted to obtain the ordered host list.
[0014] In a possible implementation manner, the load data further includes CPU usage and memory usage; the CPU usage represents the usage of computing resources of the CPU in the computing node; the memory usage represents the usage of memory resources of the CPU in the computing node;
[0015] Determining load information of the computing node according to the queue length and the waiting time includes:
[0016] The load information of the computing node is determined according to the processor usage, the memory usage, the queue length, and the waiting time.
[0017] In a possible implementation manner, determining the load information of the computing node according to the processor usage, the memory usage, the queue length, and the waiting time includes:
[0018] Determining a weight of the processor usage, a weight of the memory usage, a weight of the queue length, and a weight of the waiting time;
[0019] According to each of the weights, a weighted sum calculation is performed on the processor usage rate, the memory usage rate, the queue length, and the waiting time to obtain the load information of the computing node.
[0020] In a possible implementation, determining target computing nodes with high allocation priorities from the ordered host list, and allocating newly added tasks to be allocated to each of the target computing nodes, includes:
[0021] Obtain the number of configuration tasks and the number of hosts of the target computing cluster; wherein the number of configuration tasks is the number of tasks to be assigned that the current target computing cluster allows to be assigned; the number of hosts is the number of computing nodes in the current target computing cluster that need to process the tasks to be assigned;
[0022] Determine target computing nodes with high allocation priority for the number of hosts from the ordered host list;
[0023] The newly added tasks to be assigned of the configured number of tasks are assigned to each of the target computing nodes.
[0024] In a possible implementation, allocating the newly added tasks to be allocated of the configured number of tasks to each of the target computing nodes includes:
[0025] Determine the task priority of the task to be assigned; wherein the task priority represents the priority of task processing of the task to be assigned;
[0026] According to the priority of each task, the newly added tasks to be assigned of the configured number of tasks are assigned to each of the target computing nodes.
[0027] In a possible implementation manner, determining the task priority of the task to be assigned includes:
[0028] Determine the task priority of the task to be assigned according to the business scenario information corresponding to the task to be assigned.
[0029] In a possible implementation, the method further includes:
[0030] Determining a node state of the target computing node;
[0031] If it is determined that the state of each node indicates that the target computing node is operating normally, the step of allocating the newly added tasks to be allocated with the configured number of tasks to each target computing node is performed.
[0032] In a possible implementation, determining the node state of the target computing node includes:
[0033] According to the state of the intelligent agent component, the node state of the target computing node is determined.
[0034] In a possible implementation, the method further includes:
[0035] Parsing the load data to obtain parsed load data;
[0036] The parsed load data is cleaned to obtain processed load data.
[0037] In a possible implementation, the method further includes:
[0038] The processed load data is verified, and the verified load data is stored.
[0039] In a second aspect, an embodiment of the present application provides a load balancing device based on a computing cluster, including:
[0040] The acquisition module is used to acquire the load data of each computing node in the target computing cluster; wherein the target computing cluster includes multiple computing nodes; the load data includes queue length and waiting time; the queue length is the task queue length of the central processing unit CPU in the computing node; the waiting time is the input and output waiting time of the CPU in the computing node;
[0041] A processing module, used for sorting each of the computing nodes according to the queue length and the waiting time to obtain an ordered host list; wherein the computing node has an allocation priority, and the allocation priority represents the allocation priority of the task to be allocated to the computing node; the task to be allocated is a business request processing task to be allocated;
[0042] The allocation module is used to determine the target computing nodes with high allocation priority from the ordered host list, and allocate the newly added tasks to be allocated to each of the target computing nodes.
[0043] In a third aspect, an embodiment of the present application provides an electronic device, including: a memory, a processor;
[0044] The memory stores computer-executable instructions;
[0045] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.
[0046] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementations of the first aspect.
[0047] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.
[0048] The load balancing method, device, equipment and storage medium based on a computing cluster provided in the embodiments of the present application realize the task allocation order and priority based on the task queue length of the central processing unit CPU and the input and output waiting time of the CPU in the real-time load data of each computing node in the target computing cluster, and automatically allocate new tasks to high-priority computing nodes, thereby improving the utilization rate of internal computing resources while ensuring the continuity and stability of business processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0050] Figure 1 A schematic diagram of an application scenario provided for this application;
[0051] Figure 2 A flow chart of a load balancing method based on a computing cluster provided in an embodiment of the present application;
[0052] Figure 3 A flowchart of a computing node load sorting process provided in an embodiment of the present application;
[0053] Figure 4 A flow chart of another load balancing method based on a computing cluster provided in an embodiment of the present application;
[0054] Figure 5 A flow chart of a load data acquisition process provided in an embodiment of the present application;
[0055] Figure 6 A flow chart of a load balancing process provided in an embodiment of the present application;
[0056] Figure 7 A schematic diagram of the structure of a load balancing device based on a computing cluster provided in an embodiment of the present application;
[0057] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0058] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0059] Here, exemplary embodiments will be described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application.
[0060] First, the terms involved in this application are explained:
[0061] Marathon: is an open source container orchestration tool designed to help users manage and schedule large-scale container clusters.
[0062] Marathon Load (Marathon-LB) is a load balancing solution commonly used in cluster management platforms Mesos and Data Center Operating System (DC / OS) platforms. It helps manage and distribute traffic for Marathon application services to ensure high availability and scalability of services.
[0063] Cluster management platform (Mesos): is an open source cluster management platform, which can be regarded as the kernel of a distributed system, responsible for the allocation and management of cluster resources, including CPU resources, memory resources, storage resources, and network resources.
[0064] High Availability Proxy (HAProxy): is an open source high-performance Transmission Control Protocol (TCP) and Hypertext Transfer Protocol (HTTP) load balancer that can provide high availability for TCP and HTTP-based applications.
[0065] It should be noted that the load balancing method, device, equipment and storage medium based on a computing cluster in the present application can be used in the field of computer technology, and can also be used in any field other than computer technology. The application field of the load balancing method, device, equipment and storage medium based on a computing cluster in the present application is not limited.
[0066] In enterprise applications, with the rapid development of business, the number of business services based on computing clusters is increasing, and it is necessary to optimize enterprise application performance through load balancing.
[0067] In one example, the resource requirements of the business request task are evaluated through the resource information of each computing node in the target computing cluster, and a polling load balancing method is used to determine the target computing node for processing the business request task to be assigned.
[0068] In another example, the cloud splits off multiple web servers to form a server cluster. When a user accesses the cloud, he first accesses an intermediate server, selects a server with less pressure in the web server cluster, and processes each user's access, ensuring that the pressure on each server in the cluster is balanced, sharing the server pressure and avoiding server crashes. Among them, Marathon-lb is the load balancing module of the system. Marathon-lb uses HAProxy technology. Each service can obtain its information and generate its proxy configuration at runtime, providing proxy through Service Port and Web virtual host. Marathon-lb is bound to the service port defined by each service at runtime, so that the Marathon-lb node can access each service.
[0069] However, in the above method, Marathon-LB relies heavily on HAProxy to implement its load balancing function, which results in its function being limited by the capabilities of HAProxy itself and unable to meet some specific needs; it performs mechanical balancing based on the number of tasks, and has limited configuration flexibility; it performs load balancing based on simple metrics, resulting in unbalanced resource allocation, causing some servers to be overloaded while other servers have idle resources, thus affecting the performance and stability of the entire system, or causing transaction processing timeouts or failures.
[0070] In response to the above technical problems, this application proposes the following technical concept: based on the task queue length of the central processing unit CPU and the input and output waiting time of the CPU in the real-time load data of each computing node in the target computing cluster, the task allocation order and priority are realized, and the newly added tasks are automatically allocated to the computing nodes with high priority. In this way, the problem of unbalanced resource allocation caused by load balancing based on simple metrics in the prior art can be solved.
[0071] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0072] Figure 1 A schematic diagram of an application scenario provided by this application. Figure 1 As shown, the specific application scenario of the present application includes an electronic device 101 of a deployment management platform and each computing node 102 in a target computing cluster. The electronic device 101 monitors and obtains the load data of each computing node 102, and performs load balancing according to the load data of each computing node 102.
[0073] Figure 2 A flow chart of a load balancing method based on a computing cluster provided in an embodiment of the present application is shown as follows: Figure 2 As shown, the method includes:
[0074] 201. Obtain load data of each computing node in the target computing cluster; wherein the target computing cluster includes multiple computing nodes; the load data includes queue length and waiting time; the queue length is the task queue length of the central processing unit CPU in the computing node; and the waiting time is the input and output waiting time of the CPU in the computing node.
[0075] Exemplarily, the execution subject of this embodiment can be an electronic device, hereinafter referred to as the device, which is a physical device or a virtual device that can execute the load balancing method based on the computing cluster. A management platform is deployed in the device to monitor the target computing cluster, which includes multiple computing nodes. The device sets an API interface corresponding to the monitoring platform to ensure that the real-time load data of the computing node can be obtained by calling the monitoring platform API, that is, various indicators and parameters for evaluating and managing the workload of the computing node (such as a server, a virtual machine or other computing resources). Among them, the load data includes the task queue length of the central processing unit CPU in each computing node, that is, the queue length, such as the number of tasks (processes or threads) currently waiting for CPU processing. This queue contains all tasks that are ready to execute but cannot obtain CPU time slices temporarily because the CPU is busy; the load data also includes the input and output waiting time of the CPU in each computing node, that is, the waiting time, such as the time the CPU waits for the input / output (I / O) operation to complete, waiting for load balancing processing, so as to solve the problem that the original load balancing strategy does not consider the application node resources.
[0076] 202. Sort each computing node according to the queue length and the waiting time to obtain an ordered host list; wherein the computing node has an allocation priority, and the allocation priority represents the allocation priority of the task to be allocated of the computing node; the task to be allocated is a business request processing task to be allocated.
[0077] For example, Figure 3 A flowchart of a computing node load sorting process provided in an embodiment of the present application is shown in FIG. Figure 3 As shown, the device-based policy generation device performs analysis and processing based on the sorting algorithm according to the queue length and waiting time in the load data of each computing node, that is, the host, which is read and stored, to determine the allocation priority of the task to be assigned to each computing node, that is, the allocation priority. The task to be assigned is the business request processing task to be assigned, and all computing nodes are sorted according to the allocation priority of each computing node to obtain an ordered host list.
[0078] 203. Determine target computing nodes with high allocation priorities from the ordered host list, and allocate the newly added tasks to be allocated to each target computing node.
[0079] Exemplarily, the device determines the computing nodes with high allocation priorities as the target computing nodes from the ordered host list according to the allocation priority of each computing node, and allocates the newly added tasks to be allocated to each target computing node to execute the business request processing task and complete load balancing.
[0080] In this embodiment, a load balancing method based on a computing cluster is provided. The task allocation order and priority are realized through indicators such as the task queue length and IO waiting time of the CPU in each computing node, and new tasks are automatically allocated to computing nodes with high allocation priority, thereby improving the resource utilization of the computing cluster and ensuring the stability of business applications.
[0081] Figure 4 A flow chart of another load balancing method based on a computing cluster provided in an embodiment of the present application is shown as follows: Figure 4 As shown, the method includes:
[0082] 301. Obtain load data of each computing node in the target computing cluster; wherein the target computing cluster includes multiple computing nodes; the load data includes queue length and waiting time; the queue length is the task queue length of the central processing unit CPU in the computing node; and the waiting time is the input and output waiting time of the CPU in the computing node.
[0083] Exemplarily, this step may refer to step 201 and will not be described in detail here.
[0084] 302. Determine the load information of the computing node according to the queue length and the waiting time; wherein the load information represents the load and resource utilization of the computing node.
[0085] Exemplarily, the device processes the queue length and waiting time of each computing node based on a preset algorithm, calculates the load information of each computing node, and can know the load and resource utilization of each computing node.
[0086] In one example, the load data also includes CPU usage and memory usage; the CPU usage represents the computing resource usage of the CPU in the computing node; the memory usage represents the memory resource usage of the CPU in the computing node; step 302 includes: determining the load information of the computing node based on the processor usage, memory usage, queue length and waiting time.
[0087] Exemplarily, the load data stored in the monitoring platform acquired by the device also includes the CPU computing resource usage in each computing node, that is, CPU usage, such as the usage of each core, the CPU time distribution in user state and kernel state, etc. The load data also includes the CPU memory resource usage in each computing node, that is, memory usage, such as total memory, used memory and available memory, cache and buffer usage, swap usage, etc. The device calculates and processes the processor usage, memory usage, queue length and waiting time of each computing node based on the black processing strategy to obtain the load information of each computing node.
[0088] In one example, step 302 further specifically includes:
[0089] Step 1: Determine the weight of processor usage, memory usage, queue length, and waiting time.
[0090] Step 2: According to each weight, perform weighted sum calculation on the processor usage, memory usage, queue length and waiting time to obtain the load information of the computing node.
[0091] Specifically, based on the weighted sum method, the device assigns a weight to each factor for each computing node, and obtains the weight of the processor utilization, memory utilization, queue length, and waiting time of each computing node to reflect its importance in the overall load calculation. Based on the preset weighted summation algorithm formula L=(C*W_C)+(M*W_M)+(Q*W_Q)+(T*W_T), in this formula, L represents load information (Load), C represents CPU utilization (taken from the CPUCpuUtil indicator in the monitoring platform), W_C represents the weight of CPU utilization, M represents memory utilization (taken from the MemUsedPerc indicator in the monitoring platform), W_M represents the weight of memory utilization, Q represents the task queue length (taken from the CPURunTSize indicator in the monitoring platform), W_Q represents the weight of the task queue length, T represents IO waiting time (taken from the CPUWio indicator in the monitoring platform), and W_T represents the weight of IO waiting time; this formula normalizes all factors and weights to the same range (between 0 and 1). Based on this formula, the processor utilization, memory utilization, queue length and waiting time of each computing node are weighted and summed to obtain the load information of each computing node.
[0092] For example, there is a computing node host1 to be assigned a task, then its load information L1 = (0.8*1) + (0.6*1) + (0.7*0.5) + (0.4*0.5); among them, C = 0.8 (CPU utilization 80%), W_C = 1 (weight of CPU utilization), M = 0.6 (memory utilization 60%), W_M = 1 (weight of memory utilization), Q = 0.7 (task queue length), W_Q = 0.5 (weight of task queue length), T = 0.4 (IO waiting time), W_T = 0.5 (weight of IO waiting time).
[0093] In one example, the method further includes: parsing the load data to obtain parsed load data; and cleaning the parsed load data to obtain processed load data.
[0094] For example, Figure 5 A flow chart of a load data acquisition process provided in an embodiment of the present application is as follows: Figure 5 As shown, the device receives the response of the monitoring API interface based on the query device, and parses the returned data in the format of JSON or XML, extracts the load data of each computing node, cleans the acquired load data, removes abnormal values or erroneous data, and obtains the processed load data for sorting each computing node, thereby improving the accuracy of the computing node sorting.
[0095] In one example, the method further includes: verifying the processed load data, and storing the verified load data.
[0096] For example, in combination Figure 5 ,In order to further improve the accuracy of the acquired load data, ,based on the query device, the load data after cleaning is ,further verified to verify the validity of the load data, and the ,checked load data is stored locally or in cache for subsequent ,sorting and writing parameters.
[0097] 303. Determine the allocation priority of the computing node according to the load information.
[0098] Exemplarily, the device analyzes the load information of each computing node, and based on a preset mapping relationship, determines the priority corresponding to the load information of each computing node as the allocation priority of the computing node. The higher the load condition represented by the load information, the lower the allocation priority of the computing node.
[0099] 304. Sort the computing nodes according to the allocation priorities to obtain an ordered host list.
[0100] Exemplarily, the device sorts each computing node according to the allocation priority of each computing node based on a preset sorting algorithm, such as the allocation priority from high to low or from low to high, to obtain an ordered host list, and stores the sorted ordered host list locally or in a cache for use by the write parameter module. Furthermore, by obtaining key indicators such as the CPU and memory usage rate, task queue length, and IO waiting time of the computing node in real time, the ordered host list is sorted according to the load situation to form an ordered host list, solving the problem that the original load balancing strategy does not consider the application node resources, improving the accuracy of the computing node load sorting, and then improving the accuracy of load balancing, so as to maximize resource utilization.
[0101] 305. Obtain the number of configuration tasks and the number of hosts of the target computing cluster; wherein the number of configuration tasks is the number of pending tasks allowed to be allocated by the current target computing cluster; and the number of hosts is the number of computing nodes in the current target computing cluster that need to process pending tasks.
[0102] For example, Figure 6 A flow chart of a load balancing process provided in an embodiment of the present application is as follows: Figure 6 As shown, the device reads the number of configured tasks and the number of hosts that need to be allocated from the management platform interface. The number of configured tasks is the number of tasks to be allocated that the current target computing cluster is allowed to allocate as pre-set by the user, that is, the number of tasks allocated each time. The number of hosts is the number of computing nodes in the current target computing cluster that need to process the tasks to be allocated.
[0103] 306. Determine a target computing node with a high allocation priority for the number of hosts from the ordered host list.
[0104] For example, in combination Figure 6 , obtain the previously sorted ordered host list from the storage, and according to the number of hosts, allocate priorities from the ordered host list from high to low to intercept the corresponding number of computing nodes, which are the target computing nodes.
[0105] 307. Allocate the newly added tasks to be allocated according to the configured number of tasks to each target computing node.
[0106] For example, in combination Figure 6After determining the target computing node, determine the tasks to be assigned with the configured number of tasks from the newly added tasks to be assigned, write these tasks to be assigned and each target computing node as part of the task parameters into the Marathon task list, send the Marathon task to Mesos for execution, and automatically distribute the tasks to the target computing nodes, that is, the computing nodes with light loads, according to the host list in the parameters. Then, through the key resource indicators of the computing units obtained in real time, sort them according to the load situation to form an ordered host list. When configuring the number of tasks to be sent in the management platform interface, determine the number of hosts to be shared by the task, intercept the host list from the front to the back (from light to heavy load) according to the ordered host list and write it into the task parameters. When the tasks are sent, the newly added tasks are automatically distributed to the computing units with light loads, so as to achieve real-time load balancing and maximize resource utilization.
[0107] In one example, step 307 includes:
[0108] Step 1: Determine the task priority of the task to be assigned; wherein the task priority represents the priority of task processing of the task to be assigned.
[0109] Step 2: According to the priority of each task, the newly added tasks to be assigned with the configured number of tasks are assigned to each target computing node.
[0110] Exemplarily, in a specific task allocation process, the device first determines the task priority of each task to be allocated to characterize the task processing priority of the task to be allocated, and then determines the tasks to be allocated with high task priority and the number of configured tasks from the newly added tasks to be allocated according to the task priority of each task to be allocated, and allocates these tasks to the corresponding target computing nodes; for example, tasks to be allocated with high task priority are allocated to computing nodes with high allocation priority for processing, and tasks to be allocated with low task priority are allocated to computing nodes with low allocation priority for processing. Furthermore, the newly added tasks are automatically distributed to computing units with light loads, so as to achieve real-time load balancing and maximize resource utilization, and can also enable the tasks to be allocated to be processed in a timely manner to ensure the stability of the business system.
[0111] In one example, step 1 of step 307 includes: determining the task priority of the task to be assigned according to the business scenario information corresponding to the task to be assigned.
[0112] Specifically, when responding to each newly added task to be assigned, the device parses and processes each task to be assigned, obtains the business scenario information corresponding to the task to be assigned, and determines the task priority of each task to be assigned based on the preset one-to-one correspondence between each business scenario information and each task priority. It is worth noting that in addition to determining the task priority of the task to be assigned based on the business scenario information corresponding to the task to be assigned, the task priority can also be determined based on the task information carried by the task to be assigned.
[0113] In one example, step 307 further includes: determining the node status of the target computing node; if it is determined that the node status indicates that the target computing node is operating normally, executing the step of allocating the newly added tasks to be allocated with the configured number of tasks to each target computing node.
[0114] For example, in combination Figure 6 After determining the target computing nodes, the device needs to verify the status of each target computing node to determine the operating status of each target computing node. If it is determined that the operating status of each target computing node is normal, the newly added tasks to be assigned with the configured number of tasks will be assigned to each target computing node for processing; if it is determined that any of the operating status of each target computing node is abnormal, the target computing nodes that need to be assigned tasks will be re-determined. Furthermore, according to the dynamic changes in host resource utilization and whether the node is faulty, the lag and complexity of the original manual inspection and modification of strategies are solved.
[0115] In one example, determining the node state of the target computing node includes: determining the node state of the target computing node according to the state of the intelligent agent component.
[0116] Specifically, the monitoring platform deployed in the device deploys an intelligent agent component to monitor the operating environment status. The node status of each target computing node can be determined through the status of the Agent component to determine whether the status of the target computing node is normal.
[0117] In this embodiment, on the basis of the above embodiment, the key resource indicators of the computing nodes are obtained in real time and sorted by load conditions to form an ordered host list. When the number of tasks is configured and issued in the management platform interface, the number of hosts to which the task needs to be allocated is determined, and the host list is intercepted and written into the task parameters according to the priority of the ordered host list from high to low (load from light to heavy). As the task is issued, the newly added tasks are automatically allocated to the computing units with light load, so as to achieve real-time load balancing and maximize resource utilization.
[0118] Figure 7 A schematic diagram of a load balancing device based on a computing cluster provided in an embodiment of the present application is shown in FIG. Figure 7As shown, the device comprises:
[0119] The acquisition module 401 is used to acquire the load data of each computing node in the target computing cluster; wherein the target computing cluster includes multiple computing nodes; the load data includes queue length and waiting time; the queue length is the task queue length of the central processing unit CPU in the computing node; the waiting time is the input and output waiting time of the CPU in the computing node;
[0120] Processing module 402, used to sort each computing node according to the queue length and the waiting time to obtain an ordered host list; wherein the computing node has an allocation priority, and the allocation priority represents the allocation priority of the task to be allocated to the computing node; the task to be allocated is a business request processing task to be allocated;
[0121] The allocation module 403 is used to determine the target computing nodes with high allocation priority from the ordered host list, and allocate the newly added tasks to be allocated to each target computing node.
[0122] In one possible implementation, processing module 402 is specifically used to: determine the load information of the computing node based on the queue length and the waiting time; wherein the load information represents the load and resource utilization of the computing node; determine the allocation priority of the computing node based on the load information; and sort each computing node according to each allocation priority to obtain an ordered host list.
[0123] In a possible implementation, the load data also includes CPU usage and memory usage; the CPU usage represents the computing resource usage of the CPU in the computing node; the memory usage represents the memory resource usage of the CPU in the computing node; the processing module 402 is also specifically used to determine the load information of the computing node based on the processor usage, memory usage, queue length and waiting time.
[0124] In one possible implementation, the processing module 402 is further specifically used to: determine the weight of processor usage, the weight of memory usage, the weight of queue length, and the weight of waiting time; and perform weighted sum calculation on the processor usage, memory usage, queue length, and waiting time according to each weight to obtain the load information of the computing node.
[0125] In one possible implementation, the allocation module 403 is specifically used to: obtain the number of configuration tasks and the number of hosts of the target computing cluster; wherein the number of configuration tasks is the number of tasks to be assigned that the current target computing cluster allows to be assigned; the number of hosts is the number of computing nodes in the current target computing cluster that need to process the tasks to be assigned; determine the target computing nodes with high allocation priority for the number of hosts from the ordered host list; and assign the newly added tasks to be assigned of the number of configuration tasks to each target computing node.
[0126] In a possible implementation, the allocation module 403 is specifically used to: determine the task priority of the task to be assigned; wherein the task priority represents the task processing priority of the task to be assigned; and according to the priority of each task, allocate the newly added tasks to be assigned with the configured number of tasks to each target computing node.
[0127] In a possible implementation, the allocation module 403 is specifically configured to determine the task priority of the task to be allocated according to the business scenario information corresponding to the task to be allocated.
[0128] In a possible implementation, the allocation module 403 is further specifically used to: determine the node status of the target computing node; if it is determined that the node status indicates that the target computing node is operating normally, execute the step of allocating the newly added tasks to be allocated with the configured number of tasks to each target computing node.
[0129] In a possible implementation, the allocation module 403 is specifically configured to determine the node status of the target computing node according to the status of the intelligent agent component.
[0130] In a possible implementation, the device is further used to: parse the load data to obtain parsed load data; and clean the parsed load data to obtain processed load data.
[0131] In a possible implementation manner, the device is further used to: verify the processed load data, and store the verified load data.
[0132] The device of this embodiment can execute the technical solution in the above method. Its specific implementation process and technical principles are the same and will not be repeated here.
[0133] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown in FIG. Figure 8 As shown, the electronic device includes: a memory 501, a processor 502; the memory 501; and a memory for storing instructions executable by the processor 502.
[0134] The processor 502 is configured to execute the method provided in the above embodiment.
[0135] The electronic device 500 further includes a receiver 503 and a transmitter 504. The receiver 503 is used to receive instructions and data sent by other devices, and the transmitter 504 is used to send instructions and data to external devices.
[0136] An embodiment of the present application also provides a chip for executing instructions, which is used to execute the technical solution of the processing method in the above embodiment.
[0137] The embodiment of the present application also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer, the computer executes the technical solution of the processing method of the above embodiment.
[0138] An embodiment of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium. When at least one processor executes the computer program, the technical solution of the processing method in the above embodiment can be implemented.
[0139] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.
[0140] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to implement the solution of this embodiment.
[0141] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The above-mentioned module-composed unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
[0142] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the methods of various embodiments of the present application.
[0143] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor.
[0144] The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.
[0145] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.
[0146] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium can be any available medium that can be accessed by a general or special purpose computer.
[0147] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in an electronic control unit or a main control device.
[0148] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0149] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.
[0150] It should be further noted that, although the various steps in the flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0151] It should be understood that the above-mentioned device embodiments are only illustrative, and the device of the present application can also be implemented in other ways. For example, the division of units / modules in the above-mentioned embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.
[0152] In addition, unless otherwise specified, each functional unit / module in each embodiment of the present application may be integrated into one unit / module, each unit / module may exist physically separately, or two or more units / modules may be integrated together. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of a software program module.
[0153] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0154] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A load balancing method based on computing clusters. It is characterized in that include: Obtaining load data of each computing node in the target computing cluster; wherein the target computing cluster includes multiple computing nodes; the load data includes queue length and waiting time; the queue length is the task queue length of the central processing unit CPU in the computing node; the waiting time is the input and output waiting time of the CPU in the computing node; According to the queue length and the waiting time, each computing node is sorted to obtain an ordered host list; wherein the computing node has an allocation priority, and the allocation priority represents the allocation priority of the task to be allocated to the computing node; the task to be allocated is a business request processing task to be allocated; The target computing nodes with high allocation priority are determined from the ordered host list, and the newly added tasks to be allocated are allocated to each of the target computing nodes.
2. The method according to claim 1, It is characterized in that According to the queue length and the waiting time, the computing nodes are sorted to obtain an ordered host list, including: Determine the load information of the computing node according to the queue length and the waiting time; wherein the load information represents the load and resource utilization of the computing node; Determining the allocation priority of the computing node according to the load information; According to each of the allocation priorities, each of the computing nodes is sorted to obtain the ordered host list.
3. The method according to claim 2, It is characterized in that The load data also includes CPU usage and memory usage; the CPU usage represents the usage of computing resources of the CPU in the computing node; the memory usage represents the usage of memory resources of the CPU in the computing node; Determining load information of the computing node according to the queue length and the waiting time includes: The load information of the computing node is determined according to the processor usage, the memory usage, the queue length, and the waiting time.
4. The method according to claim 3, It is characterized in that Determining load information of the computing node according to the processor usage rate, the memory usage rate, the queue length, and the waiting time includes: Determining a weight of the processor usage, a weight of the memory usage, a weight of the queue length, and a weight of the waiting time; According to each of the weights, a weighted sum calculation is performed on the processor usage rate, the memory usage rate, the queue length, and the waiting time to obtain the load information of the computing node.
5. The method according to claim 1, It is characterized in that Determining target computing nodes with high allocation priorities from the ordered host list, and allocating newly added tasks to be allocated to each of the target computing nodes, includes: Obtain the number of configuration tasks and the number of hosts of the target computing cluster; wherein the number of configuration tasks is the number of tasks to be assigned that the current target computing cluster allows to be assigned; the number of hosts is the number of computing nodes in the current target computing cluster that need to process the tasks to be assigned; Determine target computing nodes with high allocation priority for the number of hosts from the ordered host list; The newly added tasks to be assigned of the configured number of tasks are assigned to each of the target computing nodes.
6. The method according to claim 5, It is characterized in that Allocating the newly added tasks to be allocated of the configured number of tasks to each of the target computing nodes includes: Determine the task priority of the task to be assigned; wherein the task priority represents the priority of task processing of the task to be assigned; According to the priority of each task, the newly added tasks to be assigned of the configured number of tasks are assigned to each of the target computing nodes.
7. The method according to claim 6, It is characterized in that Determining the task priority of the task to be assigned includes: Determine the task priority of the task to be assigned according to the business scenario information corresponding to the task to be assigned.
8. The method according to claim 5, It is characterized in that The method further comprises: Determining a node state of the target computing node; If it is determined that the state of each node indicates that the target computing node is operating normally, the step of allocating the newly added tasks to be allocated with the configured number of tasks to each target computing node is performed.
9. The method according to claim 8, It is characterized in that Determining the node status of the target computing node includes: According to the state of the intelligent agent component, the node state of the target computing node is determined.
10. The method according to any one of claims 1 to 9, It is characterized in that The method further comprises: Parsing the load data to obtain parsed load data; The parsed load data is cleaned to obtain processed load data.
11. The method according to claim 10, It is characterized in that The method further comprises: The processed load data is verified, and the verified load data is stored.
12. A load balancing device based on a computing cluster, It is characterized in that include: The acquisition module is used to acquire the load data of each computing node in the target computing cluster; wherein the target computing cluster includes multiple computing nodes; the load data includes queue length and waiting time; the queue length is the task queue length of the central processing unit CPU in the computing node; the waiting time is the input and output waiting time of the CPU in the computing node; A processing module, used for sorting each of the computing nodes according to the queue length and the waiting time to obtain an ordered host list; wherein the computing node has an allocation priority, and the allocation priority represents the allocation priority of the task to be allocated to the computing node; the task to be allocated is a business request processing task to be allocated; The allocation module is used to determine the target computing nodes with high allocation priority from the ordered host list, and allocate the newly added tasks to be allocated to each of the target computing nodes.
13. An electronic device, It is characterized in that include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 11.
14. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 11 when executed by a processor.
15. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.
Citation Information
Cited By
Heterogeneous cluster scheduling method and device, electronic equipment and storage medium
CN119781913A
Heterogeneous cluster scheduling method and device, electronic equipment and storage medium
CN119781913B
Distribution method and system, storage medium and program product
CN120066804A
