Lake and warehouse integrated assembly line task scheduling method based on multi-level priority feedback queue
Through the multi-level priority feedback queue scheduling method, the priority of pipeline tasks is dynamically adjusted, which solves the problems of resource tilt and response time decline in the existing technology, and realizes efficient concurrency and fast response pipeline task scheduling.
Patent Information
- Application Number
- CN202410925549.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2024-10-15
AI Technical Summary
In the existing technology, the pipeline task scheduling algorithm cannot effectively predict the blocking situation of hardware resources, resulting in resource skew and waste of performance, and the dynamic scheduling algorithm cannot dynamically sense the running time and adjust the priority, resulting in high-priority long tasks occupying resources and shortening the task response time. and reduced processing efficiency.
The lake-warehouse integrated pipeline task scheduling method using multi-level priority feedback queues obtains the running time of pipeline tasks, inserts them into multiple task queues with different priorities, and dynamically adjusts task priorities based on virtual total time consumption and priority factors. levels to ensure efficient concurrency and fast response.
It improves resource utilization, reduces task waiting time, prevents long tasks from starving short tasks, realizes real-time perception and adjustment of priorities, and balances the processing efficiency between pipelines.
Smart Images

Figure CN118779078A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of database technology, and in particular to a lake-warehouse integrated assembly line task scheduling method based on a multi-level priority feedback queue. Background Art
[0002] With the vigorous development of the Internet and new generation information technology and applications, the amount and type of data are increasing, and data lake warehouses have been proposed. Lake warehouse integration is a data storage and processing architecture that aims to effectively manage large amounts of data, diverse data types, and support flexible data analysis and applications. Lake warehouse integration faces many challenges, such as storage and processing capacity challenges, real-time and immediacy challenges, etc. Lake warehouse integration needs to continue to innovate and develop to adapt to the ever-changing data environment and user needs.
[0003] Database query execution is a core function in Lake Warehouse Integration. It is responsible for executing the generated execution plan after Lake Warehouse Integration interprets and optimizes the query statement. During the execution process, the system may involve multiple operations, such as scanning data tables, performing index lookups, and performing joins and aggregations. During the execution of the execution plan, the system will select the appropriate execution strategy based on the query conditions and data scale to improve the efficiency and performance of query execution.
[0004] The pipeline query execution engine is an execution model of a query execution engine. Compared with the traditional pull-based query execution model, the pipeline can improve query performance and efficiency when processing massive amounts of data. Its technical background involves aspects such as database query execution optimization, parallel computing, stream processing, and data flow architecture. The pipeline query execution engine divides the processing stages in the query execution plan into multiple processing units, so that the query execution process can be performed in a streaming manner, thereby reducing the waiting time and data transmission time between each processing stage and improving the query execution efficiency. In addition, the execution engine allows parallel execution between processing units, which can fully utilize hardware resources such as multi-core processors and distributed computing clusters to speed up query processing and improve the overall performance of the system.
[0005] The current physical execution plan contains a physical execution plan tree. The nodes in the tree are composed of physical operators, including two types of nodes, convergence nodes and non-convergence nodes; the directed edges in the tree represent the data flow. If the execution of a physical operator needs to obtain the output data of multiple child operators, it is a convergence node, otherwise it is a non-convergence node. If the execution of a physical operator needs to obtain all the data of its child operators, it is called a blocking operator. However, in actual database development, the blocking of operators may come from network I / O, disk I / O, and optimization strategies within operators. In actual database execution, since pipeline tasks may come from multiple execution plans or multiple tenants, and under the influence of factors such as network delay, the blocking time and running time of the pipeline are almost unpredictable. This brings a challenge to the scheduling of the pipeline: how to achieve high concurrency of pipeline tasks, reduce the waiting time of each pipeline task, and quickly respond and process each pipeline task while reducing scheduling and blocking.
[0006] The current pipeline scheduling algorithms can be roughly divided into two types: static scheduling and dynamic scheduling.
[0007] The static scheduling algorithm determines the execution order and time of tasks before query execution, and will not make dynamic adjustments based on the actual situation of task execution. The static scheduling algorithm cannot predict the hardware resource conditions and pipeline blockage during execution, which will lead to serious resource tilt and performance waste during scheduling. In addition, non-preemptive scheduling will make subsequent queries unresponsive. After processing resources are exhausted, subsequent queries will enter a pseudo-deadlock. For example, after a large query generates a large number of query execution fragments, small queries will not get the opportunity to be scheduled. Under mixed loads, small queries will experience higher latency.
[0008] The dynamic scheduling algorithm dynamically adjusts the execution order and time of tasks according to the execution status of the tasks and the situation of system resources. The existing dynamic scheduling algorithms consider the priority between operators in the data dependency of the physical plan more, so as to build a priority queue or state machine. During the task execution process, the algorithm dynamically judges the dependency between pipelines and adjusts the priority between pipelines. Such scheduling has the following problems: it cannot dynamically perceive the running time to adjust the priority of pipeline tasks. For high-priority long tasks, they occupy the running resources for a long time, which reduces the response time and processing efficiency of short tasks. In addition, the execution according to the priority of the tasks makes the order between tasks fixed, resulting in the inability to efficiently parallelize the tasks, which is not conducive to the performance of multi-core parallelism.
[0009] Therefore, it is necessary to design a pipeline task scheduling method that can be applied to the lake-warehouse integrated database. Summary of the invention
[0010] In order to solve the deficiencies in the prior art, the present invention proposes a lake-warehouse integrated pipeline task scheduling method based on a multi-level priority feedback queue for task scheduling in the query execution engine. In the case of large data volumes or mixed loads, this method enables efficient concurrent task scheduling in the pipeline query execution engine while ensuring that the response speed and processing efficiency of each task can meet the requirements of business processing more quickly.
[0011] The present invention is achieved through the following solutions.
[0012] The present invention is specifically implemented through the following technical solutions:
[0013] A method for scheduling tasks in a lake-warehouse integrated pipeline based on a multi-level priority feedback queue is provided for scheduling tasks in a query execution engine. The method comprises:
[0014] Get the pipeline tasks and the running time of each pipeline;
[0015] Inserting the pipeline task into a task queue of the pipeline according to the elapsed running time;
[0016] Selecting a pipeline task from the task queue with the smallest virtual total time consumption;
[0017] Execute the pipeline task until the pipeline task is completed, canceled, or encounters a blocking condition;
[0018] Update the elapsed running time according to the time slice consumed by the pipeline task;
[0019] Among them, the task queue of the pipeline is a task queue of multiple different priorities, which is responsible for storing pipeline tasks of each priority. The task queue of the pipeline includes two key attributes: queue priority limit and priority factor; the virtual total time consumption is obtained by dividing the total time consumption of the task queue by the priority factor of the task queue.
[0020] As a further improvement of the present invention, the obtaining of pipeline tasks includes: dividing the input physical execution plan into a number of pipeline tasks, and initializing the running time of each pipeline.
[0021] As a further improvement of the present invention, the running time of each pipeline is initially 0, and according to the priority limit of the task queue, all pipeline tasks will be inserted into the task queue with the highest priority.
[0022] As a further improvement of the present invention, the queue priority limit is a time configuration used to distinguish and limit pipeline tasks inserted into a task queue. Each pipeline task will save the total of the running time it has occupied. When trying to put a pipeline task into a task queue, it will look for a task queue with the highest priority whose queue priority limit is not less than the running time occupied by the pipeline task.
[0023] As a further improvement of the present invention, the task queue with the lowest priority has no running time restriction.
[0024] As a further improvement of the present invention, the priority factor is an integer configuration used to allocate time slices of the task queue.
[0025] As a further improvement of the present invention, the method further comprises: reselecting a task queue for the unfinished pipeline task according to the updated elapsed running time.
[0026] As a further improvement of the present invention, the minimum time granularity of each pipeline task execution is one data operation, and the execution time of each pipeline task cannot exceed the configured time slice size; the execution result of the pipeline task includes: when the configured time slice size is reached or exceeded, the scheduler reinserts the pipeline task into the task queue, and reselects the task queue according to the updated running time of the pipeline task, and the task is still in an executable state; the pipeline task is completed within the time slice, and the pipeline task is converted to a completed state; the pipeline task is found to be cancelled within the time slice, and the pipeline task is converted to a canceled state; if a blocking condition is encountered during execution within the time slice, the pipeline task state is converted to a blocked state, waiting for the dependent condition to wake up.
[0027] As a further improvement of the present invention, after the dependent condition corresponding to the blocked pipeline task is ready, all pipeline tasks blocked by this condition are awakened, and if these pipeline tasks have no other blocking conditions, the task queue is reselected for them.
[0028] The beneficial effects of the present invention are as follows: The advantages of the present invention are as follows: 1) Compared with the static scheduling algorithm, the present invention allows multiple pipelines to preempt execution, effectively improving resource utilization and accelerating the response time of high-priority pipelines. 2) The present invention divides the execution priority between pipelines according to dynamic feedback of the running time, effectively preventing the situation where long tasks occupy a large number of time slices and starve short tasks or reduce the execution efficiency of short tasks. 3) The present invention proposes a real-time scheduling algorithm that can perceive the running time slice occupancy of task execution in real time and adjust the priority in real time. It prevents sudden performance consumption tilt between task pipelines. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 It is an overall framework diagram of the pipeline scheduling method based on multi-level priority feedback queue of the present invention;
[0030] Figure 2 Schematic diagram of the pipeline task state machine. DETAILED DESCRIPTION
[0031] The present invention is further described below in conjunction with the accompanying drawings and specific implementation methods.
[0032] The present invention proposes a lake-warehouse integrated assembly line task scheduling method based on a multi-level priority feedback queue. The method improves the design of the multi-level priority feedback queue, and dynamically schedules the assembly line execution and adjusts the priority of the assembly line tasks through the blocking situation and the consumption of time slices during the assembly line execution process, so as to achieve the purpose of dynamically sensing hardware blockage and logical blockage and balancing the processing efficiency between assembly lines.
[0033] Multilevel Feedback Queue (MLFQ) is a commonly used process scheduling algorithm in operating systems. It combines multi-level queues and feedback scheduling strategies to balance the throughput, response time, and fairness of time-sharing operating systems. The main features of multi-level feedback queues include:
[0034] 1. Multi-level queue structure: MLFQ divides tasks into multiple queues according to priority, usually with multiple levels. Each queue has a different priority, and high-priority queues can get more CPU time slices, so for high-priority tasks, the response time is shorter.
[0035] 2. Feedback scheduling strategy: MLFQ uses a feedback mechanism to allow tasks to move between queues of different priorities. When a task waits for execution in the current queue for more than a certain threshold, the system will move it to the next lower priority queue. This can improve the response time and fairness of low-priority tasks.
[0036] 3. Avoid starvation: The MLFQ algorithm can avoid starvation caused by long waiting times for low-priority tasks by continuously adjusting the priority of tasks. Even tasks with lower priorities have the opportunity to obtain CPU resources for execution within a certain period of time.
[0037] With reference to the usage scenario of the database query execution engine, the present invention makes some design changes to the multi-level priority feedback queue in the time-sharing operating system: for the time-sharing operating system, user interaction or IO operation will increase the priority of the task, while in the query execution of the pipeline, there is no need to consider the user interaction problem of each task. The present invention dynamically adjusts the priority through real-time feedback of the consumption of the pipeline time slice, and allocates different numbers of running time slices to queues of different priorities.
[0038] The present invention includes three parts: pipeline tasks, multi-level feedback task queues and task schedulers. Figure 1 As shown, the scheduler schedules the execution of pipeline tasks, and the multi-level feedback task queue is a container for pipeline tasks, which is used to sense time consumption and adjust priorities and allocate running time slices.
[0039] The pipeline task is decomposed from the physical execution plan and is the scheduling unit executed by the query execution engine. Each pipeline task consists of three parts: running operators, upstream data (source), and downstream output (sink). When the buffer space is insufficient or read-write is occupied, the upstream data may not be readable or the downstream data may not be writable, resulting in the blocking of the pipeline task. The pipeline task includes five states: Not Ready, Blocked, Runnable, Finished, and Canceled. Figure 2 As shown in the figure, when creating a pipeline, its task will be set to unready, and after initialization, it will be set to executable, and then placed in a multi-level priority feedback queue. Under the scheduling of this queue, the task will reach the completion state in several blocking-executable cycles. If the transaction is canceled or errors such as data loss occur, the database will cancel the query task, and the query execution engine will set the status of all pipeline tasks under the physical plan to cancel and remove them from the queue.
[0040] The task queues of the pipeline are multiple ready queues of different priorities, which are responsible for storing pipeline tasks of various execution priorities. The number of task queues can be configured according to the needs of the business scenario, and each queue has two key attributes:
[0041] 1. Queue priority limit: Queue priority limit is a time configuration used to distinguish and limit the priority of tasks inserted into a queue. Each pipeline task will save the sum of its occupied running time. When trying to put a pipeline task into a priority queue, it will look for a queue with the highest priority whose queue priority limit is not less than the pipeline task's occupied running time. The queue with the lowest priority has no running time limit. This configuration allows short tasks to get high priority and long tasks to get low priority.
[0042] 2. Priority factor: The priority factor is an integer configuration used to allocate time slices for queues. When a task is taken out of a queue and executed, the task uses up the time slice, or is blocked or completed before the time slice runs out, the time consumed by the process will be accumulated on this queue to obtain the total time consumption of the queue. Here, a concept of virtual total time consumption is defined, which is obtained by dividing the total time consumption of the queue by the priority factor. The higher the priority of the queue, the more priority factors it has. Therefore, in the case of the same total time consumption of the queue, the virtual total time consumption calculated by the queue with a higher priority will be smaller.
[0043] The scheduler is usually included in the query execution engine and is mainly responsible for scheduling pipeline tasks, including the following steps:
[0044] Step 1. Divide the input physical execution plan into several pipeline tasks, and initialize the elapsed time of each pipeline to 0. Then insert the pipeline tasks into the task queue. Because the elapsed time is 0, according to the priority limit of the queue, all tasks will be inserted into the queue with the highest priority.
[0045] Step 2. Take out a pipeline task from the queue with the smallest total virtual time consumption and execute it. The minimum time granularity of each execution is one data operation. The execution time of each pipeline task cannot exceed the configured time slice size. There may be four situations for this execution: when the time slice size is reached or exceeded, the scheduler reinserts the task into the task queue, selects the priority queue according to the updated running time of the pipeline task, and the task is still executable; the task is completed within the time slice, and the task is converted to the completed state; the task is found to be cancelled within the time slice, and the task is converted to the canceled state; the execution encounters a blocking condition within the time slice, and the pipeline task state is converted to the blocked state, waiting for the dependent condition to wake up. After completing the processing of a pipeline task, the scheduler starts to take the next task from the task queue and continue the above process.
[0046] After the dependent conditions corresponding to the blocked pipeline tasks are ready, wake up all the tasks blocked by this condition. If these pipeline tasks have no other blocking conditions, reinsert them into the task queue.
[0047] In step 2, the queue with the least virtual total time consumption is selected each time, which can effectively prevent the queue from being starved of tasks due to long-term non-execution. The virtual total time consumption is obtained by dividing the total time consumption of each queue by the priority factor, which can make the priority factor larger, that is, the queue with higher priority can obtain more running time slices.
[0048] The scheduling method of pipeline tasks designed by the present invention ensures the performance and processing capacity of the query execution engine. The method is universal and can be applied to data warehouses and large-scale query computing engines whose data scenarios are similar to those of the lake warehouse during query execution. Alternatively, the method can be used as a basis for the design ideas of the method, and trade-offs can be made between key points that affect performance, such as execution efficiency, response speed, and scheduling frequency, to design a scheduling method suitable for specific business scenarios.
[0049] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention. For ordinary technicians in this field, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as belonging to the protection scope of the present invention.
Claims
1. A method for scheduling tasks in a lake-warehouse integrated pipeline based on a multi-level priority feedback queue, used for scheduling tasks in a query execution engine. Features: The method comprises: Get the pipeline tasks and the running time of each pipeline; Inserting the pipeline task into a task queue of the pipeline according to the elapsed running time; Select a pipeline task from the task queue with the smallest virtual total time; Execute the pipeline task until the pipeline task is completed, canceled, or encounters a blocking condition; Update the elapsed running time according to the time slice consumed by the pipeline task; Among them, the task queue of the pipeline is a task queue of multiple different priorities, which is responsible for storing pipeline tasks of each priority. The task queue of the pipeline includes two key attributes: queue priority limit and priority factor; the virtual total time consumption is obtained by dividing the total time consumption of the task queue by the priority factor of the task queue.
2. The method according to claim 1, in, The obtaining of pipeline tasks includes: dividing the input physical execution plan into a number of pipeline tasks, and initializing the running time of each pipeline.
3. The method according to claim 2, in, The initial running time of each pipeline is 0. According to the priority limit of the task queue, all pipeline tasks will be inserted into the task queue with the highest priority.
4. The method according to claim 1, in, The queue priority limit is a time configuration used to distinguish and limit pipeline tasks inserted into the task queue. Each pipeline task will save the total running time it has occupied. When trying to put a pipeline task into the task queue, it will look for a task queue with the highest priority whose queue priority limit is not less than the running time occupied by the pipeline task.
5. The method according to claim 4, in, The lowest priority task queue has no running time limit.
6. The method according to claim 1, in, The priority factor is an integer configuration used to allocate time slices for task queues.
7. The method according to claim 1, in, The method further includes: reselecting a task queue for the unfinished pipeline task according to the updated elapsed running time.
8. The method according to claim 1, in, The minimum time granularity for each pipeline task execution is one data operation, and the execution time of each pipeline task cannot exceed the configured time slice size; The execution result of the pipeline task Including: when the configured time slice size is reached or exceeded, the scheduler reinserts the pipeline task into the task queue, reselects the task queue according to the updated running time of the pipeline task, and the task remains in an executable state; the pipeline task is completed within the time slice and converted to a completed state; the pipeline task is found to be cancelled within the time slice and converted to a canceled state; if a blocking condition is encountered during execution within the time slice, the pipeline task state is converted to a blocked state, waiting for the dependent condition to wake up.
9. The method according to claim 1, in, After the dependent conditions corresponding to the blocked pipeline tasks are ready, all pipeline tasks blocked by this condition are awakened. If these pipeline tasks have no other blocking conditions, the task queues are reselected for them.
