CN-121996393-A - Task processing method and device
Abstract
The application provides a task processing method and a task processing device. The method includes that a task processing device can respond to an acquired target task, determine real load of each of N resource partitions used for executing the task and target load flow relation between at least two of the N resource partitions, and allocate the target task to at least one of the N resource partitions according to the real load and the target load flow relation. The method can improve the resource utilization rate of the resource partitions with lower loads, and simultaneously avoid continuous overload of the resource partitions with higher loads so as to realize load balancing among the resource partitions.
Inventors
- CUI GE
- YANG SHENGKAI
- LI YAMENG
Assignees
- 成都华为技术有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20241030
Claims (15)
- 1. A method of task processing, the method comprising: Acquiring a target task; Determining a real load of each of N resource partitions for executing a task and a target load flow relation between at least two of the N resource partitions in response to the target task, wherein the real load is a load which needs to be executed by each resource partition under the condition that the load is not transferred, the target load flow relation is used for indicating the load transfer condition between the N resource partitions under the condition that the load balance is achieved among the N resource partitions, and N is an integer greater than or equal to 2; And distributing the target task to at least one resource partition in the N resource partitions according to the real load and the target load flow relation.
- 2. The method of claim 1, wherein said assigning the target task to at least one of the N resource partitions according to the real load and the target load flow relationship comprises: acquiring a plurality of subtasks obtained by decomposing the target task; and distributing the plurality of subtasks to M resource partitions in the N resource partitions according to the real load and the target load flow relation, wherein M is a positive integer less than or equal to N.
- 3. The method according to claim 1 or 2, wherein said assigning the target task to at least one of the N resource partitions according to the real load and the target load flow relationship comprises: Determining probability information of each resource partition in the N resource partitions according to the real load and the target load flow relation, wherein the probability information of each resource partition is used for indicating the probability of the target task distributed to each resource partition; And distributing the target task to at least one resource partition in the N resource partitions according to the probability information of each resource partition in the N resource partitions.
- 4. A method according to any one of claims 1 to 3, wherein said determining a target load flow relationship between at least two of said N resource partitions comprises: Load flow capacity information of the N resource partitions is obtained, wherein the load flow capacity information is used for indicating the load capacity of at least two resource partitions in the N resource partitions, which need to flow in or flow out, so that load balance is achieved among the N resource partitions; based on the load flow capability information, the at least two resource partitions, and a target load flow relationship between the at least two resource partitions, are determined.
- 5. The method of claim 4, wherein the obtaining load flow capability information for the N resource partitions comprises: Load flow capability information for each of the N resource partitions is determined based on the load of each of the N resource partitions, the average load of the N resource partitions, and the number of computing resources for each of the N resource partitions.
- 6. The method of any of claims 1 to 5, wherein determining the actual load of each of the N resource partitions for performing the task comprises: acquiring initial load flow relations among the N resource partitions; Acquiring the real-time load of each resource partition, wherein the real-time load is used for indicating the load actually executed by each resource partition; and determining the real load of each resource partition according to the real-time load of each resource partition and the initial load flow relation.
- 7. A task processing device, the device comprising: The acquisition module is used for acquiring a target task; A determining module, configured to determine, in response to the target task, a real load of each of N resource partitions for performing the task and a target load flow relationship between at least two of the N resource partitions, where the real load is a load that needs to be performed by each of the N resource partitions without load transfer, where the target load flow relationship is used to indicate a load transfer condition between the N resource partitions when load balancing is achieved between the N resource partitions, and N is an integer greater than or equal to 2; and the allocation module is used for allocating the target task to at least one resource partition in the N resource partitions according to the real load and the target load flow relation.
- 8. The apparatus according to claim 7, wherein the allocation module is specifically configured to: acquiring a plurality of subtasks obtained by decomposing the target task; and distributing the plurality of subtasks to M resource partitions in the N resource partitions according to the real load and the target load flow relation, wherein M is a positive integer less than or equal to N.
- 9. The device according to claim 7 or 8, characterized in that said distribution module is in particular adapted to: Determining probability information of each resource partition in the N resource partitions according to the real load and the target load flow relation, wherein the probability information of each resource partition is used for indicating the probability of the target task distributed to each resource partition; And distributing the target task to at least one resource partition in the N resource partitions according to the probability information of each resource partition in the N resource partitions.
- 10. The apparatus according to any one of claims 7 to 9, wherein the determining module is specifically configured to: Load flow capacity information of the N resource partitions is obtained, wherein the load flow capacity information is used for indicating the load capacity of at least two resource partitions in the N resource partitions, which need to flow in or flow out, so that load balance is achieved among the N resource partitions; based on the load flow capability information, the at least two resource partitions, and a target load flow relationship between the at least two resource partitions, are determined.
- 11. The apparatus according to claim 10, wherein the determining module is specifically configured to: Load flow capability information for each of the N resource partitions is determined based on the load of each of the N resource partitions, the average load of the N resource partitions, and the number of computing resources for each of the N resource partitions.
- 12. The apparatus according to any one of claims 7 to 11, wherein the determining module is specifically configured to: acquiring initial load flow relations among the N resource partitions; Acquiring the real-time load of each resource partition, wherein the real-time load is used for indicating the load actually executed by each resource partition; and determining the real load of each resource partition according to the real-time load of each resource partition and the initial load flow relation.
- 13. A cluster of computing devices, comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device to cause the cluster of computing devices to perform the method of any one of claims 1 to 6.
- 14. A computer program product containing instructions that, when executed by a cluster of computing devices, cause the cluster of computing devices to perform the method of any of claims 1 to 6.
- 15. A computer readable storage medium comprising computer program instructions which, when executed by a cluster of computing devices, perform the method of any of claims 1 to 6.
Description
Task processing method and device Technical Field The embodiment of the application relates to the technical field of Internet, in particular to a task processing method and device. Background In order to efficiently utilize resources, to maximize utilization of the resources, tasks need to be reasonably allocated among multiple resource partitions including the resources, so that load balancing is achieved among the multiple resource partitions. The resources include physical resources and virtual resources, and the physical resources may include physical computing resources (such as a central processing unit (Central Processing Unit, CPU) or a CPU core), physical storage resources (hard disk, memory, etc.), and physical network resources (such as network cards, switches, routers, etc.). Virtual resources may include Virtual computing resources (Virtual machines, containers, threads, processes, etc.), virtual storage resources (Virtual storage pools, etc.), virtual network resources (Virtual ethernet pairs (Virtual ETHERNET DEVICE, veth), etc.). In general, load balancing among a plurality of resource partitions is achieved through loads actually executed by each resource partition (also referred to as real-time loads) and preset thresholds, or load conditions of each resource partition in the future are predicted through load conditions of a plurality of current resource partitions and a load prediction model, so that resource allocation and scheduling are achieved in advance, and load balancing among a plurality of resource partitions is achieved. However, the setting of the preset threshold is usually determined based on experience or historical data, but the prior information cannot always accurately reflect the current actual situation of the plurality of resource partitions, and the load prediction model cannot predict the sudden load well, so that the adjusting capability of the sudden load is limited, and load balancing among the plurality of computing resources cannot be realized well. Disclosure of Invention The application provides a task processing method and a task processing device, wherein the task processing device can distribute a target task to at least one resource partition in a plurality of resource partitions according to the real load of each resource partition in the plurality of resource partitions and the target flow relation between at least two resource partitions in the plurality of resource partitions, so that the resource utilization rate of the resource partition with lower load can be improved, and meanwhile, the resource partition with higher load is prevented from being continuously overloaded, so that the load balance among the resource partitions is realized. In a first aspect, the present application provides a task processing method. The method comprises the steps of obtaining a target task, responding to the target task, determining real load of each of N resource partitions for executing the task and target load flow relation between at least two of the N resource partitions, wherein the real load is load required to be executed by each resource partition under the condition that the load is not transferred, the target load flow relation is used for indicating load transfer conditions among the N resource partitions under the condition that the load balance is achieved among the N resource partitions, N is an integer greater than or equal to 2, and distributing the target task to at least one of the N resource partitions according to the real load and the target load flow relation. In the implementation manner of the application, the real load is the load required to be executed by each resource partition without load transfer, the target load flow relation reflects the load transfer condition among N resource partitions when load balance is achieved among the N resource partitions, which resource partitions are low-voltage partitions (e.g. resource partitions receiving the load of other resource partitions in the target load flow relation) can be quickly identified through the target load flow relation, and the target task is allocated to at least one resource partition among the N resource partitions for executing the task according to the real load and the target load flow relation. In the method, the load migration is carried out for a plurality of times by utilizing the real-time load and the preset threshold value, so that the load balancing among a plurality of resource partitions is realized, the influence of the load migration on the load condition of the resource partitions is considered, the load required to be executed by each resource partition under the condition that the load is not transferred is restored, the stability of the load condition of the resource partitions is enhanced, tasks are prevented from being distributed to the resource partitions which are overloaded or nearly fully loaded, the resource utilization rate of the resource partitions