Task scheduling method, device and equipment and computer readable storage medium
By dividing the front-end and back-end processing cores on the non-consistent storage access node and scheduling tasks using load balancing strategies, the problem of low task scheduling efficiency is solved, and the performance utilization rate and system efficiency of the CPU are improved.
Patent Information
- Application Number
- CN202411203477.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2024-11-22
AI Technical Summary
In the prior art, task scheduling efficiency is low, resulting in low CPU utilization. Especially under the multi-threaded model, frequent tasks switching between different CPU cores leads to performance losses.
By dividing each non-consistent storage access node into the front-end processing core and the back-end processing core, and using load balancing policies to dynamically schedule back-end tasks and front-end blocking tasks, ensuring that each task is associated with a processing core, reducing thread switching, and improving CPU performance utilization.
It effectively improves task scheduling efficiency, reduces overall latency, improves CPU performance utilization, and ensures efficient system advancement.
Smart Images

Figure CN119003127A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent scheduling technology, and in particular to a task scheduling method, device, equipment and computer-readable storage medium. Background Art
[0002] The storage backend service is built with a multi-threaded model. During a task execution process, data is transferred and processed between different CPU (Central Processing Unit) cores, which requires frequent memory access. A near-end access takes 90ns (nanoseconds) as normal time. If a task is executed and transferred between different CPU cores, the following factors may cause data transfer: 1) The data may be transferred to the CPU core of the same NUMA (non-uniform memory access) node, and the data access latency is up to 200ns. As the memory access level increases, it causes significant performance loss; 2) The CPU cache loss and the cost of thread switching result in an overall delay of more than 2us, which significantly damages performance.
[0003] It can be seen that the current scheduling method cannot fully utilize the CPU, resulting in low task scheduling efficiency. Therefore, how to improve the task scheduling efficiency and fully utilize the CPU is a problem that technical personnel in this field need to solve. Summary of the invention
[0004] In view of this, an object of the embodiments of the present invention is to provide a task scheduling method, apparatus, device and computer-readable storage medium, which can solve the technical problem of low task scheduling efficiency in the prior art.
[0005] In order to solve the above technical problems, the present invention provides a task scheduling method, comprising:
[0006] Determine a first preset number of front-end processing cores and a second preset number of back-end processing cores corresponding to each non-consistent storage access node; wherein the first preset number is greater than the second preset number, the front-end processing core is a core for processing front-end tasks, and the back-end processing core is a core for processing back-end tasks and front-end blocking tasks; the front-end blocking task is a task where the execution time of the front-end task exceeds a preset running time threshold;
[0007] Determine the processing threads corresponding to the backend tasks and the frontend tasks respectively;
[0008] Determine the front-end processing core or the back-end processing core associated with each processing thread, and when a task in the processing thread needs to be executed, use the associated front-end processing core or the back-end processing core to process the task on the processing thread;
[0009] When the number of tasks on any of the backend processing cores is greater than the maximum preset number of tasks, an idle backend processing core is determined using a load balancing strategy, and the idle backend processing core is used to execute the remaining tasks; wherein the idle backend processing core is a core whose performance is better than the performance of the backend processing core corresponding to the tasks whose number of tasks is greater than the maximum preset number of tasks.
[0010] In some embodiments, before determining the processing threads corresponding to the backend task and the frontend task respectively, the method further includes:
[0011] Determine whether the task is the backend task or the frontend task according to the task identifier; wherein the task identifier includes at least one of the task name, the task source or the task description; wherein the task description is a description for determining whether the technology type used in the task is the frontend technology or the backend technology.
[0012] In some embodiments, the process of determining the front-end blocking task includes:
[0013] Determining the preset running time threshold;
[0014] When the single execution time of the front-end task is greater than the preset running time threshold, the front-end task is determined as the front-end blocking task.
[0015] In some embodiments, when the single execution time of the front-end task is greater than the preset running time threshold, determining the front-end task as the front-end blocking task includes:
[0016] Acquire a monitoring task on each of the non-consistent storage access nodes; wherein the monitoring task is used to monitor the execution time of the front-end task of the node; the monitoring task is a task executed at the preset running time threshold as the running cycle interval;
[0017] Determine a task queue and task information corresponding to each task in the task queue by using the monitoring task; wherein the task information includes a task identifier and a task scheduling number, the task scheduling number being the number of scheduling times when a task is scheduled out of a front-end processing core in a non-consistent storage access node due to an interruption and / or waiting for an input / output event result, and then scheduled back to the front-end processing core;
[0018] When the monitoring task performs monitoring in each execution cycle, the task information obtained by each front-end processing core is compared with the task information saved last time to determine whether the task identifiers are the same;
[0019] If the task identifiers are not the same, no processing is performed and the new task information is stored;
[0020] If the task identifiers are the same, determining whether the scheduling times are consistent with the last scheduling times;
[0021] When it is determined that the scheduling number has changed, determining to store the latest scheduling number;
[0022] When it is determined that the scheduling number has not changed, it is determined that the execution time of the current front-end task is greater than the preset running time threshold, and the front-end task is determined as the front-end blocking task.
[0023] In some embodiments, when the number of tasks on any of the backend processing cores is greater than a maximum preset number of tasks, an idle backend processing core is determined using a load balancing strategy, and the idle backend processing core is used to execute the remaining tasks, including:
[0024] Storing each of the backend tasks in a task queue;
[0025] When it is determined that the number of tasks in the task queue is greater than the maximum preset number of tasks, determining to send a request for an idle backend processing core;
[0026] receiving resource utilization rates returned by other backend processing cores according to the request of the idle backend processing core, and determining the idle backend processing core according to the resource utilization rates;
[0027] The idle back-end processing cores are utilized to execute the remaining tasks.
[0028] In some embodiments, the utilizing the idle backend processing core to execute the remaining tasks includes:
[0029] When there are multiple idle back-end processing cores, determining a first non-uniform storage access node corresponding to each idle back-end processing core;
[0030] Determining that the backend processing core corresponding to the task that needs to request an idle backend processing core is the corresponding second non-uniform storage access node;
[0031] Determine a backend processing core corresponding to the non-uniform storage access node that is the same as the second non-uniform storage access node as a final idle backend processing core;
[0032] The final idle back-end processing core is utilized to execute the remaining tasks.
[0033] In some embodiments, after determining the front-end blocking task, the method further includes:
[0034] Dispatching the front-end blocking task to the back-end processing core for execution;
[0035] When there is a backend task running on the backend processing core, it is determined to interrupt the running backend task and switch the task to the frontend blocking task.
[0036] The present invention also provides a task scheduling device, comprising:
[0037] A processing core division module, used to determine a first preset number of front-end processing cores and a second preset number of back-end processing cores corresponding to each non-consistent storage access node; wherein the first preset number is greater than the second preset number, the front-end processing core is a core for processing front-end tasks, and the back-end processing core is a core for processing back-end tasks and front-end blocking tasks; the front-end blocking task is a task where the execution time of the front-end task exceeds a preset running time threshold;
[0038] A processing thread determination module is used to determine the processing threads corresponding to the backend tasks and the frontend tasks respectively;
[0039] A thread and processing core association module, used to determine the front-end processing core or the back-end processing core associated with each processing thread, and when a task in a processing thread needs to be executed, use the associated front-end processing core or the back-end processing core to process the task on the processing thread;
[0040] A load balancing module is used to determine an idle back-end processing core using a load balancing strategy when the number of tasks on any of the back-end processing cores is greater than a maximum preset number of tasks, and use the idle back-end processing core to execute the remaining tasks; wherein the idle back-end processing core is a core whose performance is better than the performance of the back-end processing core corresponding to the tasks whose number of tasks is greater than the maximum preset number of tasks.
[0041] The present invention also provides a task scheduling device, comprising:
[0042] Memory for storing computer programs;
[0043] A processor is used to execute the computer program to implement the steps of the task scheduling method as described above.
[0044] The present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the task scheduling method described above are implemented.
[0045] The present invention also provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned task scheduling method when executed by a processor.
[0046] To solve the above technical problems, an embodiment of the present invention provides a task scheduling method, by determining a first preset number of front-end processing cores and a second preset number of back-end processing cores corresponding to each non-consistent storage access node; wherein the first preset number is greater than the second preset number, the front-end processing core is a core for processing front-end tasks, and the back-end processing core is a core for processing back-end tasks and front-end blocking tasks; the front-end blocking task is a task whose execution time of the front-end task exceeds a preset running time threshold; determining the processing threads corresponding to the back-end task and the front-end task respectively; determining the front-end processing core or the back-end processing core associated with each processing thread, and when the task in the processing thread needs to be executed, using the associated front-end processing core or the back-end processing core to process the task on the processing thread; when the number of tasks on any back-end processing core is greater than the maximum preset number of tasks, using the load balancing strategy to determine the idle back-end processing core, and using the idle back-end processing core to execute the remaining tasks; wherein the idle back-end processing core is a core whose performance is better than the performance of the back-end processing core corresponding to the task whose number of tasks is greater than the maximum preset number of tasks.
[0047] It can be seen from the above technical scheme that, compared with the current task execution process in which tasks are constantly switched between different CPU cores and require frequent memory access, the beneficial effects of the present invention are: taking into account the NUMA characteristics of the hardware, the multiple CPU cores corresponding to the non-consistent storage access nodes are divided into front-end processing cores and back-end processing cores, and the front-end processing cores are used to process the front-end non-blocking tasks to ensure the minimization of the overall average delay of the front-end processing cores. A dynamic scheduling method based on load balancing for the execution of back-end tasks and front-end blocking tasks on the back-end processing cores is proposed to ensure the efficient advancement of the overall system, and one thread is associated with a corresponding core, which reduces the number of process switching times, improves the efficiency of task scheduling, and improves the performance of the CPU. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0049] Figure 1 A flowchart of a task scheduling method provided by an embodiment of the present invention;
[0050] Figure 2 A flowchart of a task scheduling method provided by an embodiment of the present invention;
[0051] Figure 3 A schematic diagram of the structure of a task scheduling device provided by an embodiment of the present invention;
[0052] Figure 4 A structural diagram of a task scheduling device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0053] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0054] The terms "including" and "having" in the specification of the present invention and the above-mentioned drawings, as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may include steps or units that are not listed.
[0055] Some of the terms that appear in the description of the embodiments of the present invention may be interpreted as follows:
[0056] NUMA: Non-Uniform Memory Access, non-uniform memory access.
[0057] Front-end IO (Input / Output) tasks: data requests directly initiated by system users. These requests usually require timely returns. The lower the latency, the more user-friendly it is.
[0058] Background IO tasks: some necessary actions performed by system services during operation, such as garbage collection of storage engines, etc., to better utilize device space, clean up expired and deleted data, etc. Background tasks are usually not real-time, but their processing results will affect the query efficiency of the engine.
[0059] Foreground blocking tasks: In foreground IO tasks, long processing time blocks subsequent tasks.
[0060] online core: The CPU core assigned to process foreground IO tasks.
[0061] Offload core: A CPU core that is allocated to process background tasks and block foreground tasks.
[0062] Rocksdb: A widely used KV storage engine.
[0063] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0064] Next, a flowchart of a task scheduling method provided by an embodiment of the present invention is described in detail. Figure 1 A task scheduling method provided in an embodiment of the present invention may include:
[0065] S101, determine a first preset number of front-end processing cores and a second preset number of back-end processing cores corresponding to each non-consistent storage access node; wherein the first preset number is greater than the second preset number, the front-end processing core is a core for processing front-end tasks, and the back-end processing core is a core for processing back-end tasks and front-end blocking tasks; a front-end blocking task is a task whose execution time exceeds a preset running time threshold.
[0066] The execution subject of this embodiment is an electronic device. The electronic device can be a computer, a mobile phone, etc. This embodiment does not limit the specific application scenario. For example, this embodiment can be applied to delay-sensitive background data services. Each non-consistent storage access node in this embodiment refers to each NUMA node. In this embodiment, the CPU core can be divided into multiple NUMA nodes, and each NUMA node corresponds to a first preset number of front-end processing cores (online core) and a second preset number of back-end processing cores (offload core). The number of front-end processing cores in this embodiment is greater than the number of back-end processing cores. It can be understood that the front-end tasks are generally more than the number of back-end tasks, and the front-end tasks need to be responded to in a timely manner. Therefore, by setting the number of front-end processing cores to be greater than the number of back-end processing cores, the response speed is improved, the user experience is enhanced, and resource allocation is optimized. This embodiment does not limit specific front-end blocking tasks. For example, a foreground read request may fall into the CRC (cyclic redundancy check) check after reading disk data, occupying the CPU for a long time. The front-end processing core in this embodiment is mainly used to process front-end non-blocking tasks. It can be understood that the execution time of the blocking task is long. If it is executed for a long time, it will affect the execution of other non-blocking tasks, so the back-end processing core is used to execute the blocking task.
[0067] It should be further explained that, in order to improve the accuracy of determining the front-end task and the back-end task, before determining the processing threads corresponding to the back-end task and the front-end task, the embodiment may further include: determining the task as a back-end task or a front-end task according to the identification of the task; wherein the identification of the task includes at least one of the task name, the task source or the task description; wherein the task description is a description of determining whether the technology type used in the task is a front-end technology or a back-end technology. In this embodiment, when determining the task type according to the task name, if the task involves the display, beautification or layout adjustment of the interface, then this usually belongs to the front-end task. For example, "optimizing the response speed of the website navigation bar" or "realizing the carousel effect" are typical front-end tasks. In this embodiment, when determining the task type according to the task source, if the task is triggered by the user interface, such as clicking a button, filling in a form, etc., then this task is usually a front-end task. If the task is initiated by the server, such as processing database operations, file uploads, etc., then this task is usually a back-end task. In this embodiment, when determining the task type according to the task description, it is usually necessary to pay attention to the keywords and the technologies involved in the task description. The following are some common criteria for judgment: Keywords: If keywords such as "interface", "interaction", "style", and "layout" appear in the task description, then this task is likely to be a front-end task. If keywords such as "database", "server", "API interface", and "data processing" appear in the description, then this task may be a back-end task. Technology stack: Front-end tasks are usually developed using front-end technologies such as HTML (Hypertext Markup Language), CSS (Cascading Style Sheets), and JavaScript (a lightweight interpreted programming language), which involve rendering and interaction on the browser side. Back-end tasks use back-end languages and technology stacks such as Java (back-end development language) and Python (object-oriented scripting language) to process business logic and data operations on the server side. The back-end tasks in this embodiment can be defined as tasks with a long execution cycle that are not obvious to the caller. In addition to the listed tasks such as upload that are clearly understood to need to be completed in a long time, there are also tasks such as garbage collection generated by the backend service process during operation; the backend tasks are generally run in service processes built in languages such as C / C++ (high performance requirements), Java (object-oriented programming language) / go (static type, compiled, concurrent programming language), etc., to handle data storage, processing, retrieval and other tasks and feedback to the front-end caller. This embodiment determines the task type through the identification of the task, so that the front-end task and the back-end task can be accurately distinguished.
[0068] It should be further explained that in order to improve the accuracy of determining the front-end blocking task, the above-mentioned front-end blocking task determination process may include: determining a preset running time threshold; when the single execution time of the front-end task is greater than the preset running time threshold, the front-end task is determined as a front-end blocking task. This embodiment does not limit the specific preset running time threshold, and the preset running time threshold is a time threshold set according to demand. The preset running time threshold in this embodiment may be 3 minutes; or the preset running time in this embodiment may also be 2 minutes, etc. This embodiment does not limit the timing of judging when the single execution time is greater than the preset running time threshold, for example, this embodiment is before the CPU is scheduled to perform task scheduling, or this embodiment may also be determined during the process of scheduling the CPU to perform task scheduling. This embodiment determines the front-end task with too long an execution time as a blocking task, which can improve the accuracy of determining the blocking task, thereby improving the accuracy of task scheduling.
[0069] It should be further explained that, in order to further improve the accuracy of determining the blocked task, when the single execution time of the front-end task is greater than the preset running time threshold, determining the front-end task as the front-end blocked task may include:
[0070] S1, obtaining the monitoring task on each non-consistent storage access node; wherein the monitoring task is used to monitor the execution time of the front-end task of this node; the monitoring task is a task executed at a preset running time threshold as an operating cycle interval.
[0071] In this embodiment, a monitoring task is set at each non-consistent storage access node, so that the execution time of the front-end task of this node can be monitored in time. In this embodiment, the monitoring task is set as a task executed at a preset running time threshold as the running cycle interval to prevent being in a monitoring state all the time and reducing the performance of the CPU.
[0072] S2, using the monitoring task to determine the task queue and the task information corresponding to each task in the task queue; wherein the task information includes the task identifier and the task scheduling number, the task scheduling number is the number of times the task is scheduled out of the front-end processing core in the non-consistent storage access node due to interruption and / or waiting for input and output event results, and then scheduled back to the front-end processing core.
[0073] S3, when the monitoring task performs monitoring in each execution cycle, the task information obtained by each front-end processing core is compared with the task information saved last time to determine whether the task identifiers are the same.
[0074] S4: If the task identifiers are not the same, no processing is performed and the new task information is stored.
[0075] S5: If the task identifiers are the same, determine whether the scheduling times are consistent with the last scheduling times.
[0076] S6, when it is determined that the scheduling number has changed, determine to store the latest scheduling number.
[0077] S7, when it is determined that the scheduling number has not changed, it is determined that the execution time of the current front-end task is greater than a preset running time threshold, and the front-end task is determined as a front-end blocking task.
[0078] This embodiment can run a monitoring task on the backend processing core of each non-consistent storage access node to monitor the time consumed by the foreground task of this node to prevent affecting the performance of the frontend processing core. The monitoring task wakes up at a periodic interval of the running time threshold (for example, defined as 5ms), scans the task queues of other CPUs of the node, and saves the task information. The saved task information includes: task ID (identification), task scheduling times. Among them, the task ID is the global unique identifier of the task, and the scheduling times are, when the task is scheduled out of the CPU due to interruption, waiting for IO event results, etc., and then scheduled back to the CPU for execution, the scheduling times increase once. When the monitoring task wakes up again, the tasks obtained on each CPU are compared with the task information saved last time. If the ID is different, no operation is performed and the new task information is saved; if the ID is the same, the scheduling times are compared. If the times have increased, the latest scheduling times information is retained and no operation is performed; if the ID is the same and the scheduling times are the same, it means that the relevant task is a task that exceeds the specified running threshold, a task interruption is initiated, and it is directly scheduled to the backend processing core for continued execution; at this time, if the backend processing core has a running background task, the original background task is interrupted and switched to the current foreground task (prioritized foreground task). This embodiment determines whether it is a blocked task through the task identifier and the number of task scheduling times, to prevent the task from being rescheduled during re-detection, thereby incorrectly calculating the scheduling time of the task and incorrectly judging the blocked task, thereby improving the accuracy of blocking task determination, and timely scheduling the blocked task to the back-end processing core for processing, thereby improving the efficiency of task scheduling.
[0079] It should be further explained that, in order to improve the efficiency of front-end task processing, after determining the front-end blocking task, the method may further include: scheduling the front-end blocking task to the back-end processing core for execution; when there is a back-end task running on the back-end processing core, determining to interrupt the running back-end task and switching the task to the front-end blocking task. This embodiment can interrupt the back-end task, so that the front-end blocking task can be processed in time, thereby improving the user experience.
[0080] S102, determining the processing threads corresponding to the backend task and the frontend task respectively.
[0081] The processing thread in this embodiment refers to a sequence of program instructions (tasks) executed by the CPU core, which is the basic unit for CPU scheduling and executing tasks. The backend tasks in this embodiment can be rocksdb compaction (compression and arrangement), and the engine's GC (Garbage Collection). When binding the processing thread of the task in this embodiment, it is necessary to analyze the task characteristics: first analyze the characteristics of each backend task, including its computationally intensive or I / O intensive characteristics, and whether it needs to run for a long time. Set the thread pool: Create a corresponding thread pool according to the task characteristics. Configure thread properties: Configure the properties of the thread, such as priority, stack size, daemon thread status, etc., to meet the needs of different tasks. Bind the processing thread: When the task starts, get the thread from the corresponding thread pool and bind it as the execution thread of the task. Monitoring and tuning: Monitor the running status and performance data of the thread, and perform tuning according to the monitoring results to ensure the reasonable use of thread resources. This embodiment can add error handling logic to the processing thread to ensure that the thread can be unbound and recycled when an exception occurs, while ensuring the robustness of the system. This embodiment can also regularly monitor the performance of each processing thread, and adjust the size of the thread pool, thread binding strategy, etc. according to the monitoring results to optimize the overall performance of the system. This embodiment can effectively bind backend tasks and frontend tasks to appropriate processing threads, respectively, to achieve parallel processing of tasks and maximize resource utilization, thereby improving the performance of the entire application and user experience.
[0082] It should be further explained that, in order to improve the efficiency of task execution, the above-mentioned determination of the processing threads corresponding to the back-end task and the front-end task respectively may include: obtaining a thread set generated based on the front-end task and / or the back-end; counting independent threads in the thread set that have no data association with other threads, and counting coupled thread groups with data association between threads according to the thread set; evenly distributing the independent threads to each processing core (front-end processing core and back-end processing core) in each non-consistent storage access node for execution; and distributing the coupled threads of the coupled thread group to the same non-consistent storage access node for processing. In the embodiment of the present invention, the coupled threads of the coupled thread group are uniformly distributed to the same non-consistent storage access node for execution, because it ensures that each coupled thread group with data association between threads can be scheduled and executed by the same non-consistent storage access node, relatively guarantees the synchronous execution between multiple threads with data association, and then relatively guarantees the reliability of executing the task program with multiple data processing threads based on the non-consistent storage access node.
[0083] S103, determining the front-end processing core or the back-end processing core associated with each processing thread, and when a task in the processing thread needs to be executed, using the associated front-end processing core or the back-end processing core to process the task on the processing thread.
[0084] In this embodiment, the processing threads corresponding to the backend task and the frontend task are determined, so that each task can be bound (associated) to a thread, and a task process is fixed in a thread to be completed, and no cross-CPU action is generated during the process execution, reducing the thread / process switching cost. It can be understood that the task can be divided into multiple threads / processes, and the general delay is 2us (microseconds)-5us. With today's high-speed networks and high-speed media, a CPU core (central processing unit core) cannot fully exert its performance, and multiple cores are required to exert its performance, which will inevitably increase the number of threads / processes, and a large number of switches affect the full performance of the CPU performance.
[0085] S104, when the number of tasks on any back-end processing core is greater than the maximum preset number of tasks, an idle back-end processing core is determined using a load balancing strategy, and the idle back-end processing core is used to execute the remaining tasks; wherein, the idle back-end processing core is a core having performance better than the performance of the back-end processing core corresponding to the tasks having a number of tasks greater than the maximum preset number of tasks.
[0086] This embodiment does not limit the specific maximum preset number of tasks, and can be set according to demand. For example, the maximum preset number in this embodiment can be 10, or the maximum preset number of tasks in this embodiment can also be 12. The performance of the idle backend processing core in this embodiment is better than the performance of the backend processing core corresponding to the task whose number of tasks is greater than the maximum preset number of tasks. This embodiment does not limit the specific method of determining the idle backend processing core based on the load balancing strategy. For example, this embodiment can determine the backend processing core with the least number of tasks, so as to determine the backend processing core with the least number of tasks as the idle backend processing core. Or this embodiment can determine the backend processing core with the load balancing strategy of the least response time (Least Response Time): select the backend processing core with the shortest response time for allocation. When selecting a strategy, factors such as the system load situation, the characteristics of the task, and the available resources need to be considered to achieve the best load balancing effect.
[0087] It should be further explained that in order to improve the accuracy of determining the idle backend processing core, when the number of tasks on any backend processing core is greater than the maximum preset number of tasks, the idle backend processing core is determined by the load balancing strategy, and the idle backend processing core is used to execute the remaining tasks, which may include: storing each backend task in a task queue; determining that the number of tasks in the task queue is greater than the maximum preset number of tasks, determining to send a request for an idle backend processing core; receiving resource utilization rates returned by other backend processing cores based on the request of the idle backend processing core, determining the idle backend processing core based on the resource utilization rate; and executing the remaining tasks using the idle backend processing core. The maximum preset number of tasks is not limited in this embodiment. For example, the maximum preset number of tasks in this embodiment may be 10; or the maximum preset number of tasks in this embodiment may be 12. By dynamically allocating tasks to idle backend processing cores, this embodiment can distribute the load more evenly and maximize the use of all computing resources.
[0088] It should be further explained that, in order to reduce the CPU performance consumption across consistent storage access nodes, the above-mentioned use of idle backend processing cores to execute the remaining tasks may include: when there are multiple idle backend processing cores, determining the first non-consistent storage access node corresponding to each idle backend processing core; determining that the backend processing core corresponding to the task that needs to request the idle backend processing core is the corresponding second non-consistent storage access node; determining the backend processing core corresponding to the non-consistent storage access node that is the same as the second non-consistent storage access node as the final idle backend processing core; and using the final idle backend processing core to execute the remaining tasks. In this embodiment, when there are multiple idle backend processing cores, the backend processing core that belongs to the same consistent storage access node as the remaining tasks is preferentially used for processing, thereby reducing CPU performance consumption and improving the efficiency of task scheduling.
[0089] The improved task scheduling method according to the embodiment of the present invention may include: S101, determining a first preset number of front-end processing cores and a second preset number of back-end processing cores corresponding to each non-consistent storage access node; wherein the first preset number is greater than the second preset number, the front-end processing core is a core for processing front-end tasks, and the back-end processing core is a core for processing back-end tasks and front-end blocking tasks; the front-end blocking task is a task whose execution time of the front-end task exceeds a preset running time threshold; S102, determining the processing threads corresponding to the back-end task and the front-end task respectively; S103, determining the front-end processing core or the back-end processing core associated with each processing thread, and when the task in the processing thread needs to be executed, using the associated front-end processing core or the back-end processing core to process the task on the processing thread; S104, when the number of tasks on any back-end processing core is greater than the maximum preset number of tasks, using the load balancing strategy to determine the idle back-end processing core, and using the idle back-end processing core to execute the remaining tasks; wherein the idle back-end processing core is a core whose performance is better than the performance of the back-end processing core corresponding to the task whose number of tasks is greater than the maximum preset number of tasks. Compared with the current storage backend service built with a pipeline multi-threaded model, in which data in an IO task process is transferred and processed between CPU cores of different NUMA nodes, frequent memory access is required, which greatly reduces the effective utilization of the CPU. In addition, too many threads bring the cost of thread switching and thread scheduling, which further reduces the utilization of the CPU and makes the task scheduling time very long. In comparison, the present invention divides the non-consistent storage access nodes into a first preset number of front-end processing cores and a second preset number of back-end processing cores, where the first preset number is greater than the second preset number, so that the front-end processing core can be used to process the front-end tasks, and one task is bound to one thread to reduce thread switching, and a load balancing strategy is used to process tasks whose number of tasks is greater than the maximum preset number of tasks, thereby ensuring efficient advancement of the overall system and efficient CPU scheduling, thereby improving the efficiency of task scheduling.Furthermore, this embodiment determines the task type by the task identifier, so that the front-end task and the back-end task can be accurately distinguished; further, this embodiment determines the front-end task with too long an execution time as a blocking task, which can improve the accuracy of determining the blocking task, thereby improving the accuracy of task scheduling; further, this embodiment determines whether it is a blocking task by the task identifier and the number of task scheduling, so as to prevent the task from being rescheduled when it is detected again, thereby miscalculating the scheduling time of the task and misjudging the blocking task, thereby improving the accuracy of determining the blocking task, and timely scheduling the blocking task to the back-end processing core for processing, thereby improving the efficiency of task scheduling; further, this embodiment can distribute the load more evenly and maximize the use of all computing resources by dynamically allocating tasks to idle back-end processing cores; further, this embodiment can distribute the load more evenly and maximize the use of all computing resources by dynamically allocating tasks to idle back-end processing cores.
[0090] In order to make the present invention easier to understand, please refer to Figure 2 , Figure 2 An example flow chart of a task scheduling method provided by an embodiment of the present invention may specifically include:
[0091] S201, divide the CPU core into multiple NUMA nodes.
[0092] The NUMA node in this embodiment is the non-uniform storage access node mentioned above. This embodiment involves the CPU of the NUMA architecture, how to efficiently schedule related tasks in a complex storage backend scenario, achieve efficient CPU utilization, maximize performance benefits, and minimize IO latency.
[0093] S202, each NUMA node corresponds to a first preset number of front-end processing cores (online cores) and a second preset number of back-end processing cores (offload cores); the first preset number is greater than the second preset number.
[0094] The number of front-end processing cores in this embodiment is greater than the number of back-end processing cores.
[0095] In the embodiment, there may be 6 NUMA nodes in the system, each node has 8 cores, 6 cores on each node are allocated to the front-end tasks, and the remaining 2 cores on the node are allocated to the back-end tasks and the front-end blocking tasks. After the allocation, there will be 36 front-end processing cores and 12 back-end processing cores. The non-blocking front-end tasks processed by the front-end processing cores in this embodiment may be foreground IO tasks, and the back-end tasks processed by the back-end processing cores in this embodiment may be background IO tasks.
[0096] S203, associate the front-end task and the back-end task with the NUMA node, and bind them with the processing thread on the NUMA node. When generating a task, this embodiment directly puts it into the back-end resource pool of the same NUMA node according to its type. If it is a back-end task, it is directly put into the front-end resource pool of the same NUMA node. If it is a front-end task, it is directly put into the front-end resource pool of the same NUMA node. This embodiment binds the processing thread to the CPU, and a task is fixed in one processing thread to complete, and no cross-CPU action is generated during the process execution. This embodiment can define a preset running time threshold for the task in the front-end resource pool. If an execution exceeds the preset running time threshold, it is regarded as a front-end blocking task. The storage back-end task in this embodiment belongs to the IO intensive type task. Generally speaking, a storage back-end service consists of tasks such as receiving read and write requests and replies through network transmission, serialization and deserialization of requests, searching in the storage engine, adding, deleting and modifying engine data structures, and reading and writing NUMA devices; serialization / deserialization of requests and operations on storage engine data structures belong to computing tasks, which take hundreds of nanoseconds and 2~3us respectively. In addition, in the storage backend service, there are usually computing tasks such as reorganizing the engine data (such as rocksdb compaction (KV storage engine), garbage collection of other engines, etc.). These tasks will occupy CPU resources for a relatively long time, and it is impossible to accurately predict when the resources will be occupied.
[0097] S204, using the backend processing core of each NUMA node to monitor the frontend task consumption time of this node, comparing the task consumption time with the preset running time threshold, and determining the frontend blocking task; wherein the monitoring task is awakened at a periodic interval with the preset running time threshold.
[0098] S205, scanning the task queue of the current NUMA node, and storing the task information corresponding to the tasks in the task queue; wherein the task information includes the task ID and the task scheduling times.
[0099] In this embodiment, each core has multiple task queues. Task queues are mainly divided into network transmission and reception, data processing, engine operation, and NUMA device reading and writing. The task ID in this embodiment is an identifier. The number of task scheduling in this embodiment increases once when a task is scheduled out of the CPU due to interruption, waiting for IO event results, etc., and then scheduled back to the CPU for execution.
[0100] S206, when the monitoring task is awakened again, each current task scheduling information is compared with the last saved task scheduling information to determine whether the task ID is consistent.
[0101] S207, when the task IDs are consistent, determine whether the scheduling times have changed. If the times have changed, retain the latest scheduling times information.
[0102] S208: If the scheduling times and the IDs are the same, it is determined that the running time of the front-end task exceeds the running time threshold, and the front-end task is interrupted.
[0103] S209: The front-end task that exceeds the running time threshold is regarded as a front-end blocking task, and is scheduled to the back-end processing core for continued execution.
[0104] S210, when the task IDs are inconsistent, save the latest task information.
[0105] S211, when the task queue of the backend task is greater than a preset value, the idle core for processing the backend task is used for processing.
[0106] This embodiment takes into account that due to the uneven generation of backend tasks, the backend processing cores on each NUMA node will produce unbalanced task processing; if the background tasks cannot be processed for a long time, it will have an adverse impact on the front-end tasks, such as the engine's data query time becoming longer. Therefore, the following load balancing strategy is executed between the back-end processing cores of each node: when a background task is generated and placed in the execution queue of the back-end processing core of the corresponding node, if it cannot be processed immediately (task queue>X, X is generally more than 10), several back-end processing cores of N nodes are randomly selected and notified to them, and the idle back-end processing cores will try to obtain task execution from the corresponding task queue. The above scheduling only applies to back-end tasks; front-end blocking tasks that are judged to be blocked are usually not transferred to other NUMA nodes because they have higher real-time requirements than background tasks.
[0107] The present invention intends to solve the following technical problems: In the storage backend service, there are frontend tasks that are constantly arriving and backend tasks that are generated at uncertain times, and there are unpredictable long-tail tasks in the frontend tasks. It is necessary to construct a task scheduling algorithm to minimize the average delay in processing the frontend tasks. In view of the above problems, the embodiment of the present invention proposes a CPU-based task scheduling method, which takes into account the NUMA characteristics of the hardware and is divided into a frontend processing core and a backend processing core, proposes a blocking perception method for frontend tasks to ensure the minimization of the overall average delay of frontend tasks, and proposes a dynamic scheduling method for background tasks on the backend processing core based on load balancing to ensure the efficient advancement of the overall system.
[0108] The task scheduling device provided by an embodiment of the present invention is introduced below. The task scheduling device described below and the task scheduling method described above can be referred to each other.
[0109] Figure 3 A structural diagram of a task scheduling device provided by an embodiment of the present invention may specifically include:
[0110] The processing core division module 100 is used to determine a first preset number of front-end processing cores and a second preset number of back-end processing cores corresponding to each non-uniform storage access node; wherein the first preset number is greater than the second preset number, the front-end processing core is a core for processing front-end tasks, and the back-end processing core is a core for processing back-end tasks and front-end blocking tasks; the front-end blocking task is a task where the execution time of the front-end task exceeds a preset running time threshold;
[0111] A processing thread determination module 200 is used to determine the processing threads corresponding to the backend task and the frontend task respectively;
[0112] The thread and processing core association module 300 is used to determine the front-end processing core or the back-end processing core associated with each processing thread, and when a task in the processing thread needs to be executed, the associated front-end processing core or the back-end processing core is used to process the task on the processing thread;
[0113] The load balancing module 400 is used to determine an idle back-end processing core using a load balancing strategy when the number of tasks on any of the back-end processing cores is greater than a maximum preset number of tasks, and use the idle back-end processing core to execute the remaining tasks; wherein the idle back-end processing core is a core whose performance is better than the performance of the back-end processing core corresponding to the tasks whose number of tasks is greater than the maximum preset number of tasks.
[0114] Further, based on the above embodiment, the above task scheduling device may further include:
[0115] A module for determining the task type based on identification is used to determine whether the task is the backend task or the frontend task according to the identification of the task; wherein the identification of the task includes at least one of the task name, the task source or the task description; wherein the task description is a description of determining whether the technology type used in the task is the frontend technology or the backend technology.
[0116] Further, based on any of the above embodiments, the above task scheduling device may include:
[0117] A preset running time threshold determination module, used to determine the preset running time threshold;
[0118] The front-end blocking task determining module is used to determine the front-end task as the front-end blocking task when the single execution time of the front-end task is greater than the preset running time threshold.
[0119] Further, based on the above embodiment, the front-end blocking task determination module may include:
[0120] A monitoring task acquisition unit, used to acquire a monitoring task on each of the non-consistent storage access nodes; wherein the monitoring task is used to monitor the execution time of the front-end task of the node; the monitoring task is a task executed at the preset running time threshold as the running cycle interval;
[0121] A task information determination unit, used to determine a task queue and task information corresponding to each task in the task queue using the monitoring task; wherein the task information includes a task identifier and a task scheduling number, wherein the task scheduling number is the number of scheduling times when the task is scheduled out of the front-end processing core in the non-consistent storage access node due to interruption and / or waiting for input / output event results, and then scheduled back to the front-end processing core;
[0122] A first judgment unit is used to compare the task information obtained by each front-end processing core with the task information saved last time when the monitoring task performs monitoring in each execution cycle, and judge whether the task identifiers are the same;
[0123] A task information storage unit, configured to store new task information without performing any processing if the task identifiers are different;
[0124] A second judgment unit, configured to judge whether the scheduling number is consistent with the previous scheduling number if the task identifiers are the same;
[0125] A scheduling number updating unit, used for determining and storing the latest scheduling number when it is determined that the scheduling number has changed;
[0126] The front-end blocking task determining unit is used to determine that the execution time of the current front-end task is greater than the preset running time threshold when it is determined that the scheduling number has not changed, and determine the front-end task as the front-end blocking task.
[0127] Further, based on any of the above embodiments, the load balancing module 400 may include:
[0128] A task queue determining unit, used for storing each of the backend tasks into a task queue;
[0129] A request sending unit, configured to determine, when determining that the number of tasks in the task queue is greater than the maximum preset number of tasks, to send a request to an idle backend processing core;
[0130] An idle backend processing core determining unit, configured to receive resource utilization rates returned by other backend processing cores according to a request of the idle backend processing core, and determine the idle backend processing core according to the resource utilization rates;
[0131] The remaining task execution unit is used to execute the remaining tasks using the idle back-end processing core.
[0132] Further, based on the above embodiment, the above remaining task execution unit may include:
[0133] A first non-consistent storage access node determining subunit, configured to determine a first non-consistent storage access node corresponding to each idle back-end processing core when there are multiple idle back-end processing cores;
[0134] A second non-uniform storage access node determination subunit, configured to determine that the backend processing core corresponding to the task requiring the request of an idle backend processing core is the corresponding second non-uniform storage access node;
[0135] a final idle backend processing core determining subunit, configured to determine a backend processing core corresponding to the non-uniform storage access node that is the same as the second non-uniform storage access node as a final idle backend processing core;
[0136] The remaining task execution subunit is used to execute the remaining tasks using the final idle back-end processing core.
[0137] Further, based on any of the above embodiments, the above task scheduling device may further include:
[0138] A front-end blocking task scheduling module, used for scheduling the front-end blocking task to the back-end processing core for execution;
[0139] The interrupt module is used to determine to interrupt the running backend task when there is a running backend task on the backend processing core, and switch the task to the frontend blocking task.
[0140] It should be noted that the order of the modules and units in the above task scheduling device can be changed without affecting the logic.
[0141] Figure 3 The description of the features in the corresponding embodiments can be found in Figure 3 The relevant descriptions of the corresponding embodiments will not be repeated here one by one.
[0142] The task scheduling device provided by the embodiment of the present invention may include: a processing core division module 100, which is used to determine a first preset number of front-end processing cores and a second preset number of back-end processing cores corresponding to each non-uniform storage access node; wherein the first preset number is greater than the second preset number, the front-end processing core is a core for processing front-end tasks, and the back-end processing core is a core for processing back-end tasks and front-end blocking tasks; the front-end blocking task is a task whose execution time of the front-end task exceeds a preset running time threshold; a processing thread determination module 200, which is used to determine the processing threads corresponding to the back-end task and the front-end task respectively; a thread and processing core association module 300, which is used to determine the front-end processing core or the back-end processing core associated with each processing thread, and when the task in the processing thread needs to be executed, the associated front-end processing core or the back-end processing core is used to process the task on the processing thread; a load balancing module 400, which is used to determine an idle back-end processing core using a load balancing strategy when the number of tasks on any of the back-end processing cores is greater than the maximum preset number of tasks, and use the idle back-end processing core to execute the remaining tasks; wherein the idle back-end processing core is a core whose performance is better than the performance of the back-end processing core corresponding to the task whose number of tasks is greater than the maximum preset number of tasks. Compared with the current storage backend service built with a pipeline multi-threaded model, in which data in an IO task process is transferred and processed between CPU cores of different NUMA nodes, frequent memory access is required, which greatly reduces the effective utilization of the CPU. In addition, too many threads bring the cost of thread switching and thread scheduling, which further reduces the utilization of the CPU and makes the task scheduling time very long. In comparison, the present invention divides the non-consistent storage access nodes into a first preset number of front-end processing cores and a second preset number of back-end processing cores, where the first preset number is greater than the second preset number, so that the front-end processing core can be used to process the front-end tasks, and one task is bound to one thread to reduce thread switching, and a load balancing strategy is used to process tasks whose number of tasks is greater than the maximum preset number of tasks, thereby ensuring efficient advancement of the overall system and efficient CPU scheduling, thereby improving the efficiency of task scheduling.Furthermore, this embodiment determines the task type by the task identifier, so that the front-end task and the back-end task can be accurately distinguished; further, this embodiment determines the front-end task with too long an execution time as a blocking task, which can improve the accuracy of determining the blocking task, thereby improving the accuracy of task scheduling; further, this embodiment determines whether it is a blocking task by the task identifier and the number of task scheduling, so as to prevent the task from being rescheduled when it is detected again, thereby preventing the scheduling time of the task from being calculated incorrectly and the blocking task from being judged incorrectly, thereby improving the accuracy of determining the blocking task, and timely scheduling the blocking task to the back-end processing core for processing, thereby improving the efficiency of task scheduling; further, this embodiment can distribute the load more evenly and maximize the use of all computing resources by dynamically allocating tasks to idle back-end processing cores; further, this embodiment can distribute the load more evenly and maximize the use of all computing resources by dynamically allocating tasks to idle back-end processing cores.
[0143] A task scheduling device provided by an embodiment of the present invention is introduced below. The task scheduling device described below and the task scheduling method described above can be referred to each other.
[0144] Figure 4 A structural diagram of a task scheduling device provided by an embodiment of the present invention is shown in FIG. Figure 4 As shown, the task scheduling device includes: a memory 40 for storing computer programs;
[0145] The processor 41 is used to implement the steps of the task scheduling method in the above embodiment when executing a computer program.
[0146] The task scheduling device provided in this embodiment may include but is not limited to a smart phone, a tablet computer, a laptop computer, or a desktop computer.
[0147] Among them, the processor 41 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 41 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 41 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 41 may be integrated with a graphics processing unit (GPU), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 41 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0148] The memory 40 may include one or more computer-readable storage media, which may be non-transitory. The memory 40 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 40 is at least used to store the following computer program 401, wherein, after the computer program is loaded and executed by the processor 41, it can implement the relevant steps of the task scheduling method disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 40 may also include an operating system 402 and data 403, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 402 may include Windows, Unix, Linux, etc. Data 403 may include but is not limited to task scheduling data, etc.
[0149] In some embodiments, the task scheduling device may further include a display screen 42 , an input / output interface 63 , a communication interface 44 , a power supply 45 , and a communication bus 46 .
[0150] Those skilled in the art will understand that Figure 4 The structure shown in the figure does not constitute a limitation on the task scheduling device, and may include more or fewer components than those shown in the figure.
[0151] It is understandable that if the task scheduling method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the current technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM, magnetic disk or optical disk and other media that can store program codes.
[0152] Based on this, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the task scheduling method described above are implemented.
[0153] The above is a detailed introduction to the task scheduling method provided by the embodiment of the present invention. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0154] The present invention also provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned task scheduling method when executed by a processor.
[0155] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0156] The above is a detailed introduction to a task scheduling method, device, equipment and computer-readable storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
Claims
1. A task scheduling method, characterized in that: include: Determine a first preset number of front-end processing cores and a second preset number of back-end processing cores corresponding to each non-consistent storage access node; wherein the first preset number is greater than the second preset number, the front-end processing core is a core for processing front-end tasks, and the back-end processing core is a core for processing back-end tasks and front-end blocking tasks; the front-end blocking task is a task where the execution time of the front-end task exceeds a preset running time threshold; Determine the processing threads corresponding to the backend tasks and the frontend tasks respectively; Determine the front-end processing core or the back-end processing core associated with each processing thread, and when a task in the processing thread needs to be executed, use the associated front-end processing core or the back-end processing core to process the task on the processing thread; When the number of tasks on any of the backend processing cores is greater than the maximum preset number of tasks, an idle backend processing core is determined using a load balancing strategy, and the idle backend processing core is used to execute the remaining tasks; wherein the idle backend processing core is a core whose performance is better than the performance of the backend processing core corresponding to the tasks whose number of tasks is greater than the maximum preset number of tasks.
2. The task scheduling method according to claim 1, characterized in that: Before determining the processing threads corresponding to the backend tasks and the frontend tasks respectively, it also includes: Determine whether the task is the backend task or the frontend task according to the task identifier; wherein the task identifier includes at least one of the task name, the task source or the task description; wherein the task description is a description for determining whether the technology type used in the task is the frontend technology or the backend technology.
3. The task scheduling method according to claim 1, characterized in that: The process of determining the front-end blocking task includes: Determining the preset running time threshold; When the single execution time of the front-end task is greater than the preset running time threshold, the front-end task is determined as the front-end blocking task.
4. The task scheduling method according to claim 3, characterized in that: When the single execution time of the front-end task is greater than the preset running time threshold, determining the front-end task as the front-end blocking task includes: Acquire a monitoring task on each of the non-consistent storage access nodes; wherein the monitoring task is used to monitor the execution time of the front-end task of the node; the monitoring task is a task executed at the preset running time threshold as the running cycle interval; Determine a task queue and task information corresponding to each task in the task queue by using the monitoring task; wherein the task information includes a task identifier and a task scheduling number, the task scheduling number being the number of scheduling times when a task is scheduled out of a front-end processing core in a non-consistent storage access node due to an interruption and / or waiting for an input / output event result, and then scheduled back to the front-end processing core; When the monitoring task performs monitoring in each execution cycle, the task information obtained by each front-end processing core is compared with the task information saved last time to determine whether the task identifiers are the same; If the task identifiers are not the same, no processing is performed and the new task information is stored; If the task identifiers are the same, determining whether the scheduling times are consistent with the last scheduling times; When it is determined that the scheduling number has changed, determining to store the latest scheduling number; When it is determined that the scheduling number has not changed, it is determined that the execution time of the current front-end task is greater than the preset running time threshold, and the front-end task is determined as the front-end blocking task.
5. The task scheduling method according to any one of claims 1 to 4, characterized in that: When the number of tasks on any of the backend processing cores is greater than the maximum preset number of tasks, an idle backend processing core is determined by using a load balancing strategy, and the idle backend processing core is used to execute the remaining tasks, including: Storing each of the backend tasks in a task queue; When it is determined that the number of tasks in the task queue is greater than the maximum preset number of tasks, determining to send a request for an idle backend processing core; receiving resource utilization rates returned by other backend processing cores according to the request of the idle backend processing core, and determining the idle backend processing core according to the resource utilization rates; The idle back-end processing cores are utilized to execute the remaining tasks.
6. The task scheduling method according to claim 5, characterized in that: The utilizing the idle backend processing core to execute the remaining tasks includes: When there are multiple idle back-end processing cores, determining a first non-uniform storage access node corresponding to each idle back-end processing core; Determining that the backend processing core corresponding to the task that needs to request an idle backend processing core is the corresponding second non-uniform storage access node; Determine a backend processing core corresponding to the non-uniform storage access node that is the same as the second non-uniform storage access node as a final idle backend processing core; The final idle back-end processing core is utilized to execute the remaining tasks.
7. The task scheduling method according to claim 1, characterized in that: After determining the front-end blocking task, it also includes: Dispatching the front-end blocking task to the back-end processing core for execution; When there is a backend task running on the backend processing core, it is determined to interrupt the running backend task and switch the task to the frontend blocking task.
8. A task scheduling device, characterized in that: include: A processing core division module, used to determine a first preset number of front-end processing cores and a second preset number of back-end processing cores corresponding to each non-consistent storage access node; wherein the first preset number is greater than the second preset number, the front-end processing core is a core for processing front-end tasks, and the back-end processing core is a core for processing back-end tasks and front-end blocking tasks; the front-end blocking task is a task where the execution time of the front-end task exceeds a preset running time threshold; A processing thread determination module is used to determine the processing threads corresponding to the backend tasks and the frontend tasks respectively; A thread and processing core association module, used to determine the front-end processing core or the back-end processing core associated with each processing thread, and when a task in a processing thread needs to be executed, use the associated front-end processing core or the back-end processing core to process the task on the processing thread; A load balancing module is used to determine an idle back-end processing core using a load balancing strategy when the number of tasks on any of the back-end processing cores is greater than a maximum preset number of tasks, and use the idle back-end processing core to execute the remaining tasks; wherein the idle back-end processing core is a core whose performance is better than the performance of the back-end processing core corresponding to the tasks whose number of tasks is greater than the maximum preset number of tasks.
9. A task scheduling device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute the computer program to implement the steps of the task scheduling method as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the task scheduling method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Cluster job scheduling method and system
CN119621272A
A cluster job scheduling method and system
CN119621272B
