Task scheduling method and related equipment
By adaptively adjusting the number of task shards in the scheduling system of distributed clusters, the problem of uneven resource allocation in task scheduling is solved, and the reliability and availability of the system are improved.
Patent Information
- Application Number
- CN202410284789.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-12-05
- Filing Date
- 2024-03-12
- Publication Date
- 2025-06-06
AI Technical Summary
In a distributed cluster environment, it is difficult to achieve accurate resource allocation for task scheduling strategies, resulting in insufficient node resources and increasing the risk of task failure or node downtime.
By introducing a mechanism to adaptively adjust the number of task shards in the scheduling system, resource usage is dynamically adjusted according to the load of running tasks or task shards to ensure that cluster resources achieve load balancing.
It effectively avoids the risk of executing nodes being filled by a single task or task shard, and improves the reliability and availability of the system.
Smart Images

Figure CN120104264A_ABST
Abstract
Description
[0001] This application claims the priority of the Chinese patent application filed with the State Intellectual Property Office on December 5, 2023, with application number 202311677310.2 and invention name “A task scheduling method and related equipment”, the entire contents of which are incorporated by reference in this application. Technical Field
[0002] The present application relates to the field of computer technology, and in particular to a task scheduling method, a task scheduling system, a computing device cluster, a computer-readable storage medium, and a computer program product. Background Art
[0003] With the continuous development of computer technology, applications that provide services to large-scale users continue to emerge. Applications represented by Internet applications or enterprise-level applications usually have a large number of batch processing tasks to be processed. As the architecture of the above applications gradually evolves from a monolithic architecture to a microservice architecture, the task scheduling in applications based on the microservice architecture can adopt a distributed task scheduling strategy.
[0004] Distributed task scheduling is a task scheduling that runs in a distributed cluster environment. The scheduling node schedules tasks to the execution nodes in the distributed cluster for processing. With the diversification of tasks, the requirements for task scheduling strategies are getting higher and higher. How to schedule tasks more accurately, achieve load balancing of cluster resources, and improve the utilization of computing resources requires further exploration.
[0005] However, many tasks cannot determine the amount of cluster resources required to execute the task. The scheduling node schedules the task to the execution node. After the task starts running, it may cause insufficient node resources, which in turn leads to the failure of running the task on the node or the risk of the entire node crashing. Summary of the invention
[0006] The present application provides a task scheduling method, which can adaptively adjust the number of task slices according to the load of the running task or task slice, and then dynamically adjust the resource usage of the task, so that the overall cluster resources can achieve load balancing, avoid the execution node being occupied by a single task or task slice, causing the risk of task failure or node downtime, and improve reliability and availability. The present application also provides a scheduling system, a computing device cluster, a computer-readable storage medium, and a computer program product corresponding to the above method.
[0007] In the first aspect, the present application provides a task scheduling method. The method can be performed by a scheduling system. The scheduling system can be a distributed task scheduling system for scheduling tasks to a distributed cluster for processing by the distributed cluster. The scheduling system can be a software system, and the software system can be an independent software system, such as an independent scheduling engine, or integrated into other software, such as integrated into other software in the form of plug-ins, applets, etc. Among them, the software system can be provided to the user in the form of a code package, which can be deployed by the user himself, or provided to the user in the form of a cloud service. The software system can be deployed in a computing device cluster, and the computing device cluster executes the program code of the software system, thereby executing the task scheduling method of the present application. In some examples, the task scheduling system can also be a hardware system, such as a computing device cluster with scheduling capabilities. When the hardware system is running, the task scheduling method of the present application is executed.
[0008] Specifically, the scheduling system receives the task, and schedules the task or the task slice of the task to the first execution node in the distributed cluster, and the first execution node is at least one execution node in the distributed cluster. In the process of the first execution node executing the task or the task slice, the scheduling system receives a slice adjustment request sent by the first execution node. The slice adjustment request is used to request to increase the task slice of the task or reduce the task slice of the task, and the slice adjustment request is generated by the first execution node according to the load of the task or the task slice on the first execution node. The scheduling system adjusts the task slice of the task in the distributed cluster according to the slice adjustment request. Among them, adjusting the task slice of the task includes: increasing the task slice of the task in the second execution node, or reducing the task slice of the task in the first execution node.
[0009] This method can adaptively adjust the number of task slices according to the load of the running tasks or task slices, and then dynamically adjust the resource usage of the tasks, so that the overall cluster resources can be load balanced, avoiding the execution nodes being occupied by a single task or task slice, causing the risk of task failure or node downtime, and improving reliability and availability.
[0010] In some possible implementations, when the load of the task or task slice on the first execution node is greater than a first threshold, the slice adjustment request is used to request to increase the task slice of the task; or, when the load of the target task slice of the task on the first execution node is less than a second threshold, the slice adjustment request is used to reduce the target task slice of the task.
[0011] In this way, the number of task slices can be adaptively adjusted according to the load size of the task or task slice, and the resource usage of the task can be dynamically adjusted to achieve load balancing of cluster resources.
[0012] In some possible implementations, the scheduling system includes a scheduling node and a data module. When the data module detects that the task slice of the task is adjusted, the processing data of the task is re-sliced to obtain at least one data slice, and the at least one data slice corresponds to the adjusted task slice one by one.
[0013] The method re-slices the task processing data when it detects that the task slice has been adjusted, for example, re-load balances the processing data, thereby reducing the resource load occupied by tasks or task slices with heavier loads, thereby achieving the purpose of relatively balanced overall resources.
[0014] In some possible implementations, the data module can re-slice the task processing data to obtain at least one data slice through load balancing according to the adjusted number of task slices. The data module re-slices the processing data through load balancing to ensure that the amount of data pulled by each task slice is relatively balanced, thereby achieving relative balance of overall resources.
[0015] In some possible implementations, the data module can also record the progress of pulling the processing data of the task. Accordingly, the data module can determine the remaining data based on the progress of pulling the processing data of the task, and then the data module can re-shard the remaining data to obtain at least one data shard. In this way, it can be ensured that when the task shard changes, the processing data can be completely pulled and the uniqueness and integrity of the data can be guaranteed.
[0016] In some possible implementations, the data module can also send a heartbeat message to the task slice, which is used to detect the activity of the task slice. Then, the data module adjusts the data slice according to the activity of the task slice. In this way, the status of the task slice can be dynamically monitored, and then the linkage adjustment of the data slice and the task slice can be realized to ensure the balance of the overall resources.
[0017] In some possible implementations, tasks or task slices are assembled in a data body. The data body records the load of the running task or task slice and the identification of the task or task slice. By maintaining a data body of task information such as a cube, the method records the load occupancy of the running task, and can quickly make a decision on the resource load occupied by each running task, providing a reference for whether to reduce the task.
[0018] In some possible implementations, the task includes a log processing task.
[0019] In a second aspect, the present application provides a scheduling system. The scheduling system comprises:
[0020] A scheduling node, used for receiving a scheduling task, scheduling the task or the task slice of the task to a first execution node in a distributed cluster, the first execution node being at least one execution node in the distributed cluster, and receiving a slice adjustment request sent by the first execution node during the process of the first execution node executing the task or the task slice, the slice adjustment request being used to request to increase the task slice of the task or reduce the task slice of the task, the slice adjustment request being generated by the first execution node according to the load of the task or the task slice of the task on the first execution node;
[0021] The scheduling node is further used to adjust the task slice of the task in the distributed cluster according to the slice adjustment request;
[0022] The adjusting of the task slices of the task includes: increasing the task slices of the task in the second execution node, or reducing the task slices of the task in the first execution node.
[0023] In some possible implementations, when the load of the task or the task slice of the task on the first execution node is greater than a first threshold, the slice adjustment request is used to request to increase the task slice of the task; or, when the load of the target task slice of the task on the first execution node is less than a second threshold, the slice adjustment request is used to reduce the target task slice of the task.
[0024] In some possible implementations, the scheduling system includes the scheduling node and a data module, and the data module is specifically used to:
[0025] When it is detected that the task slice of the task is adjusted, the processed data of the task is re-sliced to obtain at least one data slice, and the at least one data slice corresponds to the adjusted task slice one by one.
[0026] In some possible implementations, the data module is specifically used to:
[0027] According to the adjusted number of task slices, the processing data of the task is re-sliced to obtain at least one data slice through load balancing.
[0028] In some possible implementations, the data module is further used to:
[0029] Record the progress of pulling the processing data of the task;
[0030] The data module is specifically used for:
[0031] Determining remaining data according to the pulling progress of the processing data of the task;
[0032] The remaining data is re-sharded to obtain at least one data shard.
[0033] In some possible implementations, the data module is further used to:
[0034] Sending a heartbeat message to the task slice, wherein the heartbeat message is used to detect the activity of the task slice;
[0035] The data shards are adjusted according to the activity of the task shards.
[0036] In some possible implementations, the task or the task slice is assembled in a data body, and the data body records the load of the running task or the task slice and the identification of the task or the task slice.
[0037] In some possible implementations, the task includes a log processing task. The log processing task can be to read the original log from the corresponding log source according to the user's task configuration information, process it according to the rules expected by the user, and then write the result to the expected target. It should be noted that the task can also be other tasks with uncertain task demand resource size or large changes in the resources occupied by running tasks.
[0038] This method can be applied to task scheduling scenarios of different tasks and has high availability.
[0039] In a third aspect, the present application provides a computing device cluster. The computing device cluster includes at least one computing device, and the at least one computing device includes at least one processor and at least one memory. The at least one processor and the at least one memory communicate with each other. The at least one processor is used to execute instructions stored in the at least one memory, so that the computing device or the computing device cluster executes the task scheduling method described in the first aspect or any implementation of the first aspect.
[0040] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, wherein the instructions instruct a computing device or a computing device cluster to execute the task scheduling method described in the first aspect or any one of the implementations of the first aspect.
[0041] In a fifth aspect, the present application provides a computer program product comprising instructions, which, when executed on a computing device or a computing device cluster, enables the computing device or the computing device cluster to execute the task scheduling method described in the first aspect or any one of the implementations of the first aspect.
[0042] Based on the implementations provided in the above aspects, this application can also be further combined to provide more implementations. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical method of the embodiments of the present application, the drawings required for use in the embodiments are briefly introduced below.
[0044] Figure 1 A flowchart of a task scheduling process provided for this application;
[0045] Figure 2 A schematic diagram of the structure of a scheduling system provided for this application;
[0046] Figure 3 A flowchart of a task scheduling method provided for this application;
[0047] Figure 4 A schematic diagram of adaptive adjustment of task slicing provided in this application;
[0048] Figure 5 A schematic diagram of adaptive adjustment of data slicing with task slicing provided by this application;
[0049] Figure 6 A flowchart of a task slicing adaptive adjustment process provided by this application;
[0050] Figure 7 A schematic diagram of a task scheduling method provided in this application applied to a log processing scenario;
[0051] Figure 8 A schematic diagram of the structure of a scheduling node provided in this application;
[0052] Fig. 9 A schematic diagram of the structure of a computing device provided for this application;
[0053] Fig.10 A schematic diagram of the structure of a computing device cluster provided for this application;
[0054] Fig.11 A schematic diagram of the structure of another computing device cluster provided for this application;
[0055] Fig.12 A schematic diagram of the structure of another computing device cluster provided in this application. DETAILED DESCRIPTION
[0056] The terms "first" and "second" in the embodiments of the present application are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features.
[0057] First, some technical terms involved in the embodiments of the present application are introduced.
[0058] Distributed task scheduling is a task scheduling that runs in a distributed cluster environment. Distributed means that different businesses are split and deployed according to the microservice architecture style, and cluster means that the same business split according to the microservice architecture style is deployed on different nodes. Based on this, a distributed cluster refers to the cluster setting of each node in a distributed system, for example, cluster deployment of different split businesses. In specific implementation, the scheduling node can schedule tasks to the execution node in the distributed cluster for operation and processing. Among them, the scheduling node can also be called the master node, which is responsible for task scheduling, specifically scheduling tasks to reasonable execution nodes according to reasonable scheduling strategies. The execution node can also be called the worker node, which is the node that actually runs the task and completes task processing according to the task logic written by the user.
[0059] For many tasks, it is impossible to determine the amount of cluster resources required to execute the task. The scheduling node schedules the task to the execution node. After the task starts running, it may lead to insufficient node resources, which in turn leads to the failure of running the task on the node or the risk of the entire node crashing. The industry has proposed a task scheduling method based on MapReduce.
[0060] like Figure 1 As shown, the task center includes task 1 and task 2, and the scheduling center includes multiple master nodes, such as master1 and master2. The scheduling center is used to schedule tasks to task executors for execution. The task executors include multiple working nodes, such as worker1 to worker3. The master node of the scheduling center can monitor the load status of the cluster (a cluster formed by working nodes) and dynamically monitor the information during the execution of each working node. When task 1 and task 2 arrive at the scheduling center, the master node can decide whether to split the tasks according to the current load of the cluster. In this example, the master node can decide to split the tasks and send them to different working nodes for processing. For example, task1 can be split into task 1map and task1 reduce-1, task1 reduce 2, and dispatched to worker1 to worker3 respectively. A MapReduce job usually divides the input data set into several independent data blocks, and the map task processes the data blocks in a completely parallel manner. The output of the map task can be used as the input of the reduce task.
[0061] The task scheduling method based on MapReduce can achieve the effect of dynamic sharding. The above task sharding can make better use of cluster resources, but in extreme scenarios, there is still a situation where the reduce task will occupy all the worker resources during processing, resulting in task execution failure or node downtime. The above distributed scheduling methods only assign tasks to specific executors for execution when the tasks are issued, and will not pay attention to the subsequent workload of each executor. Even if the sharding strategy interface is opened for user customization, it is still inevitable that the entire logic is determined when the task is issued and cannot be dynamically adapted. If a high-energy resource-consuming task is scheduled later, the scheduling engine will still allocate it to each executor for execution according to the static sharding or MapReduce dynamic sharding method without being able to identify the subsequent resource occupancy of the task. There is a risk that the resources of the entire executor will be fully occupied, resulting in the failure of other tasks to execute or the entire node to crash.
[0062] In view of this, the present application provides a task scheduling method. The method can be executed by a scheduling system. The scheduling system can be a distributed task scheduling system. The task scheduling system is suitable for scheduling scenarios where the required resource size and the number of shards are uncertain at the beginning of scheduling, there are a large number of batch tasks or the resource size required for the running state changes over time, and there is a long-term stable task scenario where a single task will occupy the execution node resources. The scheduling system can be a software system, and the software system can be an independent software system, such as an independent scheduling engine, or integrated into other software, such as in the form of plug-ins, applets, etc. In which, the software system can be provided to the user in the form of a code package, deployed by the user, or provided to the user in the form of a cloud service. The software system can be deployed in a computing device cluster, and the computing device cluster executes the program code of the software system, thereby executing the task scheduling method of the present application. In some examples, the task scheduling system can also be a hardware system, such as a computing device cluster with scheduling capabilities. When the hardware system is running, the task scheduling method of the present application is executed.
[0063] Specifically, the scheduling system can receive a task, and schedule the task or the task slice of the task to the first execution node in the distributed cluster. The first execution node is at least one execution node in the distributed cluster. Then, during the process of the first execution node executing the task or the task slice, the scheduling system receives a slice adjustment request sent by the first execution node. The slice adjustment request is used to request to increase the task slice of the task or reduce the task slice of the task. The slice adjustment request is generated by the first execution node according to the load of the task or the task slice of the task on the first execution node. The scheduling system adjusts the task slice of the task in the distributed cluster according to the slice adjustment request. Among them, adjusting the task slice of the task includes increasing the task slice of the task in the second execution node, or reducing the task slice of the task in the first execution node.
[0064] This method can adaptively adjust the number of task slices according to the load of the running tasks or task slices, and then dynamically adjust the resource usage of the tasks, so that the overall cluster resources can be load balanced, avoiding the execution nodes being occupied by a single task or task slice, causing the risk of task failure or node downtime, and improving reliability and availability.
[0065] In order to make the technical solution of the present application clearer and easier to understand, the system architecture of the present application is introduced below with reference to the accompanying drawings.
[0066] See also Figure 2 The schematic diagram of the architecture of a scheduling system shown in the figure, the scheduling system 10 includes a scheduling node 100. Considering reliability or load balancing, the scheduling system 10 may include multiple scheduling nodes 100, and the scheduling node 100 may be a master. Among them, the scheduling nodes may form a scheduling center. The scheduling system 10 is connected to the task center 20 and the task executor 30 respectively, and the task executor 30 may include a distributed cluster formed by multiple execution nodes. The scheduling system 10 is used to schedule the tasks of the task center 20 to the execution nodes in the task executor 30 for execution. Among them, the execution node may be a working node worker. Further, the scheduling system 10 may also include a data module 200.
[0067] Specifically, the scheduling node 100 is used to receive a task, and schedule the task or the task slice of the task to the first execution node in the distributed cluster. The first execution node is at least one execution node in the distributed cluster. In the process of the first execution node executing the task or the task slice, the first execution node receives a slice adjustment request sent by the first execution node. The slice adjustment request is used to request to increase the task slice of the task or reduce the task slice of the task. The slice adjustment request is generated by the first execution node according to the load of the task or the task slice of the task on the first execution node. In some examples, the slice adjustment request may include an adjustment type and an identifier of an adjustment object. The adjustment type may be to increase the task slice or reduce the task slice. The identifier of the adjustment object may include at least one of the task identifier or the identifier of the task slice. In other examples, the slice adjustment request may include the load of the task or the task slice. The scheduling node is also used to adjust the task slice of the task in the distributed cluster according to the slice adjustment request. Wherein, adjusting the task slice of the task includes increasing the task slice of the task in the second execution node, or reducing the task slice of the task in the first execution node.
[0068] The data module 200 stores the data required to execute the task, which is also called the processing data of the task. Figure 2 For example, data module 200 may store data 1 (such as data 1) required for executing task 1 and data 2 (such as data 2) required for executing task 2. Tasks or task slices running on execution nodes may pull processing data of tasks from data module 200 to execute tasks.
[0069] The first execution node is used to sense the load of the task or task slice, decide whether to adjust the number of task slices based on the load, and then generate a slice adjustment request based on the decision result. In some possible implementations, the scheduling system can set a threshold for deciding whether to adjust the number of task slices, such as a first threshold or a second threshold. When the load of the task or the task slice of the task on the first execution node is greater than the first threshold, the slice adjustment request is used to request to increase the task slice of the task. Alternatively, when the load of the target task slice of the task on the first execution node is less than the second threshold, the slice adjustment request is used to reduce the target task slice of the task. Among them, the first threshold or the second threshold can be set according to experience, the first threshold can be equal to the second threshold, and it can also be unequal to the second threshold, and this embodiment does not limit this.
[0070] Still Figure 2As an example, task 1 is scheduled by the scheduling node 100 (such as master1) to the first execution node (such as working node 1, denoted as worker1) when scheduling starts. When worker1 senses that the load of task 1 is greater than the first threshold, it can send a shard adjustment request to the scheduling node 100. The shard adjustment request is used to request to add a task shard of task 1 to the second execution node. Among them, the second execution node can be an execution node other than the first execution node in the distributed cluster, such as worker3. Based on this, task 1 can be divided into the following task shards: task 1-1 (task1-1), task 1-2 (task1-2). Among them, task1-2 can be a newly added task shard, and task1-1 is a task shard formed after the original task 1 shares part of the load to task1-2.
[0071] The data module 200 is used to re-slice the processing data of the task to obtain at least one data slice when it is detected that the task slice of the task is adjusted. The at least one data slice corresponds to the adjusted task slice one by one. Figure 2 For example, when task 1 is divided into 2 task shards, data 1 can be re-sharded into 2 data shards. For example, data blocks numbered 0 to 3 in data 1 are divided into one data shard, and data blocks numbered 4 to 7 are divided into another data shard.
[0072] The task slices may pull data from the corresponding data slices, and then process the task according to the data slices. The results of the execution nodes executing the tasks or task slices may be reported to the scheduling node 100.
[0073] Based on the aforementioned scheduling system 10, the present application further provides a task scheduling method. The task scheduling method of the present application is described in detail below in conjunction with an embodiment.
[0074] See also Figure 3 The flowchart of a task scheduling method shown in FIG. 1 is a flowchart of a task scheduling method, which can be executed by a scheduling system 10. The scheduling system 10 includes a scheduling node 100. Further, the scheduling system 10 may also include a data module 200. The method specifically includes the following steps:
[0075] S301: The scheduling node 100 receives a task.
[0076] A task refers to a task that needs to be scheduled by the scheduling node 100 to the execution node for execution. The task is a task or a batch processing task with uncertain resource requirements, uncertain number of shards, and resource size that changes over time in the running state. In some examples, the task may be a log processing task. The log processing task may be based on the user's task configuration information, read the original log from the corresponding log source, process it according to the rules expected by the user, and then write the result to the expected target. In other examples, the task may also be other tasks with uncertain resource requirements or tasks with large changes in the resources occupied by running tasks.
[0077] S302 , the scheduling node 100 schedules the task or the task slice of the task to the first execution node in the distributed cluster.
[0078] The first execution node is at least one execution node in the distributed cluster. The scheduling node 100 may determine the first execution node from the distributed cluster according to the load of the execution node in the distributed cluster. For example, the scheduling node 100 may determine the node with the smallest load or less than a set value as the first execution node. Then, the scheduling node 100 may schedule the task to the above-mentioned first execution node.
[0079] In some possible implementations, the scheduling node 100 may also slice the task to obtain multiple task slices. The scheduling node 100 may schedule multiple task slices to different first execution nodes. For example, when the scheduling node 100 receives task1, it may divide task1 into multiple task slices, including task1-1 and task1-2, according to the initial requirements of the task, and schedule task1-1 and task1-2 to different first execution nodes, wherein task1-1 is scheduled to worker1 and task1-2 is scheduled to worker2.
[0080] S304. When the first execution node is executing a task or a task slice, the scheduling node 100 receives a slice adjustment request sent by the first execution node.
[0081] The slicing adjustment request is used to request to increase the task slice of a task or reduce the task slice of a task. The slicing adjustment request is generated by the first execution node according to the load of the task or the task slice of the task on the first execution node. The task or task slice scheduled to the first execution node can pull the processing data corresponding to the task or task slice to execute the task or task slice. In the process of the first execution node executing the task or task slice, the first execution node can monitor the load of the task or task slice, wherein the load of the task or task slice refers to the resource load (resource load) of the task or task slice, and the resource load of the task or task slice can be the sum of the number of processes being processed and waiting to be processed by the processor within a period of time. The first execution node can generate a slicing adjustment request according to the load of the task or task slice, and send the slicing adjustment request to the scheduling node 100. Accordingly, the scheduling node 100 receives the slicing adjustment request sent by the first execution node during the execution of the task or task slice, and can perform subsequent slicing adjustment operations.
[0082] The following is a detailed description of the generation process of the shard adjustment request.
[0083] The first execution node compares the load (such as resource load) of the task or the task slice of the task with a set threshold. Specifically, when the load of the task or the task slice is greater than the first threshold, the first execution node can generate a slice adjustment request for requesting to increase the task slice. When the load of the task slice is less than the second threshold, the first execution node can generate a slice adjustment request for requesting to reduce the task slice.
[0084] by Figure 4As an example, for task 1 (such as task1), the scheduling center schedules task1 to working node 1 (such as worker1). Worker1 detects that the load of task1 is greater than the first threshold, and sends a slicing adjustment request to the scheduling center. The slicing adjustment request is used to request to increase the task slicing of task1, for example, to add a task slicing of task1 to working node 3 (such as worker3), such as task 1-2 (task1-2). Accordingly, task1 running on worker1 can become a task slicing of task1, such as task 1-1 (such as task1-1). For task 2 (such as task2), the scheduling center divides task2 into 3 task slicings, such as task 2-1 (such as task2-1), task 2-2 (such as task2-2), and task 2-3 (such as task2-3), which are respectively scheduled to worker1, working node 2 (such as worker2), and worker3. When worker2 detects that the load of task slice task2-2 executing task2 is less than the second threshold, it can send a slice adjustment request to the scheduling center, where the slice adjustment request is used to request to shrink the task slice task2-2 of task2.
[0085] In some possible implementations, tasks or task slices can be assembled in a data body. The data body can be a cube that carries the running tasks or task slices. The data body can also record the load of the running tasks or task slices and the identification of the tasks or task slices. Task slices are subtasks of tasks. Based on this, the data body can record the load of tasks or subtasks and the identification of tasks or subtasks. The first execution node can encapsulate the task or task slice, the identification of the task, the identification of the task slice, and the resource load in a cube for each task or task slice scheduled to the execution node. For ease of understanding, Figure 4 Example description. In this example, worker1 can assemble task1 in a cube and record the task ID (recorded as taskId), the task slice ID (recorded as Sub TaskId), and the load of the task or task slice (recorded as ResourceLoad) in the cube. Similarly, worker2 can assemble task2-2 in a cube and record the task2 ID, task2-2 ID, and task2-2 load in the cube.
[0086] The scheduling node 100 may receive a slice adjustment request generated by the first execution node according to the load of the task or task slice. In some examples, the slice adjustment request may include an adjustment type and an identifier of an adjustment object, the adjustment type may be to increase a task slice or to reduce a task slice, and the identifier of the adjustment object may include at least one of a task identifier or an identifier of a task slice. In other examples, the slice adjustment request may include the load of the task or task slice.
[0087] S306 . The scheduling node 100 adjusts the task slices of the task in the distributed cluster according to the slice adjustment request.
[0088] Wherein, adjusting the task slice of the task includes increasing the task slice of the task in the second execution node, or reducing the task slice of the task in the first execution node. The second execution node may be an execution node other than the first execution node in the distributed cluster.
[0089] The slicing adjustment request indicates an adjustment type or an adjustment object. When the adjustment type is to add task slicing, the scheduling node can add the task slicing of the task in the second execution node according to the identifier of the task in the slicing adjustment request. Among them, the scheduling node can determine the second execution node in a similar manner to determining the first execution node. The scheduling node can obtain the load of each execution node in the distributed cluster and determine the second execution node according to the load of the execution node. The second execution node can be the execution node with the smallest load among the other execution nodes in the distributed cluster except the first execution node, or the execution node with a load less than a set value. When the adjustment type is to reduce task slicing, the scheduling node can reduce the target task slicing in the first execution node according to the identifier of the target task slicing, such as the identifier of the target task slicing in the slicing adjustment request.
[0090] S308: When the data module 200 detects that the task slice of the task is adjusted, the processing data of the task is re-sliced to obtain at least one data slice.
[0091] The data module 200 stores the processing data of the task. The data module 200 can slice the processing data of the task according to the number of slices of the task to obtain at least one data slice. The newly added task slice can be automatically registered to the data module 200. In this way, the data module 200 can detect that the task slice of the task has been adjusted, and the data module 200 can re-slice the processing data of the task to obtain at least one data slice. Figure 5In the example, task1 includes the following task slices task1-1 and task1-2. When the scheduling node 100 adds a task slice task1-3, the task slice can be automatically registered to the data module 200. The data module 200 detects the increase of the task slice and can re-slice the processing data of the task from 2 data slices to 3 data slices. For example, the data block numbered 3 in data slice 1 and the data blocks numbered 4 and 5 in data slice 2 can be stripped from the original data slice and merged into a new data slice.
[0092] Taking data shard as an example, the processing data of the task, such as log data, can be stored in shards. Shard can support operations such as indexing and data query. When the data module 200 detects a newly added task shard, it performs a rebalance operation to re-shard the shard to ensure that the amount of data pulled by each task shard is relatively balanced.
[0093] In some possible implementations, the data module 200 may also record the progress of pulling the processing data of the task, such as the progress of pulling the data shards. Accordingly, when the data module 200 re-shards the processing data of the task, it may determine the remaining data according to the progress of pulling the processing data of the task, and then re-shard the remaining data to obtain at least one data shard. By recording the progress of pulling each data shard (such as shard), this method can ensure that data pulling is not repeated.
[0094] In some possible implementations, the data module 200 can also send a heartbeat message to the task slice, and the heartbeat message is used to detect the activity of the task slice. Among them, the activity of the task slice is used to characterize the current state of the task slice, such as a normal operating state or an inactivated state. Correspondingly, the data module 200 can also adjust the data slice according to the activity of the task slice. For example, if the data module 200 detects that the task slice is inactivated, the data slice can be readjusted to reduce the number of data slices. In this method, a heartbeat is maintained between the data module 200 and the task slice, and the shard assigned to the task slice is guaranteed to be updated in real time through monitoring to ensure the integrity of data pulling.
[0095] It should be noted that the above S308 is an optional step of the embodiment of the present application. The task scheduling method of the embodiment of the present application may not execute the above step.
[0096] Based on the above description, the present application provides a task scheduling method. The method receives a task and schedules the task or the task slice of the task to the first execution node in the distributed cluster. During the process of the first execution node executing the task or the task slice, the first execution node receives a slice adjustment request generated and sent according to the load of the task or the task slice on the node, and adjusts the task slice of the task in the distributed cluster according to the slice adjustment request, thereby monitoring the load of the running task or the task slice, adaptively adjusting the number of tasks or task slices according to the load of the task or the task slice, and then dynamically adjusting the resource usage of the task, so that the overall cluster resources are load balanced, avoiding the execution node being occupied by a single task, causing the risk of task failure or node downtime, and improving reliability and availability.
[0097] The following is an explanation of the process of adaptive adjustment of task slices with reference to the accompanying drawings. Figure 6 As shown in Figure 1, the adaptive adjustment of task slicing can be divided into multiple stages: task scheduling, operation monitoring, and dynamic adjustment.
[0098] In the task scheduling stage, the scheduling node 100 receives new tasks, such as task1 and task2, and can schedule the new tasks to execution nodes with relatively abundant resources according to the scheduling strategy. Figure 6 In the example, the scheduling node 100 can schedule task1 to worker1 and task2 to worker2.
[0099] During the running phase, each time a task pulls a batch of processing data, the worker can determine the resource load of the task. It should be noted that when a task is divided into task slices and scheduled to different workers, the worker can determine the resource load of the task slices.
[0100] In the dynamic adjustment stage, the worker can send a shard adjustment request to the scheduling node 100 to request the addition of task shards based on the monitored task load when the task load exceeds the set threshold, for example, exceeds the first threshold. The newly added task shards can trigger the data module 200 to rebalance. The newly added task shards can pull data from the rebalanced data shards to share the resource load of the existing tasks, so as to reduce the resource occupation of the worker where the existing tasks are located. When the task load is lower than the set threshold, for example, lower than the second threshold, the worker can send a shard adjustment request to the master to request the reduction of the task shards. When the task shards of the task in the distributed cluster are not unique, the scheduling node 100 can reduce the task shards, and the remaining task shards share the data shards corresponding to the task shards.
[0101] In order to make the technical solution of the present application clearer and easier to understand, the present application also provides application scenarios for example illustration.
[0102] See also Figure 7 The schematic diagram of a task scheduling method applied to a log processing scenario is shown. In this scenario, the task can be a log processing task. The user can create a log processing task. The scheduling node 100 can divide task1 into two task slices, specifically task1-1 and task1-2, according to the initial task requirements, and schedule the two task slices, which are respectively allocated to worker1 and worker2. The two task slices pull the data of the corresponding log 1 (such as log1 log stream) in the log pulling module, task1-1 pulls the log data on 0-2 shard, and task1-2 pulls the log data on 3-5 shard. The log data is input into the function module and processed according to the rules set by the user, and the processed log is output. Among them, the rules set by the user can be rules based on a domain-specific language (Domain-specific language, DSL). Domain-specific language is a language used for a specific context in a specific domain, usually optimized for a specific class of problems, and contains a more advanced abstract programming language. DSL can use concepts and rules from a profession or field to process log data and output a processed log.
[0103] During the operation of the log processing task, when it is monitored that the load (or occupied resources) of the task shard task1-1 exceeds the set threshold (for example, the first threshold), the scheduling node 100 is automatically requested to increase the shard of task 1 (task1), and the scheduling node 100 schedules the task shard task1-3 to worker3. The log pulling module monitors the task shard corresponding to the newly added log1, and rebalances, assigning 0-1shard to task1-1, 2-3shard to task1-2, and 4-5shard to task1-3, thereby achieving the purpose of reducing the resource load occupied by task1-1 and relatively balancing the overall resources.
[0104] Based on the above-mentioned task scheduling method, the present application also provides a scheduling system. Figure 2 As shown, the scheduling system 10 includes:
[0105] The scheduling node 100 is used to receive a scheduling task, schedule the task or the task slice of the task to the first execution node in the distributed cluster, the first execution node is at least one execution node in the distributed cluster, and during the process of the first execution node executing the task or the task slice, receive a slice adjustment request sent by the first execution node, the slice adjustment request is used to request to increase the task slice of the task or reduce the task slice of the task, and the slice adjustment request is generated by the first execution node according to the load of the task or the task slice of the task on the first execution node;
[0106] The scheduling node 100 is further used to adjust the task slices of the task in the distributed cluster according to the slice adjustment request, wherein adjusting the task slices of the task includes: increasing the task slices of the task in the second execution node, or reducing the task slices of the task in the first execution node.
[0107] The above-mentioned scheduling node 100 can be implemented by software or by hardware. When implemented by hardware, the scheduling node 100 may include at least one computing device, such as a server. When implemented by software, the scheduling node 100 may be an application running on a computing device, such as a virtualized application.
[0108] Further, see Figure 8 , the scheduling node 100 may include the following functional modules:
[0109] Interaction module 102, used for receiving scheduling tasks;
[0110] A scheduling module 104, configured to schedule a task or a task slice of a task to a first execution node in a distributed cluster, where the first execution node is at least one execution node in the distributed cluster;
[0111] The interaction module 102 is further used to receive a slicing adjustment request sent by the first execution node during the process of the first execution node executing the task or the task slice, the slicing adjustment request is used to request to increase the task slice of the task or reduce the task slice of the task, and the slicing adjustment request is generated by the first execution node according to the load of the task or the task slice of the task on the first execution node;
[0112] The adjustment module 106 is used to adjust the task slices of the task in the distributed cluster according to the slice adjustment request.
[0113] The interaction module 102, the scheduling module 104 or the adjustment module 106 may be implemented by software or by hardware.
[0114] When implemented by software, the interaction module 102, the scheduling module 104 or the adjustment module 106 may be an application running on a computing device, such as a computing engine. The application may be provided to users through virtualization services. Virtualization services may include virtual machine (VM) services, bare metal server (BMS) services and container services. Among them, the VM service may be a service that virtualizes a virtual machine (VM) resource pool on multiple physical hosts through virtualization technology to provide VMs for users to use on demand. The BMS service is a service that virtualizes a BMS resource pool on multiple physical hosts to provide BMS for users to use on demand. The container service is a service that virtualizes a container resource pool on multiple physical hosts to provide containers for users to use on demand. VM is a simulated virtual computer, that is, a logical computer. BMS is a high-performance computing service that can be elastically scalable, and its computing performance is no different from that of a traditional physical machine, and it has the characteristics of secure physical isolation. Containers are a kernel virtualization technology that can provide lightweight virtualization to achieve the purpose of isolating user space, processes and resources. It should be understood that the VM service, BMS service and container service in the above-mentioned virtualization services are only specific examples. In actual applications, virtualization services can also be other lightweight or heavyweight virtualization services, which are not specifically limited here.
[0115] When implemented by hardware, the interaction module 102, the scheduling module 104 or the adjustment module 106 may include at least one computing device, such as a server, etc. Alternatively, the interaction module 102, the scheduling module 104 or the adjustment module 106 may also be implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD), etc. The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
[0116] In some possible implementations, when the load of a task or a task slice of a task on a first execution node is greater than a first threshold, a slice adjustment request is used to request an increase in the task slice of the task; or, when the load of a target task slice of a task on the first execution node is less than a second threshold, a slice adjustment request is used to reduce the target task slice of the task.
[0117] In some possible implementations, the scheduling system 10 includes a scheduling node 100 and a data module 200, where the data module 200 is specifically used for:
[0118] When it is detected that the task slice of the task is adjusted, the processing data of the task is re-sliced to obtain at least one data slice, and the at least one data slice corresponds to the adjusted task slice one by one.
[0119] Similar to the interaction module 102 , the scheduling module 104 or the adjustment module 106 , the data module 200 may be implemented by software or by hardware.
[0120] When implemented by software, the data module 200 may be an application running on a computing device, such as a computing engine. The application may be provided to users through virtualization services such as VM services, BMS services, or container services. When implemented by hardware, the data module 200 may include at least one computing device, such as a server. Alternatively, the data module 200 may also be a device implemented by ASIC or PLD.
[0121] In some possible implementations, the data module 200 is specifically used to:
[0122] According to the adjusted number of task shards, the task processing data is re-sharded through load balancing to obtain at least one data shard.
[0123] In some possible implementations, the data module 200 is further used to:
[0124] Record the progress of pulling the processing data of the task;
[0125] The data module 200 is specifically used for:
[0126] Determine the remaining data based on the progress of pulling the processing data of the task;
[0127] The remaining data is re-sharded to obtain at least one data shard.
[0128] In some possible implementations, the data module 200 is further used to:
[0129] Send heartbeat messages to task shards. Heartbeat messages are used to detect the activity of task shards.
[0130] Adjust data sharding based on the activity of task sharding.
[0131] In some possible implementations, tasks or task slices are assembled in a data body, and the data body records the load of the running tasks or task slices and the identification of the tasks or task slices.
[0132] In some possible implementations, the task includes a log processing task.
[0133] The present application also provides a computing device 900. Fig. 9 As shown, the computing device 900 includes: a bus 902, a processor 904, a memory 906, and a communication interface 908. The processor 904, the memory 906, and the communication interface 908 communicate through the bus 902. The computing device 900 can be a server or a terminal device. It should be understood that the present application does not limit the number of processors and memories in the computing device 900.
[0134] The bus 902 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 The bus 902 may include a path for transmitting information between various components of the computing device 900 (eg, the memory 906, the processor 904, and the communication interface 908).
[0135] The processor 904 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0136] The memory 906 may include a volatile memory, such as a random access memory (RAM). The memory 906 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid state drive (SSD). The memory 906 stores an executable program code, and the processor 904 executes the executable program code to implement the aforementioned task scheduling method. Specifically, the memory 906 stores instructions for the scheduling system 10 to execute the task scheduling method. For example, the memory 906 may store instructions of the interaction module 102, the scheduling module 104, and the adjustment module 106 in the scheduling node 100, and further, the memory 906 may also store instructions of the data module 200.
[0137] The communication interface 908 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 900 and other devices or communication networks.
[0138] The embodiment of the present application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.
[0139] like Fig. 9 As shown, the computing device cluster includes at least one computing device 900. The memory 906 in one or more computing devices 900 in the computing device cluster may store the same instructions of the scheduling system 10 for executing the task scheduling method.
[0140] In some possible implementations, one or more computing devices 900 in the computing device cluster may also be used to execute some instructions of the scheduling system 10 for executing the task scheduling method. In other words, a combination of one or more computing devices 900 may jointly execute instructions of the scheduling system 10 for executing the task scheduling method.
[0141] It should be noted that the memory 906 in different computing devices 900 in the computing device cluster can store different instructions for executing partial functions of the scheduling system 10 .
[0142] Fig.10 A possible implementation is shown. Fig.10As shown, two computing devices 900A and 900B are connected via a communication interface 908. The memory in the computing device 900A stores instructions for executing the functions of the scheduling node 100, for example, the memory stores instructions for executing the functions of the interaction module 102, the scheduling module 104, and the adjustment module 106. Further, the memory in the computing device 900B stores instructions for executing the functions of the data module 200. In other words, the memories 906 of the computing devices 900A and 900B jointly store instructions for the scheduling system 10 to execute the task scheduling method.
[0143] Fig.10 The connection mode between the computing device clusters shown may be considered to be that the task scheduling method provided by the present application requires more resources to detect whether the task slices are adjusted. Therefore, it is considered to hand over the functions implemented by the data module 200 to the computing device 900B for execution.
[0144] It should be understood that Fig.10 The functions of the computing device 900A shown in FIG. 9A may also be completed by multiple computing devices 900. Similarly, the functions of the computing device 900B may also be completed by multiple computing devices 900.
[0145] In some possible implementations, one or more computing devices in the computing device cluster may be connected via a network, which may be a wide area network or a local area network. Fig.11 A possible implementation is shown. Fig.11 As shown, two computing devices 900C and 900D are connected via a network. Specifically, the network is connected via a communication interface in each computing device. In this type of possible implementation, the memory 906 in the computing device 900C stores instructions for executing the functions of the scheduling node 100, such as storing instructions for executing the functions of the interaction module 102, the scheduling module 104, and the adjustment module 106. At the same time, the memory 906 in the computing device 900D stores instructions for executing the functions of the data module 200.
[0146] Fig.11 The connection method between the computing device clusters shown may be based on the consideration that the task scheduling method provided in the present application requires more resources to perform task slicing detection, and therefore it is considered that the functions implemented by the data module 200 are handed over to the computing device 900D for execution.
[0147] It should be understood that Fig.11 The functions of the computing device 900C shown in FIG. 900A may also be completed by multiple computing devices 900. Similarly, the functions of the computing device 900D may also be completed by multiple computing devices 900.
[0148] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by the computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions that instruct the computing device to execute the above-mentioned task scheduling method applied to the scheduling system 10.
[0149] The embodiment of the present application also provides a computer program product including instructions. The computer program product may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes the above-mentioned task scheduling method.
[0150] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present invention.
Claims
1. A task scheduling method, characterized in that: The method comprises: The scheduling system receives the task; The scheduling system schedules the task or the task slice of the task to a first execution node in the distributed cluster, where the first execution node is at least one execution node in the distributed cluster; During the process of the first execution node executing the task or the task slice, the scheduling system receives a slice adjustment request sent by the first execution node, the slice adjustment request is used to request to increase the task slice of the task or reduce the task slice of the task, and the slice adjustment request is generated by the first execution node according to the load of the task or the task slice on the first execution node; The scheduling system adjusts the task slice of the task in the distributed cluster according to the slice adjustment request; The adjusting of the task slices of the task includes: increasing the task slices of the task in the second execution node, or reducing the task slices of the task in the first execution node.
2. The method according to claim 1, characterized in that: When the load of the task or the task slice on the first execution node is greater than a first threshold, the slice adjustment request is used to request to increase the task slice of the task; or, when the load of the target task slice of the task on the first execution node is less than a second threshold, the slice adjustment request is used to reduce the target task slice of the task.
3. The method according to claim 1 or 2, characterized in that: The scheduling system includes a scheduling node and a data module, and the method further includes: When the data module detects that the task slice of the task is adjusted, the processing data of the task is re-sliced to obtain at least one data slice, and the at least one data slice corresponds to the adjusted task slice one by one.
4. The method according to claim 3, characterized in that The data module re-shards the processed data of the task to obtain at least one data shard, including: The data module re-slices the processing data of the task to obtain at least one data slice through load balancing according to the adjusted number of task slices.
5. The method according to claim 3, characterized in that: The method further comprises: The data module records the progress of pulling the processing data of the task; The data module re-shards the processed data of the task to obtain at least one data shard, including: The data module determines the remaining data according to the pulling progress of the processing data of the task; The data module re-shards the remaining data to obtain at least one data shard.
6. The method according to any one of claims 3 to 5, characterized in that: Said also includes: The data module sends a heartbeat message to the task slice, and the heartbeat message is used to detect the activity of the task slice; The data module adjusts the data slice according to the activity of the task slice.
7. The method according to any one of claims 1 to 6, characterized in that: The task or the task slice is assembled in a data body, and the data body records the load of the running task or the task slice and the identification of the task or the task slice.
8. The method according to any one of claims 1 to 7, characterized in that: The tasks include log processing tasks.
9. A scheduling system, characterized in that: The dispatching system comprises: A scheduling node, used for receiving a scheduling task, scheduling the task or the task slice of the task to a first execution node in a distributed cluster, the first execution node being at least one execution node in the distributed cluster, and receiving a slice adjustment request sent by the first execution node during the process of the first execution node executing the task or the task slice, the slice adjustment request being used to request to increase the task slice of the task or reduce the task slice of the task, the slice adjustment request being generated by the first execution node according to the load of the task or the task slice of the task on the first execution node; The scheduling node is further used to adjust the task slice of the task in the distributed cluster according to the slice adjustment request; The adjusting of the task slices of the task includes: increasing the task slices of the task in the second execution node, or reducing the task slices of the task in the first execution node.
10. The system according to claim 9, characterized in that When the load of the task or the task slice of the task on the first execution node is greater than a first threshold, the slice adjustment request is used to request to increase the task slice of the task; or, when the load of the target task slice of the task on the first execution node is less than a second threshold, the slice adjustment request is used to reduce the target task slice of the task.
11. The system according to claim 9 or 10, characterized in that: The scheduling system includes the scheduling node and a data module, and the data module is specifically used for: When it is detected that the task slice of the task is adjusted, the processed data of the task is re-sliced to obtain at least one data slice, and the at least one data slice corresponds to the adjusted task slice one by one.
12. The system according to claim 11, characterized in that The data module is specifically used for: According to the adjusted number of task slices, the processing data of the task is re-sliced to obtain at least one data slice through load balancing.
13. The system according to claim 11, characterized in that The data module is also used for: Record the progress of pulling the processing data of the task; The data module is specifically used for: Determining remaining data according to the progress of pulling the processing data of the task; The remaining data is re-sharded to obtain at least one data shard.
14. The system according to any one of claims 9 to 13, characterized in that: The data module is also used for: Sending a heartbeat message to the task slice, wherein the heartbeat message is used to detect the activity of the task slice; The data shards are adjusted according to the activity of the task shards.
15. The system according to any one of claims 9 to 14, characterized in that The task or the task slice is assembled in a data body, and the data body records the load of the running task or the task slice and the identification of the task or the task slice.
16. The system according to any one of claims 9 to 15, characterized in that The tasks include log processing tasks.
17. A computing device cluster, characterized in that: The computing device cluster includes at least one computing device, and the at least one computing device includes at least one processor and at least one memory, wherein the at least one memory stores computer-readable instructions; the at least one processor executes the computer-readable instructions so that the computing device cluster performs the task scheduling method as described in any one of claims 1 to 8.
18. A computer-readable storage medium, characterized in that: Comprising computer-readable instructions; the computer-readable instructions are used to implement the task scheduling method described in any one of claims 1 to 8.
19. A computer program product, characterized in that Comprising computer-readable instructions; the computer-readable instructions are used to implement the task scheduling method described in any one of claims 1 to 8.
Citation Information
Cited By
Data migration method and device, electronic equipment and storage medium
CN120631268A
Data migration method and device, electronic equipment and storage medium
CN120631268B