Task allocation method and device, computer equipment and readable storage medium
By calculating the reference average task resources and proportion of candidate nodes, the node load can be accurately assessed, which solves the problem of resource imbalance in task allocation and improves processing efficiency and stability.
Patent Information
- Application Number
- CN202510823869.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-19
- Publication Date
- 2025-10-10
AI Technical Summary
Existing task allocation methods cannot accurately understand the load of each node, resulting in low task processing efficiency and uneven resource utilization. Especially in scenarios of high concurrent access and large-scale data operations, some nodes are overloaded while other node resources are idle.
By obtaining the target task and candidate node set, calculating the reference average task resources and current average task resources of the candidate node, determining the reference task resource ratio and the uniformity of resource distribution, and fusing them to obtain the reference node load of the candidate node, we can accurately evaluate and allocate tasks to achieve load balancing.
It achieves effective task allocation, avoids node overload, improves processing performance and stability, and ensures resource demand and load balancing.
Smart Images

Figure CN120762883A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a task allocation method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] In modern data centers and cloud computing environments, the design and implementation of distributed systems has become a key technology. Distributed systems rationally distribute tasks across multiple nodes for processing, achieving high availability (HA), reliability, and scalability of task services. However, in actual deployments, the random selection of nodes or resources can lead to uneven distribution of task loads across nodes, impacting overall system performance. For example, in scenarios with high concurrent access and large-scale data operations, uneven task distribution can cause some nodes to be overloaded while other nodes remain idle, leading to uneven resource utilization and performance bottlenecks.
[0003] Existing task allocation methods typically select nodes for task allocation based on the statistical values of a single factor (such as memory or disk capacity) to ensure load balancing. However, these traditional methods allocate tasks based on statistical data at runtime, failing to accurately understand the load of each node for task allocation, resulting in low task processing efficiency. Summary of the Invention
[0004] Based on this, it is necessary to provide a task allocation method, device, computer equipment, computer-readable storage medium and computer program product that can effectively evaluate node load, accurately allocate tasks and improve task processing efficiency in response to the above technical problems.
[0005] In a first aspect, the present application provides a task allocation method, comprising:
[0006] Get the target task and candidate node set;
[0007] Based on the target task, the task resource is calculated for the current node information corresponding to the current candidate node in the candidate node set to obtain the reference average task resource corresponding to the current candidate node;
[0008] Obtain the current average task resources corresponding to other candidate nodes in the candidate node set, and determine the proportion of reference task resources corresponding to the current candidate node based on the reference average task resources and the current average task resources;
[0009] Based on the difference between the reference average task resources and the current average task resources, determine the uniformity of the reference resource distribution corresponding to the candidate node set;
[0010] The reference node load corresponding to the current candidate node is obtained by integrating the uniformity of reference resource distribution and the proportion of reference task resources;
[0011] Based on the reference node loads corresponding to each candidate node, the target node corresponding to the target task is determined from the candidate node set.
[0012] In a second aspect, the present application further provides a task allocation device, comprising:
[0013] Acquisition module, used to obtain target tasks and candidate node sets;
[0014] The task resource calculation module is used to calculate the task resources for the current node information corresponding to the current candidate node in the candidate node set based on the target task, and obtain the reference average task resources corresponding to the current candidate node;
[0015] The resource ratio calculation module is used to obtain the current average task resources corresponding to other candidate nodes in the candidate node set, and determine the reference task resource ratio corresponding to the current candidate node based on the reference average task resources and the current average task resources;
[0016] A resource distribution module is used to determine the uniformity of the reference resource distribution corresponding to the candidate node set based on the difference between the reference average task resources and the current average task resources;
[0017] The fusion module is used to fuse the reference resource distribution uniformity and the reference task resource ratio to obtain the reference node load corresponding to the current candidate node;
[0018] The task allocation module is used to determine the target node corresponding to the target task from the candidate node set based on the reference node load corresponding to each candidate node.
[0019] In a third aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0020] Get the target task and candidate node set;
[0021] Based on the target task, the task resource is calculated for the current node information corresponding to the current candidate node in the candidate node set to obtain the reference average task resource corresponding to the current candidate node;
[0022] Obtain the current average task resources corresponding to other candidate nodes in the candidate node set, and determine the proportion of reference task resources corresponding to the current candidate node based on the reference average task resources and the current average task resources;
[0023] determine the reference resource distribution uniformity of the candidate node set based on the difference between the reference average task resource and the current average task resource;
[0024] obtain the reference node load of the current candidate node by fusing the reference resource distribution uniformity and the reference task resource proportion;
[0025] determine the target node corresponding to the target task from the candidate node set based on the reference node load of each candidate node.
[0026] In a fourth aspect, the present application further provides a computer readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the following steps:
[0027] obtain the target task and the candidate node set;
[0028] perform task resource calculation on the current node information of the current candidate node in the candidate node set based on the target task, to obtain the reference average task resource of the current candidate node;
[0029] obtain the current average task resource of other candidate nodes in the candidate node set, and determine the reference task resource proportion of the current candidate node based on the reference average task resource and the current average task resource;
[0030] determine the reference resource distribution uniformity of the candidate node set based on the difference between the reference average task resource and the current average task resource;
[0031] obtain the reference node load of the current candidate node by fusing the reference resource distribution uniformity and the reference task resource proportion;
[0032] determine the target node corresponding to the target task from the candidate node set based on the reference node load of each candidate node.
[0033] In a fifth aspect, the present application further provides a computer program product comprising a computer program, the computer program being executed by a processor to implement the following steps:
[0034] obtain the target task and the candidate node set;
[0035] perform task resource calculation on the current node information of the current candidate node in the candidate node set based on the target task, to obtain the reference average task resource of the current candidate node;
[0036] obtain the current average task resource of other candidate nodes in the candidate node set, and determine the reference task resource proportion of the current candidate node based on the reference average task resource and the current average task resource;
[0037] Based on the difference between the reference average task resources and the current average task resources, determine the uniformity of the reference resource distribution corresponding to the candidate node set;
[0038] The reference node load corresponding to the current candidate node is obtained by integrating the uniformity of reference resource distribution and the proportion of reference task resources;
[0039] Based on the reference node loads corresponding to each candidate node, the target node corresponding to the target task is determined from the candidate node set.
[0040] The above-mentioned task allocation method, apparatus, computer device, computer-readable storage medium, and computer program product, after obtaining the target task, calculates the task resources for the current node information corresponding to the current candidate node in the candidate node set to obtain the reference average task resources corresponding to the current candidate node, and can calculate the average task resources of the current candidate node if the target task is added. Then, based on the reference average task resources of the current candidate node and the current average task resources of other candidate nodes, the proportion of the task resources of the current candidate node if the target task is added relative to the reference task resources of the candidate node set is determined, and based on the difference between the reference average task resources and the current average task resources, the degree of uniformity of the distribution of the reference resources corresponding to the candidate node set is determined. This can accurately evaluate the load balancing of each candidate node in the candidate node set if the target task is assigned to the current candidate node, thereby achieving accurate estimation of the load of the candidate node set.
[0041] Then, by fusing the reference distribution uniformity and the reference task resource ratio, the reference node load corresponding to the current candidate node is obtained. This allows the accurate determination of the load of the current candidate node when the target task is assigned to the current candidate node under the load balancing condition of the evaluated set of candidate nodes. After calculating the reference node load of each candidate node, the target node is determined based on the reference node load of each candidate node, and then the target task is assigned to the target node. This ensures that the target node is a node that meets the resource requirements of the target task and can also meet the load balancing requirements after adding a new target task, thereby achieving effective allocation of target tasks and improving task processing efficiency. Furthermore, by effectively allocating target tasks, node overload can be avoided, and the processing performance and stability of the node can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments of the present application or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying any creative work.
[0043] Figure 1 An application environment diagram of a task allocation method in an embodiment;
[0044] Figure 2 A flowchart of a task allocation method in an embodiment;
[0045] Figure 3 A diagram of task distribution in an embodiment;
[0046] Figure 4 A flowchart of a task allocation method in another embodiment;
[0047] Figure 5 A flowchart of a specific task allocation in an embodiment;
[0048] Figure 6 A flowchart of a multi-priority task allocation in an embodiment;
[0049] Figure 7 A structural block diagram of a task allocation apparatus in an embodiment;
[0050] Figure 8 An internal structure diagram of a computer device in an embodiment;
[0051] Figure 9 An internal structure diagram of a computer device in another embodiment. DETAILED DESCRIPTION
[0052] In order to make the purposes, technical solutions and advantages of the present application clearer, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and should not be used to limit the present application.
[0053] The task allocation method provided by the embodiments of the present application can be applied in an application environment as shown in FIG. 1. Figure 1 In the application environment, a terminal 102 communicates with a distributed system 104 through a network. The distributed system 104 is composed of various system nodes. In the distributed system 104, there is a management node 106, which is used to coordinate, monitor and manage the operation of the distributed system 104, such as performing task allocation, etc. The management node 106 can be an external server of the distributed system 104, or a management node shared by other distributed systems, or a randomly selected node among the various system nodes of the distributed system 104. A data storage system can store data to be processed by the distributed system 104. The data storage system can be integrated on the distributed system 104, or placed on a cloud or other network server.
[0054] In an exemplary embodiment, the management node 106 in the distributed system 104 obtains the target task sent by the terminal 102 through network communication and obtains the candidate node set corresponding to the distributed system 104; based on the target task, the management node 106 calculates the task resource for the current node information corresponding to the current candidate node in the candidate node set to obtain the reference average task resource corresponding to the current candidate node; the management node 106 obtains the current average task resource corresponding to other candidate nodes in the candidate node set, and determines the reference task resource ratio corresponding to the current candidate node based on the reference average task resource and the current average task resource; the management node 106 determines the uniformity of the reference resource distribution corresponding to the candidate node set based on the difference between the reference average task resource and the current average task resource; the management node 106 combines the reference resource distribution uniformity and the reference task resource ratio to obtain the reference node load corresponding to the current candidate node; the management node 106 determines the target node corresponding to the target task from the candidate node set based on the reference node load corresponding to each candidate node. The terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablets, IoT devices, and portable wearable devices. The IoT devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, projectors, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. Head-mounted devices can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. Distributed system 104 can be a server cluster consisting of multiple physical servers, or a cloud server providing cloud computing services. Management node 106 can be an independent physical server.
[0055] In an exemplary embodiment, Figure 2 As shown, a task allocation method is provided, which is applied to Figure 1 The following steps are used as an example to illustrate the management node in the example:
[0056] Step 202: Obtain the target task and the candidate node set.
[0057] Step 204 : Based on the target task, the task resource calculation is performed on the current node information corresponding to the current candidate node in the candidate node set to obtain a reference average task resource corresponding to the current candidate node.
[0058] The target task refers to the task currently being processed. The candidate node set refers to the set of nodes that are candidates for processing the target task. The current candidate node refers to any candidate node in the candidate node set. Current node information includes the currently available resources and task information of the currently configured node. Task information can be task information after the target task is pre-assigned to the currently configured node. The reference average task resources refer to the average resources required for each task, calculated based on the currently available resources of the currently configured node.
[0059] For example, a client sends a task request to a distributed system, such as a query request or a web page generation request. The distributed system receives the task request through a management node, generates a target task, and performs load-balancing task allocation on the target task. The management node considers each system node in the distributed system as a candidate node set. The candidate node set includes each candidate node, which can be a node in the distributed system that can provide services.
[0060] The management node selects any candidate node in the candidate node set as the current candidate node and pre-assigns the target task to the current candidate node. This can be used to evaluate whether the overall load of the distributed system is balanced after the current candidate node is pre-assigned the target task. The management node obtains the current node information corresponding to the current candidate node. The current node information includes the current candidate node's available resources, such as memory, communication traffic, and other resources, as well as the current task information of the current candidate node. The current task information can be the task information of the current candidate node that contains the target task (i.e., including the information and task quantity of the current candidate node's assigned and pre-assigned tasks). When pre-assigning the target task to the current candidate node, the management node calculates the average resources of each task based on the current candidate node's task information and available resources to obtain a reference average task resource corresponding to the current candidate node. For example, the ratio of the current candidate node's available resources to the number of tasks is calculated to obtain the reference average task resource corresponding to the current candidate node.
[0061] Step 206 , obtaining the current average task resources corresponding to other candidate nodes in the candidate node set, and determining the reference task resource ratio corresponding to the current candidate node based on the reference average task resources and the current average task resources.
[0062] The current average task resources refer to the average resources required for each task, calculated based on the currently available resources of other candidate nodes. The reference task resource ratio refers to the ratio of the reference average task resources in the candidate node cluster after the target task is pre-assigned to the current candidate node.
[0063] Exemplarily, the management node obtains the current average task resources of other candidate nodes in the candidate node set except the current candidate node. This may be the case where the management node, without pre-allocating the target task to other candidate nodes, calculates the average resources of each task of other candidate nodes based on the task information (including the assigned task information and task amount of other candidate nodes) and available resources in the corresponding node information of other candidate nodes to obtain the current average task resources of other candidate nodes. The management node then calculates the reference task resource ratio corresponding to the current candidate node based on the reference average task resources of the current candidate node and the current average task resources of each other candidate node. Specifically, the management node may calculate the sum of the reference average task resources of the current candidate node and the current average task resources of each other candidate node to obtain the total average task resources of the candidate node set, and then calculates the ratio of the reference average task resources to the total average task resources to obtain the reference task resource ratio of the current candidate node relative to the candidate node set.
[0064] Step 208 : Determine the uniformity of distribution of reference resources corresponding to the candidate node set based on the difference between the reference average task resources and the current average task resources.
[0065] The uniformity of reference resource distribution can be understood as the average distribution of task resources of the candidate node set after the current candidate node is pre-assigned the target task. It is an indicator used to measure the load balance of the candidate node set after the current candidate node is pre-assigned the target task.
[0066] Exemplarily, the management node calculates the average value of the average task resources based on the reference average task resources of the current candidate node and the current average task resources of each other candidate node (the reference average task resources and the current average task resources may be collectively referred to as the average task resources), and determines the degree of dispersion of the average task resources in the candidate node set when pre-assigning the target task to the current candidate node based on the differences between the reference average task resources of the current candidate node and the current average task resources of each other candidate node and the average value of the average task resources, and obtains the degree of uniform distribution of the initial resources corresponding to the current candidate node. For example, the greater the degree of uniform distribution of the initial resources of the candidate node set, the more uneven the distribution of the average task resources of the candidate node set will be after the target task is pre-assigned to the current candidate node.
[0067] The management node then takes each other candidate node in the candidate node set as the current candidate node pre-assigned with the target task in turn, returns to the step of calculating the task resources for the current node information corresponding to the current candidate node in the candidate node set based on the target task, and obtains the reference average task resources corresponding to the current candidate node, until the initial resource uniformity corresponding to each other candidate node is obtained.
[0068] The management node calculates the average value of the initial resource uniformity distribution degrees according to the initial resource uniformity distribution degrees corresponding to the current candidate node and other candidate nodes, and determines the degree of dispersion of the initial resource uniformity distribution degrees in the candidate node set from the average value according to the initial resource uniformity distribution degrees and the calculated average value, and obtains the reference resource distribution uniformity degree corresponding to the candidate node set. For example, the smaller the reference resource distribution uniformity degree, the more uniform the initial resource uniformity degree of each candidate node. Accordingly, the selection of any candidate node has a smaller impact on the dispersion degree of the entire candidate node set.
[0069] Step 210 : The reference resource distribution uniformity and the reference task resource ratio are integrated to obtain the reference node load corresponding to the current candidate node.
[0070] The reference node load refers to an indicator used to measure the load condition of the current candidate node under load balancing based on the candidate node set after the current candidate node is pre-assigned with the target task.
[0071] For example, if the current candidate node includes available resources corresponding to multiple resource types, the reference task resource ratio includes the reference task resource ratio corresponding to each resource classification. The management node calculates the fusion weight corresponding to each resource type based on the uniformity of the reference resource distribution. Based on the fusion weight corresponding to each resource type, the management node performs a weighted fusion of the reference task resource ratios corresponding to each resource type to obtain the reference node load corresponding to the current candidate node.
[0072] Step 212 : Based on the reference node loads corresponding to the candidate nodes, determine the target node corresponding to the target task from the candidate node set.
[0073] Exemplarily, the management node sequentially selects each other candidate node in the candidate node set as the current candidate node, pre-assigns the target task to the current candidate node, returns to the step of calculating the task resources for the current node information corresponding to the current candidate node in the candidate node set based on the target task, and obtains the reference average task resource corresponding to the current candidate node. In the process of obtaining the degree of uniform distribution of the initial resources corresponding to each other candidate node, the reference task resource ratio of each resource type corresponding to each other candidate node can be obtained. The management node then calculates the fusion weight of each resource type corresponding to each other candidate node according to the uniformity of the reference resource distribution, and performs weighted fusion based on the fusion weight of each resource type corresponding to each other candidate node and the reference task resource ratio to obtain the reference node load corresponding to each other candidate node.
[0074] The management node determines the target node from each candidate node based on its corresponding reference node load. Generally, the candidate node with the lowest reference node load is selected as the target node. This means that if the target task is pre-assigned to the target node, the target node's load value is minimized and meets the load balancing requirements of the distributed system. After determining the target node, the management node assigns the target task to the target node for processing and returns the processing node to the client.
[0075] In an exemplary embodiment, the management node may add certain disturbances to the intermediate calculation results and reference node loads of each candidate node in the process of calculating the reference node loads of each candidate node, such as adding a random value to each result within a certain proportion range. Taking 5% as an example, the calculation result is multiplied by a random value between (95%, 105%).
[0076] In the above-mentioned task allocation method, after obtaining the target task, the task resource calculation is performed on the current node information corresponding to the current candidate node in the candidate node set to obtain the reference average task resource corresponding to the current candidate node. This allows the calculation of the average task resource of the current candidate node if the target task is added. Then, based on the reference average task resource of the current candidate node and the current average task resource of other candidate nodes, the proportion of the task resource of the current candidate node if the target task is added relative to the reference task resource of the candidate node set is determined. Based on the difference between the reference average task resource and the current average task resource, the uniformity of the distribution of the reference resource corresponding to the candidate node set is determined. This allows the accurate assessment of the load balancing of each candidate node in the candidate node set if the target task is assigned to the current candidate node, thereby achieving an accurate estimation of the load of the candidate node set.
[0077] Then, by fusing the reference distribution uniformity and the reference task resource ratio, the reference node load corresponding to the current candidate node is obtained. This allows the accurate determination of the load of the current candidate node when the target task is assigned to the current candidate node under the load balancing condition of the evaluated set of candidate nodes. After calculating the reference node load of each candidate node, the target node is determined based on the reference node load of each candidate node, and then the target task is assigned to the target node. This ensures that the target node is a node that meets the resource requirements of the target task and can also meet the load balancing requirements after adding a new target task, thereby achieving effective allocation of target tasks and improving task processing efficiency. Furthermore, by effectively allocating target tasks, node overload can be avoided, and the processing performance and stability of the node can be improved.
[0078] In an exemplary embodiment, the task allocation method further includes the following steps:
[0079] The candidate nodes other than the target master node in the candidate node set are combined into an update node set, and the updated node set is used as the candidate node set. The target task is returned, and the task resource calculation is performed on the current node information corresponding to the current candidate node in the candidate node set. The steps of obtaining the reference average task resource corresponding to the current candidate node are executed until the updated target node is obtained.
[0080] The updated target node is used as the target sub-node corresponding to the target task.
[0081] The target secondary node is a backup node for the target primary node. It is used to continue executing tasks interrupted by the target primary node if the target primary node encounters an exception and is unable to execute tasks. The target primary node is the node associated with a task and has priority for executing that task.
[0082] Exemplarily, after the management node assigns the target task to the target node, the target node to which the target task is assigned for the first time is used as the target primary node corresponding to the target task. In order to prevent the target primary node from being unable to execute the task due to an exception, it is also necessary to select a target secondary node from the other candidate nodes in the candidate node set except the target primary node. Specifically, the other candidate nodes in the candidate node set except the target primary node are composed into an updated node set, and the updated node set is used as the candidate node set. The task resource calculation is performed on the current node information corresponding to the current candidate node in the candidate node set based on the target task, and the step of obtaining the reference average task resource corresponding to the current candidate node is performed until the updated target node is obtained, and the updated target node is used as the target secondary node corresponding to the target task. When at least one target secondary node is required, the next target secondary node is selected from the other candidate nodes in the candidate node set except the target primary node and the selected target secondary node until a sufficient number of target secondary nodes are selected. Among them, the target secondary node can be understood as a node with the smallest load in the candidate node set except the target primary node and which meets the load balancing requirements of the distributed system when continuing to execute the target task.
[0083] The management node then sends the node identifier of the selected target sub-node to the target master node, so that the target master node communicates with the target sub-node based on the node identifier, and backs up the target task locally to obtain a backup task, and sends the backup task to the target sub-node. When the task is executed, the target master node will synchronize the task execution progress with the target sub-node, so that after the target master node fails, it can trigger the target sub-node to execute the task according to the failure location of the target master node.
[0084] In an exemplary embodiment, Figure 3 As shown in , a schematic diagram of task distribution is provided. Figure 3The distributed system consists of five nodes: A, B, C, D, and E, and four assigned tasks: Tasks 1, 2, 3, and 4. Among them, one master node corresponds to one or two slave nodes, namely the backup node with the first priority and the backup node with the second priority. Figure 3 In the example, the primary node, first-priority backup node, and second-priority backup node for Task 1 are nodes A, B, and C, respectively. The primary node, first-priority backup node, and second-priority backup node for Task 2 are nodes B, C, and D, respectively. The primary node and first-priority backup node for Task 3 are nodes C and E, respectively. The primary node and first-priority backup node for Task 4 are nodes D and B, respectively. Therefore, node B is both the primary node for Task 2 and the first-priority backup node for Tasks 1 and 4. Node C is both the primary node for Task 3, the first-priority backup node for Task 2, and the second-priority backup node for Task 1.
[0085] In this embodiment, after determining the target primary node, a target secondary node is selected from other candidate nodes in the candidate node set, and the target secondary node is used as a backup node for the target primary node, thereby ensuring the security of task execution and improving task execution efficiency.
[0086] In an exemplary embodiment, Figure 4 As shown, step 208, based on the difference between the reference average task resources and the current average task resources, determines the uniformity of the reference resource distribution corresponding to the candidate node set, including:
[0087] Step 402: Calculate an average value based on the reference average task resources and the current average task resources to obtain a first task resource statistic corresponding to the candidate node set;
[0088] Step 404: Calculate the standard deviation based on the reference average task resources and the current average task resources to obtain a second task resource statistic corresponding to the candidate node set;
[0089] Step 406 : Based on the difference between the first task resource statistics and the second task resource statistics, obtain the uniformity of reference resource distribution corresponding to the candidate node set.
[0090] The first task resource statistics value refers to the average value calculated by the reference average task resource and the current average task resource, and the second task resource statistics value refers to the standard deviation calculated by the reference average task resource and the current average task resource.
[0091] Exemplarily, the management node calculates a sum of the reference average task resource and the current average task resource to obtain an average task resource sum, and then calculates a ratio of the average task resource sum to a number of nodes of each candidate node (including the current candidate node and other candidate nodes) to obtain a first task resource statistical value. Then, a standard deviation is calculated according to a deviation between the reference average task resource and the current average task resource and the first task resource statistical value to obtain a second task resource statistical value, and according to a difference between the first task resource statistical value and the second task resource statistical value, which can be a ratio of the second task resource statistical value to the first task resource statistical value, an initial resource distribution uniformity degree corresponding to the candidate node set is obtained. The calculation of the initial resource distribution uniformity degree is shown in formulas (1)-(3).
[0092]
[0093] wherein, is a dimensionless quantity, representing an initial resource distribution uniformity degree corresponding to the current candidate node i, which can be understood as a coefficient of variation of the candidate node set after the target task is pre-assigned to the current candidate node i; represents the second task resource statistical value corresponding to the current candidate node i; represents the first task resource statistical value corresponding to the current candidate node i; and N represents a number of nodes of each candidate node. represents a current average task resource of the other candidate node k; represents a reference average task resource of the current candidate node i.
[0094] Then, the initial resource distribution uniformity degrees corresponding to each of the other candidate nodes when the target task is pre-assigned to the other candidate nodes are obtained, and a ratio between a standard deviation and an average value of each initial resource distribution uniformity degree is calculated to obtain a reference resource distribution uniformity degree corresponding to the candidate node set.
[0095] In the present example, by calculating the reference resource distribution uniformity degree corresponding to the candidate node set, the distribution uniformity of the average task resource of the candidate node set can be reflected, and then the load balancing situation of the candidate node set is embodied, so as to perform task allocation according to the load balancing situation of the candidate node set, thereby ensuring the accuracy of task allocation.
[0096] In one exemplary embodiment, step 306, based on the difference between the first task resource statistical value and the second task resource statistical value, the reference resource distribution uniformity degree corresponding to the candidate node set is obtained, including:
[0097] Based on the difference between the first task resource statistical value and the second task resource statistical value, an initial resource distribution uniformity degree corresponding to the candidate node set when the target task is pre-assigned to the current candidate node is obtained;
[0098] Obtain the initial resource distribution uniformity of the candidate node set when pre-allocating the target task to other candidate nodes;
[0099] Calculate the average value based on the uniformity of the initial resource distribution and obtain the third task resource statistics corresponding to the candidate node set;
[0100] Calculate the standard deviation based on the uniformity of the initial resource distribution and obtain the resource statistics of the fourth task corresponding to the candidate node set;
[0101] Based on the difference between the third task resource statistical value and the fourth task resource statistical value, the uniformity of reference resource distribution corresponding to the candidate node set is obtained.
[0102] The third task resource statistic is an average value calculated from the uniformity of the distribution of each initial resource. The fourth task resource statistic is a standard deviation calculated from the uniformity of the distribution of each initial resource.
[0103] Exemplarily, the management node calculates the ratio of the second task resource statistic to the first task resource statistic to obtain the initial resource distribution uniformity corresponding to the candidate node set when the target task is pre-assigned to the current candidate node. The management node then sequentially uses each other candidate node in the candidate node set as the current candidate node to which the target task is pre-assigned, and returns to the step of performing task resource calculation on the current node information corresponding to the current candidate node in the candidate node set based on the target task to obtain the reference average task resource corresponding to the current candidate node, until the initial resource distribution uniformity corresponding to the candidate node set when the target task is pre-assigned to other candidate nodes is obtained.
[0104] The management node calculates the average value of the initial resource distribution uniformity to obtain the third task resource statistics corresponding to the candidate node set. It also calculates the standard deviation of the initial resource distribution uniformity to obtain the fourth task resource statistics corresponding to the candidate node set. The ratio of the fourth task resource statistics to the third task resource statistics is then calculated to obtain the reference resource distribution uniformity corresponding to the candidate node set. The calculation of the reference resource distribution uniformity is shown in Formula (4).
[0105]
[0106] in, The reference resource distribution uniformity is obtained by calculating the coefficient of variation again for the initial resource distribution uniformity corresponding to each candidate node, which can be expressed as the quadratic coefficient of variation; Indicates the resource statistics of the fourth task; Indicates the resource statistics of the third task.
[0107] In this example, by calculating the uniformity of the reference resource distribution corresponding to the candidate node set, the uniformity of the average task resource distribution of the candidate node set can be reflected, and then the load balance of the candidate node set can be reflected, so that tasks can be allocated according to the load balance of the candidate node set, ensuring the accuracy of task allocation.
[0108] In an exemplary embodiment, the current node information includes node resources corresponding to at least two resource types; the reference task resource ratio includes the reference task resource ratio corresponding to each resource type; the reference resource distribution uniformity includes the reference resource distribution uniformity corresponding to each resource type;
[0109] Step 210, integrating the reference resource distribution uniformity and the reference task resource ratio to obtain the reference node load corresponding to the current candidate node, including:
[0110] Based on the uniformity of the reference resource distribution corresponding to each resource type, the fusion weight corresponding to each resource type is determined;
[0111] Based on the fusion weight, the reference task resource proportions corresponding to each resource type are fused to obtain the reference node load corresponding to the current candidate node.
[0112] For example, the calculation of the reference task resource ratio is shown in formula (5).
[0113]
[0114] in, Indicates the reference task resource ratio of the current candidate node i.
[0115] Since the node information corresponding to each candidate node includes node resources corresponding to at least two resource types, such as memory capacity, outbound communication traffic, inbound communication traffic, and other resources, when the target task is pre-allocated to the current candidate node i: the reference task resource ratio corresponding to the current candidate node i also includes the reference task resource ratio corresponding to each resource type, such as the reference task resource ratio corresponding to resource types A, B, and C respectively: 、 、 The reference resource distribution uniformity also includes the reference resource distribution uniformity corresponding to each resource type, such as the reference resource distribution uniformity corresponding to resource types A, B, and C respectively: 、 、 Similarly, the initial resource distribution uniformity corresponding to resource types A, B, and C is: 、 、 ; The reference average task resources corresponding to resource types A, B, and C of the current candidate node i are: 、 、 ; The current average task resources corresponding to resource types A, B, and C of other candidate nodes k are: 、 、 .
[0116] After obtaining the reference resource distribution uniformity and reference task resource ratio corresponding to each resource type, the management node calculates the fusion weight corresponding to each resource type according to the reference resource distribution uniformity corresponding to each resource type. Taking resource types A, B, and C as examples, the fusion weight corresponding to resource type A is calculated as shown in formula (6).
[0117]
[0118] in, Indicates the fusion weight corresponding to resource type A.
[0119] The management node performs weighted fusion on the reference task resource proportions corresponding to each resource type based on the fusion weights corresponding to each resource type to obtain the reference node load corresponding to the current candidate node. Taking resource types A, B, and C as an example, the reference node load corresponding to the current candidate node i is calculated as shown in formula (7).
[0120] in, 、 、 They are the load factors of resource types A, B, and C, which are customizable weight adjustment parameters. Specifically, if, according to actual needs, a node resource of a certain resource type is determined not to participate in the calculation when selecting the target secondary node, the load factor corresponding to the resource type is set to 0. For example, when selecting the target secondary node, resource type B is not considered for calculation. , after setting the load factor corresponding to resource type B to zero, the reference node load corresponding to the current candidate node i is calculated as shown in formula (8).
[0121]
[0122] In this embodiment, by calculating the fusion weights corresponding to each resource type and obtaining the reference node load corresponding to the current candidate node based on the fusion weights, the weights of important resource types can be set according to actual needs, thereby achieving optimal resource configuration and improving overall efficiency.
[0123] In an exemplary embodiment, the task allocation method further includes:
[0124] Get the current master node task corresponding to the current candidate node, the current backup task corresponding to the current master node task, and the current slave node task;
[0125] Based on the outbound communication traffic corresponding to the current master node task and the current backup task, the current outbound communication traffic corresponding to the current candidate node is obtained;
[0126] Based on the incoming network communication flow corresponding to the current secondary node task, the current incoming network communication flow corresponding to the current candidate node is obtained;
[0127] Based on the current outgoing communication traffic and the current incoming communication traffic, the current node information corresponding to the current candidate node is obtained.
[0128] Among them, the current master node task refers to the task that needs to be executed first when the current candidate node is assigned as the master node, including the pre-assigned target task. The current backup task refers to the backup task that needs to back up the current master node task when the current candidate node is the target master node. The current secondary node task refers to the backup task sent by other master nodes and received by the current candidate node as a secondary node. Outgoing communication traffic refers to the traffic resources consumed by the current candidate node when communicating with the outside when performing tasks, such as uploading data, requesting responses, etc. The current outgoing communication traffic refers to the total outgoing communication traffic required by the current candidate node to perform various tasks. Incoming communication traffic refers to the traffic resources consumed when the current candidate node receives communication from the outside when performing tasks, such as downloading data, sending requests, etc. The current incoming communication traffic refers to the total incoming communication traffic required by the current candidate node to perform various tasks.
[0129] Exemplarily, after receiving the target task, the management node takes any candidate node in the candidate node set as the current candidate node, and obtains the current master node task corresponding to the current candidate node, the current backup task corresponding to the current master node task, and the current secondary node task. According to the outgoing communication traffic corresponding to the current master node task and the current backup task, respectively, and the number of tasks of the current master node task and the current backup task, the current outgoing communication traffic corresponding to the current candidate node is calculated. According to the incoming communication traffic corresponding to the current secondary node task and the number of tasks of the current secondary node task, the current incoming communication traffic corresponding to the current candidate node is calculated. Based on the current outgoing communication traffic and the current incoming communication traffic, the management node obtains the current node information corresponding to the current candidate node. The current node information may also include task information such as the current master node task corresponding to the current candidate node, the current backup task corresponding to the current master node task, and the current secondary node task.
[0130] In an exemplary embodiment, in the process of selecting the target node, the node resources of the resource type participating in the calculation are pre-set, including: node available memory capacity, node out-network traffic, node in-network traffic, node underlying data service quantity, etc. Wherein, the out-in network traffic of the candidate node is mainly composed of two parts: the communication between the master node of the task level on this node and the corresponding backup nodes, and the out-in network traffic caused by the service of the underlying data services on this node. The more the underlying data services on this node, the more the out-in network traffic of this node. As the basis for subsequent load estimation, the calculation method of the load estimation related indicators of each candidate node needs to be determined, such as the out-network traffic expectation (current in-network communication traffic) and in-network traffic expectation (current out-network communication traffic). For example, assuming that the candidate node cluster has s candidate nodes, and the number of underlying data services affecting the out-in network traffic on each candidate node is D1, D2, …, DS, the total number of such underlying data services is .
[0131] In order to maintain the uninterrupted processing of task execution, the master node of the task needs to communicate with the backup node. Assuming that the out-network communication traffic corresponding to the current master node task of the master node of the task is a, the number of backups of the current master node task is N (i.e. the number of current backup tasks), and the out-network traffic of the backup node is N*a. Since the read-write traffic of the underlying data services on the node is proportional to the number of underlying data services on the node , assuming that the allocation of backup nodes and underlying data services of the task is completely random, and there is no other restriction except that the same underlying data service cannot be selected repeatedly, the out-network traffic expectation of the i-th node is: , wherein P represents the probability that the underlying data service of the node communicates with other nodes.
[0132] Since the in-network traffic is also composed of two parts, i.e. the communication between the master node and the backup node of the task level, and the read-write traffic of the underlying data services on the node. Assuming that the amount of data received by the node for master-backup communication is a (i.e. the in-network communication traffic corresponding to the current backup task), the read-write traffic of the underlying data services on the node is proportional to the number of underlying data services , the allocation of tasks and underlying data services is completely random, and the restriction condition is the same as above, the in-network traffic expectation of the i-th node is: , wherein P represents the probability that the underlying data service of the node communicates with other nodes.
[0133] In this embodiment, by introducing the inbound and outbound network traffic of the node as an indicator of load assessment, the load assessment error caused by a single factor is avoided, the accuracy of load assessment is improved, and thus the accuracy of task allocation is improved.
[0134] In an exemplary embodiment, Figure 5 The figure shows a specific task allocation process flow diagram. The management node selects any candidate node as the current candidate node (hereinafter referred to as node i) and calculates the current average task resources for node k for each metric (node resources corresponding to resource types) based on the current node information of other candidate nodes (hereinafter referred to as node k). The target task is pre-assigned to node i. Based on the target task and node i's current node information, the reference average task resources for node i for each metric are calculated. This can be achieved by calculating the ratio of the number of tasks for node i for each metric to the number of tasks after the target task is added to node i, thereby obtaining the reference average task resources for node i for each metric. Based on the reference average task resources for node i for each metric and the current average task resources for node k for each metric, the proportion of the reference task resources for node i for each metric is determined. Based on the reference average task resources for node i for each metric and the current average task resources for node k for each metric, the coefficient of variation (the uniformity of the initial resource distribution) for the candidate node set for each metric is calculated if the target task is pre-assigned to node i. The coefficient of variation for each metric for the candidate node set is also calculated if the target task is pre-assigned to node k. The coefficient of variation is calculated again based on the coefficient of variation corresponding to each indicator, resulting in the quadratic coefficient of variation (i.e., the uniformity of the reference resource distribution) for each candidate node set. The fusion weights for each indicator are then calculated. Combined with the load factors and fusion weights, the weighted fusion of node i's reference task resource share for each indicator is weighted to obtain the weighted load value for the coefficient of variation for node i (i.e., the reference node load). The weighted load value for the coefficient of variation for node k is calculated when the target task is pre-assigned to node k, resulting in the weighted load value for the coefficient of variation for each candidate node. Based on the weighted load values for the coefficient of variation for each candidate node, the candidate node with the smallest weighted load value for the coefficient of variation is selected as the target node, and the target task is assigned to the target node (either the target primary node or the target secondary node).
[0135] When the target node is the primary node, such as Figure 6As shown, a flowchart of a multi-priority task allocation is provided. A first backup node with the highest priority is selected from the candidate node set except the master node (i.e., the backup node corresponding to the master node), and the target task is allocated to the first backup node. The current backup node includes a plurality of times, and the iteration calculation is sequentially performed from the remaining candidate nodes to determine each backup node until the task allocation of all master nodes and backup nodes is completed.
[0136] In this embodiment, when creating resources, selecting master nodes and backup nodes, the load of each candidate node is calculated according to the known node information of the candidate node set, and then the target node with lower load is selected to allocate tasks, which can realize accurate estimation and allocation of load, and further ensure the balanced distribution of load (tasks) of the distributed system.
[0137] In addition, the coefficient of variation is used as the standard for load estimation. The coefficient of variation measures the dispersion degree of node load, providing a more objective load balancing measurement standard, avoiding estimation bias caused by simple average. And dynamically monitor and adjust the load distribution during system operation. Through dynamic adjustment of real-time data, the distributed system can adapt to load changes and sudden situations, further optimizing performance and stability. Further, by using a more objective load balancing measurement standard, it can ensure more reasonable load allocation and avoid high-load tasks concentrated on low-performance nodes, leading to performance bottlenecks and system instability.
[0138] It should be understood that although each step in the flowchart involved in each embodiment as described above is displayed in sequence according to the arrow, these steps are not necessarily executed in sequence according to the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other orders. Moreover, at least part of the steps in the flowchart involved in each embodiment as described above can include multiple steps or stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be executed alternately or alternately with at least part of other steps or steps or stages in other steps.
[0139] Based on the same inventive concept, the embodiments of the present application also provide a task allocation device for implementing the task allocation method as described above. The implementation scheme of the problem solving provided by the device is similar to the implementation scheme described in the above method, so the specific limitations in one or more task allocation device embodiments provided below can refer to the limitations of the task allocation method in the above text, and will not be repeated here.
[0140] In an exemplary embodiment, as Figure 7As shown, a task allocation apparatus 700 is provided, comprising: an acquisition module 702, a task resource calculation module 704, a resource proportion calculation module 706, a resource distribution module 708, a fusion module 710 and a task allocation module 712, wherein:
[0141] The acquisition module 702 is configured to acquire a target task and a candidate node set.
[0142] The task resource calculation module 704 is configured to perform task resource calculation on current node information corresponding to a current candidate node in the candidate node set based on the target task, to obtain reference average task resources corresponding to the current candidate node.
[0143] The resource proportion calculation module 706 is configured to acquire current average task resources corresponding to other candidate nodes in the candidate node set, and determine reference task resource proportions corresponding to the current candidate node based on the reference average task resources and the current average task resources.
[0144] The resource distribution module 708 is configured to determine reference resource distribution uniformity corresponding to the candidate node set based on a difference between the reference average task resources and the current average task resources.
[0145] The fusion module 710 is configured to fuse the reference resource distribution uniformity and the reference task resource proportions, to obtain reference node loads corresponding to the current candidate node.
[0146] The task allocation module 712 is configured to determine a target node corresponding to the target task from the candidate node set based on reference node loads corresponding to respective candidate nodes.
[0147] In an exemplary embodiment, the task allocation apparatus 700 is further configured to take the target node as a target master node corresponding to the target task, take other candidate nodes in the candidate node set except the target master node as an update node set, take the update node set as the candidate node set, return to performing the step of performing task resource calculation on current node information corresponding to a current candidate node in the candidate node set based on the target task, to obtain reference average task resources corresponding to the current candidate node, until an updated target node is obtained, and take the updated target node as a target slave node corresponding to the target task.
[0148] In an exemplary embodiment, the resource distribution module 708 is further configured to calculate an average value based on the reference average task resources and the current average task resources, to obtain a first task resource statistical value corresponding to the candidate node set, calculate a standard deviation based on the reference average task resources and the current average task resources, to obtain a second task resource statistical value corresponding to the candidate node set, and obtain the reference resource distribution uniformity corresponding to the candidate node set based on a difference between the first task resource statistical value and the second task resource statistical value.
[0149] In an exemplary embodiment, the resource distribution module 708 is also used to obtain the initial resource distribution uniformity corresponding to the candidate node set when pre-allocating the target task to the current candidate node based on the difference between the first task resource statistic and the second task resource statistic; obtain the initial resource distribution uniformity corresponding to the candidate node set when pre-allocating the target task to other candidate nodes; calculate the average value based on each initial resource distribution uniformity to obtain the third task resource statistic corresponding to the candidate node set; calculate the standard deviation based on each initial resource distribution uniformity to obtain the fourth task resource statistic corresponding to the candidate node set; and obtain the reference resource distribution uniformity corresponding to the candidate node set based on the difference between the third task resource statistic and the fourth task resource statistic.
[0150] In an exemplary embodiment, the current node information includes node resources corresponding to at least two resource types; the reference task resource ratio includes the reference task resource ratio corresponding to each resource type; the reference resource distribution uniformity includes the reference resource distribution uniformity corresponding to each resource type; the fusion module 710 is also used to determine the fusion weight corresponding to each resource type based on the reference resource distribution uniformity corresponding to each resource type; the reference task resource ratio corresponding to each resource type is fused based on the fusion weight to obtain the reference node load corresponding to the current candidate node.
[0151] In an exemplary embodiment, the task allocation device 700 is also used to obtain the current main node task corresponding to the current candidate node, the current backup task corresponding to the current main node task, and the current secondary node task; based on the outgoing communication traffic corresponding to the current main node task and the current backup task respectively, the current outgoing communication traffic corresponding to the current candidate node is obtained; based on the incoming communication traffic corresponding to the current secondary node task, the current incoming communication traffic corresponding to the current candidate node is obtained; based on the current outgoing communication traffic and the current incoming communication traffic, the current node information corresponding to the current candidate node is obtained.
[0152] Each module in the task allocation device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0153] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 8As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O) and a communication interface. The processor, memory and input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store data related to the distributed system. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a task allocation method is implemented.
[0154] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 9 As shown. The computer device includes a processor, memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals via wired or wireless means, and the wireless means can be implemented via Wi-Fi, a mobile cellular network, near-field communication (NFC), or other technologies. When executed by the processor, the computer program implements a task allocation method. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse.
[0155] Those skilled in the art will understand that Figure 8-Figure 9The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0156] In an exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.
[0157] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0158] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0159] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0160] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), quantum computing-based data processing logic devices, artificial intelligence (AI) processors, and the like.
[0161] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0162] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A task allocation method, characterized in that: The method comprises: Get the target task and candidate node set; Based on the target task, performing task resource calculation on the current node information corresponding to the current candidate node in the candidate node set to obtain a reference average task resource corresponding to the current candidate node; Obtaining current average task resources corresponding to other candidate nodes in the candidate node set, and determining a proportion of reference task resources corresponding to the current candidate node based on the reference average task resources and the current average task resources; Determining a degree of uniformity of distribution of reference resources corresponding to the candidate node set based on a difference between the reference average task resources and the current average task resources; The reference node load corresponding to the current candidate node is obtained by integrating the uniformity of the reference resource distribution and the reference task resource ratio; Based on the reference node loads corresponding to the candidate nodes, a target node corresponding to the target task is determined from the candidate node set.
2. The method according to claim 1, characterized in that The method further comprises: Using the target node as the target master node corresponding to the target task; The other candidate nodes in the candidate node set except the target master node are combined into an updated node set, the updated node set is used as the candidate node set, and the step of performing task resource calculation on the current node information corresponding to the current candidate node in the candidate node set based on the target task to obtain the reference average task resource corresponding to the current candidate node is returned to be executed until an updated target node is obtained; The updated target node is used as the target sub-node corresponding to the target task.
3. The method according to claim 1, characterized in that The determining, based on the difference between the reference average task resources and the current average task resources, a degree of uniformity of distribution of reference resources corresponding to the candidate node set includes: Calculating an average value based on the reference average task resource and the current average task resource to obtain a first task resource statistic corresponding to the candidate node set; Calculating a standard deviation based on the reference average task resource and the current average task resource to obtain a second task resource statistic corresponding to the candidate node set; Based on the difference between the first task resource statistical value and the second task resource statistical value, a uniformity of distribution of reference resources corresponding to the candidate node set is obtained.
4. The method according to claim 3, characterized in that The obtaining, based on the difference between the first task resource statistics and the second task resource statistics, a degree of uniformity of distribution of reference resources corresponding to the candidate node set includes: Based on the difference between the first task resource statistical value and the second task resource statistical value, obtaining the initial resource distribution uniformity corresponding to the candidate node set when pre-allocating the target task to the current candidate node; Obtaining a uniformity of initial resource distribution corresponding to the candidate node set when pre-allocating the target task to the other candidate nodes; Calculate an average value based on the uniformity of the initial resource distribution to obtain a third task resource statistic corresponding to the candidate node set; Calculating a standard deviation based on the uniformity of the distribution of each initial resource, and obtaining a fourth task resource statistic corresponding to the candidate node set; Based on the difference between the third task resource statistical value and the fourth task resource statistical value, a uniformity of distribution of reference resources corresponding to the candidate node set is obtained.
5. The method according to claim 1, wherein The current node information includes node resources corresponding to at least two resource types; the reference task resource ratio includes the reference task resource ratio corresponding to each resource type; the reference resource distribution uniformity includes the reference resource distribution uniformity corresponding to each resource type; The fusing the reference resource distribution uniformity and the reference task resource ratio to obtain the reference node load corresponding to the current candidate node includes: Determining the fusion weights corresponding to the respective resource types based on the uniformity of distribution of the reference resources corresponding to the respective resource types; The reference task resource proportions corresponding to each resource type are fused based on the fusion weight to obtain the reference node load corresponding to the current candidate node.
6. The method according to claim 1, characterized in that The method further comprises: Obtain the current master node task corresponding to the current candidate node, the current backup task corresponding to the current master node task, and the current slave node task; Based on the outbound communication traffic corresponding to the current master node task and the current backup task, respectively, obtaining the current outbound communication traffic corresponding to the current candidate node; Based on the incoming network communication flow corresponding to the current secondary node task, obtaining the current incoming network communication flow corresponding to the current candidate node; Based on the current outgoing communication traffic and the current incoming communication traffic, current node information corresponding to the current candidate node is obtained.
7. A task allocation device, characterized in that: The device comprises: Acquisition module, used to obtain target tasks and candidate node sets; A task resource calculation module is used to perform task resource calculation on the current node information corresponding to the current candidate node in the candidate node set based on the target task, and obtain a reference average task resource corresponding to the current candidate node; a resource proportion calculation module, configured to obtain current average task resources corresponding to other candidate nodes in the candidate node set, and determine a reference task resource proportion corresponding to the current candidate node based on the reference average task resources and the current average task resources; A resource distribution module, configured to determine a uniformity of distribution of reference resources corresponding to the candidate node set based on a difference between the reference average task resources and the current average task resources; A fusion module, configured to fuse the reference resource distribution uniformity and the reference task resource ratio to obtain a reference node load corresponding to the current candidate node; The task allocation module is used to determine the target node corresponding to the target task from the candidate node set based on the reference node load corresponding to each candidate node.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.