Resource allocation method, device and system
By matching execution units with different resource configurations for subtasks in a distributed computing system, the problem of long task waiting time caused by the same execution unit configuration is solved, and balanced execution efficiency and efficient resource utilization are achieved.
Patent Information
- Application Number
- CN202410399735.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-01
- Publication Date
- 2025-10-14
AI Technical Summary
In distributed computing systems, due to the same configuration of execution units, the execution efficiency of different tasks is uneven, and some tasks have long waiting times, which is particularly obvious in heterogeneous clusters.
Match execution units with different resource configurations to different subtasks so that the subtasks match their required resources. Determine the number and resource configuration of execution units through parameter setting or resource configuration prediction model, consider task characteristics and available resource information, and generate subtask-execution unit matching pairs.
It reduces the execution time differences between subtasks, reduces unnecessary waiting time, improves the overall execution efficiency of tasks, and achieves efficient utilization and balance of resources.
Smart Images

Figure CN120780446A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and particularly relates to a resource allocation method, device and system. BACKGROUND
[0002] In a distributed computing system, underlying hardware resources are usually divided into multiple execution units, and tasks are allocated to the execution units for execution. For example, in Spark, execution units (executors) are created in different computing nodes (workers), and task allocation is performed to realize the utilization of underlying hardware resources.
[0003] In a scheduling scheme similar to Spark, all executors have the same configuration, for example, the number of cores, the size of memory and other hardware resources of different executors are the same. However, different tasks are not completely the same, and the required resources can be different. When different tasks are executed in executors with the same configuration, different execution efficiencies are obtained, and some tasks are executed first, and the tasks executed first wait for other tasks being executed, resulting in a long task waiting time. SUMMARY
[0004] The present application provides a resource allocation method and device to solve the technical problem of long task waiting time caused by the same configuration of execution units.
[0005] In a first aspect, a resource allocation method is provided, which comprises: obtaining a task set of a task, the task being submitted by a client, the task set containing a first subtask and a second subtask; the method further comprises: matching a first execution unit for the first subtask; the first execution unit is used for executing the first subtask; the first execution unit has a first resource configuration; the first resource configuration indicates the type or quantity of resources possessed by the first execution unit; matching a second execution unit for the second subtask; the second execution unit is used for executing the second subtask; the second execution unit has a second resource configuration; the second resource configuration indicates the type or quantity of resources possessed by the second execution unit; wherein the first resource configuration is different from the second resource configuration.(New right 1)
[0006] In one solution, the number of execution units and the resource configuration enjoyed by each execution unit are determined by a parameter setting method. Under normal circumstances, the resource configuration determined by the parameter setting method is the same for different execution units. In other words, regardless of the resource situation required by the subtask, it will be assigned to the execution unit with the same resource configuration for execution. In the resource allocation method of the first aspect of the present invention, the subtasks (first subtask, second subtask) are matched with execution units (first execution unit, second execution unit) with different resource configurations, so that different subtasks are matched with different resources, avoiding the subtasks being matched with the same resources, thereby reducing the difference in execution time between different subtasks, reducing unnecessary waiting time, and balancing the execution efficiency between different subtasks.
[0007] In one possible implementation, the resources required by the first subtask match the resources configured in the first resource configuration; the resources required by the second subtask match the resources configured in the second resource configuration. That is, the resources required by different subtasks match the resources possessed by the execution unit to which they are matched. Matching here can be understood as the same type or the same quantity, etc. Matching the resources required by the subtasks with the resources possessed by the execution unit can make the execution efficiency of different subtasks equivalent, avoid unnecessary waiting time, and improve the execution efficiency of tasks. (Corresponding right 8)
[0008] In one possible implementation, the first resource configuration includes computing resources; the computing resources required by the first subtask match the computing resources configured in the first resource configuration; the second resource configuration includes computing resources; the computing resources required by the second subtask match the computing resources configured in the second resource configuration. That is, the computing resources required by the subtask match the computing resources configured by the execution unit assigned to it, thus ensuring that the execution efficiency of different subtasks is comparable.
[0009] In one possible implementation, a first resource configuration includes storage resources; the storage resources required by a first subtask match the storage resources configured in the first resource configuration; a second resource configuration includes storage resources; and the storage resources required by a second subtask match the storage resources configured in the second resource configuration. In other words, the storage resources required by a subtask match the storage resources configured for its assigned execution unit, thus ensuring comparable execution efficiency across subtasks.
[0010] In one possible implementation, hardware resources are configured in both the first resource configuration and the second resource configuration; the number or type of hardware resources configured in the first resource configuration and the second resource configuration are different; or, the number and type of hardware resources configured in the first hardware resource and the second hardware resource are different. The execution units with different resource configurations are configured with different hardware resources. The so-called resource configuration can be understood as: certain hardware resources are configured for the execution unit. The execution unit executes subtasks based on the configured hardware resources. Different hardware resources will result in different performance of the execution unit. The performance of the execution unit required for different subtasks may be different. Therefore, when different subtasks are assigned to execution units with different hardware resources for execution, the execution efficiency between the subtasks can be relatively balanced. (Corresponding to right 2)
[0011] In one possible implementation, the first resource configuration includes a first computing resource, and the second resource configuration includes a second computing resource. The first and second computing resources differ in size. Different subtasks may require different computing resources. Therefore, by assigning different computing resources to different subtasks, the execution time of different subtasks can be made comparable, balancing the execution efficiency of different subtasks. Computing resources can be represented by the number of cores.
[0012] In one possible implementation, the first resource configuration includes a first storage resource, and the second resource configuration includes a second storage resource. The first storage resource and the second storage resource have different sizes. Different subtasks may require different storage resources. Therefore, by matching different storage resources to different subtasks, the execution time of different subtasks can be made comparable, balancing the execution efficiency of different subtasks. The storage resource can be represented by memory size.
[0013] In one possible implementation, a first processor type is configured in the first resource configuration; a second processor type is configured in the second resource configuration; and the first processor type and the second processor type are different. On the one hand, different subtasks may be suitable for execution on different types of processors. Therefore, by matching different subtasks with different types of processors, the subtasks can be matched to the processor types, balancing the execution efficiency of different subtasks. On the other hand, creating execution units configured with different hardware resources on different processors can achieve uniform configuration and hardware performance.
[0014] In one possible implementation, the first processor type is a CPU, and the second processor type is a DPU; the first subtask is suitable for execution on the CPU; and the second subtask is suitable for execution on the DPU. In a scheduling scheme for a heterogeneous cluster, the execution units created on different types of processors have the same hardware resources (such as the same number of cores, the same memory, etc.). For example, the execution units created on the CPU and the DPU have the same number of cores and the same memory. This will lead to the following problem: since the performance of the CPU is higher than that of the DPU, although the execution unit A created on the CPU and the execution unit B created on the DPU have the same hardware configuration, the performance of execution unit A is better than that of execution unit B. This results in differences in the execution effects of different processors, which in turn leads to extended waiting times for some tasks during distributed computing. In this implementation, matching each subtask with a processor suitable for its execution can balance the execution efficiency of different subtasks.
[0015] In one possible implementation, before allocating execution units (first execution unit, second execution unit) to subtasks (first subtask, second subtask), the method further includes: obtaining the task information of the task and the available resource information of the computing node; determining the number of execution units that need to be created on the computing node and the resource configuration parameters of each execution unit that needs to be created based on the obtained task information and available resource information; wherein the task information is related to the resources required to execute the task; and the resource configuration parameters are used to indicate the resource configuration of each execution unit that needs to be created. In this implementation, the resource configuration parameters of the execution unit are determined based on the task information of the task and the available resource information of each computing node; wherein the task information can reflect the resource situation required for the task; and the available resource information can reflect the available resource situation within the cluster. Therefore, the resource allocation method of this implementation combines the resource situation and available resource situation required to execute the task at the current stage. The resource configuration of the execution unit constructed based on this is more matched with the resources required to execute the task, and the execution unit is more suitable for the current task, which can improve the execution efficiency of the task. (Beneficial effect of right 4, right 4 is the previous right 1)
[0016] In one possible implementation, task information includes the task code. The code itself directly reflects the computational complexity and parallelism of the code, and can reflect the resources required to execute the task. Therefore, the execution unit built based on the task code is highly compatible with the task's resources, significantly improving task execution efficiency.
[0017] In one possible implementation, the method further includes generating a subtask-execution unit matching pair; the subtask-execution unit matching pair is used to indicate a correspondence between subtasks included in a task set and execution units; wherein the subtasks included in the task set include at least a first subtask and a second subtask. In this implementation, the subtask-execution unit matching pair is used to indicate to which execution unit the subtask is assigned; when a subsequent computing node assigns a subtask to an execution unit, it may refer to the subtask-execution unit matching pair for execution.
[0018] In one possible implementation, the method further includes: applying for available resources to create an execution unit in the computing node; and sending the subtask-execution unit matching pair to the computing node so that the computing node assigns the subtask to the execution unit for execution.
[0019] In this implementation, after determining the number of execution units and the resource configuration of the execution units using task information and available resource information, the execution units can be created on the corresponding computing nodes. Since we already know what resources the execution units require and what available resources each computing node has, we can create corresponding execution units on the corresponding computing nodes. For example, if the hardware resources available to a computing node include 64 cores and 256G of memory, and the resource configuration of a certain execution unit is 4 cores and 16G of memory, then the execution unit can be created on the computing node. After the execution unit is created on the computing node, the subtask can be sent to the corresponding execution unit for execution according to the allocation scheme embodied by the subtask-execution unit matching pair.
[0020] In one possible implementation, resource configuration parameters include computing power resource parameters and storage resource parameters; an execution unit is matched to a subtask based on the computing power and storage resources required by the subtask. When matching an execution unit to a subtask, matching is performed based on the computing power and storage resources required by the subtask. Computing power resources can be represented by the number of cores, and storage resources can be represented by the size of the memory. For example, if a subtask requires storage resources, the subtask is assigned to an execution unit that is configured with memory; if the subtask does not require storage resources, the subtask is assigned to an execution unit that is not configured with memory. If the subtask requires more storage resources, the subtask is assigned to an execution unit that is configured with a larger memory; if the subtask requires less storage resources, the subtask is assigned to an execution unit that is configured with a smaller memory. If the subtask requires higher computing power, the subtask is assigned to an execution unit that is configured with more cores; if the subtask has lower computing power requirements, the subtask is assigned to an execution unit that is configured with fewer cores. In the subtask-execution unit matching pairs obtained by the resource allocation method of this implementation, the resources required by the subtasks match the resources available in the execution units to which they are matched, thereby ensuring that the execution efficiency of all subtasks is comparable. In one possible implementation, the resource configuration parameters also include network resource parameters and I / O resource parameters.
[0021] In one possible implementation, a resource configuration prediction model is used to predict the number of execution units and the resource configuration of the execution units. This resource configuration prediction model is a prediction model trained using a large amount of historical data and the corresponding resource configuration of the execution units as training data. This resource configuration prediction model can predict the number of execution units and the configuration of the execution units required for a task. The historical data includes historical tasks and the resource configuration of the execution units that executed the historical tasks. For example, SQL statements and the resource configuration of the execution units that execute SQL statements. By using a model to predict execution units, the problem of manually given configuration is solved, and configuration automation is achieved.
[0022] In one possible implementation, the resource configuration parameter includes a processor type. Configuring an execution unit for a certain type of processor means that the execution unit will be assigned to run on that type of processor. There are at least two types of processors, each with a different chip architecture.
[0023] In a scheduling scheme for a heterogeneous cluster, the execution units created on different types of processors have the same hardware resources (for example, the same number of cores, the same memory, etc.). For example, the execution units created on the CPU and the DPU have the same number of cores and the same memory. This will lead to the following problem: Since the performance of the CPU is higher than that of the DPU, although the execution unit A created on the CPU and the execution unit B created on the DPU have the same hardware configuration, the performance of the execution unit A is better than that of the execution unit B. This leads to differences in the execution effects of different processors, which in turn leads to extended waiting times for some tasks during distributed computing. In this implementation, by determining which processor the execution unit is assigned to run on through task information and available resource information, execution units with different hardware resources can be created on different processors, and the configuration and hardware performance can be unified. In this way, the performance differences between different execution units can be reduced.
[0024] In one possible implementation, the multiple subtasks include at least a first category of subtasks and a second category of subtasks, and different categories of subtasks are suitable for execution on different types of processors. The method further includes: pairing the first category of subtasks with an execution unit configured with the first category of processor; and pairing the second category of subtasks with an execution unit configured with the second category of processor. The first category of subtasks are suitable for execution on the first category of processor; the second category of subtasks are suitable for execution on the second category of processor; and the chip architectures of the first category of processor and the second category of processor differ. In this implementation, when assigning tasks, the attributes of the task itself are taken into consideration to determine the most suitable type of processor for the task. Therefore, the task can be matched with the most suitable execution unit, greatly improving the execution efficiency of the task.
[0025] In a second aspect, a resource allocation device is provided, including: a task management module, used to obtain a task set of a task, the task set including a first subtask and a second subtask; a task scheduling module, used to match a first execution unit for the first subtask; the first execution unit is used to execute the first subtask; the first execution unit has a first resource configuration; the task scheduling module is also used to match a second execution unit for the second subtask; the second execution unit is used to execute the second subtask; the second execution unit has a second resource configuration; wherein the first resource configuration is different from the second resource configuration.
[0026] In a possible implementation, hardware resources are configured in both the first resource configuration and the second resource configuration; the hardware resources configured in the first resource configuration and the second resource configuration are different in quantity or type.
[0027] In a possible implementation, the quantity and type of hardware resources configured in the first hardware resource and the second hardware resource are different.
[0028] In one possible implementation, a first computing resource is configured in the first resource configuration; a second computing resource is configured in the second resource configuration; and the first computing resource and the second computing resource are different in size.
[0029] In a possible implementation, the first resource configuration includes a first storage resource; the second resource configuration includes a second storage resource; and the first storage resource and the second storage resource have different sizes.
[0030] In a possible implementation, a first processor type is configured in the first resource configuration; a second processor type is configured in the second resource configuration; and the first processor type is different from the second processor type.
[0031] In one possible implementation, the device also includes: a resource monitoring module, which obtains task information of the task and available resource information of one or more computing nodes; the task information is related to the resources required to execute the task; the resource monitoring module is also used to determine the number of execution units that need to be created on the computing node, and the resource configuration parameters of each execution unit based on the task information and available resource information; the resource configuration parameters are used to indicate the resource configuration of the execution unit; wherein the execution unit includes at least a first execution unit and a second execution unit.
[0032] In a possible implementation, the task information includes a task code.
[0033] In one possible implementation, the task scheduling module is further used to generate subtask-execution unit matching pairs; the subtask-execution unit matching pairs are used to indicate the correspondence between the subtasks included in the task set and the execution units; wherein the subtasks included in the task set include at least a first subtask and a second subtask.
[0034] In one possible implementation, the device also includes a resource application module for applying for resources from the resource monitoring module so that the resource monitoring module creates an execution unit on the computing node; the aforementioned task scheduling module is also used to match subtasks-execution units to computing nodes so that the computing node assigns subtasks to execution units for execution.
[0035] In a possible implementation, the computing resources required by the first subtask match the computing resources configured in the first resource configuration.
[0036] In a possible implementation, the computing resources required by the second subtask match the computing resources configured in the second resource configuration.
[0037] In a possible implementation, computing resources are configured in the first resource configuration; the computing resources required by the first subtask match the computing resources configured in the first resource configuration.
[0038] In a possible implementation, storage resources are configured in the first resource configuration; and the storage resources required by the first subtask match the storage resources configured in the first resource configuration.
[0039] In a possible implementation, computing resources are configured in the second resource configuration; and the computing resources required for the second subtask match the computing resources configured in the second resource configuration.
[0040] In a possible implementation, the second resource configuration includes storage resources; the storage resources required by the second subtask match the storage resources configured in the second resource configuration.
[0041] In a possible implementation, the first processor type is a CPU, and the second processor type is a DPU; the first subtask is suitable for execution on the CPU; and the second subtask is suitable for execution on the DPU.
[0042] In a third aspect, a computer device is provided, comprising a processor and a memory, wherein a computer program is stored in the memory, and the processor is configured to execute the computer program to implement the method as described in the first aspect and any implementation manner of the first aspect.
[0043] In a fourth aspect, a computing system is provided, comprising a management node and a computing node, wherein the management node is used to obtain a task set of a task, the task set including a first subtask and a second subtask; the management node is also used to match a first execution unit for the first subtask; the first execution unit is used to execute the first subtask; the first execution unit has a first resource configuration; the management node is also used to match a second execution unit for the second subtask; the second execution unit is used to execute the second subtask; the second execution unit has a second resource configuration; wherein the first execution unit and the second execution unit are created on the computing node; the first resource configuration is different from the second resource configuration.
[0044] In a fifth aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the method described in the first aspect and any implementation of the first aspect.
[0045] The technical effects that can be achieved in the above-mentioned second to fifth aspects can be described with reference to the technical effects that can be achieved in the above-mentioned first aspect and any possible implementation method of the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1A schematic diagram of the logical architecture of Spark implemented in the present invention;
[0047] Figure 2 A schematic diagram of the configuration of the execution unit of the relevant scheduling scheme;
[0048] Figure 3 A schematic diagram of an application scenario of the resource allocation method provided in an embodiment of the present invention;
[0049] Figure 4 A schematic diagram of another application scenario of the resource allocation method provided in an embodiment of the present invention;
[0050] Figure 5 A schematic diagram of a flow chart of a resource allocation method provided in an embodiment of the present invention;
[0051] Figure 5A A schematic diagram of a flow chart of another resource allocation method provided in an embodiment of the present invention;
[0052] Figure 5B A schematic diagram of a flow chart of another resource allocation method provided in an embodiment of the present invention;
[0053] Figure 6 A schematic diagram of a flow chart of another resource allocation method provided in an embodiment of the present invention;
[0054] Figure 7A A schematic diagram of a resource queue in a resource allocation method according to an embodiment of the present invention;
[0055] Figure 7B A schematic diagram of another resource queue in the resource allocation method according to an embodiment of the present invention;
[0056] Figure 8A A schematic diagram of a task queue in a resource allocation method according to an embodiment of the present invention;
[0057] Figure 8B A schematic diagram of another task queue in the resource allocation method according to an embodiment of the present invention;
[0058] Figure 8C A schematic diagram of another task queue in the resource allocation method according to an embodiment of the present invention;
[0059] Figure 9 A schematic diagram of a subtask-execution unit matching pair in the resource allocation method according to an embodiment of the present invention;
[0060] Figure 10A A schematic diagram of the structure of a resource allocation device provided by an embodiment of the present invention;
[0061] Figure 10BAnother resource allocation device provided by the embodiment of the present application is shown in the structural schematic diagram.
[0062] Figure 11 The structural schematic diagram of a computer device provided by the embodiment of the present application is shown in the structural schematic diagram.
[0063] Figure 12 The structural schematic diagram of a computer system provided by the embodiment of the present application is shown in the structural schematic diagram. DETAILED DESCRIPTION
[0064] The embodiment of the present application will be described below with reference to the accompanying drawings.
[0065] At present, the resource scheduling such as the computing power resource and the cache resource may be involved in the big data, AI and HPC scenarios.
[0066] Taking the commonly used Spark in the big data processing process as an example, the resource scheduling process will be described below. The Spark is a fast general-purpose computing engine specially designed for large-scale data processing. The logical architecture diagram of the Spark is shown in FIG. 1, which includes a driver, a cluster manager, a worker, a data source, a distribute cache and a shuffle service. The driver includes a Spark context (SparkContext), a directed acyclic scheduler (DAG scheduler), a task scheduler and a scheduler backend. The cluster manager includes a resource manager and a scheduler. The worker can include a plurality of executors. Figure 1
[0067] An application refers to a Spark application written by a user, which includes a code of a driver function and an executor code running on a plurality of nodes in a cluster. The driver in the Spark runs a main function of the above-mentioned application and creates a SparkContext. The purpose of creating the SparkContext is to prepare a running environment of the Spark application. In the Spark, the SparkContext is responsible for communicating with the cluster manager, applying for resources, allocating tasks and monitoring, etc. When the executor is run, the driver is responsible for closing the SparkContext.
[0068] An application can generate one or more jobs, and a job can contain one or more tasks. Each job can be split into multiple groups of tasks, each group of tasks is a task set (TaskSet), which is called a stage. The division and scheduling of the stage are the responsibility of the DAG scheduler. The DAG scheduler constructs a directed acyclic graph (DAG) based on the stage according to the job and sends the stage to the task scheduler. The task scheduler submits the TaskSet to the worker for execution, and the task scheduler determines which executor will run each task. The task scheduler maintains all TaskSets. When the executor sends a heartbeat to the driver, the task scheduler allocates the corresponding task based on the remaining resources. The scheduler backend interacts with the cluster manager to obtain the resources allocated to the application.
[0069] The above cluster can be a heterogeneous cluster. A heterogeneous cluster refers to a cluster in which processors of different architectures (or chip architectures) are used for joint computing. For example, the processors in the cluster include a central processing unit (CPU), a graphics processing unit (GPU), an embedded neural network processing unit (NPU), a tensor processing unit (TPU), a data processing unit (DPU), an application-specific integrated circuit (ASIC) or a field-programmable gate array (FPGA), and any two or more chips. In some possible examples, a heterogeneous device may also refer to a storage device with computing capabilities, or a network card with computing capabilities.
[0070] In the application scenario of heterogeneous clusters, multiple executors can be distributed among different processors and executed by different types of processors. This can offload CPU tasks to other types of processors, reduce CPU load, achieve comprehensive utilization of heterogeneous resources, and improve the performance of the entire cluster system.
[0071] In such Figure 2 In the related scheduling scheme shown in , each Executor has the same configuration. For example, Figure 2 Executors 1 to 6 are configured with the same number of cores and memory size. The problems with this scheduling scheme are:
[0072] (1) Different tasks are not identical and may require different resources. Executors with the same configuration may have different execution efficiencies when executing tasks. Some tasks may finish first, and the first-completed tasks may wait for other tasks to finish, resulting in longer waiting times.
[0073] (2) In heterogeneous cluster scenarios, heterogeneous processors have different computing performance. For example, a DPU with the same configuration may have lower performance than a CPU. Executors with the same workload will take different amounts of time to execute on the CPU and DPU. Therefore, simply assigning the same resources to each executor will result in different executor performance on different processors, which in turn increases the waiting time for other tasks in distributed computing.
[0074] In view of this, an embodiment of the present invention provides a resource allocation method. After obtaining a task set, this method matches an execution unit to each subtask in the task set. The resource configuration of the execution units is not completely identical. Therefore, different execution units can spend similar execution time when executing different subtasks, reducing the time spent waiting for subtask execution. The above method can be applied to heterogeneous clusters capable of distributed computing and distributed caching.
[0075] Embodiments of the present invention also provide a resource allocation method for generating execution units with different resource configurations after acquiring a task, such that the resource configurations of the execution units match the task attributes (resource requirements) of the subtask, thereby ensuring that the execution units can efficiently complete the task, thereby improving the execution efficiency of the entire computing system. The above method can also be applied to heterogeneous clusters capable of distributed computing and distributed caching.
[0076] Figure 3 and Figure 4Schematic diagram of an application scenario of the resource allocation method provided by an embodiment of the present invention. Figure 3 As shown, the application scenario includes a cluster 100 , which includes: a management node 110 , and a plurality of computing nodes 120 connected to the management node 110 .
[0077] If the cluster 100 is a heterogeneous cluster, then at least two of the multiple computing nodes 120 use processors with different chip architectures. Figure 4 As shown, among the multiple computing nodes 120, some computing nodes 120 use processors including a CPU, some computing nodes 120 use processors including a CPU and a DPU, and the remaining computing nodes 120 use processors including a CPU and an NPU (not shown in the figure). Alternatively, at least one computing node 120 among the multiple computing nodes 120 is configured with multiple processors, and among the multiple processors, at least two processors have different chip architectures. For example, among the multiple nodes, a computing node 120 is configured with a CPU and a DPU.
[0078] The management node 110 and the computing node 120 each have independent processors (central processing units, CPUs) and storage resources (including memory and disks). Different nodes are connected via a high-speed network (such as Ethernet or a fiber optic switching network).
[0079] The management node 110 is responsible for managing each computing node 120 in the entire cluster, providing external interfaces such as task submission interface and task query interface, receiving jobs submitted by clients, decomposing external task requests to computing nodes 120 for parallel execution, and collecting execution results and feeding them back to the client.
[0080] The computing node 120 is controlled by the management node 110 and is responsible for managing the resources of the node, regularly reporting heartbeats (or resource utilization) to the management node 110, receiving commands from the management node 110, executing submitted jobs, and performing model training according to the management node 110.
[0081] Figure 1 The cluster manager in runs on the management node 110. Figure 1 The resource manager in is equivalent to Figure 4 The resource monitor in. Figure 1 The Driver in the example can run on the management node 110 or the computing node 120. Figure 1 The Executor in runs on computing node 120.
[0082] The embodiment of the present invention is described by taking the example of Driver running on the management node 110. Figure 4 As shown, the Driver runs on the management node 110 , and the task scheduler and task manager included in the Driver also run on the management node 110 .
[0083] Figure 5 A flow chart of a resource allocation method provided by an embodiment of the present invention is as follows: Figure 5 As shown, the method includes step S501 and step S502.
[0084] Step S501: The management node 110 obtains a task set of a task, where the task set includes multiple subtasks.
[0085] In some implementations, each task is independent of the others, and each task is executed by a single executor. An executor can execute one or more tasks. Multiple tasks can be executed in parallel. A task is considered complete only after all tasks have completed.
[0086] In step S502, the management node 110 matches an execution unit to each subtask in the task set (pairs the subtask with the execution unit), and the execution unit is used to execute the subtask matched to it.
[0087] The aforementioned execution units can be created on the same or different compute nodes. Once a subtask is assigned to an execution unit created on a compute node, it can be executed by the execution unit.
[0088] In some embodiments, the multiple subtasks include a first subtask and a second subtask, a first execution unit is matched for the first subtask, and a second execution unit is matched for the second subtask; the first execution unit has a first resource configuration, and the second execution unit has a second resource configuration; wherein the first resource configuration is different from the second resource configuration.
[0089] In an embodiment of the present invention, Executors with different resource configurations are matched to different subtasks, so that different subtasks are matched to different resources, avoiding the situation where all subtasks are matched to the same resources. This can reduce the difference in execution time between different subtasks, thereby reducing unnecessary waiting time, balancing the execution efficiency between different subtasks, and improving the execution efficiency of the entire task.
[0090] In some embodiments, the resources required by the first subtask are different from the resources required by the first subtask, and the resources required by the first subtask match the resource configuration of the first execution unit; the resources required by the second subtask match the resource configuration of the second execution unit. In this embodiment of the present invention, subtasks requiring different resources are assigned to execution units with different resource configurations for execution, and the resources required by the subtasks match the resources of the matched execution units. This can make the execution efficiency of different subtasks comparable, reduce waiting time, and improve the execution efficiency of the entire task.
[0091] Figure 5A A schematic diagram of a resource allocation method provided by an embodiment of the present invention is shown in FIG. Figure 5A As shown, the method includes steps 501 to 505.
[0092] Step 501: The management node 110 receives a task sent by a client.
[0093] In some embodiments, as Figure 6 As shown, the task is a Job as described above, and the Job is generated by an Application. In some embodiments, the Application is, for example, a SQL statement, or a Spark Java / Scala job.
[0094] In some embodiments, Figure 4 The Driver receives tasks from users and converts the tasks into task sets, which include multiple subtasks.
[0095] Step 502: The management node 110 determines the number of executors required for the task and resource configuration parameters of each executor according to the characteristics of the task and the available resources in the cluster, thereby generating a resource queue.
[0096] The characteristics of a task refer to the computational load and parallelism of the task, etc. The available resources of a cluster are the resources available in all computing nodes 120 in the cluster 100, such as computing power resources, storage resources, network resources, and IO resources.
[0097] In some embodiments, after the management node 110 receives the task, the management node 110 obtains the task information of the task and the available resource information (available resource amount or available resource type, etc.) of each computing node 120, determines how many execution units need to be created on the computing node 120 according to the obtained two kinds of information, and determines what kind of resource (including resource amount, resource type, etc.) each execution unit needs to be configured. Thus, a creation scheme (resource queue) of the execution unit is constructed. The creation scheme indicates the required resource of each execution unit, and when the execution unit is created subsequently, the resource of the computing node 120 can be applied according to the deployment scheme, and the resource possessed by the finally created execution unit matches the required resource of the task.
[0098] One method is to simply allocate the same resource to each execution unit without considering the task, so if the resource allocated to a certain execution unit is not enough, the problem of low execution efficiency of the execution unit will occur; if the resource allocated to a certain execution unit is too much, resource waste will occur. In the embodiment of the present application, when the execution unit is constructed, the characteristics of the task and the available resources in the cluster are considered, so the resource configuration possessed by the execution unit constructed in this way is not completely the same, the resource configuration possessed by the execution unit matches the required resource of the task, the execution unit can efficiently complete the task by using the resource occupied, and no extra resource is occupied, avoiding resource waste.
[0099] In some embodiments, as shown in FIG. 1, Figure 6 The action of determining the number of Executors to be created and the resource configuration parameters of the Executors to be created and generating the resource queue is performed by a resource monitor (RM) of the management node.
[0100] In some embodiments, the resource queue includes a plurality of Executors and resource configuration parameters of each Executor. The resource configuration parameter is used to indicate the resource to be configured by the Executor.
[0101] The resource configuration parameter can include at least one of a computing power resource parameter and a storage resource parameter, and correspondingly, the resource to be configured by each Executor can include at least one of a computing power resource and a storage resource; the resource configuration parameter can also include a processor type; the resource configuration parameter can also simultaneously include a processor type, a computing power resource parameter and a storage resource parameter.
[0102] The computing power resource parameter is represented by the available core number on the computing node 120, the storage resource parameter is represented by the available memory size on the computing node 120, and the processor type is the type of the processor provided on the computing node 120, such as CPU, DPU, NPU, GPU, etc.
[0103] It can be understood that one Executor runs on one processor; multiple Executors can run on one processor; one Executor can execute one or more tasks.
[0104] The following describes the resource queue in combination with Figure 7A and Figure 7B The resource queue is described in detail.
[0105] As shown in Figure 7A , the resource monitor RM determines that the task requires P Executors, namely Executor1-ExecutorP. For Executor1, n1 cores and m1 G of memory are allocated to it. For Executor2, n2 cores and m2 G of memory are allocated to it. Similarly, for ExecutorP, nP cores and mP G of memory are allocated to it. The resource queue in the embodiment of the present application is suitable for application in a scenario where processor types do not need to be distinguished. Figure 7A In the embodiment, the resource configuration parameters of different Executors are not completely the same. Therefore, the resource configurations of the execution units matched to the tasks are not completely the same.
[0106] As shown in Figure 7B , the resource monitor RM determines that the task requires P Executors, namely Executor1-ExecutorP. For Executor1, n1 cores and m1 G of memory are allocated to it, and it is determined to execute on a CPU. For Executor2, n2 cores and m2 G of memory are allocated to it, and it is determined to execute on a DPU. Similarly, for ExecutorP, nP cores and mP G of memory are allocated to it, and it is determined to execute on a CPU. The resource queue in the embodiment of the present application is suitable for application in a scenario where processor types need to be distinguished. Figure 7B In the embodiment, the resource configuration parameters of different Executors are not completely the same. Therefore, the resource configurations of the execution units matched to the tasks are not completely the same.
[0107] It should be noted that the available resources provided by the computing node 120 can also include other resources, such as IO resources and network resources, etc. The embodiments of the present application do not limit the types of resources.
[0108] The above computing power resources, storage resources, processor types, etc. are collectively referred to as hardware resources. That is, in the embodiment of the present application, the hardware resources configured by the execution units are not completely the same.
[0109] The following describes how the resource monitor RM determines the number of Executors to be deployed and the resource configuration parameters of the Executors to be created according to the task characteristics and the available resources of the computing node 120.
[0110] In some instances, the resource monitor RM determines the number of executors and resource configuration based on the code of the task and the available resource information (available resource amount, available resource type, etc.) of the computing nodes 120 in the cluster. On the one hand, the embodiment of the present invention takes into account the code of the task when determining the relevant configuration of the executor. The code itself is the most direct reflection of the computational amount and parallelism of the code. Therefore, taking the code as a factor can make the final number of executors and resource configuration more consistent with the computational characteristics of the task (such as what kind of processing each task is suitable for execution and / or how many resources are required, etc.). On the other hand, the embodiment of the present invention also takes into account the available resources in the cluster when determining the relevant configuration of the executor. It can make full use of the resources in the cluster on the basis of considering the computational characteristics of the task, allocate the best available resources to each executor, and enable the task to be completed efficiently without causing waste of resources.
[0111] In some embodiments, the compute nodes 120 send available resource reports (or node information reports) to the management node 110. The reports include information such as computing power utilization and memory utilization, such as the number of used cores, the number of available cores, used memory, and available memory. The resource monitor (RM) obtains information about available resources across the entire cluster based on the available resource reports submitted by the compute nodes 120.
[0112] In some embodiments, as Figure 6 As shown, the Node Manager (NM) of the computing node 120 sends the above report to the resource monitor RM of the management node 110. The Node Manager NM is responsible for monitoring the resources of the computing node 120 and sending task reports to the Task Manager TM after the Executor completes the task.
[0113] In some embodiments, the resource monitor RM predicts the number and configuration of executors for a task using a resource configuration prediction model f. The resource configuration prediction model f is a prediction model trained using a large amount of historical data (including a large number of SQL transactions and their corresponding executor resource configurations) using a supervised algorithm.
[0114] The input of resource allocation prediction model f is the task code and the available resource information of computing nodes (such as the number of computing nodes, the list of core numbers of computing nodes, the memory list of computing nodes, etc.). The output of resource allocation prediction model f is as follows: Figure 7A or Figure 7B The resource queues shown.
[0115] It should be noted that a resource allocation prediction model f suitable for different scenarios can be trained according to the scenario. In different scenarios, the input and output of the resource allocation prediction model f may be different.
[0116] For example, in scenarios where it is not necessary to distinguish between processor types, it is possible to train Figure 7A The resource queue shown in Figure 1 is used as the output of the resource configuration prediction model f. In scenarios where it is necessary to distinguish processor types, it is possible to train Figure 7B The resource queue shown is used as the output of the resource configuration prediction model f. Accordingly, the input available resource information also includes the processor type.
[0117] For example, if you need to determine the number and configuration of executors based on each task, you can train a resource configuration prediction model f that takes the task code segment and the resource queue of the computing node's available resource information as input.
[0118] In some embodiments, before using the resource configuration prediction model f to predict resource configuration, the resource monitor RM first encodes the original code using a large language model encoder to obtain a feature vector e. It then uses the corresponding feature vector e to predict the executor configuration required for executing the code (including the number of executors, processor type, number of cores, and memory size), and outputs the executor configuration.
[0119] Currently, mainstream large language models can generate corresponding code based on natural language (such as Python, bash, and even SQL statements). Therefore, the large language model itself has learned the execution and calculation logic of the code. Choosing a large language model as a feature encoder can effectively utilize the robustness and feature capabilities of the pre-trained model, making resource allocation predictions more accurate.
[0120] In some embodiments, the resource monitor RM determines the number of executors and resource configuration based on the metadata of the task and the available resource information of the computing nodes 120 in the cluster, wherein the metadata includes information that can reflect the amount of task data.
[0121] Step 503: The management node 110 obtains the task set of the task. This step is similar to the aforementioned step S501 and will not be described in detail here.
[0122] In some embodiments, after acquiring the task set, the management node 110 generates a task queue, wherein the task queue includes each subtask in the task set, and the subtasks are arranged in a certain order.
[0123] A task set is a TaskSet, also known as a stage. A task set can include multiple tasks (subtasks). As mentioned earlier, a job obtained from an application can include multiple tasks; further, each job can be divided into one or more task sets, namely TaskSets.
[0124] like Figure 6 As shown, in some embodiments, the actions of obtaining a task set and generating a task queue are performed by a task manager (TM) of the management node.
[0125] If the task manager TM obtains a job from the application, then the task manager TM can divide the obtained job into one or more task sets. For example, the task manager TM can divide the job into different task sets based on wide conversion operations or shuffle dependency boundaries. In other embodiments, the task manager TM obtains the task set from the application, or the task manager TM in the embodiment of the present invention may not communicate directly with the application. For example, the task manager TM can obtain the task set from the application. Figure 1 The DAGScheduler shown obtains the already divided task set.
[0126] In some embodiments, the Task Manager™ directly queues the tasks to obtain Figure 8A The task queue shown in the embodiment of the present invention is suitable for use in scenarios where it is not necessary to distinguish between processor types. Figure 8A In the task queue shown, tasks can be sorted by required computing power, memory, or a combination of both. If resource allocation also includes network and I / O resources, these can also be taken into account when sorting.
[0127] In other embodiments, the Task Manager TM first classifies the tasks, and then arranges the tasks into queues according to the different classifications, so as to obtain the following: Figure 8BThe task queue shown. The task manager TM divides the tasks in the task set into at least a first type of task (a first type of subtask, including a first subtask) and a second type of task (a second type of subtask, including a second subtask). Among them, the first type of task and the second type of task are suitable for execution on different processors. In an embodiment of the present invention, different processors refer to processors with different chip architectures. For example, the first type of task is suitable for execution on a CPU; the second type of task is suitable for execution on a DPU. The task queue of an embodiment of the present invention is suitable for application in scenarios where it is necessary to distinguish between processor types. Similarly, within each queue, each task can be sorted according to the size of computing resources and / or storage resources.
[0128] It should be noted that the embodiments of the present invention only exemplify two types of tasks and two types of processors, and do not limit the types of tasks and processors. For example, the types of tasks may also include a third type of tasks; the types of processors may also include GPUs; and the third type of tasks may be suitable for execution on GPUs.
[0129] In some embodiments, the task manager TM classifies some tasks that consume more computing power resources as first-class tasks, which are suitable for execution on processors with relatively high computing performance, such as CPUs; and classifies other tasks as second-class tasks, which relatively speaking, do not require high computing power and are therefore suitable for execution on processors with relatively low computing performance, such as DPUs.
[0130] In other embodiments, the Task Manager™ classifies tasks that require disk resources as first-category tasks, which are suitable for execution on the CPU; and tasks that do not require disk resources as second-category tasks, which are suitable for execution on the DPU, because the CPU is equipped with a hard disk, while the DPU is not.
[0131] In some embodiments, the task manager TM classifies tasks according to their historical execution time. For example, for a current task i, the TM classifies it according to the historical execution time of the same task.
[0132] Specifically, if task i's historical execution time satisfies the following conditions: computeTime > η * shuffleRead, task i is assigned to the compute queue. If task i's historical execution time satisfies the following conditions: shuffleRead > η * shuffleWrite, task i is assigned to the network interaction queue. Otherwise, task i is assigned to the file read / write queue. Here, computeTime is the CPU execution time of the task; shuffleRead is the time it takes to read from the disk; and shuffleWrite is the time it takes to write to the disk. η is a performance reference ratio, an empirical value that satisfies 0 < η < 1.
[0133] Since the core resources used in the cluster task execution process include three parts: computing resources, network interaction resources and file reading and writing resources. Therefore, according to the historical execution time of the task, the embodiment of the present invention divides the task into three categories according to the preset performance reference ratio η: computing queue, network interaction queue, file reading and writing queue (such as Figure 8C This classification allows us to determine which tasks are suitable for execution on the CPU and which are suitable for execution on the DPU. Tasks in the compute queue are suitable for execution on the CPU; tasks in the network interaction queue are preferentially executed on the DPU; and tasks in the file read and write queue can be executed on either the CPU or the DPU, with priority given to the DPU.
[0134] In step 504, after the resource queue and task queue are generated, the management node 110 matches an executor for each task based on the resource queue and task queue to obtain a task-executor matching pair (subtask-execution unit matching pair). In the task-executor matching pair, the resources required by the task match the resources of the matching executor.
[0135] In some embodiments, as Figure 6 As shown, the task scheduler (TS) performs the task matching of executors. Specifically, the resource monitor (RM) sends the resource queue to the task scheduler TS, and the task manager (TM) sends the task queue to the task scheduler TS. After receiving the task queue and resource queue, the task scheduler TS matches the task with an executor according to specific rules. The matching rules are described below.
[0136] (1) Scenario where processor type differentiation is not necessary. This scenario generally does not involve heterogeneous processors. Executors are all executed on the same processor type. For example, executors are all created on CPUs.
[0137] In this scenario, the resource queue obtained by the task scheduler TS is as follows Figure 7A As shown, the obtained task queue is as follows Figure 8A As shown in the figure, tasks can be matched with executors based on their required resources (such as computing power and storage). This ensures that the executor has the resources to efficiently execute the task; it also prevents wasting resources by allocating too many resources to a task.
[0138] For example, suppose Figure 7A The Executors in the table are arranged from top to bottom in descending order of the configured computing resources. Assume Figure 8A The tasks in the task queue are arranged from top to bottom in the order of the computing power required. Therefore, the task at the head of the task queue can be assigned to the executor at the head of the resource queue, the task at the second head of the task queue can be assigned to the executor at the second head of the resource queue, and so on.
[0139] The number of tasks is generally greater than the number of executors. Therefore, the tasks in the first n positions of the task queue can be assigned to the executor at the head of the resource queue; the tasks in positions (n+1) to (n+m) of the task queue can be assigned to the executor at the second position of the resource queue; and so on.
[0140] Through the above matching method, the resources required by the task (computing resources, storage resources, etc.) are matched with the resources (computing resources, storage resources, etc.) possessed by the matched execution unit.
[0141] It should be noted that Figure 7A The Executors in can also be sorted according to the configured storage resource size; Figure 8A The tasks in the example can also be sorted according to the required storage resource size. Similarly, the Executor can be matched to the task according to the above logic. This embodiment of the present invention will not be described in detail.
[0142] (2) Scenarios where it is necessary to distinguish processor types. This scenario generally involves heterogeneous processors. Figure 4 As shown in the figure, the cluster includes CPUs, DPUs, etc. Executors are created on CPUs and DPUs.
[0143] In this scenario, the resource queue obtained by the task scheduler TS is as follows Figure 7B As shown, the obtained task queue is as follows Figure 8B (or Figure 8C). At this point, we first consider which processor the task is suitable for execution on, and then match the task with an Executor based on the resources required by the task (such as computing power and storage resources).
[0144] Below Figure 8C The task queue shown is used as an example for explanation.
[0145] Similarly, assuming Figure 7B The Executors in the table are arranged from top to bottom in descending order of the configured computing resources. Assume Figure 8C The tasks in the three queues are arranged from top to bottom in the order of the computing power resources required. When matching an executor to a task, the first consideration is which processor the task is suitable for, and then the matching is based on the computing power resources.
[0146] For example, if a task in the compute queue is suitable for execution on the CPU, the task at the head of the compute queue is first assigned to the first executor in the resource queue that has a CPU. Then, the task at the second head of the compute queue is assigned to the second executor in the resource queue that has a CPU. And so on.
[0147] Similarly, the number of tasks is generally greater than the number of executors, that is, N>P. Therefore, we can assign the tasks in the first n positions of the computation queue to the first executor in the resource queue with a CPU; assign the tasks in positions (n+1) to (n+m) of the computation queue to the second executor in the source queue with a CPU; and so on. Here, n+m<N.
[0148] For example, if a task in the network interaction queue is suitable for execution on a DPU, the task at the head of the network interaction queue is assigned to the first executor in the resource queue that has a DPU. Then, the task at the second head of the network interaction queue is assigned to the second executor in the resource queue that has a DPU. And so on.
[0149] Similarly, the number of tasks is generally greater than the number of executors, that is, N>P. Therefore, we can assign the first n tasks in the network interaction queue to the first executor in the resource queue with a DPU; assign the tasks in positions (n+1) to (n+m) in the network interaction queue to the second executor in the source queue with a CPU; and so on. Here, n+m<N.
[0150] For tasks in the file read and write queue, the Executor can be matched with reference to the above rules, which will not be described in detail in this embodiment of the present invention.
[0151] In some embodiments, in a heterogeneous cluster scenario, if only the processor type needs to be distinguished, the following situation may occur: all executors configured with CPUs have the same other resource configurations; all executors configured with DPUs have the same other resource configurations. For example, Figure 7B In this example, all CPU-configured executors have the same number of cores and memory size; all DPU-configured executors have the same number of cores and memory size; CPU-configured executors and DPU-configured executors have different number of cores and memory size. In this case, when assigning tasks, you only need to consider which processor the task is best suited for execution and pair it with any executor configured with that processor. That is, after determining the processor type, tasks that need to be executed on the same type are evenly distributed among the executors configured with that processor.
[0152] After the above process, we can match an Executor to each task, and get Figure 9 The task-executor matching pairs shown. Figure 9 In the example, 100 task and 9 Executor matching pairs are listed. Figure 9 In the example, the computing power requirements of task1 to task100 gradually decrease, and the number of cores configured for Executor1 to Executor9 gradually decreases.
[0153] Step 505 : The management node 110 sends the task-executor matching pair to the corresponding computing node 120 , so that the executor created on the corresponding computing node 120 executes the task.
[0154] In some embodiments, as Figure 6 As shown, the task scheduler TS of the management node 110 sends the task-executor matching pair to the node manager NM of the computing node 120, and the node manager NM then assigns the task to the corresponding executor for execution.
[0155] In some embodiments, as Figure 5B As shown, the resource allocation method further includes step 506 .
[0156] Step 506 : The management node 110 creates an executor on the corresponding computing node 120 based on the available resources of the entire cluster and the resource configuration of each executor.
[0157] In some embodiments, the Diver of the management node 110 applies for resources from the resource monitor RM according to the aforementioned subtask-execution unit matching. After receiving the request, the resource monitor RM will create an Executor on the computing node that meets the conditions. After the Executor is created, it will reversely register with the Driver so that the Driver's task scheduler TS can assign tasks to the Executor for execution.
[0158] When creating an executor on a compute node 120, configuration can be performed based on the available resources in the compute node 120. If a compute node 120 has a large amount of available resources, multiple executors can be created on the compute node 120. If a compute node 120 has a small amount of available resources, only one executor can be created.
[0159] The task scheduler TS can create an Executor according to the following rules:
[0160] (1) The principle of data proximity.
[0161] Each task has data to process, which is stored on compute nodes 120 in the cluster. To reduce network resource consumption for data transmission, tasks are preferentially assigned to the compute nodes where the data they process resides. Based on this principle, if the data for task i is stored on a particular compute node 120, an Executor paired with task i can be created on that compute node 120.
[0162] (2) Resource matching principle.
[0163] Because the executor's resource allocation has been determined, the executor can be created on a compute node 120 with sufficient resources. For example, in descending order of resource allocation, the executor with the largest resource allocation can be created on the compute node with the most resources. This can be repeated in this order. When the resources of a compute node 120 are fully allocated, the next executor can be created on the next compute node 120. This continues until all executors have been created.
[0164] It should be noted that the above two principles can be used in combination, or one of them can be used alone.
[0165] In some embodiments, as Figure 6As shown, the resource allocation method further comprises step 507.
[0166] Step 507, the computing node 120 assigns the received task to the Executor created on the computing node 120 according to the task-Executor matching pair.
[0167] In some embodiments, as shown in Figure 6 The action of assigning the task to the Executor for execution is performed by the node manager NM in the computing node 120.
[0168] Figure 6 As shown in the middle, two Executors are created on a certain computing node 120, which are Executor 1 and Executor 2. The node manager NM assigns task 1 to Executor 1 and task 2 to Executor 2. It should be noted that in the embodiments of the present application, task 1 and Executor 1 are a matching pair, and task 2 and Executor 2 are a matching pair.
[0169] In some embodiments, as shown in Figure 6 The resource allocation method further comprises step 508.
[0170] Step 508, after the Executor finishes executing a task, the task report is sent to the node manager NM of the computing node 120 where the Executor is located.
[0171] In some embodiments, as shown in Figure 6 The resource allocation method further comprises step 509.
[0172] Step 509, the node manager NM sends the received task report to the task manager TM of the management node.
[0173] It should be noted that in the above embodiments, the Driver is taken as an example running on the management node 110. Since the Driver can also run on the computing node 120, the steps performed by the task scheduler TS and the task manager TM in the above embodiments can also be performed on the computing node 120.
[0174] The resource allocation method provided by the embodiments of the present application is described in detail above in combination with Figures 1 to 9 The resource allocation apparatus provided by the embodiments of the present application will be described in combination with Figure 10A and Figure 10B
[0175] Figure 10A The schematic diagram of the structure of the resource allocation device 1000 provided in the embodiment of the present invention. The resource allocation device 1000 can be used to implement the functions of the management node 110 in the above method embodiment, and thus can also achieve the beneficial effects of the above method embodiment. In the embodiment of the present invention, the resource allocation device 1000 can be as follows: Figure 4 The management node 110 shown may also be a module (such as a chip) applied to a server.
[0176] like Figure 10A As shown, the resource allocation device 1000 includes a task management module 1002 and a task scheduling module 1003. The resource allocation device 1000 is used to implement the above Figure 5A and Figure 5B The functions of the management node 110 are shown in the method embodiment shown in FIG.
[0177] The task management module 1002 is used to obtain a task set of a task, which includes multiple subtasks; generate a task queue based on the obtained task set; and send the generated task queue to the task scheduling module 1003. For example, the task management module 1002 is used to execute Figure 5 Step S501 in Figure 5A and Figure 5B Step 503 in .
[0178] The task scheduling module 1003 is used to match execution units for subtasks; generate subtask-execution unit matching pairs based on the obtained resource queue and task queue; and send the subtask-execution unit matching pairs to the computing node 120. For example, the task scheduling module 1003 is used to execute Figure 5 Step S502 in Figure 5A and Figure 5B Step 504 and step 505 in .
[0179] Figure 10B This is a structural diagram of another resource allocation device 1000 provided by an embodiment of the present invention. Figure 10A The difference between the resource allocation device shown is that Figure 10B The resource allocation device further includes a resource monitoring module 1001.
[0180] The resource monitoring module 1001 is used to obtain the task information and the available resource information of the computing node; and determine the number of execution units and the resource configuration required for each execution unit based on the task information and the available resource information; generate a resource queue; and send the resource queue to the task scheduling module 1003. For example, the resource monitoring module 1001 is used to execute Figure 5A and Figure 5B Step 501 and step 502 in .
[0181] Optionally, the resource allocation device further includes a resource application module 1004 for applying for available resources from the resource monitoring module 1001 based on the generated subtask-execution unit matching pair, so that the resource monitoring module 1001 creates an execution unit in the computing node. Figure 5B Step 506 in .
[0182] Optionally, the resource configuration includes computing resources and storage resources; when the task scheduling module matches the execution unit for the subtask, it matches the computing resources and storage resources required by the subtask.
[0183] Optionally, the resource monitoring module predicts the number of execution units and the resource configuration of the execution units through a resource configuration prediction model.
[0184] Optionally, the task management module is specifically used to: divide multiple subtasks into at least two categories, and subtasks of different categories are suitable for execution on different types of processors; the task scheduling module is specifically used to: pair the first category of subtasks with an execution unit configured with a first category of processor; and pair the second category of subtasks with an execution unit configured with a second category of processor; wherein the first category of subtasks are suitable for execution on the first category of processor; the second category of subtasks are suitable for execution on the second category of processor; and the chip architecture of the first category of processor and the second category of processor are different.
[0185] The embodiment of the present invention further provides a computer device, which can be applied to the cluster provided in the above embodiment. The computer device can be the management node 110 or the computing node 120 provided in the above embodiment. Figure 11 The computer device may include a processor 1101, a memory 1102, a network interface 1103, and a bus 1104. Bus 1104 is used to connect processor 1101, memory 1102, and network interface 1103. Network interface 1103 (which may be wired or wireless) enables communication with other devices. Memory 1102 stores a computer program 5021, which is used to implement various application functions.
[0186] It should be understood that in the embodiment of the present invention, the processor 1101 may be a CPU, or may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), GPUs, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0187] Memory 1102 may be volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. Nonvolatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory may be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), sync link DRAM (SLDRAM), and direct rambus RAM (DR RAM).
[0188] In addition to the data bus, the bus 1104 may also include a power bus, a control bus, a status signal bus, etc. However, for the sake of clarity, various buses are labeled as the bus 1104 in the figure.
[0189] The processor 1101 is configured to execute the computer program stored in the memory 1102 . The processor 1101 implements the resource allocation method shown in the above method embodiment by executing the computer program.
[0190] For example, if the computer device is the management node 110, the processor 1101 may implement the steps performed by the management node 110 in the above method embodiment by executing the computer program. If the computer device is the computing node 120, the processor 1101 may implement the steps performed by the computing node 120 in the above method embodiment by executing the computer program.
[0191] An embodiment of the present invention also provides a computer-readable storage medium, which stores instructions, and the instructions are executed by a processor to implement the resource allocation method applied to the management node in the above method embodiment, or to implement the resource allocation method applied to the computing node in the above method embodiment.
[0192] An embodiment of the present invention also provides a computer program product containing instructions. When the computer program product is run on a computer, it enables the computer to implement the resource allocation method applied to the management node in the above method embodiment, or implement the resource allocation method applied to the computing node in the above method embodiment.
[0193] The embodiment of the present invention also provides a computing system, such as Figure 3 and Figure 4 As shown, the system may include: a management node 110, and multiple computing nodes 120. The management node may be Figure 3 or Figure 4 The management node 110 shown; the multiple computing nodes 120 can be as follows Figure 3 or Figure 4 The computing node 120 is shown. Figure 4 As shown, the Driver runs on the management node 110 .
[0194] The embodiment of the present invention also provides another computing system. Figure 12 , different from the aforementioned computing system, in the embodiment of the present invention, the Driver runs on the computing node 120.
[0195] The above embodiments can be implemented in whole or in part through software, hardware, firmware, or any other combination. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on a computer, the processes or functions described in accordance with the embodiments of the present invention are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains a collection of one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, hard disk, tape), an optical medium (e.g., a DVD), or a semiconductor medium. The semiconductor medium can be a solid state drive (SSD).
[0196] In the present invention, the terms "first", "second", etc. are used to distinguish identical or similar items with substantially the same effects and functions. It should be understood that there is no logical or temporal dependency between "first", "second", and "nth", nor is there any limitation on the quantity and execution order.
[0197] The term "at least one" in the present invention means at least one, and the term "plurality" in the present invention means two or more. The terms "system" and "network" are often used interchangeably herein.
[0198] The above are merely optional embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Anyone skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and such modifications or substitutions are intended to be within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the scope of protection of the claims.
[0199] It will be appreciated that some features of the invention described for clarity in the context of separate embodiments may also be provided in combination in a single embodiment. Conversely, various features of the invention described for brevity in the context of a single embodiment may also be provided individually, in any suitable combination, or as applicable to any other described embodiment of the invention.
Claims
1. A computing resource allocation method, characterized in that: The method comprises: Acquire a task set of a task, wherein the task set includes a first subtask and a second subtask; Matching a first execution unit for the first subtask; the first execution unit is used to execute the first subtask; the first execution unit has a first resource configuration; Matching a second execution unit for the second subtask; the second execution unit is used to execute the second subtask; the second execution unit has a second resource configuration; The first resource configuration is different from the second resource configuration.
2. The resource allocation method according to claim 1, wherein: Both the first resource configuration and the second resource configuration are configured with hardware resources; The first resource configuration and the second resource configuration have different hardware resources in terms of quantity or type; or The quantity and type of hardware resources configured in the first hardware resources are different from those in the second hardware resources.
3. The resource allocation method according to claim 1, wherein: The first resource configuration is configured with a first computing resource; the second resource configuration is configured with a second computing resource; the first computing resource and the second computing resource are different in size; or The first resource configuration includes a first storage resource; the second resource configuration includes a second storage resource; the first storage resource and the second storage resource have different sizes; or The first resource configuration is configured with a first processor type; the second resource configuration is configured with a second processor type; and the first processor type is different from the second processor type.
4. The resource allocation method according to claim 1, wherein: The method further comprises: Obtaining task information of the task and available resource information of one or more computing nodes; the task information is related to the resources required to perform the task; Determining the number of execution units that need to be created on the computing node and resource configuration parameters of each execution unit based on the task information and the available resource information; the resource configuration parameters are used to indicate the resource configuration of the execution unit; The execution unit at least includes the first execution unit and the second execution unit.
5. The resource allocation method according to claim 4, characterized in that: The task information includes a task code.
6. The resource allocation method according to claim 4, characterized in that: The method further comprises: Generate a subtask-execution unit matching pair; the subtask-execution unit matching pair is used to indicate the corresponding relationship between the subtasks included in the task set and the execution unit; The subtasks included in the task set include at least the first subtask and the second subtask.
7. The resource allocation method according to claim 6, characterized in that: The method further comprises: Apply for available resources to create execution units on compute nodes; The subtask-execution unit matching pair is sent to a computing node so that the computing node assigns the subtask to an execution unit for execution.
8. A resource allocation device, characterized in that: include: A task management module, configured to obtain a task set of a task, wherein the task set includes a first subtask and a second subtask; A task scheduling module, configured to match a first execution unit to the first subtask; the first execution unit is configured to execute the first subtask; the first execution unit has a first resource configuration; The task scheduling module is further configured to match a second execution unit for the second subtask; the second execution unit is configured to execute the second subtask; and the second execution unit has a second resource configuration; The first resource configuration is different from the second resource configuration.
9. The resource allocation device according to claim 8, characterized in that: Both the first resource configuration and the second resource configuration are configured with hardware resources; The first resource configuration and the second resource configuration have different hardware resources in terms of quantity or type; or The quantity and type of hardware resources configured in the first hardware resources are different from those in the second hardware resources.
10. The resource allocation device according to claim 8, characterized in that: Its characteristics are: The first resource configuration is configured with a first computing resource; the second resource configuration is configured with a second computing resource; the first computing resource and the second computing resource are different in size; or The first resource configuration includes a first storage resource; the second resource configuration includes a second storage resource; the first storage resource and the second storage resource have different sizes; or The first resource configuration is configured with a first processor type; the second resource configuration is configured with a second processor type; and the first processor type is different from the second processor type.
11. The resource allocation device according to claim 8, characterized in that: Also includes: Resource monitoring module, which obtains task information and available resource information of one or more computing nodes; The task information is related to resources required to perform the task; The resource monitoring module is further configured to determine, based on the task information and the available resource information, the number of execution units that need to be created on the computing node and resource configuration parameters of each execution unit; the resource configuration parameters are used to indicate the resource configuration of the execution unit; The execution unit at least includes the first execution unit and the second execution unit.
12. The resource allocation device according to claim 11, characterized in that: The task information includes a task code.
13. The resource allocation device according to claim 11, wherein: The task scheduling module is further configured to generate a subtask-execution unit matching pair; the subtask-execution unit matching pair is configured to indicate a corresponding relationship between the subtasks included in the task set and the execution unit; The subtasks included in the task set include at least the first subtask and the second subtask.
14. The resource allocation device according to claim 12, wherein: Also includes a resource application module, configured to apply for available resources from the resource monitoring module so that the resource monitoring module creates an execution unit on a computing node; The task scheduling module is further configured to match the subtasks and execution units to computing nodes, so that the computing nodes can assign the subtasks to the execution units for execution.
15. The resource allocation device according to claim 8, wherein: The computing resources required by the first subtask match the computing resources configured in the first resource configuration; or, The computing resources required by the second subtask match the computing resources configured in the second resource configuration.
16. The resource allocation device according to claim 10, characterized in that: The first processor type is a CPU, and the second processor type is a DPU; The first subtask is suitable for execution on a CPU; the second subtask is suitable for execution on a DPU.
17. A computing system comprising a management node and one or more computing nodes, characterized in that: The management node is configured to obtain a task set of a task, wherein the task set includes a first subtask and a second subtask; The management node is further configured to match a first execution unit for the first subtask; the first execution unit is configured to execute the first subtask; and the first execution unit has a first resource configuration; The management node is further configured to match a second execution unit for the second subtask; the second execution unit is configured to execute the second subtask; and the second execution unit has a second resource configuration; The first execution unit and the second execution unit are deployed on the computing node; and the first resource configuration is different from the second resource configuration.
18. A computer device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program, and the processor is configured to execute the computer program to implement the method according to any one of claims 1 to 7.