Container-based real-time task scheduling method, device and system and storage medium
By introducing a central scheduler in the cloud computing environment, separating and prioritizing high-real-time tasks, the problem of poor container tasks is solved, and efficient and instant completion of tasks is achieved.
Patent Information
- Application Number
- CN202411905794.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-04-15
AI Technical Summary
In the existing cloud computing environment, container tasks are poor in immediacy and cannot be effectively scheduled and resource management, resulting in insufficient timeliness of completing tasks within strict time constraints.
The data processing tasks to be run are obtained through the central scheduler, and divided into high-real-time tasks that match the target task table and mismatched tasks, and are scheduled to run in containers in the node collection to ensure priority processing of high-real-time tasks.
It improves the immediacy of container processing tasks, ensures the efficiency of the system and the immediacy of task completion, is suitable for multi-node systems, and provides richer resources for scheduling.
Smart Images

Figure CN119829208A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing, and more specifically, to a container-based real-time task scheduling method, device, system, and storage medium. Background Art
[0002] This section is intended to provide a background or context to what is stated in the claims or specification, and no admission is made that what is described herein is prior art by inclusion in this section.
[0003] The Industrial Internet platform is a platform for developing and running various Industrial Internet application functions. The Industrial Cloud Platform refers to the cloud platform in the industrial field, including three levels: Infrastructure as a Service (IaaS), Platform as a Service (PaaS), and Software as a Service (SaaS). The Industrial Internet Cloud Platform is an extension and extension of the Industrial Cloud Platform. It can not only support all the functions of the Industrial Cloud Platform, but also support the application of Industrial Internet of Things and realize the integration of Information Technology (IT) and Operation Technology (OT).
[0004] At present, container technology based on the Industrial Internet has become a very popular technology. Container technology can manage codes and applications by virtualizing the operating system (the operating system here can be a real-time operating system), making it easier for computing nodes (which can be physical servers or virtual machines) to handle more computing work. In the existing cloud computing environment, how to effectively schedule and manage resources for tasks that need to be performed by containers to ensure that tasks are completed within strict time constraints is still a challenge.
[0005] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0006] The embodiments of the present application provide a container-based real-time task scheduling method, device, system, and storage medium to at least solve the technical problem of poor immediacy of container processing tasks in the related art.
[0007] According to one aspect of an embodiment of the present application, a container-based real-time task scheduling method is provided, including: obtaining data processing tasks to be run; determining a first data processing task that matches a task in a target task table and a second data processing task that does not match a task in the target task table among the data processing tasks to be run, wherein the real-time requirement of the data processing task recorded in the target task table is higher than that of other data processing tasks; scheduling the first data processing task to run in a container of a node in a node set, and after scheduling the first data processing task, scheduling the second data processing task to run in a container of a node in the node set.
[0008] According to another aspect of an embodiment of the present application, a container-based real-time task scheduling device is also provided, including: an acquisition unit, used to acquire data processing tasks to be run; a determination unit, used to determine a first data processing task that matches a task in a target task table and a second data processing task that does not match a task in the target task table among the data processing tasks to be run, wherein the real-time requirement of the data processing task recorded in the target task table is higher than that of other data processing tasks; a scheduling unit, used to schedule the first data processing task to run in a container of a node in a node set, and after scheduling the first data processing task, schedule the second data processing task to run in a container of a node in the node set.
[0009] According to another aspect of an embodiment of the present application, a container-based real-time task scheduling system is also provided, including: a central scheduler, used to determine a first data processing task that matches a task in a target task table and a second data processing task that does not match a task in the target task table among the data processing tasks to be run; and schedule the first data processing task to run in a container of a node in a node set, and after scheduling the first data processing task, schedule the second data processing task to run in a container of a node in the node set, wherein the real-time requirement of the data processing task recorded in the target task table is higher than that of other data processing tasks; a node set, used to run the first data processing task and the second data processing task through the container on the node.
[0010] According to another aspect of an embodiment of the present application, a computer-readable storage medium is further provided, the storage medium including a stored program, and the above method is executed when the program is run.
[0011] According to another aspect of an embodiment of the present application, an electronic device is further provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above method through the computer program.
[0012] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of any one of the embodiments of the above method.
[0013] In an embodiment of the present application, a data processing task to be run is obtained; a first data processing task that matches a task in a target task table and a second data processing task that does not match a task in a target task table are determined in the data processing task to be run, and the real-time requirement of the data processing task recorded in the target task table is higher than that of other data processing tasks; the first data processing task is scheduled to run in a container of a node in a node set, and after scheduling the first data processing task, the second data processing task is scheduled to run in a container of a node in a node set. In the technical scheme of the present application, all data processing tasks with higher real-time requirements have a higher processing priority than other data processing tasks, will be entered into the target task table, will be processed preferentially, and the poor timeliness caused by the use of a fifo queue can be avoided; in addition, the present scheme is applicable to a multi-node system, and is undertaken by multiple nodes for the operation of all data processing tasks with real-time requirements, and compared with a single node processing, it has more resources for scheduling, so that the technical problem of the poor immediacy of container processing tasks in the related art can be solved, thereby ensuring the efficiency of the system and the immediacy of task completion. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0015] Figure 1 is a schematic diagram of an optional container-based real-time task scheduling system according to an embodiment of the present application;
[0016] Figure 2 is a flowchart of an optional container-based real-time task scheduling method according to an embodiment of the present application;
[0017] Figure 3 is a schematic diagram of an optional container-based real-time task scheduling solution according to an embodiment of the present application;
[0018] Figure 4 is a schematic diagram of an optional container-based real-time task scheduling device according to an embodiment of the present application;
[0019] Figure 5It is a structural block diagram of a terminal according to an embodiment of the present application. DETAILED DESCRIPTION
[0020] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0021] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0022] The node mentioned in this application can be a server node or a virtual machine node with a real-time operating system installed; a container refers to a task processing process running on a node with specific real-time requirements.
[0023] In the cloud computing environment, the time scheduling algorithm used is implemented at the level of a single-node real-time system, which leads to the following problems: 1) The scheduling algorithm is fixed, such as the first-in-first-out queue fifo, that is, the first-arrived tasks are processed first and the later-arrived tasks are processed later. At this time, if the tasks that need to be processed immediately are the later ones, their timeliness cannot be guaranteed; 2) When a single node receives multiple tasks that need to be processed immediately at the same time, due to its limited resources, it cannot guarantee the timeliness of all tasks; 3) The scheduling algorithm is not suitable for multi-node systems. When faced with complex multi-node real-time systems, it cannot better perform priority management and resource scheduling, so there are problems such as scheduling limitations and insufficient real-time performance.
[0024] To overcome some or all of the above problems, according to one aspect of an embodiment of the present application, an embodiment of a container-based real-time task scheduling method and system is provided.
[0025] Optionally, in this embodiment, the above container-based real-time task scheduling method can be applied to Figure 1In the container-based real-time task scheduling system shown, which is composed of a central scheduler 101 and a node set 103 (i.e., a set of all nodes in a multi-node system, including multiple nodes, each node can be a physical machine or a virtual machine, and the node set is equivalent to a cluster), the central scheduler 101 is connected to the node set 103 through a network to provide scheduling strategies for data processing tasks and optimize the scheduling strategies. The above-mentioned network includes but is not limited to: a wide area network, a metropolitan area network or a local area network, and the nodes are not limited to PCs, servers, virtual machines, etc.
[0026] like Figure 1 As shown, the central scheduler 101 is a logical processor (such as a CPU) for executing the method of the present application, and can specifically execute the steps of "obtaining data processing tasks to be run; determining a first data processing task that matches a task in a target task table and a second data processing task that does not match a task in the target task table among the data processing tasks to be run, and the real-time requirement of the data processing task recorded in the target task table is higher than that of other data processing tasks; scheduling the first data processing task to run in a container of a node in a node set, and after scheduling the first data processing task, scheduling the second data processing task to run in a container of a node in the node set" and the like; the nodes in the node set are specifically used to run the assigned (scheduled) data processing tasks through the provided containers.
[0027] The container-based real-time task scheduling method of the embodiment of the present application can be executed by a central scheduler. Figure 2 is a flowchart of an optional container-based real-time task scheduling method according to an embodiment of the present application, such as Figure 2 As shown, the method may include the following steps:
[0028] Step S202, obtaining the data processing task to be executed, where the data processing task may be a production data processing task, an image data processing task, etc.
[0029] Step S204, determine the first data processing task in the data processing tasks to be run that matches the task in the target task table and the second data processing task that does not match the task in the target task table. The target task table is a table used to record high real-time requirements (such as a time scheduling table), wherein the real-time requirements of the recorded data processing tasks are higher than those of other data processing tasks.
[0030] Step S206, scheduling the first data processing task to run in a container of a node in the node set, and after the first data processing task is scheduled, scheduling the second data processing task to run in a container of a node in the node set.
[0031] By adopting the technical solution of the present application: all data processing tasks with high real-time requirements have a higher processing priority (which can be the highest priority) compared to other data processing tasks, and will be entered into the target task table and given priority processing, which can avoid the poor timeliness caused by the use of fixed algorithms such as fifo queues; in addition, the present solution is applicable to multi-node systems, and multiple nodes are responsible for the operation of all data processing tasks with real-time requirements. Compared with single-node processing, it has more resources for scheduling and can run more data processing tasks, thereby solving the technical problem of poor immediacy of container processing tasks in related technologies, thereby ensuring the high efficiency of the system and the immediacy of task completion.
[0032] This solution optimizes the real-time node time scheduling mechanism through the central scheduler, ensuring the real-time performance of the task and system performance. As an optional embodiment, the following is combined with Figure 2 The steps shown further detail embodiments of the present application:
[0033] In the technical solution provided in step S202, the data processing tasks to be executed are obtained. For example, when the central scheduler receives a task registration request, it parses the task registration request to obtain specific data processing tasks to be executed, which may be one or more.
[0034] The above central scheduler is pre-deployed in the system. The central scheduler is responsible for global task scheduling and resource allocation. Functionally, the central scheduler can include task registration module, resource allocation module, optimization strategy module and fault detection and recovery module. Figure 1 .
[0035] After the central scheduler is deployed, the target task table (specifically, the time schedule) can be set manually or automatically. For example, the system administrator first manually sets the major frame time, that is, defines a major time period within which all tasks are scheduled. The major frame time can include multiple basic time frames. The basic time frame is the basic time unit of the major frame time, such as a CPU cycle, a custom duration (such as 0.01 seconds), etc.
[0036] For data processing tasks with real-time requirements (such tasks may be tasks that need to be run repeatedly), such tasks may be recorded in the target task table with one or more of the descriptive information such as task type, task name, task ID, etc., for subsequent search. When recording the target task table, the node selection attributes, start time, and end time (the start time and end time here can be a specific moment or a specific time frame) may be configured for the data processing tasks with real-time requirements, and recorded in the target task table. The node selection attributes are used to configure the data processing tasks to run as a single node or multiple nodes. The start time and end time are within the main frame time. For example, the main frame time includes 20 basic time frames. Here, the second basic time frame can be selected as the start time and the 11th basic time frame can be selected as the end time.
[0037] By setting the scheduling start point (i.e., the start time) and the scheduling end point (the end time) for each data processing task, it is possible to ensure that the task is executed within the specified time window (i.e., the time window between the above scheduling start point and the scheduling end point). When configuring the node selection properties, the system administrator can manually specify whether the task is to be run through one or more nodes (the node can be selected from the specified nodes configured for the target task table), or even directly select one or more specific real-time nodes from the specified nodes (e.g., for resource-consuming tasks, select nodes with sufficient resources, for tasks with high performance consumption, select nodes where high-performance servers are located, and for tasks with high stability requirements, select nodes with the strongest reliability) to execute data processing tasks, thereby ensuring the execution priority and reliability of the task.
[0038] In the technical solution provided in step S204, a first data processing task that matches the task in the target task table and a second data processing task that does not match the task in the target task table are determined among the data processing tasks to be run, and the real-time requirement of the data processing task recorded in the target task table is higher than that of other data processing tasks.
[0039] For the above-mentioned data processing tasks to be executed, these data processing tasks can be divided into two types of tasks by matching with the description information (such as task name, task type, task ID and other information) in the target task table.
[0040] In this embodiment, after the central scheduler receives the task registration request for the data processing task (here it is equivalent to the central scheduler knowing the tasks that need to be executed subsequently in order to facilitate timely scheduling), preprocessing can be performed: configuring a suitable container for each data processing task (to meet its resource requirements, such as the required amount of memory, number of threads, storage space, etc.) and deadline.
[0041] For a first data processing task, obtain resource requirements, start time, and deadline configured for the first data processing task, search for a first container that matches the resource requirements, start time, and deadline of the first data processing task from containers on a designated node, reserve the first container for the first data processing task, and configure the scheduling priority of the first data processing task to be a first priority (such as a highest priority, a second highest priority), and designate a node as a node in the node set that is designated to run tasks in the target task table;
[0042] For the second data processing task, obtain the resource requirements, start time and deadline configured for the second data processing task, search for a second container that matches the resource requirements, start time and deadline of the second data processing task from the containers on the nodes in the node set, reserve the second container for the second data processing task, and configure the scheduling priority of the second data processing task to a second priority, where the second priority is a general term for all priorities lower than the first priority, and can be one or more priorities of different levels.
[0043] In the above embodiment, when the above second data processing task has an associated data processing task that has been run (which may be the second data processing task, a task of the same type as the second data processing task, a task similar to the second data processing task, etc.):
[0044] 1) Obtaining historical operation records of the associated data processing task, and configuring resource requirements for the second data processing task according to resource consumption in the historical operation records.
[0045] For example, if the system has been run multiple times in history, the actual resource allocation amount with the best economic benefit can be selected as the resource demand, or the actual resource allocation amount when both resource consumption and time consumption meet the actual demand can be selected as the resource demand, or the average of these multiple resource allocation amounts can be selected as the resource demand.
[0046] 2) configuring a deadline for the second data processing task according to the running time in the historical running record and the start time configured in the target task.
[0047] For example, the running time of the data processing task recorded in the historical running record is 4 basic time frames, the 2nd basic time frame configured in the target task is the start time, and the 11th basic time frame is the end time. At this time, the deadline can be set to the 5th time frame. A certain margin can be left in actual processing, that is, a set time frame value is added to the basis of (initial time frame + running time - 1) (it is necessary to ensure that the final deadline does not exceed the end time). For example, if the set time frame value is 2, the deadline is the 7th time frame.
[0048] In the above embodiment, when the second data processing task does not have any associated data processing task that has been executed:
[0049] 1) configuring resource requirements for the second data processing task according to the estimated resource requirements (which may be a fixed value, such as the average resource consumption determined by similar tasks or the resource requirements given by experts);
[0050] 2) configuring a deadline for the second data processing task based on the estimated runtime (which may be a fixed value, such as the average runtime determined by similar tasks or the runtime recommended by experts) and the start time configured in the target task.
[0051] For example, the running time of the data processing task recorded in the historical running record is 6 basic time frames, the 3rd basic time frame configured in the target task is the start time, and the 13th basic time frame is the end time. At this time, the deadline can be set to the 8th time frame. If the set margin is 3 time frames, the deadline is the 11th time frame. In short, the deadline = (initial time frame + running time - 1) + time margin.
[0052] During the operation process, machine learning algorithms can also be used to analyze historical task execution data, predict the execution time and resource requirements of future tasks, and allocate resources and scheduling time in advance based on the prediction results, which can reduce scheduling delays and improve the accuracy of resource allocation.
[0053] In the technical solution provided in step S206, the first data processing task is scheduled to run in a container of a node in the node set, and after the first data processing task is scheduled, the second data processing task is scheduled to run in a container of a node in the node set.
[0054] When allocating data processing tasks, there are two implementation methods:
[0055] First, containers are allocated instantly when tasks are running: for a first data processing task, the resource requirements, start time, and deadline configured for the first data processing task are obtained, a first container matching the resource requirements, start time, and deadline of the first data processing task is searched from the containers on the specified node, and the first data processing task is run in the first container; for a second data processing task, the resource requirements, start time, and deadline configured for the second data processing task are obtained, a second container matching the resource requirements, start time, and deadline of the second data processing task is searched from the containers on the nodes in the node set, and the second data processing task is run in the second container.
[0056] The second is to pre-allocate containers before tasks run (for the specific implementation of pre-allocation, refer to the previous text): when the expected scheduling time of the first data processing task and the second data processing task is within the current scheduling cycle, obtain the first priority of the first data processing task to be scheduled and the second priority of the second data processing task; according to the first priority and the second priority, first schedule the first data processing task to run in the reserved first container, and after the scheduling of the first data processing task is completed, run the automatic scheduling logic to schedule the second data processing task to run in the reserved second container.
[0057] When running the automatic scheduling logic, you can proceed as follows:
[0058] 1) When the current system load of the node set is lower than the first load (i.e., running in low load mode, such as lower than 20%), the fixed priority scheduling algorithm FPS (Fixed Priority Scheduling) in the automatic scheduling logic is run: the data processing tasks are scheduled in descending order of their scheduling priorities;
[0059] 2) When the current system load of the node set is higher than the second load (i.e., running in high load mode, such as higher than 80%), one of the Earliest Deadline First (EDF) algorithm and the Least Laxity First (LLF) algorithm is used to schedule the data processing task, and the scheduling effect is tracked. When the scheduling effect does not meet the requirements, the other of the Earliest Deadline First (EDF) algorithm and the Least Laxity First (LLF) algorithm is used to schedule the data processing task next time. The Earliest Deadline First (EDF) algorithm schedules the data processing tasks in order of deadline from near to far, and the Least Laxity First (LLF) algorithm schedules the data processing tasks in order of delay from small to large. The second load is greater than or equal to the first load.
[0060] In the technical solution of the present application, the scheduling strategy can be continuously optimized according to the system operation status and historical data. The central scheduler can select the most suitable scheduling algorithm (such as FPS, EDF, LLF, etc.) according to the current system status to improve the flexibility and efficiency of scheduling.
[0061] In order to ensure that the task is completed on schedule, the running status of the container on each node in the system can be monitored in real time during the operation of the data processing task. By monitoring the running status of the task in the container of each node in real time (including execution status, resource usage, system load, etc.), the priority and / or resource allocation of the task can be dynamically adjusted according to the real-time monitoring data (for example, for the first data processing task, the speed can be increased by increasing the amount of allocated resources, and for the second data processing task, the processing speed can be increased by at least one of increasing the priority and increasing the resource allocation), so as to ensure that the key tasks are completed on time.
[0062] When the running status indicates that the first data processing task is not completed, and the interval between the current time and the deadline of the first data processing task is less than the preset time (the preset time here can be set according to different tasks, such as a specific percentage of the time between the start time and the deadline, generally less than 50%, such as 20%), more resources are allocated from the designated node for the first data processing task. The scheme can determine that the designated task cannot be completed on time within the set time and an exception occurs. At this time, the exception handling program is entered, and one or more of the following operations can be performed:
[0063] 1) Emergency resource allocation: raising the priority of unfinished tasks and / or allocating more computing resources. For example, for a first data processing task, the speed can be increased by increasing the amount of allocated resources; for a second data processing task, the processing speed can be increased by at least one of raising the priority and increasing the resource allocation;
[0064] 2) Rescheduling: rescheduling the task on other idle nodes;
[0065] 3) Notify the administrator and send an alarm notification to the system administrator, providing detailed fault or exception information and specific handling suggestions.
[0066] When the running status indicates that the first container where the first data processing task is located or the node where the first container is located has failed, a third container matching the resource requirements, start time and end time of the first data processing task is searched from the designated node again, and the first data processing task is transferred to the third container for continued operation. By real-time monitoring of the running status of each node, node failures can be detected and reported in a timely manner. After detecting a node failure, the central scheduler immediately reallocates the affected tasks to other normally operating nodes to ensure that the tasks are not affected. At the same time, an alarm notification can be sent to the system administrator to provide detailed failure information and specific processing suggestions.
[0067] In the technical solution of the present application, the operation of tasks in the time schedule is guaranteed first, and the automatic scheduling logic is executed after the tasks in the time schedule are completed. During the scheduling process, the central scheduler first ensures that the manually or automatically set time schedule is executed. After ensuring that the tasks in the time schedule are completed on time, the central scheduler executes the automatic scheduling logic based on real-time monitoring data and predictive scheduling results to ensure the real-time and efficiency of the system. When the set time schedule conflicts with the automatic scheduling logic, the central scheduler will give priority to the manually set tasks and adjust the time window or resource allocation of the automatic scheduling logic to avoid affecting the execution of manually scheduled tasks.
[0068] As an optional embodiment, the following is combined with Figure 3 , the technical solution of this application is further described in detail with specific implementation methods:
[0069] 1) System initialization
[0070] Deploy a container cloud platform: Configure container engines and orchestration tools, such as deploying Kubernetes (K8s for short) to automatically deploy, scale, and manage containerized applications through K8s.
[0071] Initialize real-time nodes: You can introduce real-time nodes to the container cloud platform for management through automatic discovery or manual introduction.
[0072] Deploy a central scheduler: configure global scheduling policies and optimization rules.
[0073] 2) Set up a time schedule
[0074] On the container cloud management platform interface, for tasks with high real-time requirements, you can manually or automatically set a time schedule to ensure that the tasks are completed in real time and reliably.
[0075] Major frame time setting: The system administrator manually or automatically sets the major frame time (major frame), that is, defines a major time period in order to schedule specified tasks within the period.
[0076] Scheduling start and end point settings: Set the scheduling start and end point for each task in the time schedule to ensure that the task is executed within the specified time window.
[0077] Node selection: Through this option, users can choose to execute tasks through single or multiple real-time nodes to ensure the real-time and reliability of the tasks.
[0078] Limited scheduling guarantee: By manually or automatically setting the time schedule, the real-time container is ensured to complete the task within the limited time, improving the certainty and controllability of scheduling.
[0079] 3) Task registration and preprocessing
[0080] Task registration: Register all data processing tasks to the central scheduler and configure the task priority, resource requirements, and deadline.
[0081] Task preprocessing: The central scheduler first detects whether the task matches the set time schedule. If it matches the set time schedule, the task is configured as the highest priority according to the settings, and the resource requirements and deadlines are configured. If not, check whether there is historical execution data, estimate the resource requirements and deadlines based on the historical execution situation, and configure the specified priority based on the task type (real-time, non-real-time). Generally, the priority of real-time tasks is higher than that of non-real-time tasks.
[0082] 4) Real-time monitoring
[0083] Monitor task execution: Through the monitoring module, the execution status of tasks, resource usage and system load on each node can be monitored in real time, and monitoring data can be collected for scheduling optimization.
[0084] High-priority monitoring and alarm for the time schedule: Set the monitoring alarm level of the tasks in the time schedule to a higher level than the alarm level of ordinary tasks to ensure that the tasks in the schedule are completed on time. If the tasks are not completed on time, the system will immediately trigger a high-level alarm and perform resource scheduling and task priority adjustment.
[0085] Adjust resource allocation: Dynamically adjust task priorities and resource allocation based on real-time monitoring data. For example, if a high-priority task is approaching its deadline but has not been completed, increase its priority and allocate more resources to it.
[0086] Load balancing: Dynamically adjust task allocation to ensure load balance among nodes and avoid overloading of some nodes affecting task execution.
[0087] 5) Predictive Scheduling
[0088] Analyze historical data: Use machine learning algorithms to analyze historical task execution data and predict the execution time and resource requirements of future tasks.
[0089] Allocate resources in advance: Allocate resources and schedule time for upcoming tasks in advance based on forecast results, reduce scheduling delays, and improve the accuracy of resource allocation.
[0090] 6) Fault detection and recovery
[0091] Real-time monitoring of node operation status: The monitoring module monitors the operation status of each node in real time, and detects and reports node failures in a timely manner.
[0092] Task reallocation: After detecting a node failure, the central scheduler immediately reallocates the affected tasks to other normally operating nodes to ensure that the tasks are not affected.
[0093] 7) Scheduling strategy optimization
[0094] Continuously optimize scheduling strategies: Continuously optimize scheduling strategies based on system operation status and historical data. The central scheduler can select the most suitable scheduling algorithm based on the current system status, such as fixed priority scheduling FPS (when the load is low or the priority difference between tasks is obvious, the scheduler may choose FPS. The FPS algorithm assigns a fixed priority to each task and schedules it in order of priority. This algorithm is suitable for situations where the task priority is clear and the system status is stable), earliest deadline priority scheduling EDF (select the task with the highest priority according to the task deadline. If the task deadline is close and the system load is high in the system status, the scheduler tends to choose the EDF algorithm to ensure that the task is completed on time), least remaining time priority scheduling LLF (scheduled according to the task delay (that is, the room for task completion), the task with smaller delay has higher priority. When there are tasks in the system approaching their deadlines and the system load is high, the scheduler can choose LLF to ensure that the most urgent tasks are processed in time), thereby improving the flexibility and efficiency of scheduling.
[0095] Prioritize the manual time schedule, then execute the automatic scheduling logic:
[0096] Time schedule is executed first: During the scheduling process, the central scheduler first ensures that the manually set time schedule is executed.
[0097] Automatic scheduling logic execution: After ensuring that the tasks in the time schedule are completed on time, the central scheduler executes the automatic scheduling logic based on real-time monitoring data and predictive scheduling results to ensure the real-time and efficiency of the system.
[0098] During the operation of the automatic scheduling logic, the central scheduler can flexibly select and adjust these scheduling algorithms based on the actual needs and performance goals of the system, combined with historical data and current system status, to achieve the best scheduling effect:
[0099] 7.1) System status monitoring and analysis
[0100] The real-time central scheduler needs to monitor the status of the system in real time and collect various information, such as the priority, deadline and execution time of the task; the availability of resources (such as CPU, memory, etc.); the arrival time and expected execution time of the task; the historical execution status of the task and the system load. With this information, the scheduler can determine the current system load, the real-time requirements of the task, and the dependencies between tasks.
[0101] 7.2) Scheduling Strategy
[0102] When the task type is complex or the system status changes frequently, the scheduler can switch between different scheduling algorithms according to certain rules. For example, when the system load is low, FPS or other simple algorithms are used; when the task has a tight deadline, EDF or LLF is used to ensure timely completion.
[0103] During the scheduling process, the central scheduler can optimize the key parameters in the scheduling algorithm by setting a time schedule to better adapt to the current system status and task characteristics to further optimize the scheduling performance.
[0104] In addition, the central scheduler needs to constantly track the scheduling effect and make adjustments based on the task execution results and system status. For example, if the EDF algorithm does not perform well and causes too many task delays, the scheduler can switch to LLF or other algorithms to optimize the task completion time and system efficiency.
[0105] The purpose of this application is to provide a time scheduling management solution for a real-time operating system based on a container cloud, which introduces a central scheduler. By optimizing the priority determination method of the central scheduler and optimizing the time scheduling mechanism, efficient management of real-time tasks is achieved. By combining the time scheduling mechanism of the containerized RTOS in the central scheduler with the distributed scheduling algorithm, global task scheduling and resource management can be performed on multiple real-time nodes to ensure the high efficiency of the system and the timely completion of tasks.
[0106] The technical solution of the present application is adopted: 1) By combining the advantages of container cloud technology, real-time operating system and the priority determination method and optimized time scheduling mechanism of the central scheduler, the time scheduling management solution of the present application can effectively improve the system's responsiveness and resource utilization; 2) The solution is not only suitable for real-time tasks with strict time constraints, but also for mixed tasks with variable resource requirements, and has broad application prospects.
[0107] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0108] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0109] According to another aspect of an embodiment of the present application, a container-based real-time task scheduling device for implementing the above-mentioned container-based real-time task scheduling method is also provided. Figure 4 is a schematic diagram of an optional container-based real-time task scheduling device according to an embodiment of the present application, such as Figure 4 As shown, the device may include:
[0110] The acquisition unit 401 is used to acquire the data processing task to be executed.
[0111] The determination unit 403 is used to determine a first data processing task in the data processing tasks to be run that matches the task in the target task table and a second data processing task that does not match the task in the target task table, wherein the real-time requirement of the data processing task recorded in the target task table is higher than that of other data processing tasks.
[0112] The scheduling unit 405 is used to schedule the first data processing task to run in the container of a node in the node set, and after scheduling the first data processing task, schedule the second data processing task to run in the container of a node in the node set.
[0113] Through the above modules, multiple data processing tasks to be run are obtained; the first data processing task that matches the task in the time schedule and the second data processing task that does not match the task in the time schedule are determined, wherein the time schedule records the data processing tasks with real-time requirements; within the configured main frame time, the container on the node in the node set is first called to run the first data processing task, and after all the first data processing tasks are completed, the container on the node in the node set is called to run the second data processing task. All data processing tasks with real-time requirements have a higher processing priority (which can be the highest priority) than other data processing tasks, and need to be processed first, which can avoid the poor timeliness caused by the use of fifo queues; in addition, this scheme is applicable to multi-node systems, and all data processing tasks with real-time requirements are undertaken by multiple nodes, which have more resources for scheduling than single node processing, thereby solving the technical problem of poor immediacy of container processing tasks in related technologies, thereby ensuring the efficiency of the system and the immediacy of task completion.
[0114] Optionally, the scheduling unit is also used to: obtain the resource requirements, start time and deadline configured for the first data processing task, search for a first container that matches the resource requirements, start time and deadline of the first data processing task from the containers on the designated node, reserve the first container for the first data processing task, and configure the scheduling priority of the first data processing task to a first priority, wherein the designated node is a node in the node set that is designated to run the tasks in the target task table; obtain the resource requirements, start time and deadline configured for the second data processing task, search for a second container that matches the resource requirements, start time and deadline of the second data processing task from the containers on the nodes in the node set, reserve the second container for the second data processing task, and configure the scheduling priority of the second data processing task to a second priority, wherein the second priority is lower than the first priority.
[0115] Optionally, the scheduling unit is also used to: when the expected scheduling time of the first data processing task and the second data processing task is within the current scheduling cycle, obtain the first priority of the first data processing task to be scheduled and the second priority of the second data processing task; according to the first priority and the second priority, first schedule the first data processing task to run in the reserved first container, and then run the automatic scheduling logic after the scheduling of the first data processing task is completed, so as to schedule the second data processing task to run in the reserved second container.
[0116] Optionally, the scheduling unit is also used to: when the current system load of the node set is lower than the first load, run the fixed priority scheduling algorithm FPS in the automatic scheduling logic, wherein the fixed priority scheduling algorithm FPS schedules the data processing tasks in order of scheduling priority from high to low; when the current system load of the node set is higher than the second load, use one of the earliest deadline first algorithm EDF and the least delay first algorithm LLF to schedule the data processing tasks, and track the scheduling effect, wherein, if the scheduling effect does not meet the requirements, the other of the earliest deadline first algorithm EDF and the least delay first algorithm LLF is used to schedule the data processing tasks next time, the earliest deadline first algorithm EDF schedules the data processing tasks in order of deadline from near to far, and the least delay first algorithm LLF schedules the data processing tasks in order of delay from small to large, and the second load is greater than or equal to the first load.
[0117] Optionally, the device of the present application may also include: a configuration unit, used to: before obtaining the data processing task to be run, select a node from the node set as the designated node based on stability, and configure the designated node for the target task table; configure node selection attributes, start time and end time for the data processing task with real-time requirements, and record them in the target task table, wherein the node selection attributes are used to configure the data processing task to be run by a single node or multiple nodes among the designated nodes.
[0118] Optionally, the configuration unit is also used to: when there is an associated data processing task for the second data processing task, configure resource requirements for the second data processing task according to the resource consumption in the historical operation records of the associated data processing task, and configure a deadline for the second data processing task according to the running time and the expected scheduling time in the historical operation records; when there is no associated data processing task for the second data processing task, configure resource requirements for the second data processing task according to the estimated resource requirements, and configure a deadline for the second data processing task according to the estimated running time and the expected scheduling time.
[0119] Optionally, the scheduling unit is also used to: monitor the running status of the first data processing task; when the running status indicates that the first data processing task is not completed and the interval between the current time and the deadline of the first data processing task is less than a preset time, allocate more resources for the first data processing task from the designated node; when the running status indicates that the first container where the first data processing task is located or the node where the first container is located fails, re-search from the designated node for a third container that matches the resource requirements, start time and deadline of the first data processing task, and transfer the first data processing task to the third container to continue running.
[0120] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments. It should be noted that the above modules, as part of the device, can be run in a corresponding hardware environment, can be implemented by software, and can also be implemented by hardware, wherein the hardware environment includes a network environment.
[0121] According to another aspect of an embodiment of the present application, a server or terminal for implementing the above container-based real-time task scheduling method is also provided.
[0122] Figure 5 is a structural block diagram of a terminal according to an embodiment of the present application, such as Figure 5 As shown, the terminal may include: one or more (only one is shown in the figure) processors 501, a memory 503, and a transmission device 505, such as Figure 5 As shown, the terminal may also include an input and output device 507.
[0123] Among them, the memory 503 can be used to store software programs and modules, such as the program instructions / modules corresponding to the container-based real-time task scheduling method and device in the embodiment of the present application, and the processor 501 executes various functional applications and data processing by running the software programs and modules stored in the memory 503, that is, realizing the above-mentioned container-based real-time task scheduling method. The memory 503 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 503 may further include a memory remotely arranged relative to the processor 501, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0124] The above-mentioned transmission device 505 is used to receive or send data via a network, and can also be used for data transmission between a processor and a memory. The above-mentioned network specific examples may include wired networks and wireless networks. In one example, the transmission device 505 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 505 is a radio frequency (Radio Frequency, RF) module, which is used to communicate with the Internet wirelessly.
[0125] Specifically, the memory 503 is used to store application programs.
[0126] The processor 501 can call the application stored in the memory 503 through the transmission device 505 to perform the following steps: obtain the data processing tasks to be run; determine the first data processing task that matches the task in the target task table and the second data processing task that does not match the task in the target task table among the data processing tasks to be run, wherein the real-time requirement of the data processing tasks recorded in the target task table is higher than that of other data processing tasks; schedule the first data processing task to run in the container of a node in the node set, and after scheduling the first data processing task, schedule the second data processing task to run in the container of a node in the node set.
[0127] The processor 501 is also used to perform the following steps: obtain the resource requirements, start time and deadline configured for the first data processing task, search for a first container that matches the resource requirements, start time and deadline of the first data processing task from the containers on the designated node, reserve the first container for the first data processing task, and configure the scheduling priority of the first data processing task to be a first priority, wherein the designated node is a node in the node set that is designated to run the task in the target task table; obtain the resource requirements, start time and deadline configured for the second data processing task, search for a first container on a node in the node set that matches the resource requirements, start time and deadline of the second data processing task. A second container is allocated, the second container is reserved for the second data processing task, and the scheduling priority of the second data processing task is configured as a second priority, wherein the second priority is lower than the first priority; when the expected scheduling time of the first data processing task and the second data processing task is within the current scheduling cycle, the first priority of the first data processing task to be scheduled and the second priority of the second data processing task are obtained; according to the first priority and the second priority, the first data processing task is first scheduled to run in the reserved first container, and after the scheduling of the first data processing task is completed, the automatic scheduling logic is run to schedule the second data processing task to run in the reserved second container.
[0128] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.
[0129] It can be understood by those skilled in the art that Figure 5 The structure shown is for illustration only, and the terminal may be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, or other terminal devices. Figure 5 It does not limit the structure of the above electronic device. For example, the terminal may also include Figure 5 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 5 Different configurations shown.
[0130] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0131] The embodiment of the present application further provides a storage medium. Optionally, in this embodiment, the storage medium can be used to execute the program code of the container-based real-time task scheduling method.
[0132] Optionally, in this embodiment, the storage medium may be located on at least one network device among a plurality of network devices in the network shown in the above embodiment.
[0133] Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps:
[0134] Obtain data processing tasks to be run; determine a first data processing task that matches a task in a target task table and a second data processing task that does not match a task in the target task table among the data processing tasks to be run, wherein the real-time requirement of the data processing tasks recorded in the target task table is higher than that of other data processing tasks; schedule the first data processing task to run in a container of a node in a node set, and after scheduling the first data processing task, schedule the second data processing task to run in a container of a node in the node set.
[0135] Optionally, the storage medium is also configured to store program code for performing the following steps: obtaining the resource requirements, start time and deadline configured for the first data processing task, searching for a first container that matches the resource requirements, start time and deadline of the first data processing task from the containers on the designated node, reserving the first container for the first data processing task, and configuring the scheduling priority of the first data processing task to be a first priority, wherein the designated node is a node in the node set that is designated for running tasks in the target task table; obtaining the resource requirements, start time and deadline configured for the second data processing task, searching for a first container that matches the resource requirements, start time and deadline of the second data processing task from the containers on the nodes in the node set. and a second container that matches the deadline, reserving the second container for the second data processing task, and configuring the scheduling priority of the second data processing task to be a second priority, wherein the second priority is lower than the first priority; when the expected scheduling times of the first data processing task and the second data processing task are within the current scheduling cycle, obtaining the first priority of the first data processing task to be scheduled and the second priority of the second data processing task; according to the first priority and the second priority, first scheduling the first data processing task to be run in the reserved first container, and then running the automatic scheduling logic after the scheduling of the first data processing task is completed, so as to schedule the second data processing task to be run in the reserved second container.
[0136] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.
[0137] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.
[0138] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0139] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
[0140] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0141] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0142] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0143] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0144] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A container-based real-time task scheduling method, characterized in that: include: Get the data processing tasks to be run; Determine a first data processing task that matches a task in a target task table and a second data processing task that does not match a task in the target task table among the data processing tasks to be run, wherein the real-time requirement of the data processing task recorded in the target task table is higher than that of other data processing tasks; The first data processing task is scheduled to run in a container of a node in the node set. After the first data processing task is scheduled, the second data processing task is scheduled to run in a container of a node in the node set.
2. The method according to claim 1, characterized in that After determining a first data processing task that matches a task in the target task table and a second data processing task that does not match a task in the target task table among the data processing tasks to be executed, the method further includes: Obtain resource requirements, start time, and deadline configured for the first data processing task, search for a first container that matches the resource requirements, start time, and deadline of the first data processing task from containers on a designated node, reserve the first container for the first data processing task, and configure the scheduling priority of the first data processing task to a first priority, wherein the designated node is a node in the node set that is designated to run the task in the target task table; Obtain resource requirements, start time, and deadline configured for the second data processing task, search for a second container that matches the resource requirements, start time, and deadline of the second data processing task from containers on nodes in the node set, reserve the second container for the second data processing task, and configure the scheduling priority of the second data processing task to a second priority, wherein the second priority is lower than the first priority.
3. The method according to claim 2, characterized in that Scheduling the first data processing task to run in a container of a node in the node set, and after scheduling the first data processing task, scheduling the second data processing task to run in a container of a node in the node set, including: When the expected scheduling times of the first data processing task and the second data processing task are within the current scheduling period, obtaining a first priority of the first data processing task to be scheduled and a second priority of the second data processing task; According to the first priority and the second priority, the first data processing task is first scheduled to run in the reserved first container, and after the first data processing task is scheduled, the automatic scheduling logic is run to schedule the second data processing task to run in the reserved second container.
4. The method according to claim 3, characterized in that: During the execution of the automatic scheduling logic, the method further includes: When the current system load of the node set is lower than the first load, running the fixed priority scheduling algorithm FPS in the automatic scheduling logic, wherein the fixed priority scheduling algorithm FPS schedules the data processing tasks in descending order of scheduling priority; When the current system load of the node set is higher than the second load, one of the earliest deadline first algorithm EDF and the least delay first algorithm LLF is used to schedule the data processing task, and the scheduling effect is tracked. When the scheduling effect does not meet the requirements, the other of the earliest deadline first algorithm EDF and the least delay first algorithm LLF is used to schedule the data processing task next time. The earliest deadline first algorithm EDF schedules the data processing tasks in order of deadline from near to far, and the least delay first algorithm LLF schedules the data processing tasks in order of delay from small to large. The second load is greater than or equal to the first load.
5. The method according to claim 2, characterized in that: Before obtaining the data processing task to be executed, the method further includes: Selecting a node from the node set as the designated node according to stability, and configuring the designated node for the target task table; Configure node selection attributes, start time and end time for data processing tasks with real-time requirements, and record them in the target task table, wherein the node selection attributes are used to configure the data processing task to be run by a single node or multiple nodes in the specified nodes.
6. The method according to claim 2, characterized in that After obtaining the data processing task to be executed, the method further includes: In the case where the second data processing task has an associated data processing task, configuring resource requirements for the second data processing task according to resource consumption in the historical operation records of the associated data processing task, and configuring a deadline for the second data processing task according to the operation duration and expected scheduling time in the historical operation records; In the case that the second data processing task has no associated data processing task, resource requirements are configured for the second data processing task according to the estimated resource requirements, and a deadline is configured for the second data processing task according to the estimated running time and the expected scheduling time.
7. The method according to any one of claims 1 to 6, characterized in that: After scheduling the first data processing task to run in a container of a node in the node set, the method further includes: Monitoring the running status of the first data processing task; When the running status indicates that the first data processing task is not completed and the interval between the current time and the deadline of the first data processing task is less than a preset time, allocating more resources for the first data processing task from the designated node; When the running status indicates that a first container where the first data processing task is located or a node where the first container is located fails, a third container that matches the resource requirements, start time, and end time of the first data processing task is searched again from the designated node, and the first data processing task is transferred to the third container for continued operation.
8. A container-based real-time task scheduling device, characterized in that: include: An acquisition unit, used for acquiring data processing tasks to be executed; a determining unit, used to determine, among the data processing tasks to be executed, a first data processing task that matches a task in a target task table and a second data processing task that does not match a task in the target task table, wherein the real-time requirement of the data processing task recorded in the target task table is higher than that of other data processing tasks; A scheduling unit is used to schedule the first data processing task to run in a container of a node in the node set, and after scheduling the first data processing task, schedule the second data processing task to run in a container of a node in the node set.
9. A container-based real-time task scheduling system, characterized in that: include: A central scheduler is used to determine a first data processing task that matches a task in a target task table and a second data processing task that does not match a task in the target task table among the data processing tasks to be run; and schedule the first data processing task to run in a container of a node in a node set, and after scheduling the first data processing task, schedule the second data processing task to run in a container of a node in the node set, wherein the real-time requirement of the data processing task recorded in the target task table is higher than that of other data processing tasks; A node set is used to run the first data processing task and the second data processing task through containers on the nodes.
10. A computer-readable storage medium, characterized in that: The storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 7 when executed.
11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: The processor executes the method described in any one of claims 1 to 7 through the computer program.
Citation Information
Cited By
Real-time task scheduling method and device based on Docker container
CN121957773A
A real-time task scheduling method and device based on a Docker container
CN121957773B