Method, electronic device and computer program product for load balancing

By collecting resource information on each node in the distributed system and dynamically migrating the load, it solves the problems of task failure and low execution efficiency caused by insufficient node resources, achieves load balancing and system self-regulation, and improves the reliability of the distributed system. and performance.

CN112882827BActive Publication Date: 2024-09-03EMC IP HLDG CO LLC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201911211629.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-11-29
Publication Date
2024-09-03
Estimated Expiration
2039-11-29

AI Technical Summary

Technical Problem

In distributed systems, the lack of effective load balancing strategies leads to task failures when node resources are insufficient, and task execution efficiency is low. Traditional methods rely on the performance of the master node and are prone to load balancing failures or insufficient performance.

Method used

Collect resource usage information at each node in the distributed system, dynamically migrate the load, determine the work tasks to be stopped based on the resource usage status and release permissions to ensure that the task load is evenly distributed and all nodes share the load balancing task.

Benefits of technology

Through dynamic load migration and resource release, task execution efficiency is improved, ensuring that the system can self-adjust when a node fails or is overloaded, avoiding task failure, and improving system reliability and performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112882827B
    Figure CN112882827B
Patent Text Reader

Abstract

Embodiments of the present disclosure provide a method, electronic device, and computer program product for load balancing. The method includes collecting resource usage information of multiple devices in a distributed system at a target device in the distributed system. The method also includes determining a first work task to be stopped of the target device based on the resource usage information, and the target device has a first permission to perform the first work task. The method also includes causing the first permission to be released. Using the embodiments of the present disclosure, each node in the distributed system can balance different task loads and the use of resources by different operations of tasks, thereby improving the performance of the distributed system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the field of distributed computing, and more particularly, to a method, an electronic device, and a computer program product for load balancing. Background Art

[0002] Distributed systems and distributed applications are increasingly being used. In a distributed system, there are multiple nodes, each node has a processor or at least processor resources, and typically has a separate operating system. Multiple nodes can collaborate and process multiple tasks in parallel, thereby improving the efficiency of processing tasks. However, in a distributed system, a large number of concurrent tasks may affect each other because they compete for limited shared distributed system resources, such as network bandwidth, CPU, memory, disk bandwidth, etc.

[0003] In such a distributed system, without a load balancing strategy, when the resources on a node are insufficient, tasks will continue to be assigned to the node, resulting in task failure. In addition, if there is no good load balancing strategy and no suitable execution resources can be found, the task will remain in a waiting state, reducing the execution efficiency of the task. Summary of the invention

[0004] Embodiments of the present disclosure provide a solution for load balancing.

[0005] In a first aspect of the present disclosure, a method for load balancing is provided. The method includes collecting resource usage information of multiple devices in the distributed system at a target device in the distributed system. The method also includes determining a first work task to be stopped of the target device based on the resource usage information, and the target device has a first permission to perform the first work task. The method also includes causing the first permission to be released.

[0006] In a second aspect of the present disclosure, an electronic device is provided. The device includes a processor and a memory coupled to the processor, the memory having instructions stored therein, and the instructions, when executed by the processor, cause the device to perform an action. The action includes collecting resource usage information of multiple devices in the distributed system at a target device in the distributed system. The action also includes: determining a first work task to be stopped of the target device based on the resource usage information, and the target device has a first permission to perform the first work task. The action also includes causing the first permission to be released.

[0007] According to a third aspect of the present disclosure, there is provided a computer program product, the computer program product being tangibly stored on a computer readable medium and comprising machine executable instructions which, when executed, cause a machine to perform the method according to the first aspect.

[0008] This Summary is provided to introduce a selection of concepts in a simplified form that are further described in the Detailed Description below. This Summary is not intended to identify key features or essential features of the disclosure, nor is it intended to limit the scope of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] The above and other purposes, features and advantages of the present disclosure will become more apparent by describing the exemplary embodiments of the present disclosure in more detail in conjunction with the accompanying drawings, wherein the same reference numerals generally represent the same components in the exemplary embodiments of the present disclosure. In the accompanying drawings:

[0010] Figure 1 A schematic diagram illustrating an example environment in which embodiments of the present disclosure may be implemented;

[0011] Figure 2 A flow chart of a process for load balancing according to an embodiment of the present disclosure is shown;

[0012] Figure 3 A flowchart showing a process of determining a work task to be stopped based on resource usage information according to an embodiment of the present disclosure;

[0013] Figure 4 A flow chart of a process for load balancing according to an embodiment of the present disclosure is shown;

[0014] Figure 5 A flowchart showing a process of determining a work task to be stopped that has not received a stop signal based on resource usage information according to an embodiment of the present disclosure;

[0015] Figure 6 A flowchart showing a process for load balancing according to an embodiment of the present disclosure; and

[0016] Figure 7 A schematic block diagram of an example device suitable for implementing embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0017] The principles of the present disclosure will be described below with reference to several example embodiments shown in the accompanying drawings. Although preferred embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that these embodiments are described only to enable those skilled in the art to better understand and implement the present disclosure, and are not intended to limit the scope of the present disclosure in any way.

[0018] As used herein, the term "including" and its variations mean open inclusion, i.e., "including but not limited to". Unless otherwise stated, the term "or" means "and / or". The term "based on" means "based at least in part on". The terms "an example embodiment" and "an embodiment" mean "at least one example embodiment". The term "another embodiment" means "at least one additional embodiment". The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may also be included below.

[0019] As mentioned above, in a distributed system, multiple nodes can collaborate and process multiple tasks in parallel. Such parallel processing of multiple tasks may affect each other due to contention for limited shared resources. However, traditional distributed systems do not have a load balancing strategy for task allocation. Instead, when allocating tasks, they do not consider the resource consumption on the node that processes the task. Even if the resources on the node have been exhausted, tasks will continue to be randomly assigned. When a server in a node runs too many resources, the node server consumes too much resources and affects its processing performance, and task execution will fail. Especially when the system is overloaded, that is, the task demand exceeds the service capacity of the distributed system, not only may I / O congestion occur, but the service quality of the task (such as throughput, delay, packet loss rate, etc.) cannot be guaranteed.

[0020] In addition, in traditional solutions, a master node or coordinator is usually used to perform load balancing. The master node or coordinator can collect resource usage information of other nodes in the distributed system, and determine which node to assign tasks to based on the resource usage information, and decide to migrate certain tasks from one node to other nodes. However, this method makes the quality of load balancing work of the entire distributed system completely dependent on the performance of the master node or coordinator. If the master node or coordinator fails, or when the hardware configuration capacity of the master node or coordinator is low, effective load balancing will not be possible, which will affect the execution of tasks in the system.

[0021] In response to the above problems and potential other problems, the present disclosure provides a load balancing solution. In this solution, resource usage information of multiple devices in a distributed system is collected at a target device in the distributed system. The target node determines the first work task to be stopped of the target device based on the resource usage information, and the target device has a first permission to execute the first work task. Then, the first permission is released. By collecting resource usage information at each node in the distributed system, each node in the distributed system can dynamically migrate the load according to the resource usage status, so that the task load is distributed as evenly as possible on the node. In addition, since all nodes in the distributed system can undertake load balancing tasks, once an individual node fails or the workload is too heavy, other nodes can also each perform effective load balancing according to the resource usage status.

[0022] In this document, the term "device of a distributed system" refers to a node in a distributed system. The device may be a physically independent electronic device that has a processor or at least processor resources and may have a separate operating system. It should be understood that the device may also be a logically independent electronic device. Multiple devices in a distributed system may collaborate with each other to perform a task.

[0023] In this article, the term "work task" is a work to be performed on a node of a distributed system, which has certain work content. A work task is, for example, communicating with a device outside the distributed system (such as a Ranger server and an Ambari server (both Ranger server and Ambari server are WEB-based open source software)). For a Ranger task in a distributed file system, the work content of the work task is to download a policy from a Ranger server. In each work task, there are some "work" to be performed. For a work task, it may be implemented as different instances on different nodes, such as an entity that runs on a node and actually performs the work. In some embodiments, if there is a Ranger agent on each node to perform the Ranger task, each Ranger agent here can be considered as an instance of a work task. In the following embodiments, sometimes the related processing or execution of a work task is described by an instance of a work task.

[0024] In this article, the term "authority" refers to the permission required for a node to perform a work task in a distributed system. In the embodiments of the present disclosure, "authority" is sometimes also implemented through "locks". For example, locks can be used in a distributed system to allow nodes to have the authority to perform work tasks. The node needs to obtain the lock corresponding to the work task in order to perform the work task. It can be understood that locks can be implemented in a variety of ways. For example, in a file storage system, it can be implemented by having the work task lock the file.

[0025] Hereinafter, embodiments of the present disclosure will be described in detail with reference to the accompanying drawings. Figure 1 1 is a schematic diagram of an example environment 100 in which embodiments of the present disclosure may be implemented. Figure 1 The distributed system 101 shown may be composed of a plurality of devices or nodes 110-1, 110-2, ..., 110-N interconnected via a network. The distributed system 101 may be a distributed file storage system. For ease of description, these devices or nodes in the distributed system 101 are also collectively referred to as devices or nodes 110. On each node 110, a plurality of work tasks 130-1, 130-2, ..., 130-M (hereinafter collectively referred to as work tasks 130) and a control task are run. Figure 1 As shown, the node 110-1 has a control task 120-1, the node 110-2 has a control task 120-2, ..., the node 110-N has a control task 120-N. In the following embodiments, for ease of description, the control tasks 120-1, 120-2, ..., 120-N are sometimes collectively referred to as control tasks 120.

[0026] In the distributed system 101, there are many work tasks to be performed. In order to make full use of the resources in the distributed system, each work task has a different number of instances according to the different work contents to be performed, so as to be implemented on different nodes. Thus, a work task may be executed on one or more nodes. For example, work task 130-1 needs to be executed on 2 nodes at the same time, and at this time, 2 nodes 110-1 and 110-2 respectively have the authority to execute work task 130-1. For another example, work task 130-2 can be executed only on one node, and at this time only node 110-2 has the authority to execute work task 130-2. Taking the distributed file system as an example, a work task will download data from an external server every 30 seconds, and the work task can be executed only on one node.

[0027] In order to limit the number of nodes executing work tasks, locks are used in the distributed system to request multiple nodes 110 to execute the same work task 130 in parallel. When a node 110 needs to execute a work task 130, it needs to apply for permission from the distributed system. Only when the node 110 obtains the lock corresponding to the work task can it obtain the resources required to execute the work task, thereby executing the work task 130. For example, work task 130-1 requires two nodes to execute, so work task 130-1 corresponds to two locks A140-1 and 140-2. And work task 130-2 requires one node to execute, so it corresponds to one lock B 150. If a node has obtained the lock corresponding to a work task, it can execute the work task. If a node does not obtain the lock corresponding to a work task, the node needs to periodically request the lock corresponding to the work task at a certain frequency. The frequency can be different for different work tasks, resulting in different possibilities of obtaining the lock.

[0028] In some embodiments, the node 110-1 can collect resource usage information of other nodes 110-2...110-N in the distributed system 101, and send the collected resource usage information to each work task 130 on the node 110-1. The node 110-1 can perform the above collection process through the control task 120-1. The control task 120-1 can determine whether it is necessary to stop one or more work tasks on the node 110-1 based on the resource usage information. In an alternative embodiment, the work tasks 130 on the node 110-1 can also decide whether to continue to execute according to the resource usage information.

[0029] Figure 1 The number of nodes and the number of work tasks shown in are exemplary only and are not intended to be limiting. It should be understood that any suitable number of nodes and number of work tasks may be used. In addition, the example environment 100 is described with respect to the first node 110-1 for illustrative purposes only, and it is understood that the description of the first node 110-1 may be applied to any node in a distributed system.

[0030] The following will refer to Figure 2-Figure 7 The embodiments of the present disclosure are described in detail. Figure 2 FIG. 2 is a flow chart of a process 200 for load balancing according to an embodiment of the present disclosure. Figure 1 To describe process 200. For example, process 200 may be implemented at any node of distributed system 101, such as Figure 1 Node 110-1.

[0031] In block 210, resource usage information of multiple nodes 110 in the distributed system 101 is collected at the node 110-1, including resource usage information on the node 110-1 and resource usage information on other nodes 110-2 to 110-N. For example, the node 110-1 can collect resource usage information of the node 110-1 and other nodes 110-2 to 110-N. In some embodiments, the control task 120-1 running on the node 110-1 can periodically collect resource usage information of each node 110. In some embodiments, the resource usage information may include at least one of the following: storage resource availability and / or usage, dedicated processing resource availability (GPU) and / or usage, processing unit resource availability (CPU) and / or usage. For example, the control task 120-1 on the node 110-1 collects resource usage information such as memory availability, CPU availability, and disk availability of the node 110-1 and other nodes 110-2 to 110-N every 15 minutes. It can be understood that the resource usage information may include different status information of various resources required for the node 110 to perform tasks in the distributed system.

[0032] In some embodiments, the control task 120-1 may send resource usage information to each work task 130 on the node 110-1. For example, the control task 120-1 on the node 110-1 sends the collected resource usage information such as the available memory, available CPU, and available disk of each node 110 to each work task 130 on the node 110-1.

[0033] In block 220, node 110-1 may determine the work task to be stopped of node 110-1 (hereinafter referred to as the first work task for the convenience of description) based on the resource usage information, and node 110-1 has the authority to execute the first work task (hereinafter referred to as the first authority for the convenience of description). Figure 1As can be seen from the description, multiple work tasks 130 on node 110-1 can be in two states: a task execution state in which a lock (authority) has been obtained and a contention lock state in which a lock has not been obtained. For example, work task 130-1 on node 110-1 already has lock 140-1, so work task 130-1 is in a task execution state, and work task 130-2 does not have lock 150, so work task 130-2 is in a contention lock state and is competing for lock 150 at frequency B1160-1. Through contention locks, when some nodes fail and release the locks they have, other nodes can obtain the locks in time so that the work tasks on the failed nodes can continue to be executed without interruption. Only work tasks 130 that have obtained locks (for example, work tasks 130-1 on node 110-1) occupy the resources of the distributed system, and the resource consumption when in the contention lock state can be ignored compared to work tasks. Node 110-1 can select work task 130-1 in task execution state as the object that needs to be stopped based on resource usage information, because stopping work task 130-1 in task execution state can release more resources. In some embodiments, control task 120-1 on node 110-1 can determine the first work task of node 110-1 based on resource usage information. In some embodiments, control task 120-1 on node 110-1 can sort the available resources of multiple nodes in the distributed system from high to bottom based on resource usage information, and determine the first work task according to the ranking of node 110-1 among multiple nodes 110. For example, the last-ranked node 110 is used as the first work task. In some embodiments, control task 120-1 on node 110-1 can determine the available resources of node 110-1 and the average available resources of the system based on resource usage information, thereby determining the first work task based on the available resources and the average available resources. The following will be combined with reference Figure 3 An embodiment in which the control task 120 - 1 determines the first work task of the node 110 - 1 based on the resource usage information is described in detail.

[0034] In box 230, the first permission is released. Node 110-1 can make the selected first work task with permission release the first permission, thereby releasing the resources occupied by the work task. In some embodiments, the control task 120-1 on the node 110-1 can send a signal to notify the first work task 130-1 on the node 110-1 so that the first permission of the first work task is released. In some embodiments, the first work task 130-1 on the node 110-1 can release the first permission it has by itself.

[0035] By collecting resource usage information at each node in the distributed system, each node in the distributed system can dynamically migrate its load according to the resource usage status, so that the task load is distributed on the nodes as evenly as possible. In addition, since all nodes in the distributed system can undertake load balancing tasks, once an individual node fails or the workload is too heavy, other nodes can also perform effective load balancing according to the resource usage status.

[0036] Figure 3 FIG. 3 is a flowchart of a process 300 for determining a work task to be stopped based on resource usage information according to some embodiments of the present disclosure. Figure 1 1 to describe process 300. In such an example, process 300 may be performed by control task 120 on a target device (e.g., node 110), and process 300 is described with respect to control task 120-1 on node 110-1 for illustration purposes only. In some embodiments, process 300 may be viewed as a specific implementation of block 220 of process 200.

[0037] In block 310, the control task 120-1 on the node 110-1 determines the available resource amount of the node 110-1 from the resource usage information. The collected resource usage information includes various status information of various resources of the node 110-1. For example, the resource usage information may include the available amount of various resources of the node 110-1, the usage amount of various resources, etc. The control task 120-1 on the node 110-1 may extract the available resource amount of the node 110-1 from the resource usage information. For example, the available amount of memory, the available amount of CPU, and the available amount of disk of the node 110-1.

[0038] In box 320, the control task 120-1 on the node 110-1 determines the average available resource amount of the distributed system 101 based on the resource usage information. The collected resource usage information also includes various status information of various resources of other nodes 110-2 to 110-N. For example, the available memory, CPU available amount, and disk available amount of other nodes 110-2 to 110-N. The control task 120-1 on the node 110-1 can calculate the average available resource amount of the distributed system 101 based on the available amount of various resources of each node. For example, the average available memory, average available CPU, and average available disk of the distributed system 101 are calculated.

[0039] In box 330, the control task 120-1 on the node 110-1 determines the first work task from the multiple work tasks of the node 110-1 according to determining that the available resource amount of the node 110-1 is less than the average available resource amount. For example, the control task 120-1 on the node 110-1 compares the available resource amount of the node 110-1 with the average available resource amount of the distributed system 101. If the available resource amount of the node 110-1 is less than the average available resource amount, it can be determined that the available resources of the node 110-1 are relatively small relative to other nodes. In this case, the control task 120-1 on the node 110-1 can select one or more work tasks from the multiple work tasks of the node 110-1. The control task 120-1 can randomly select one or more of the multiple work tasks, or can select according to certain rules. For example, sort the multiple work tasks according to the required resource amount, select several work tasks that require more resources, or select several work tasks with high priority according to the priority of the work tasks. The work tasks with authority can be determined in the selected one or more work tasks, and stopping these work tasks with authority can reduce the task load on the node 110 - 1.

[0040] In such an embodiment, resource usage information is collected by the control task on each node, and some of the work tasks being executed are stopped according to the resource usage information, thereby releasing more resources, so that the work tasks on the nodes with insufficient resources are migrated to other nodes with good resource conditions. In this way, the resources in the distributed system can be used more effectively and the performance can be improved.

[0041] In some embodiments, the control task 120-1 on the node 110-1 may send a signal indicating to stop the first work task, so that the first work task is stopped. For example, the control task 120-1 on the node 110-1 may send a signal indicating to stop the work task with authority to one or more work tasks 130 selected from the plurality of work tasks of the node 110-1, so that the work task with authority is stopped.

[0042] In some embodiments, if the available resource amount of the node 110-1 is greater than or equal to the average available resource amount, it can be determined that the node 110-1 has more available resources than other nodes. In this case, the control task 120-1 on the node 110-1 can send resource usage information to each work task 130 on the node 110-1, so that the work task 130 can perform load balancing based on the resource usage information and the resources required by the work task 130.

[0043] Figure 4FIG. 2 is a flow chart of a process 200 for load balancing according to an embodiment of the present disclosure. Figure 1 4. In such an example, the process 400 may be performed by the control task 120 on the target device (e.g., any one of the nodes 110), and the process 400 is described with respect to the control task 120-1 on the node 110-1 for the purpose of illustration only. In some embodiments, the process 400 may be regarded as a specific implementation of the load balancing process 200 implemented by the control task 120-1 on the node 110-1.

[0044] At block 410 , the control task 120 - 1 on the node 110 - 1 collects resource usage information for all nodes in the distributed system 101 .

[0045] At block 420 , the control task 120 - 1 on the node 110 - 1 may send resource usage information to the various worker tasks 130 on the node 110 - 1 .

[0046] At block 430 , the control task 120 - 1 on the node 110 - 1 determines whether the resources on the node 110 - 1 are sufficient.

[0047] If in box 430, it is determined that the resources on node 110-1 are insufficient, then in box 440, the control task 120-1 on node 110-1 selects one or more work tasks from the multiple work tasks 130 on node 110-1, and in box 450, the control task 120-1 on node 110-1 sends a signal to the selected one or more work tasks to instruct to stop the first work task, so that the first work task is stopped.

[0048] Since resource usage in a distributed system changes in real time, process 400 is executed periodically so that node 110 can perform load balancing based on the latest resource usage information.

[0049] In some embodiments, box 220 in process 200 can determine the first work task respectively by each work task 130 on node 110-1. An embodiment of the work task 130 determining the first work task of node 110-1 based on resource usage information will be described in detail below.

[0050] The control task 120-1 on the node 110-1 may send resource usage information to the multiple work tasks 130 on the node 110-1, so that the first work task is determined from the multiple work tasks based on the resource usage information. After collecting the resource usage information of the multiple nodes 110 in the distributed system 101, the control task 120-1 on the node 110-1 may directly send the resource usage information to each work task 130 on the node 110-1 without performing any operation. Each work task 130 may determine the first work task based on the resource usage information and the available resources of the node 110-1.

[0051] In some embodiments, each work task 130 can use this information based on the resource to calculate the average available resource amount of the distributed system 101, and compare the average available resource amount with the available resource amount of the node 110-1. During the comparison, since the resource types required by each work task are different, for example, some work tasks need to occupy a large amount of CPU resources, and some work tasks need to consume a large amount of memory, each work task 130 can compare the different types of resource available amounts in the resource usage information. For example, the work task 130 of the work task that needs to occupy a large amount of CPU resources can compare the CPU available amount with the average CPU available amount. If the CPU available amount is less than the average CPU available amount, the work task corresponding to the work task 130 is determined as the first work task; and the work task 130 that needs to consume a large amount of memory can compare the memory available amount with the average memory available amount. If the memory available amount is less than the average memory available amount, the work task corresponding to the work task 130 is determined as the first work task. It can be understood that multiple resource available amounts can also be compared at the same time.

[0052] In such an embodiment, each work task on each node decides whether to stop based on the resource usage information, so that each work task can make a decision based on the specific resource that it is most concerned about. In this way, load balancing can be performed more flexibly, thereby further improving the efficiency of task execution.

[0053] In some embodiments, node 110-1 may also adjust the frequency of requesting the first permission based on the resource usage information. Figure 1As can be seen from the description, multiple work tasks 130 running on node 110-1 can be in two states: a task execution state in which a lock (authority) has been obtained and a contention lock state in which a lock has not been obtained. A work task 130 in the task execution state immediately changes to the contention lock state after releasing its authority. The first work task on node 110-1 can adjust the frequency of requesting the first authority based on resource usage information. When multiple nodes in a distributed system start working, they all contend for locks at a reference frequency. After node 110-1 collects resource usage information, each work task 130 on node 110-1 can determine the available amount of different resources of other nodes 110-2 to 110-M of the node based on the resource usage information, thereby determining the average available amount of different resources of the distributed system. In some embodiments, each work task 130 on node 110-1 can compare the available amount of the resource it is concerned about with the average available amount of the resource. If it is greater than the average available amount of resources, the frequency is adjusted to be above the reference frequency, and if it is less than the average available amount of resources, the frequency is adjusted to be below the reference frequency.

[0054] In this way, by changing the frequency with which stopped work tasks request locks, it is possible to ensure that work tasks on nodes with more resources are more likely to obtain permissions than work tasks on nodes with fewer resources, thereby further evenly distributing the task load on the nodes, thereby more efficiently utilizing resources in the distributed system.

[0055] Since the control task 120-1 on the node 110-1 sends a signal to the work task 130 of one or more work tasks selected from the multiple work tasks of the node 110-1 to instruct to stop the work task with authority, there are one or more work tasks that have not received the stop signal in the work tasks 130. In some embodiments, the node 110-1 can also determine the work task (hereinafter referred to as the second authority for the convenience of description) with authority (hereinafter referred to as the second authority for the convenience of description) among the one or more work tasks that have not received the stop signal.

[0056] Figure 5 FIG. 5 is a flowchart showing a process 500 of determining a work task to be stopped that has not received a stop signal based on resource usage information according to some embodiments of the present disclosure. Figure 1 The process 500 is described in detail. In such an example, the process 500 may be performed by each work task 130 on a target device (eg, any one of the nodes 110), and the process 500 is described with respect to the work task 130-1 on the node 110-1 for illustration purposes only.

[0057] In box 510, the work task 130-1 of the second work task with the second permission can release the second permission based on determining that the node 110-1 does not have the resources available to perform the second work task. In other words, for one or more work tasks that have not received a stop signal, each work task can determine whether it has permission. If it has permission, its corresponding work task 130 can release the second permission based on determining that the node 110-1 does not have the resources available to perform the second work task. Each work task 130 can use this information based on the resource and the amount of available resources on the node 110-1 to determine that the node 110-1 does not have the resources available to perform the second work task. The determination process is the same as the process by which the work task 130 determines the first work task, and will not be repeated here.

[0058] In block 520, the work task 130-1 on the node 110-1 may adjust the frequency of requesting the second permission based on the resource usage information. The process of adjusting the frequency is the same as the process of node 110-1 adjusting the frequency of requesting the first permission based on the resource usage information, which is not repeated here.

[0059] In this way, on the basis of load balancing performed by the control task, it is possible to further combine it with the load balancing performed by the work task, thereby further improving the efficiency of load balancing.

[0060] In some embodiments, for a work task 130 for which node 110-1 does not have the authority (hereinafter referred to as the third authority) to perform a work task (hereinafter referred to as the third work task for the convenience of description), node 110-1 may also adjust the frequency of requesting the third authority based on resource usage information. In other words, for a third work task other than the first work task that node 110-1 has not determined, if there is no authority, the third work task may adjust the frequency of requesting authority based on resource usage information. For example, the third work task may compare the available resources of node 110-1 with the average available resources. If it is higher than the average available resources, the frequency of the third work task is increased; otherwise, the frequency of the third work task is reduced.

[0061] In this way, by changing the frequency of contention locks of all non-privileged work tasks based on resource usage information, it is ensured that work tasks on nodes with more resources are more likely to obtain permissions than work tasks on nodes with fewer resources, thereby further making the task load evenly distributed on the nodes, thereby more efficiently utilizing resources in the distributed system.

[0062] Figure 6 FIG. 6 is a flow chart of a process 600 for load balancing according to an embodiment of the present disclosure. Figure 1The process 600 is described in detail. In such an example, the process 600 may be performed by each work task 130 on a target device (eg, any one of the nodes 110), and the process 600 is described with respect to the work task 130-1 on the node 110-1 for illustration purposes only.

[0063] In block 605, the work task 130-1 on the node 110-1 determines whether a signal instructing to stop the work task with authority is received from the control task 120-1. Since the control task 120-1 sends a signal instructing to stop the work task with authority to the work task 130 of one or more work tasks selected from the multiple work tasks of the node 110-1. Therefore, there are cases where the multiple work tasks 130 on the node 110-1 receive the signal instructing to stop the work task with authority and the case where the signal is not received.

[0064] If in box 605, it is determined that the work task 130-1 on the node 110-1 receives a signal instructing to stop the work task, then in box 625, the work task 130-1 on the node 110-1 releases the permission based on the determination that it has the permission, and then in box 630, the frequency of requesting permission is adjusted, and in box 635, permission is requested with the adjusted frequency, and in box 640, it is determined whether permission is obtained. If permission is obtained, in box 620, the work task 130-1 is executed, otherwise in box 645, the permission is requested again in box 635 based on the frequency waiting.

[0065] If in box 605, it is determined that the work task 130-1 on the node 110-1 has not received a signal instructing to stop the work task, then in box 610, the work task 130-1 on the node 110-1 determines whether it has the authority to execute the work task 130-1.

[0066] If at block 610, it is determined that the user has the authority to perform work task 130-1, then process 600 proceeds to block 615. Figure 6 In the illustrated embodiment, the control task 120-1 may send resource usage information about each node in the distributed system 101 to the work task 130-1. In block 615, the work task 130-1 determines whether there are resources available on the node 110-1 to execute the work task 130-1 based on the resource usage information.

[0067] If in box 615, it is determined that there are no resources available to execute work task 130-1, then in box 650, the permission is released, in box 630, the frequency of requesting permission is adjusted, and in box 635, permission is requested with the adjusted frequency, and in box 640, it is determined whether permission is obtained. If permission is obtained, work task 130-1 is executed in box 620, otherwise in box 645, wait according to the frequency and request permission again in box 635.

[0068] If it is determined in block 615 that there are resources available to execute the work task 130 - 1 , then execution of the work task 130 - 1 continues directly in block 620 .

[0069] Since resource usage in a distributed system changes in real time, process 600 is executed periodically so that node 110 can perform load balancing based on the latest resource usage information.

[0070] In some implementations, each work task on the node 110 - 1 may collect resource usage information of multiple nodes 110 in the distributed system 101 .

[0071] Figure 7 A schematic block diagram of an example device 700 that can be used to implement an embodiment of the present disclosure is shown. As shown, the device 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 702 or loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0072] A number of components in the device 700 are connected to the I / O interface 705, including: an input unit 706, such as a keyboard, a mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a disk, an optical disk, etc.; and a communication unit 709, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0073] The processing unit 701 performs the various methods and processes described above, such as any one of the processes 200, 300, 400, 500, and 600. For example, in some embodiments, any one of the processes 200, 300, 400, 500, and 600 may be implemented as a computer software program or a computer program product, which is tangibly contained in a machine-readable medium, such as a storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the CPU 701, one or more steps of any one of the processes 200, 300, 400, 500, and 600 described above may be performed. Alternatively, in other embodiments, the CPU 701 may be configured to perform any one of the processes 200, 300, 400, 500, and 600 by any other suitable means (e.g., by means of firmware).

[0074] According to some embodiments of the present disclosure, a computer readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method according to the present disclosure is implemented.

[0075] Those skilled in the art should understand that the various steps of the method disclosed above can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, optionally, they can be implemented with program codes executable by the computing device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present disclosure is not limited to any specific combination of hardware and software.

[0076] It should be understood that although several devices or sub-devices of the device are mentioned in the detailed description above, this division is only exemplary and not mandatory. In fact, according to an embodiment of the present disclosure, the features and functions of two or more devices described above can be embodied in one device. Conversely, the features and functions of one device described above can be further divided into multiple devices to be embodied.

[0077] The above description is only an optional embodiment of the present disclosure and is not intended to limit the present disclosure. For those skilled in the art, the present disclosure may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A method for load balancing, comprising: Collecting resource usage information of multiple devices in the distributed system at a target device in the distributed system, wherein the target device has multiple work tasks, and the resource usage information of the target device indicates a total available resource amount of the target device, wherein the total available resource amount includes resource amounts of multiple types; Determining a first work task to be stopped of the target device based on the resource usage information, where the target device has a first permission to execute the first work task, includes: Sending the resource usage information of the multiple devices to the multiple work tasks on the target device; Determining, by the plurality of work tasks, an average resource amount of each type and work tasks corresponding to the resource amount of each type according to the resource usage information of the plurality of devices; In response to the amount of resources of the first type in the total available resources of the target device being less than the average amount of resources of the first type, the plurality of work tasks determine a work task corresponding to the resources of the first type as the first work task; causing the first permission to be released; and Based on the resource usage information, a frequency of requesting the first permission is adjusted.

2. The method according to claim 1, wherein the target device has a second permission to perform a second work task among the plurality of work tasks, and the method further comprises: Releasing the second permission according to determining that the target device does not have resources available to perform the second work task; as well as Based on the resource usage information, a frequency of requesting the second permission is adjusted.

3. The method according to claim 1, wherein the target device does not have a third permission to perform a third work task, and the method further comprises: Based on the resource usage information, a frequency of requesting the third permission is adjusted.

4. The method according to claim 1, wherein the resource usage information includes at least one of the following: storage resource availability, dedicated processing resource availability, processing unit resource availability, storage resource usage, dedicated processing resource usage, and processing unit resource usage.

5. The method according to claim 1, further comprising: A signal instructing to stop the first work task is sent, so that the first work task is stopped.

6. An electronic device comprising: processor; as well as a memory coupled to the processor, the memory having instructions stored therein, the instructions, when executed by the processor, causing the device to perform actions, the actions comprising: Collecting resource usage information of multiple devices in a distributed system, wherein the electronic device has multiple work tasks, and the resource usage information of the electronic device indicates the total available resources of the electronic device, and the total available resources include resources of multiple types; Determining a first work task of the electronic device to be stopped based on the resource usage information, where the electronic device has a first permission to execute the first work task, includes: Sending the resource usage information of the multiple devices to the multiple work tasks on the electronic device; Determining, by the plurality of work tasks, an average resource amount of each type and a work task corresponding to each type according to the resource usage information of the plurality of devices; In response to the amount of resources of the first type in the total available resources of the electronic device being less than the average amount of resources of the first type, the plurality of work tasks determine a work task corresponding to the resources of the first type as the first work task; causing the first permission to be released; and Based on the resource usage information, a frequency of requesting the first permission is adjusted.

7. The device according to claim 6, wherein the electronic device has a second permission to perform a second work task among the plurality of work tasks, and the action further comprises: Releasing the second permission according to determining that the electronic device does not have resources available to perform the second work task; as well as Based on the resource usage information, a frequency of requesting the second permission is adjusted.

8. The device according to claim 6, wherein the electronic device does not have a third permission to perform a third work task, and the action further comprises: Based on the resource usage information, a frequency of requesting the third permission is adjusted.

9. The apparatus of claim 6, wherein the resource usage information comprises at least one of: storage resource availability, dedicated processing resource availability, processing unit resource availability, storage resource usage, dedicated processing resource usage, and processing unit resource usage.

10. The device of claim 6, wherein the actions further comprise: A signal instructing to stop the first work task is sent, so that the first work task is stopped.

11. A computer program product tangibly stored on a computer readable medium and comprising machine executable instructions which, when executed, cause a machine to perform the method according to any one of claims 1 to 5.