A task scheduling method, device, and task execution system
Through dynamic priority calculation and non-preemptive control task scheduling methods, the problems of inflexible task scheduling and unbalanced load in the existing technology are solved, and the task execution time optimization and processing efficiency are achieved, reducing the access cost of new business scenarios.
Patent Information
- Application Number
- CN202010202403.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-20
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2040-03-20
AI Technical Summary
The existing task scheduling methods cannot flexibly adapt to the changing business scenario needs of the e-commerce industry, resulting in the inability to achieve load balancing, unreasonable hardware resource utilization, inoptimal task execution time, low processing efficiency, and high access costs for new business scenarios.
By assigning tasks from the same subprocess of different business lines to the same task executor, and calculating dynamic priority based on the priority relative weight ratio of the task, historical execution records and predicted execution time, non-preemptive control and hardware resource scheduling are performed to achieve reasonable allocation and execution of tasks.
It realizes flexibility in task execution order and rules, ensures load balancing and rational utilization of hardware resources, optimizes the overall task execution time, improves processing efficiency, and reduces the access cost of new business scenarios.
Smart Images

Figure CN113495779B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular, to a task scheduling method and apparatus, and a task execution system. Background Art
[0002] Existing task scheduling and execution can only meet a single execution order and execution rule. Such a task scheduling platform designed based on a certain scenario and scale cannot flexibly and dynamically guarantee and respond to the changing business scenario requirements of the e-commerce industry. Existing task allocation mostly adopts static task allocation methods, where tasks can only be fixed to execute on a certain machine, which may lead to heavy computing tasks on some machines, while some machines are always idle, and the hardware resources cannot be reasonably utilized. Because the execution performance and efficiency of each machine are different, and for tasks, the computational complexity of each task's execution is different, resulting in a huge difference in execution time. Such static task allocation methods cannot achieve reasonable allocation, and may also cause some tasks not to be executed and completed on time.
[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:
[0004] It can only meet a single execution order and execution rule, tasks can only be fixed to execute on a certain machine, load balancing cannot be achieved, hardware resources cannot be reasonably utilized, the overall execution duration of tasks cannot be optimized, the processing efficiency is reduced, the task access cost for new business scenarios is high, and it will affect the execution efficiency of the original tasks, and it cannot dynamically adapt to the changing requirements of business scenarios. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a task scheduling method and apparatus, and a task execution system, which can flexibly and reasonably determine the task execution order and execution rule, perform non-preemptive control on tasks to be executed, can schedule tasks according to the busy and idle status of hardware resources, better achieve load balancing, ensure the reasonable utilization of hardware resources, optimize the overall execution duration of tasks, improve the processing efficiency, new business scenario tasks only need to perform some ordinary initialization work, the access cost is low, and the impact on the execution efficiency of the original tasks is small, and it can dynamically adapt to the changing requirements of business scenarios.
[0006] To achieve the above object, according to one aspect of the embodiments of the present invention, a task scheduling method is provided.
[0007] A task scheduling method, comprising: allocating tasks of the same sub-process of different business lines to the same task executor, where the business lines are configured with business line weights; calculating the dynamic priority of a task in its task executor according to the relative weight ratio of the priority of the task, the maximum execution duration of the task in the most recent N historical execution records in its sub-process, the predicted execution duration of the task in its task executor, and a preset first reconciliation factor, N being a positive integer, and the relative weight ratio of the priority of the task being calculated according to the configured business line weights of each business line; scheduling the tasks in each task executor according to the dynamic priority.
[0008] Optionally, calculate the predicted execution duration of the task in its task executor according to the average execution duration of the task in its sub-process, the data volume of the task in this execution, and the average data volume of the task in the most recent N historical execution records in its sub-process.
[0009] Optionally, calculate the predicted execution duration of the task in its task executor in the following manner: obtain the average duration per unit data volume of the task according to the quotient of the average execution duration of the task in its sub-process and the average data volume of the task in the most recent N historical execution records in its sub-process; obtain the predicted execution duration of the task in its task executor according to the product of the average duration per unit data volume of the task and the data volume of the task in this execution.
[0010] Optionally, calculate the average execution duration of the task in its sub-process in the following manner: calculate the weighted average according to the execution durations and respective influence weights of the most recent N historical execution records of the task in its sub-process, and use the weighted average as the average execution duration of the task in its sub-process.
[0011] Optionally, for each historical execution record, calculate the influence weight of the historical execution record according to the data volume size of the historical execution record, the average data volume of the most recent N historical execution records, the number of days between the start time of the historical execution record and the current time, and a preset second reconciliation factor.
[0012] Optionally, the relative weight ratio of the priority of the task is equal to the ratio of the first business line weight to the sum of the configured business line weights of each business line, and the first business line weight is the business line weight of the business line to which the task belongs.
[0013] Optionally, the value of the preset first harmonic factor is greater than 0 and less than 1; the dynamic priority of the task in its task executor is calculated as follows: calculate the first difference between the maximum execution duration of the most recent N historical execution records of the task in its subprocess and the predicted execution duration of the task in its task executor, and use the ratio of the first difference to the maximum execution duration of the most recent N historical execution records of the task in its subprocess as the predicted idle time ratio of the task; use the preset first harmonic factor as the weighting coefficient of the relative weight ratio of the task priority, and use the second difference between 1 and the preset first harmonic factor as the weighting coefficient of the predicted idle time ratio of the task, and calculate the weighted sum of the relative weight ratio of the task priority and the predicted idle time ratio of the task as the dynamic priority of the task in its task executor.
[0014] Optionally, scheduling the tasks in each task executor according to the dynamic priority includes: for each task executor, generating a task queue according to the dynamic priorities of the tasks therein, and sequentially determining the group corresponding to each task in the task queue, where the group corresponds to each computer in the task executor one by one, and scheduling the tasks in the task queue to the corresponding computers according to the group for execution. When determining the group corresponding to each task in the task queue, the sum of the predicted execution durations of the tasks already existing in each group is statistically calculated, and the task is assigned to the group with the smallest sum of the predicted execution durations.
[0015] According to another aspect of the embodiments of the present invention, a task scheduling device is provided.
[0016] A task scheduling device includes: a task allocation module, configured to allocate tasks of the same subprocess of different business lines to the same task executor, where the business line is configured with a business line weight; a dynamic priority calculation module, configured to calculate the dynamic priority of the task in its task executor according to the relative weight ratio of the task priority, the maximum execution duration of the most recent N historical execution records of the task in its subprocess, the predicted execution duration of the task in its task executor, and a preset first harmonic factor, where N is a positive integer, and the relative weight ratio of the task priority is calculated according to the configured business line weights of each; a task scheduling module, configured to schedule the tasks in each task executor according to the dynamic priority.
[0017] Optionally, it further includes a predicted execution duration calculation module, configured to calculate the predicted execution duration of the task in its task executor according to the average execution duration of the task in its subprocess, the data volume of the task in this execution, and the average data volume of the most recent N historical execution records of the task in its subprocess.
[0018] Optionally, the predicted execution duration calculation module is further configured to: obtain the average duration per unit data volume of the task according to the quotient of the average execution duration of the task in its subprocess and the average data volume of the most recent N historical execution records of the task in its subprocess; and obtain the predicted execution duration of the task in its task executor according to the product of the average duration per unit data volume of the task and the data volume of the current execution of the task.
[0019] Optionally, it further includes an average execution duration calculation module, configured to: calculate a weighted average according to the execution durations and respective influence weights of the most recent N historical execution records of the task in its subprocess, and use the weighted average as the average execution duration of the task in its subprocess.
[0020] Optionally, it further includes an influence weight calculation module, configured to: for each historical execution record, calculate the influence weight of the historical execution record according to the data volume size of the historical execution record, the average data volume of the most recent N historical execution records, the number of days between the start time of the historical execution record and the current time, and a preset second harmonic factor.
[0021] Optionally, it further includes a relative priority weight ratio calculation module, configured to obtain the relative priority weight ratio of the task according to the ratio of the first business line weight to the sum of the configured business line weights, where the first business line weight is the business line weight of the business line to which the task belongs.
[0022] Optionally, the value of the preset first harmonic factor is greater than 0 and less than 1; the dynamic priority calculation module is further configured to calculate the dynamic priority of the task in its task executor in the following manner: calculate a first difference between the maximum execution duration of the most recent N historical execution records of the task in its subprocess and the predicted execution duration of the task in its task executor, and use the ratio of the first difference to the maximum execution duration of the most recent N historical execution records of the task in its subprocess as the predicted idle time ratio of the task; use the preset first harmonic factor as the weighting coefficient of the relative priority weight ratio of the task, use the second difference between 1 and the preset first harmonic factor as the weighting coefficient of the predicted idle time ratio of the task, and calculate the weighted sum of the relative priority weight ratio of the task and the predicted idle time ratio of the task as the dynamic priority of the task in its task executor.
[0023] Optionally, the task scheduling module is further configured to: for each of the task executors, generate a task queue according to the dynamic priorities of the tasks therein, and sequentially determine the group corresponding to each task in the task queue, where the groups correspond one by one to the computers in the task executor, and schedule the tasks in the task queue to the corresponding computers according to the groups for execution. Among them, when determining the group corresponding to each task in the task queue, calculate the total predicted execution duration of the tasks that each group currently has, and assign the task to the group with the smallest total predicted execution duration.
[0024] According to another aspect of the embodiments of the present invention, a task execution system is provided.
[0025] A task execution system includes: a task scheduling center processor and one or more task executors, where: the task scheduling center processor is configured to assign tasks of the same sub-process of different business lines to the same task executor, and the business line is configured with a business line weight; calculate the dynamic priority of the task in its task executor according to the relative weight ratio of the task priority, the maximum execution duration of the task in the most recent N historical execution records in its sub-process, the predicted execution duration of the task in its task executor, and a preset first harmonic factor, where N is a positive integer, and the relative weight ratio of the task priority is calculated according to the configured business line weights of each; schedule the tasks in each task executor according to the dynamic priority; the task executor is configured to: execute the tasks scheduled by the task scheduling center processor.
[0026] According to another aspect of the embodiments of the present invention, an electronic device is provided.
[0027] An electronic device includes: one or more processors; a memory for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the task scheduling method provided by the embodiments of the present invention.
[0028] According to another aspect of the embodiments of the present invention, a computer-readable medium is provided.
[0029] A computer-readable medium has a computer program stored thereon, and when the program is executed by a processor, the task scheduling method provided by the embodiments of the present invention is implemented.
[0030] One embodiment of the above invention has the following advantages or beneficial effects: The tasks of the same sub-process in different business lines are assigned to the same task executor. According to the relative weight ratio of the task priorities, the maximum execution duration of the task in the last N historical execution records in its sub-process, the predicted execution duration of the task in its task executor, and a preset first reconciliation factor, the dynamic priority of the task in its task executor is calculated. For each task executor, a task queue is generated according to the dynamic priorities of the tasks therein, and the grouping corresponding to the task is determined in sequence. When determining the grouping corresponding to the task, the task is assigned to the grouping with the smallest total predicted execution duration, and is executed by the computer corresponding to the grouping. It can flexibly and reasonably determine the task execution order and execution rules, perform non-preemptive control on the tasks to be executed, schedule tasks according to the busy and idle status of the hardware resources, better achieve load balancing, ensure the reasonable utilization of the hardware resources, optimize the overall task execution duration, improve the processing efficiency, the tasks in the new business scenarios only need to perform some ordinary initialization work, the access cost is low, and the impact on the execution efficiency of the original tasks is small, dynamically adapting to the changing requirements of the business scenarios.
[0031] The further effects of the above non-conventional optional methods will be described below in combination with specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The drawings are used to better understand the present invention and do not constitute an improper limitation to the present invention. Among them:
[0033] Figure 1 is a schematic diagram of the main steps of a task scheduling method according to an embodiment of the present invention;
[0034] Figure 2 is a schematic diagram of the task execution principle according to an embodiment of the present invention;
[0035] Figure 3 is a schematic diagram of the structure of a task execution record table according to an embodiment of the present invention;
[0036] FIG. 4(a) and FIG. 4(b) are schematic diagrams of the historical execution records of tasks according to an embodiment of the present invention;
[0037] Figure 5 is a schematic diagram of a business line configuration table according to an embodiment of the present invention;
[0038] Figure 6 is an application schematic diagram of task scheduling according to an embodiment of the present invention;
[0039] Figure 7 is a schematic diagram of the main modules of a task scheduling device according to an embodiment of the present invention;
[0040] Figure 8 is an exemplary system architecture diagram to which embodiments of the present invention can be applied;
[0041] Figure 9 is a schematic structural diagram of a computer system of a terminal device or a server suitable for implementing embodiments of the present invention. Detailed implementation manners
[0042] The following describes exemplary embodiments of the present invention with reference to the accompanying drawings. Various details of the embodiments of the present invention are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, descriptions of well-known functions and structures are omitted below for clarity and conciseness.
[0043] Figure 1 is a schematic diagram of the main steps of a task scheduling method according to an embodiment of the present invention.
[0044] As Figure 1 shown, the task scheduling method of an embodiment of the present invention mainly includes the following steps S101 to S103.
[0045] Step S101: Assign tasks of the same sub-process of different business lines to the same task executor, and each business line is configured with a business line weight.
[0046] Step S102: Calculate the dynamic priority of a task in its task executor according to the relative weight ratio of the task's priority, the maximum execution duration of the task in its sub-process in the most recent N historical execution records, the predicted execution duration of the task in its task executor, and a preset first reconciliation factor. The relative weight ratio of the task's priority is calculated based on the configured weights of each business line; N is a positive integer.
[0047] Step S103: Schedule tasks in each task executor according to the dynamic priority.
[0048] A business line can have multiple sub-processes. Tasks of multiple sub-processes are assigned to different task executors for execution, and tasks of the same sub-process of different business lines are assigned to the same task executor. That is, the tasks in one task executor are tasks of a certain sub-process of different business lines, and the number of tasks in one task executor is the same as the number of business lines. There are multiple computers in one task executor for concurrently executing tasks. The computers can be physical machines or virtual machines.
[0049] The predicted execution duration of a task in its task executor can be calculated according to the average execution duration of the task in its sub-process, the amount of data of the task in this execution, and the average amount of data of the task in the most recent N historical execution records in its sub-process.
[0050] Specifically, the predicted execution duration of a task in its task executor can be calculated in the following way: Obtain the average duration per unit data volume of the task by taking the quotient of the average execution duration of the task in its subprocess and the average data volume of the most recent N historical execution records of the task in its subprocess; obtain the predicted execution duration of the task in its task executor by multiplying the average duration per unit data volume of the task by the data volume of the current execution of the task.
[0051] The average execution duration of a task in its subprocess can be calculated in the following way: Calculate the weighted average based on the execution durations and respective impact weights of the most recent N historical execution records of the task in its subprocess, and use this weighted average as the average execution duration of the task in its subprocess.
[0052] For each historical execution record, calculate the impact weight of the current historical execution record based on the data volume size of the current historical execution record, the average data volume of the most recent N historical execution records, the number of days between the start time of the current historical execution record and the current time, and a preset second harmonic factor.
[0053] The value range of the preset second harmonic factor is in the interval (0, 1). The specific method for calculating the impact weight of the current historical execution record will be introduced in detail below.
[0054] The relative weight ratio of the task priority is equal to the ratio of the weight of the first business line to the sum of the weights of all configured business lines, where the weight of the first business line is the business line weight of the business line to which the task belongs.
[0055] The value of the preset first harmonic factor is greater than 0 and less than 1.
[0056] Specifically, the dynamic priority of a task in its task executor can be calculated in the following way: Calculate the first difference between the maximum execution duration of the most recent N historical execution records of the task in its subprocess and the predicted execution duration of the task in its task executor, and use the ratio of this first difference to the maximum execution duration of the most recent N historical execution records of the task in its subprocess as the predicted idle time ratio of the task; use the preset first harmonic factor as the weighting coefficient of the relative weight ratio of the task priority, and use the second difference between 1 and the preset first harmonic factor as the weighting coefficient of the predicted idle time ratio of the task, and calculate the weighted sum of the relative weight ratio of the task priority and the predicted idle time ratio of the task as the dynamic priority of the task in its task executor.
[0057] In one embodiment, scheduling tasks in each task executor according to the dynamic priority includes: for each task executor, generating a task queue according to the dynamic priorities of the tasks therein, and sequentially scheduling the tasks in the task queue to each computer of the task executor.
[0058] In another embodiment, tasks in each task executor are scheduled according to dynamic priorities, including: for each task executor, generating a task queue according to the dynamic priorities of the tasks therein, and sequentially determining the group corresponding to each task in the task queue. The groups correspond one by one to the computers in the task executor. The tasks in the task queue are scheduled to the corresponding computers for execution according to the groups. When determining the group corresponding to each task in the task queue, the total predicted execution duration of the tasks already existing in each group is statistically calculated, and the task is assigned to the group with the smallest total predicted execution duration. For example, assume there are two machines (i.e., computers): Machine 1 and Machine 2, and three tasks A, B, and C. Task A takes 30 minutes to execute, task B takes 20 minutes to execute, and task C takes 10 minutes to execute. Assume the order of the tasks in the task queue is A, B, C. Then according to the embodiment of the present invention, task A is assigned to Machine 1, task B is assigned to Machine 2, and task C is also assigned to Machine 2. The total task execution time of the two machines is statistically calculated as 30 minutes as a whole, thereby realizing scheduling tasks according to the busy and idle conditions of the hardware resources, better achieving load balancing, ensuring the reasonable utilization of the hardware resources, optimizing the overall task execution duration, and improving the processing efficiency.
[0059] Figure 2 It is a schematic diagram of the task execution principle according to an embodiment of the present invention.
[0060] As Figure 2 shown, an embodiment of the present invention is provided with a task scheduling center processor (abbreviated as task scheduling center), denoted as Job_dataCenter, and a plurality of task executors, denoted as: multi_Job_Performer i |i = 1, 2,......, n, where n is the number of sub-processes, and each sub-process corresponds one by one to a task executor. There are multiple computers (i.e., Figure 2 physical machines in) in each task executor to concurrently execute tasks. The tasks concurrently executed in the i-th task executor are denoted as: multi_Job_Performer i -sub_job j |j = 1, 2,......, m, where m is the number of concurrent threads in the i-th task executor. The task scheduling center maintains a task queue for each task executor. The task k in the task queue of the i-th task executor is denoted as:
[0061] multi_Job_Performer i -task k|k = 1, 2,......, p, where p is the number of tasks in the i-th task executor. The number of tasks in the task queue of each task executor should be the same and equal to the number of business lines connected.
[0062] Taking the e-commerce scenario as an example, assume there are multiple business lines, and each business line needs to execute the calculation tasks of user and commodity information in its own business scenario. Each business line has multiple sub-processes, and the task types of each sub-process are different. The tasks in the same task executor are tasks from the same sub-process of different business lines. For example, the tasks of two sub-processes of a certain business line A are sales data calculation task and promotion data calculation task respectively. For the tasks of these two sub-processes, if there are corresponding task executors currently, that is, there are already two task executors respectively used to execute the sales data calculation tasks and promotion data calculation tasks of each business line, then the sales data calculation task and promotion data calculation task of this business line A are executed by the corresponding task executors respectively. If there is no corresponding task executor for the task of a certain sub-process currently, then the task is assigned to an idle task executor (a task executor that has not executed any sub-process tasks) for execution.
[0063] For the tasks of the new business scenario in the embodiments of the present invention, such as the tasks of a newly added business line, only some ordinary initialization work needs to be carried out, with low access cost and little impact on the execution efficiency of the original tasks, dynamically adapting to the changing requirements of the business scenario.
[0064] For the task k in each task executor i in the embodiments of the present invention:
[0065] multi_Job_Performer i -task k |k = 1, 2,......, p, p is the number of tasks in the i-th task executor, calculate the following five-tuple information:
[0066] multi_Job_Performer i -task k
[0067]
[0068] In the five-tuple information:
[0069] avg_time ik represents the average execution duration of task k in its sub-process i (since the sub-process and the task executor are in one-to-one correspondence, so task executor i corresponds to sub-process i). This value can be calculated using the execution record table of task k, and the specific calculation method will be introduced in detail below.
[0070] Represents the relative weight ratio of the priority of task k, calculated based on the weights weight of each business line configured in the business line configuration table. i (i ∈ [1, p]), where p is the number of tasks in the i-th task executor. Since the tasks in a task executor are tasks of different business lines, the number of tasks in a task executor also represents the number of business lines. Each business line is configured with its own business line weight, so p also represents the number of configured business line weights.
[0071] data_size k Represents the data volume of task k in this execution. This value changes in the following two cases: one is when the first task executor is executed for the first time; the other is when manually configured. Usually, the above two cases only occur in the sub-process of the first task executor. Therefore, the sub-process tasks in the first task executor will write information such as the data volume size and the execution start time into the task execution record table after the calculation is completed. In subsequent sub-processes, or in the first sub-process when there is no configuration change, the data volume size is taken from the upper-level sub-process or the last sub-process of the previous execution, without having to recalculate. For example, taking a business line with two sub-processes as an example, when configuring the data volume of the tasks in the task executor for the first time when the first task executor is executed for the first time, the second task executor executes the tasks of the next-level sub-process of the sub-process of the first task executor. Without manually configuring the data volume, the data volume is taken from the data volume of the tasks in the sub-process of the first task executor. When the tasks in the first task executor are executed for the second time, without manually configuring the data volume, the data volume is taken from the data volume size of the last sub-process of the previous execution, that is, the data volume of the tasks in the second task executor executed for the first time. If the data volume configuration in the business line configuration table is manually modified, the manually configured data volume is taken.
[0072] The task execution record table records the execution duration of the task after the task is completed, providing a reference for subsequent dynamic priority calculation. Figure 3 Is a schematic structural diagram of the task execution record table according to an embodiment of the present invention, which records the task start time (work_start_tm), task end time (work_end_tm), the data volume data_size of the task each time it is executed, etc. The task execution record table also includes the execution duration work_cal_sec of each historical execution record of the task in its sub-processes ( Figure 3 not shown).
[0073] dyn_priority ik Represents the dynamic priority of task k in its task executor i.
[0074] forecast_timeik Indicates the predicted execution duration of task k in its task executor i.
[0075] An embodiment of the present invention proposes a dynamic priority algorithm for concurrent execution of multiple tasks. The above-mentioned avg_time is calculated by the dynamic priority algorithm of the embodiment of the present invention. ik 、 data_size k 、forecast_time ik And based on the above four items calculated, the dynamic priority dyn_priority of task k in its task executor i is calculated. ik Tasks in each task executor are scheduled according to the dynamic priority, so as to execute tasks in the task executor. The dynamic priority algorithm of the embodiment of the present invention is introduced in detail below.
[0076] avg_time ik Indicates the average execution duration of task k in its subprocess i. Since the task scheduling in the embodiment of the present invention is non-preemptive, the execution duration of task k in its subprocess i is only related to the calculation difficulty, computing resources, and the amount of data to be calculated. Since the comparison of the dynamic priorities of tasks in the embodiment of the present invention only exists in the same subprocess, and the calculation difficulties of tasks on all business lines in the same subprocess are the same. Assuming that the computing resources of the cluster where the task is located remain unchanged every time a task is executed, then the current execution duration of task k in its subprocess is only related to the amount of data data_size k of this execution of task k.
[0077] Define w_his i as the influence weight of the i-th historical execution record in the most recent N historical execution records of the task in its subprocess. Since the older the execution record, the less reference value it has. w_his i is calculated related to the amount of data, but it is not that the larger the amount of data, the more reference value it has. Instead, the historical data closer to the average amount of data has more reference value. The calculation formula of w_his i can be expressed in the following form:
[0078]
[0079] Where i is the serial number for sorting the most recent N historical execution records, and i takes values in the interval [1, N]. data_size i is the amount of data size of the i-th historical execution record in the most recent N historical execution records, is the average amount of data in the most recent N historical execution records, dis_days iis the number of days between the start time of the \(i\)-th historical execution record among the most recent \(N\) historical execution records and the current time, and \(\beta\) is the harmonic factor (i.e., the second harmonic factor). Taking \(N = 10\) as an example, i.e., \(w_{his}\) i | \(i = 1, 2,\cdots, 10\),
[0080] Assume that the task has a total of \(u\) historical execution records in its subprocess, and the historical execution records are arranged in chronological order. Then, take the most recent 10 historical execution records, that is: take 10 historical execution records with the historical execution record numbers \(r\in[u - 9, u]\). Then, express \(i\) in \(w_{his}\) i in terms of the historical execution record number \(r\), and the above formula can also be expressed in the following form:
[0081]
[0082] where \(w_{his}\) r is the influence weight of the \(r\)-th historical execution record among all the historical execution records of the task in its subprocess; \(data\_size\) r is the data volume size of the \(r\)-th historical execution record, that is, the data volume when the task is executed for the \(r\)-th time in its subprocess. When there is no data volume, this value \(= 0\); is the average data volume of a total of 10 historical execution records from the \((u - 9)\)-th to the \(u\)-th; \(dis\_days\) r is the number of days between the start time of the \(r\)-th historical execution record and the current time; \(\beta\) has the same meaning as in the above formula.
[0083] As a harmonic factor, \(0\lt\beta\lt1\), \(\beta\) is used to reconcile the influence of the data volume size and the number of days between the historical execution record and the current day on the weight. In the embodiment of the present invention, \(\beta = 0.8\), that is, the deviation of the data volume has a greater impact on the weight. The greater the deviation (the deviation of the data volume refers to the gap between the data volume size of this task and the average data volume size of the most recent 10 data volumes of this task), the smaller the weight, and the smaller the impact of this execution record on the calculation of the overall average execution duration.
[0084] According to the execution duration of each of the most recent \(N\) historical execution records of the task in its subprocess and the influence weight of each historical execution record among the most recent \(N\) historical execution records, a weighted average value is calculated as the average execution duration of the task in its subprocess. For example, setting \(N = 10\), the average execution duration \(avg\_time\) of task \(k\) in its subprocess \(i\) ik can be calculated by the following formula:
[0085]
[0086] That is, the weighted average calculated based on the impact weight and execution duration of the most recent 10 execution history records of task k is used as the average execution duration of task k in subprocess i, where time r is the execution duration (in seconds) of the r-th historical execution record of task k in subprocess i, w_his r is the impact weight of the r-th historical execution record of task k in its subprocess i, and u is the total number of historical execution records of task k in subprocess i.
[0087] The following is an example to introduce the average execution duration avg_time of task k in its subprocess i ik . Through the task execution record table, the recorded task id, subprocess number workflow_id, the number of days between the start time of the historical execution record and the current time dis_days, etc. can also be obtained. As shown in Figures 4(a) and 4(b), they are schematic diagrams of the historical execution records of the task. Among them, Figure 4(a) shows the most recent 4 historical execution records of the task with task id = 1 and subprocess number workflow_id = 1, and Figure 4(b) shows the most recent 4 historical execution records of the task with task id = 2 and subprocess number workflow_id = 1. In Figures 4(a) and 4(b), work_cal_sec represents the execution duration of each historical execution record of the task in its subprocess.
[0088] According to the calculation formula of the impact weight w_his i of the i-th historical execution record in the most recent N historical execution records of the task in its subprocess 1 , calculate w_his
[0089]
[0090] As shown in Figure 4(a), data_size 1 = 12, the average data volume of the most recent four historical execution records dis_days 1 = 2, set β = 0.8, and substitute them into the calculation formula of w_his 1 respectively, and get:
[0091]
[0092]
[0093]
[0094]
[0095] Thus, calculate the average execution duration of the task with task ID 1 in its subprocess (subprocess number is 1):
[0096]
[0097] Similarly, the average execution duration of the task with task ID 2 in its subprocess (subprocess number is 1) can be calculated:
[0098]
[0099] Read the pre-configured business line weight weight from the business line configuration table i (i ∈ [1, p]), where p is the number of tasks in the i-th task executor and also the number of business line weights. The relative weight ratio of the priority of task k can be calculated by the following formula
[0100]
[0101] Relative weight ratio of priority The value range of is in the interval (0, 1). The smaller the relative weight ratio of priority , the lower the priority of task k. Figure 5 is a schematic diagram of the business line configuration table according to an embodiment of the present invention, as Figure 5 shown. The two business line weights are respectively configured as 9 and 1. According to the above formula, the relative weight ratios of the priorities of the tasks of the two business lines can be calculated respectively.
[0102] Read the size of the data of the configured task from the business line configuration table. By the configured modification time, it can be known whether the data volume has been modified compared with the last time. For example Figure 5 in the configured data volume of the task of business line 1 is 20, and the data volume of the task of business line 2 is 8. The configuration time create_time is the same as the modification time modify_time, indicating that the data volume has not been modified. Then the data volumes of the tasks executed this time are data_size 1 = 20, data_size 2 = 8.
[0103] For task k, the average execution duration avg_time of task k in its subprocess i can be obtained through the above method ik , the relative weight ratio of priority the data volume data_size executed this time k ,
[0104] Next, calculate the predicted execution duration forecast_time of task k in its task executor i ik, forecast_time ik It is related to the average execution duration of task k in its subprocess, the data volume of this execution, and the data volumes of the most recent N historical execution records. Taking N = 10 as an example, forecast_time ik Specifically, it can be calculated by the following formula:
[0105]
[0106] Among them, assuming that task k has u historical execution records in its subprocess, and the historical execution records are arranged in chronological order, then the most recent N = 10 historical execution records are taken, that is: take 10 historical execution records with the historical execution record numbers in the interval r ∈ [u - 9, u].
[0107] represents the average data volume of the most recent 10 historical execution records, and the average execution duration avg_time of task k in its subprocess ik and the quotient of this average data volume is the average duration per unit data volume of task k. Then multiply it by the data volume data_size of this execution k , that is, the predicted execution duration forecast_time of task k in its task executor i is obtained ik .
[0108] Based on the avg_time of task 1 calculated above 11 = 2267.2,
[0109] the avg_time of task 2 12 = 1605.8. Assuming that the data volumes of the two tasks are respectively
[0110] data_size 1 = 20, data_size 2 = 8,
[0111] the above-mentioned average data volume corresponding to task 1 the above-mentioned average data volume corresponding to task 2 Then through the above formula for forecast_time ik , the forecast_time can be calculated 11 = 2267.2×20÷16 = 2834; forecast_time 12 = 1605.8×8÷8 = 1605.8.
[0112] According to the relative weight ratio of the priority of task k The maximum execution duration max(time r=u-N-1 , u) of the most recent N historical executions of task k in its subprocess i, the predicted execution duration forecast_time of task k in its task executor i ik , and the reconciliation factor are used to calculate the dynamic priority dyn_priority of the task in its task executor ik . Taking N = 10 as an example, the calculation formula of dyn_priority ik is as follows:
[0113]
[0114] Among them, max(time r=u-9,u ) is the maximum execution duration of the most recent 10 historical executions of task k in its subprocess i. max(time r=u-9,u ) represents selecting the maximum execution duration among these 10 execution durations starting from time r=u-9 until time r=u .
[0115] can be called the predicted proportion of idle time. This value ranges in the interval (0, 1). The shorter the predicted execution time of the task and the larger the proportion of idle time, the higher the priority of the task should be. Among them is the reconciliation factor, whose value range is in the interval (0, 1). In the embodiments of the present invention, preferably , usually when all tasks are completed earliest.
[0116] Figure 6 is a schematic diagram of the application of task scheduling according to an embodiment of the present invention.
[0117] As Figure 6 shown, there are n business lines in total. Each business line has its own subset of products, and the subset of products is obtained by filtering the products in the total product pool according to the filtering conditions of each business line. The business line product pool is instantiated, the business line product pool tag set, and the business line tag set are pushed to each subprocess corresponding to the business line in the application database and respectively correspond to each task executor. There are dependency relationships between the subprocesses. The task execution result output by the business line product pool instantiation subprocess is used as the input of the next subprocess of the same business line, that is, the business line product pool tag set subprocess. The task execution result of the business line product pool tag set subprocess is then used as the input of its next process, that is, the business line tag set pushed to the application database subprocess.
[0118] The task scheduling center monitors and groups tasks in various execution states through a core task, assigns task executors to tasks according to the sub-processes corresponding to the tasks, and there are multiple computers in each task executor that execute concurrently. These computers select and execute tasks corresponding to their own groups from the task queues of the task executors they belong to. When grouping, the tasks are assigned to the group with the smallest total predicted execution duration, so that each task is assigned to the machine (computer) with the shortest overall execution time of the currently executing tasks.
[0119] Due to the different amounts of basic data, even the same calculation logic will result in different execution durations of tasks. The task scheduling center is responsible for managing the list of tasks to be executed. It predicts the execution duration of tasks based on the historical execution records of tasks in the task execution record table of the business line, and makes assignments according to these execution durations. The task execution record table includes the size of the basic data, the execution date, and the execution duration of the current execution. For most computing tasks, the amount of basic data has an obvious impact on the overall execution duration of the task. The larger the amount of basic data of a task, the longer the execution time. In this embodiment, the task scheduling algorithm, that is, the dynamic priority algorithm, is used to calculate the dynamic priority of the task. The dynamic priority algorithm has been introduced in detail above and will not be elaborated here. The task scheduling center arranges, groups, and schedules tasks according to the execution performance, execution duration, dynamic priority, etc. of the tasks to be executed, improving the processing efficiency and better achieving load balancing.
[0120] Figure 7 It is a schematic diagram of the main modules of a task scheduling device according to an embodiment of the present invention.
[0121] As Figure 7 shown, the task scheduling device 700 according to an embodiment of the present invention mainly includes a task assignment module 701, a dynamic priority calculation module 702, and a task scheduling module 703.
[0122] The task assignment module 701 is used to assign tasks of the same sub-process of different business lines to the same task executor, and the business line is configured with a business line weight.
[0123] The dynamic priority calculation module 702 is used to calculate the dynamic priority of a task in its task executor according to the relative weight ratio of the task's priority, the maximum execution duration of the task in the most recent N historical execution records in its sub-process, the predicted execution duration of the task in its task executor, and a preset first harmonic factor. N is a positive integer, and the relative weight ratio of the task's priority is calculated according to the configured weights of each business line.
[0124] The task scheduling module 703 is used to schedule tasks in each task executor according to the dynamic priority.
[0125] The task scheduling device 700 further includes a predicted execution duration calculation module, which is used to: calculate the predicted execution duration of a task in its task executor according to the average execution duration of the task in its sub-processes, the data volume of the current execution of the task, and the average data volume of the task in the most recent N historical execution records in its sub-processes.
[0126] Specifically, the predicted execution duration calculation module may be used to: obtain the average duration per unit data volume of the task according to the quotient of the average execution duration of the task in its sub-processes and the average data volume of the task in the most recent N historical execution records in its sub-processes; obtain the predicted execution duration of the task in its task executor according to the product of the average duration per unit data volume of the task and the data volume of the current execution of the task.
[0127] The task scheduling device 700 may further include an average execution duration calculation module, which is used to: calculate a weighted average according to the execution durations and respective influence weights of the most recent N historical execution records of the task in its sub-processes, and use the weighted average as the average execution duration of the task in its sub-processes.
[0128] The task scheduling device 700 may further include an influence weight calculation module, which is used to: for each historical execution record, calculate the influence weight of the current historical execution record according to the data volume size of the current historical execution record, the average data volume of the most recent N historical execution records, the number of days between the start time of the current historical execution record and the current time, and a preset second harmonic factor.
[0129] The task scheduling device 700 may further include a relative weight ratio of priority calculation module, which is used to obtain the relative weight ratio of the priority of the task according to the ratio of the weight of the first service line to the sum of the weights of each configured service line, where the weight of the first service line is the service line weight of the service line to which the task belongs.
[0130] The value of the preset first harmonic factor is greater than 0 and less than 1.
[0131] Specifically, the dynamic priority calculation module 702 is used to calculate the dynamic priority of a task in its task executor in the following manner: calculate a first difference between the maximum execution duration of the task in the most recent N historical execution records in its sub-processes and the predicted execution duration of the task in its task executor, and use the ratio of the first difference to the maximum execution duration of the task in the most recent N historical execution records in its sub-processes as the predicted idle time ratio of the task; use the preset first harmonic factor as the weighting coefficient of the relative weight ratio of the priority of the task, and use the second difference between 1 and the preset first harmonic factor as the weighting coefficient of the predicted idle time ratio of the task, and calculate the weighted sum of the relative weight ratio of the priority of the task and the predicted idle time ratio of the task as the dynamic priority of the task in its task executor.
[0132] The task scheduling module 703 can specifically be used for: for each task executor, generating a task queue according to the dynamic priorities of the tasks therein, and sequentially determining the group corresponding to each task in the task queue, where the groups correspond one by one to the computers in the task executor, and scheduling the tasks in the task queue to the corresponding computers according to the groups for execution. Among them, when determining the group corresponding to each task in the task queue, the total predicted execution duration of the tasks already existing in each group is statistically calculated, and the task is assigned to the group with the smallest total predicted execution duration.
[0133] In addition, the specific implementation content of the task scheduling device in the embodiments of the present invention has been described in detail in the above-mentioned task scheduling method, so the repeated content will not be described herein again.
[0134] In addition, an embodiment of the present invention further provides a task execution system, which mainly includes: a task scheduling center processor and one or more task executors. Among them:
[0135] The task scheduling center processor is abbreviated as the task scheduling center, which implements the functions in the above-mentioned task scheduling device 700. Specifically, the task scheduling center processor is used to allocate the tasks of the same sub-process of different business lines to the same task executor, and the business line is configured with a business line weight; according to the relative weight ratio of the task priority, the maximum execution duration of the task in the most recent N historical execution records in its sub-process, the predicted execution duration of the task in its task executor, and a preset first harmonic factor, calculate the dynamic priority of the task in its task executor, where N is a positive integer, and the relative weight ratio of the task priority is calculated according to the configured weights of each business line; schedule the tasks in each task executor according to the dynamic priority.
[0136] The task executor is used to execute the tasks scheduled by the task scheduling center processor.
[0137] The task execution principle of the task execution system in an embodiment of the present invention, as well as the task scheduling center processor and the task executor, can specifically also refer to the detailed introduction of the Figure 2 embodiment above.
[0138] Figure 8 An exemplary system architecture 800 to which the task scheduling method or the task scheduling device of the embodiments of the present invention can be applied is shown.
[0139] As Figure 8 shown, the system architecture 800 may include terminal devices 801, 802, 803, a network 804, and a server 805. The network 804 is used to provide a medium for a communication link between the terminal devices 801, 802, 803 and the server 805. The network 804 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0140] Users can use terminal devices 801, 802, and 803 to interact with server 805 via network 804 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 801, 802, and 803, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (for example only).
[0141] Terminal devices 801, 802, and 803 can be various electronic devices with a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop computers, desktop computers, and so on.
[0142] Server 805 can be a server that provides various services, such as a background management server that supports shopping websites browsed by users using terminal devices 801, 802, and 803 (for example only). The background management server can analyze and process data such as product information query requests received, and feedback the processing results (such as target push information, product information - for example only) to the terminal device.
[0143] It should be noted that the task scheduling method provided by the embodiments of the present invention is generally executed by server 805. Correspondingly, the task scheduling device is generally set in server 805.
[0144] It should be understood that Figure 8 the numbers of terminal devices, networks, and servers in
[0145] are merely illustrative. According to actual needs, there can be any number of terminal devices, networks, and servers. Figure 9 is a schematic structural diagram of a computer system 900 of a terminal device or a server suitable for implementing the embodiments of the present application. Figure 9 The terminal device or server shown is merely an example and should not impose any limitations on the functions and usage scope of the embodiments of the present application.
[0146] As Figure 9 shown, computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 902 or the program loaded from the storage section 908 into the random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of system 900 are also stored. The CPU 901, ROM 902, and RAM 903 are connected to each other via a bus 904. The input / output (I / O) interface 905 is also connected to the bus 904.
[0147] The following components are connected to the I / O interface 905: an input section 906 including a keyboard, a mouse, etc.; an output section 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN card, a modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as required. A removable medium 911 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is installed on the drive 910 as required so that a computer program read therefrom is installed into the storage section 908 as required.
[0148] Specifically, according to the embodiments disclosed in the present invention, the process described above with reference to the main step schematic diagram can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program codes for performing the method shown in the main step schematic diagram. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 909, and / or installed from the removable medium 911. When the computer program is executed by a central processing unit (CPU) 901, the above functions defined in the system of the present application are executed.
[0149] It should be noted that the computer-readable medium shown in the present invention can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of a computer-readable storage medium can include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present application, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0150] The schematic diagrams of the main steps and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the schematic diagram of the main steps or block diagram can represent a module, a program segment, or a part of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks can occur in a different order than that marked in the accompanying drawings. For example, two consecutively shown blocks can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or schematic diagram of the main steps, as well as the combination of blocks in the block diagram or schematic diagram of the main steps, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0151] The modules involved in the embodiments of the present invention can be implemented in software or in hardware. The described modules can also be provided in a processor. For example, it can be described as: a processor includes a task allocation module, a dynamic priority calculation module, and a task scheduling module. Among them, the names of these modules do not constitute a limitation to the module itself in some cases. For example, the task allocation module can also be described as "a module for allocating tasks of the same sub-process of different business lines to the same task executor".
[0152] As another aspect, the present invention also provides a computer-readable medium. The computer-readable medium can be included in the device described in the above embodiments; or it can exist alone without being assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by a device, the device includes: allocating tasks of the same sub-process of different business lines to the same task executor, where the business lines are configured with business line weights; calculating the dynamic priority of a task in its task executor according to the relative weight ratio of the priority of the task, the maximum execution duration of the task in the most recent N historical execution records in its sub-process, the predicted execution duration of the task in its task executor, and a preset first harmonic factor, where the relative weight ratio of the priority of the task is calculated according to the configured business line weights of each; scheduling tasks in each task executor according to the dynamic priority.
[0153] According to the technical solution of the embodiments of the present invention, tasks of the same sub-process of different business lines are allocated to the same task executor. According to the relative weight ratio of the priority of the task, the maximum execution duration of the task in the most recent N historical execution records in its sub-process, the predicted execution duration of the task in its task executor, and a preset first harmonic factor, the dynamic priority of the task in its task executor is calculated. For each task executor, a task queue is generated according to the dynamic priority of the tasks therein and the corresponding grouping of the tasks is determined in sequence. When determining the corresponding grouping of the tasks, the task is assigned to the group with the smallest total predicted execution duration for execution by the computer corresponding to the group. It can flexibly and reasonably determine the task execution order and execution rules, perform non-preemptive control on the tasks to be executed, schedule tasks according to the busy and idle status of the hardware resources, better achieve load balancing, ensure the reasonable utilization of hardware resources, optimize the overall execution duration of tasks, improve processing efficiency, and for the tasks in the new business scenario, only some ordinary initialization work needs to be done, with low access cost and little impact on the execution efficiency of the original tasks, dynamically adapting to the changing requirements of the business scenario.
[0154] The above specific embodiments do not constitute a limitation to the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A task scheduling method, characterized in that, it includes: allocating tasks of the same sub-process of different business lines to the same task executor, where the business lines are configured with business line weights; calculating the dynamic priority of the task in its task executor according to the relative weight ratio of the priority of the task, the maximum execution duration of the task in the most recent N historical execution records in its sub-process, the predicted execution duration of the task in its task executor, and a preset first adjustment factor, N is a positive integer, and the relative weight ratio of the priority of the task is calculated according to the configured business line weights of each; scheduling the tasks in each task executor according to the dynamic priority.
2. The method according to claim 1, characterized in that, calculating the predicted execution duration of the task in its task executor according to the average execution duration of the task in its sub-process, the amount of data executed by the task this time, and the average amount of data in the most recent N historical execution records of the task in its sub-process.
3. The method according to claim 2, characterized in that, the predicted execution duration of the task in its task executor is calculated in the following way: obtaining the average duration per unit data amount of the task according to the quotient of the average execution duration of the task in its sub-process and the average amount of data in the most recent N historical execution records of the task in its sub-process; obtaining the predicted execution duration of the task in its task executor according to the product of the average duration per unit data amount of the task and the amount of data executed by the task this time.
4. The method according to claim 2, characterized in that, the average execution duration of the task in its sub-process is calculated in the following way: calculating the weighted average according to the execution durations and respective influence weights of each of the most recent N historical execution records of the task in its sub-process, and taking the weighted average as the average execution duration of the task in its sub-process.
5. The method according to claim 4, characterized in that, for each historical execution record, calculating the influence weight of the historical execution record according to the amount of data of the current historical execution record, the average amount of data of the most recent N historical execution records, the number of days from the start time of the current historical execution record to the present, and a preset second adjustment factor.
6. The method according to claim 1, characterized in that, the value of the preset first adjustment factor is greater than 0 and less than 1; the dynamic priority of the task in its task executor is calculated in the following way: calculating the first difference between the maximum execution duration of the task in the most recent N historical execution records in its sub-process and the predicted execution duration of the task in its task executor, and taking the ratio of the first difference to the maximum execution duration of the task in the most recent N historical execution records in its sub-process as the predicted idle time ratio of the task; Using the preset first harmonic factor as the weighting coefficient of the relative weight ratio of the priority of the task, and using the second difference between 1 and the preset first harmonic factor as the weighting coefficient of the predicted idle time ratio of the task, calculate the weighted sum of the relative weight ratio of the priority of the task and the predicted idle time ratio of the task as the dynamic priority of the task in its task executor.
7. The method according to claim 1, wherein, scheduling the tasks in each of the task executors according to the dynamic priority includes: For each of the task executors, generate a task queue according to the dynamic priority of the tasks therein, and sequentially determine the group corresponding to each task in the task queue. The groups correspond one by one to the computers in the task executor, and schedule the tasks in the task queue to the corresponding computers for execution according to the groups. Among them, when determining the group corresponding to each task in the task queue, count the total predicted execution duration of the tasks that each group already has, and assign the task to the group with the smallest total predicted execution duration.
8. A task scheduling device, wherein, comprising: A task allocation module, configured to allocate tasks of the same sub-process of different business lines to the same task executor, and the business lines are configured with business line weights; A dynamic priority calculation module, configured to calculate the dynamic priority of the task in its task executor according to the relative weight ratio of the priority of the task, the maximum execution duration of the task in the most recent N historical execution records in its sub-process, the predicted execution duration of the task in its task executor, and a preset first harmonic factor, where N is a positive integer, and the relative weight ratio of the priority of the task is calculated according to the configured business line weights of each; A task scheduling module, configured to schedule the tasks in each of the task executors according to the dynamic priority.
9. A task execution system, wherein, comprising: A task scheduling center processor and one or more task executors, wherein: The task scheduling center processor is configured to allocate tasks of the same sub-process of different business lines to the same task executor, and the business lines are configured with business line weights; calculate the dynamic priority of the task in its task executor according to the relative weight ratio of the priority of the task, the maximum execution duration of the task in the most recent N historical execution records in its sub-process, the predicted execution duration of the task in its task executor, and a preset first harmonic factor, where N is a positive integer, and the relative weight ratio of the priority of the task is calculated according to the configured business line weights of each; schedule the tasks in each of the task executors according to the dynamic priority; The task executor is configured to: execute the tasks scheduled by the task scheduling center processor.
10. An electronic device, wherein, comprising: One or more processors; A memory, configured to store one or more programs, when the one or more programs are executed by the one or more processors, enabling the one or more processors to implement the method according to any one of claims 1-7.
11. A computer-readable medium having a computer program stored thereon, characterized in that, when the program is executed by a processor, it implements the method according to any one of claims 1-7.
Citation Information
Patent Citations
Priority-based wireless sensor network polling system control method
CN107347201A
A priority dynamic judgment model for multiple types of tasks of a rotary phased array radar
CN109885394A