Task allocation method and related equipment
By calculating the weight value of each sub-task and assigning it to execution units using a balanced strategy, the problem of excessive task execution time differences between execution units in parallel computing is solved and the efficiency of completing computing tasks is improved.
Patent Information
- Application Number
- CN202410745473.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-11
- Publication Date
- 2024-09-10
Smart Images

Figure CN118626261A
Abstract
Description
Technical Field
[0001] The present application relates to the field of parallel computing, and in particular to a task allocation method, apparatus, device storage medium, and computer program product. Background Art
[0002] In a parallel computing scenario, if a large computing task is expected to take a long time to execute, parallel computing technology can be used to achieve efficient processing - that is, split the large computing task into multiple subtasks with the same priority and no dependencies between each other, and then execute the subtasks in parallel. Generally, a subtask is assigned to an execution unit for processing. An execution unit can be a thread, a process, etc., or an independent computing node.
[0003] In this scenario where multiple subtasks of the same priority are executed in parallel, traditional task scheduling methods usually allocate subtasks to different execution units based on the principle of quantity balance, and then each execution unit executes the subtasks in parallel and sequentially.
[0004] like Figure 1 As shown in FIG. 1 , it is a schematic diagram of subtasks assigned to execution units a1 to a4 according to this principle. 12 Represents a total of 12 subtasks obtained by splitting the same computing task. Each execution unit is assigned 3 subtasks. For example, execution unit a1 is assigned subtasks b1, b2 and b3, execution unit a2 is assigned subtasks b4, b5 and b5, ...
[0005] Depend on Figure 1 It can be seen that there are differences in the task execution time (i.e. the execution time consumed by the task) of different subtasks. Therefore, even if each execution unit is assigned the same number of subtasks and executes the subtasks in parallel and sequentially at the same time, the total task execution time consumed by different execution units may be different.
[0006] How to avoid the large difference in the total execution time of tasks consumed by different execution units, resulting in low efficiency in completing computing tasks, is a problem that needs to be urgently solved in the existing technology. Summary of the invention
[0007] The embodiment of the present application provides a task allocation method to solve the problem of how to avoid the problem of low efficiency in completing computing tasks due to large differences in the total task execution time consumed by different execution units.
[0008] Embodiments of the present application also provide a task allocation device, an electronic device, a computer-readable storage medium, and a computer program product.
[0009] The present application embodiment adopts the following technical solutions:
[0010] On the one hand, a task allocation method is provided, comprising:
[0011] For the subtask that is launched to the production environment for the first time among the subtasks to be executed, obtain the most recent single execution duration of the subtask in the test environment as the historical single execution duration;
[0012] For the subtasks that are not launched to the production environment for the first time among the subtasks, the average execution time of the subtasks in the production environment is obtained as the historical single execution time;
[0013] Determine the weight value of each subtask based on the historical single execution duration of each subtask;
[0014] During the scheduling cycle for a single subtask, the following operations are performed respectively until all subtasks are scheduled, and then at least two execution units execute the subtasks in their respective task queues in parallel:
[0015] Operation 1: Select the subtask with the maximum weight value from the unassigned subtasks in the subtasks, and arrange it to the task queue of the execution unit with the smallest sum of first weight values among the at least two execution units; update the sum of first weight values of the execution units assigned the subtask with the maximum weight value; after all subtasks are arranged, the at least two execution units execute the subtasks in their respective corresponding task queues in parallel; the first sum of weight values is determined based on the weight values of the subtasks;
[0016] Operation 2: Obtain the load factors of the at least two execution units; the size of the load factor of the execution unit is related to the load of the execution unit; within the scheduling cycle for a single subtask, respectively perform: from the unassigned subtasks in each subtask, select the subtask with the maximum weight value, and based on the maximum weight value and the load factor, respectively estimate the sum of the second weight values of the at least two execution units after being assigned the subtask with the maximum weight value; schedule the subtask with the maximum weight value to the task queue of the execution unit with the smallest sum of the second weight values; update the sum of the second weight values of the execution units assigned the subtask with the maximum weight value.
[0017] On the other hand, a task allocation method is provided, comprising:
[0018] Obtain the weight value of each subtask to be executed respectively; the size of the weight value of the subtask is related to the single execution time of the subtask;
[0019] Based on the weight values, a weight value sum balancing strategy is adopted to respectively assign the subtasks to at least two execution units for execution.
[0020] In another aspect, a task allocation device is provided, comprising:
[0021] An execution duration acquisition unit is used to acquire the most recent single execution duration of a subtask in a test environment as a historical single execution duration for a subtask that is launched to a production environment for the first time among the subtasks to be executed; and to acquire the average execution duration of the subtask in the production environment as a historical single execution duration for a subtask that is not launched to the production environment for the first time among the subtasks to be executed;
[0022] A subtask weight value determination unit, used to determine the weight value of each subtask based on the historical single execution duration of each subtask;
[0023] The operation execution unit is used to execute the following operation 1 or operation 2 respectively within the scheduling cycle for a single subtask, until all subtasks are scheduled, and at least two execution units execute the subtasks in their respective corresponding task queues in parallel:
[0024] Operation 1: Select the subtask with the maximum weight value from the unassigned subtasks in the subtasks, and arrange it to the task queue of the execution unit with the smallest sum of first weight values among the at least two execution units; update the sum of first weight values of the execution units assigned the subtask with the maximum weight value; after all subtasks are arranged, the at least two execution units execute the subtasks in their respective corresponding task queues in parallel; the first sum of weight values is determined based on the weight values of the subtasks;
[0025] Operation 2: Obtain the load factors of the at least two execution units; the size of the load factor of the execution unit is related to the load of the execution unit; within the scheduling cycle for a single subtask, respectively perform: from the unassigned subtasks in each subtask, select the subtask with the maximum weight value, and based on the maximum weight value and the load factor, respectively estimate the sum of the second weight values of the at least two execution units after being assigned the subtask with the maximum weight value; schedule the subtask with the maximum weight value to the task queue of the execution unit with the smallest sum of the second weight values; update the sum of the second weight values of the execution units assigned the subtask with the maximum weight value.
[0026] In another aspect, a task allocation device is provided, comprising:
[0027] The subtask weight value acquisition unit is used to respectively acquire the weight value of each subtask to be executed; the size of the subtask weight value is related to the single execution time of the subtask;
[0028] The subtask allocation unit is used to allocate each subtask to at least two execution units for execution based on the weight value and adopt a weight value sum balancing strategy.
[0029] On the other hand, an electronic device is provided, comprising: a memory and a processor, wherein:
[0030] The memory is used to store computer programs;
[0031] The processor is coupled to the memory and is used to execute the computer program stored in the memory to perform any of the above-mentioned task allocation methods.
[0032] On the other hand, a computer-readable storage medium storing a computer program is provided, and when the computer program is executed by a computer, any of the above-mentioned task allocation methods can be implemented.
[0033] On the other hand, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, any one of the task allocation methods is implemented.
[0034] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:
[0035] Since the execution time of each execution unit is taken as the main consideration when allocating execution units to subtasks, the total execution time of each execution unit is made as close as possible after task allocation by matching the predicted subtask execution time with the cumulative execution time of the execution unit. This avoids the serious time skew caused by the large difference in the total execution time between the execution units when they execute tasks, thereby ensuring the completion efficiency of the total task. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0037] Figure 1 An example schematic diagram of subtask allocation for existing technical solutions;
[0038] Figure 2 A specific implementation flow chart of a task allocation method provided in an embodiment of the present application;
[0039] Figure 3 A specific implementation flow chart of another task allocation method provided in an embodiment of the present application;
[0040] Figure 4 A specific implementation flow chart of implementing subtask allocation within a single subtask scheduling cycle in an embodiment of the present application;
[0041] Figure 5A schematic diagram of a task list of each execution unit after allocating subtasks in an embodiment of the present application;
[0042] Figure 6 Another specific implementation flow chart of implementing subtask allocation within a single subtask scheduling cycle in an embodiment of the present application;
[0043] Figure 7 A schematic diagram of the implementation flow of the task allocation method provided in an embodiment of the present application in a specific application scenario;
[0044] Figure 8 A schematic diagram of the specific structure of a task allocation device provided in an embodiment of the present application;
[0045] Fig. 9 A schematic diagram of the specific structure of another task allocation device provided in an embodiment of the present application;
[0046] Fig.10 A schematic diagram of the specific structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0048] Those skilled in the art may appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0049] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0050] In order to solve the problem of how to avoid the problem of low efficiency in completing computing tasks due to large differences in the total task execution time consumed by different execution units, an embodiment of the present application provides a task allocation method and related equipment.
[0051] The execution subject of the method may be any computing device, or may be software running on the computing device. The embodiment of the present application does not limit the computing device or software that the execution subject is.
[0052] In addition, different steps of the method may be implemented by different computing devices or software, and the embodiments of the present application do not limit which computing device or software is used to implement which step.
[0053] For ease of description, the method provided in the embodiment of the present application is described in detail below by taking the execution subject of the method as a task scheduling system running on a user device or a server as an example.
[0054] Please refer to the instruction manual Figure 2 , is a specific implementation flow chart of a task allocation method provided in an embodiment of the present application, comprising the following steps:
[0055] Step 21: For each subtask to be executed that is launched to the production environment for the first time, obtain the most recent single execution duration of the subtask in the test environment as the historical single execution duration; for each subtask that is not launched to the production environment for the first time, obtain the average execution duration of the subtask in the production environment as the historical single execution duration;
[0056] In this embodiment, if a computing task is executed for the first time in a production environment and has no execution history record, the execution time of each subtask belonging to the computing task in the task development or test environment can be obtained as the historical single execution duration of the subtask in the task. Unlike other computing tasks that already have an execution history, the historical single execution duration of each subtask in the task in the test environment is used. The most recent execution duration in the test environment is used as the basis for subsequent calculations of the weight values of each subtask.
[0057] In an optional implementation, for subtasks that are not launched to the production environment for the first time, the average execution time of the subtask in the production environment is obtained as the historical single execution time of the subtask. Exemplarily, the weight value of a subtask can be the average execution time of each historical execution as the weight value of the subtask.
[0058] Step 22: Determine the weight value of each subtask based on the historical single execution time of each subtask;
[0059] In an optional implementation, the weight of the subtask can be determined according to certain rules, calculation methods or artificial intelligence algorithms based on the recorded historical single execution time of each subtask. Since the purpose of task allocation is to evenly distribute the total time to each execution unit, the weight of the subtask is determined by taking the single execution time of the subtask in the past as the main consideration.
[0060] In this embodiment, the weight value of each subtask is determined based on the past execution time of each subtask and a certain calculation method.
[0061] Step 23: During the scheduling cycle for a single subtask, the following operations are performed respectively until all subtasks are scheduled, and at least two execution units execute the subtasks in their respective corresponding task queues in parallel:
[0062] The scheduling cycle of a single subtask refers to the scheduling cycle of each subtask, which is the entire life cycle of a subtask being selected from the unassigned subtask set, selecting a suitable execution unit for the subtask, and being recorded in the task queue of the selected execution unit. This cycle usually includes: determining the subtask selected in this cycle; determining the appropriate execution unit; and recording the subtask identifier in the task queue of the selected execution unit.
[0063] In an optional implementation, after the subtasks are scheduled, each execution unit may simultaneously execute the subtasks scheduled in its own queue.
[0064] Operation 1 in step 23: select the subtask with the maximum weight value from the unassigned subtasks in the subtasks, and arrange it to the task queue of the execution unit with the smallest sum of first weight values among the at least two execution units; update the sum of first weight values of the execution units assigned the subtask with the maximum weight value; after all subtasks are arranged, the at least two execution units execute the subtasks in their respective corresponding task queues in parallel; the first sum of weight values is determined based on the weight values of the subtasks;
[0065] The first weight value sum balancing strategy refers to the use of the weight values of the subtasks assigned to the execution units to determine the sum of the weight values of the execution units as the first weight value sum when the weight value sum balancing strategy is used to allocate subtasks. The first weight value sum is used as the main factor to be considered when implementing the weight value sum balancing strategy.
[0066] In this embodiment, the sum of the first weight values pre-assigned to an execution unit is directly related to the weight values of the subtasks assigned to the execution unit, and the sum of the weight values of all subtasks pre-assigned to the execution unit can be used as the sum of the first weight values of the execution unit.
[0067] In an optional implementation, the first weight value sum balancing strategy can be used when the execution unit resources remain basically unchanged, such as when the execution unit is a separate computing node and the resources of each computing node are basically equivalent. When subtasks are executed, the execution time of the same type of subtasks is only related to the computational amount of the subtasks, the difficulty of model calculation, etc., and is basically unrelated to changes in resources owned by the execution unit. In this case, the first weight value sum balancing strategy can be used to allocate subtasks.
[0068] Specifically, the subtasks that have not been assigned can be sorted in descending order of weight value, and then, at the beginning of each scheduling cycle, the subtask with the largest weight value in the current sorting sequence is selected as the subtask to be assigned in the current scheduling cycle.
[0069] In this embodiment, the execution unit with the smallest sum of first weight values can be selected as the execution unit to which the subtask selected in this scheduling cycle is to be assigned. In this way, tasks with larger weight values can be evenly distributed to all execution units as much as possible, thereby achieving a balanced sum of weight values.
[0070] Operation 2 in step 23: obtaining the load factors of the at least two execution units; the size of the load factor of the execution unit is related to the load of the execution unit; within the scheduling cycle for a single subtask, respectively performing: selecting the subtask with the maximum weight value from the unassigned subtasks in each subtask, and estimating the sum of the second weight values of the at least two execution units after being assigned the subtask with the maximum weight value based on the maximum weight value and the load factor; scheduling the subtask with the maximum weight value to the task queue of the execution unit with the smallest sum of the second weight values; updating the sum of the second weight values of the execution units assigned the subtask with the maximum weight value.
[0071] In an optional embodiment, when adopting the second weight value sum balancing strategy, the scheduling cycle of a single subtask may generally also include four stages: determining the subtask selected for this cycle; estimating the sum of the second weight values of each execution unit to which the selected subtask is assigned; determining a suitable execution unit based on the estimated sum of the second weight values of each execution unit; and recording the subtask identifier in the task queue of the selected execution unit.
[0072] In this embodiment, the same method as described above may be used to select the subtask with the largest weight value from the subtasks that have not yet been assigned.
[0073] The second weight value sum refers to the sum of the weight values of all subtasks currently assigned to an execution unit and the second weight value determined by the load factor of the execution unit. Each execution unit records a variable for the weight value sum. When the second weight value sum balancing strategy is selected, the weight value sum variable stores the specific value of the second weight value sum currently calculated.
[0074] In an optional implementation, the second weight value sum of the execution unit determined by combining the weight values of all subtasks that have been assigned to an execution unit and the load factor of the execution unit may be used.
[0075] In this embodiment, the sum of the weight values of the execution units is updated to a new sum of the second weight values, which is the sum of the second weight values of the execution units before the subtasks are assigned, plus the weight value of the subtask with the maximum weight value and the new sum of the second weight values determined by the execution unit load factor.
[0076] In an optional embodiment, the estimated second weight value sum of each execution unit is assigned to the selected subtask. The subtask with the largest weight value selected in this scheduling cycle can be combined with each execution unit participating in the execution of the task to calculate the estimated second weight value sum for each execution unit. The estimated second weight value sum of each execution unit is sorted in ascending order, and the execution unit with the smallest estimated second weight value sum is taken as the execution unit selected for the subtask in this scheduling cycle.
[0077] By adopting the method provided in the embodiment of the present application, since the execution time of each execution unit is taken as the main consideration factor when allocating execution units to subtasks, the total execution time of each execution unit after task allocation is matched with the predicted subtask execution time and the cumulative execution time of the execution unit to be as close as possible, thereby avoiding the serious time skew phenomenon caused by excessive difference in the total execution time between the execution units when each execution unit executes the task, and ensuring the completion efficiency of the total task.
[0078] In order to solve the problem of how to avoid the problem of low efficiency of computing task completion caused by large differences in the total execution time of tasks consumed by different execution units, please refer to the attached manual. Figure 3 , is a specific implementation flow chart of another task allocation method provided in an embodiment of the present application, comprising the following steps:
[0079] Step 31: Obtain the weight value of each subtask to be executed respectively; the size of the weight value of the subtask is related to the single execution time of the subtask;
[0080] A subtask refers to a smaller task unit that is decomposed from a large computing task and can be executed independently. The decomposed subtask can be executed in parallel on multiple processing processes or multiple computing nodes at the same time.
[0081] The subtasks involved in the embodiments of the present application are independent of each other, and the execution of any subtask does not depend on the output of other subtasks, or does not depend on whether other subtasks are completed. In other words, the subtasks can be separated logically and data-wise.
[0082] Subtasks belonging to a larger computing task have the same priority, that is, different subtasks can be executed synchronously without any constraints on the execution order between them.
[0083] After the large task to be executed is divided into multiple subtasks, the execution time of each subtask in each execution unit is different. For example, in a weather index prediction task, the parameters and models of the weather index prediction subtasks for each province are quite different due to different meteorological conditions, geographical environment and other factors, and the amount of calculation will also be different, so the execution time of each subtask cannot be accurately estimated in advance.
[0084] The single execution duration of a subtask is the length of time required for a subtask to be executed from the start to the completion, which is recorded as the single execution duration of the subtask.
[0085] In an optional implementation, a large computing task can be divided according to fixed rules. For example, the computing task is a large-scale log data backup task. Subtasks can be divided by day, and each subtask is responsible for backing up the log data of a specified day among several days of log data. For example, subtasks b1 to b 365 Each representative backs up the log data of the first day, second day, third day, etc. of the year. For another example, the computing task is a weather index prediction task, which needs to be carried out on a province-by-province basis. Since the prediction model is relatively complex and the amount of calculation is large, the weather index prediction of a province can be divided into a subtask, such as: 山东 , Subtask 河北 , Subtask 北京 ...represent the Shandong Province meteorological index forecast task, Hebei Province meteorological index forecast subtask, and Beijing City meteorological index forecast subtask respectively...
[0086] In an optional implementation, for the same computing task that is repeatedly executed, such as the weather index prediction task in the above embodiment, it may be necessary to perform a prediction every month / week / every three days. For the same computing task, a data record corresponding to the execution status of each time and the unique identifier of the subtask can be established. The corresponding record can be: a record named in the subtask division rule. The name of the subtask in the execution status record when executing the task in the above example can be specifically named: weather index subtask 山东 , Weather Index Subtask 河北 , Weather Index Subtask 北京 ……; The name of the subtask in the execution record when the task is executed for the first time can be specifically named: Weather Index Subtask D1 山东 , Weather Index Subtask D1 河北 , Weather Index Subtask D1 北京 ... etc. Then, the subtask status is recorded in the execution status record according to the above subtask naming rules, thereby forming a corresponding relationship between "a computing task-subtask unique identifier-the subtask's previous execution status records".
[0087] For example, the execution record table of a computing task divided into five subtasks may be as follows:
[0088]
[0089] In an embodiment of the present application, a subtask has a weight value, and the size of the weight value of the subtask is related to the single execution time of the subtask. The correlation mentioned here can be a positive correlation or a negative correlation. When the size of the weight value is positively correlated with the single execution time, the longer the single execution time, the greater the weight value; conversely, the smaller the weight value.
[0090] In an optional implementation, the weight value of the subtask to be executed may be a quantitative indicator used to represent the expected execution time of the subtask to be executed.
[0091] In an optional implementation, the weight value of a subtask is related to a single execution duration of the subtask; the single execution duration of a subtask may refer to a single historical execution duration of the subtask. The weight value of a subtask may be calculated using a certain mathematical method based on the historical execution duration during the historical execution process, or it may be predicted using an artificial intelligence algorithm.
[0092] In an optional implementation, for each subtask that may be repeatedly executed, a variable "weight value" is set and stored, and the value of the weight value variable of the subtask is updated according to past execution conditions after each execution or before assigning subtasks.
[0093] In an optional implementation, the weight of the subtask can be determined according to a certain rule, calculation method or artificial intelligence algorithm based on the single execution time of each subtask recorded. Since the purpose of task allocation is to evenly distribute the total time for each execution unit, the single execution time of the subtask in the past is used as the main consideration to determine the weight of the subtask.
[0094] In an optional implementation, the weight value of each subtask may be determined based on the historical single execution duration of each subtask.
[0095] In this embodiment, the weight value of each subtask is determined based on the past execution time of each subtask and a certain calculation method.
[0096] For example, the most recent n historical single durations of a subtask are recorded as T1, T2, T3, ... T n , you can sort all historical execution times by size, and choose the middle value as the weight value. Then the weight value of this subtask = the first value after sorting. value.
[0097] For example, the historical single execution duration of a subtask is T1, T2, T3, ... T n , the average of the last k execution times can be used as the weight of the subtask, where k is a fixed integer less than the total number of executions.
[0098] In an optional implementation, in step 31, for a subtask that is launched to the production environment for the first time, the last single execution duration of the subtask in the test environment can be obtained as the historical single execution duration of the subtask. That is, for a computing task that has no execution history, the weight value of its subtask can be the last single execution duration of the subtask in the test environment.
[0099] In this embodiment, if a computing task is executed for the first time in a production environment and has no execution history record, the execution time of each subtask belonging to the computing task in the task development or test environment can be obtained as the historical single execution duration of the subtask in the task. Unlike other computing tasks that already have an execution history, the historical single execution duration of each subtask in the task in the test environment is used. The most recent execution duration in the test environment is used as the basis for subsequent calculations of the weight values of each subtask.
[0100] In an alternative embodiment, for a subtask that is not first launched into the production environment, obtain the average execution duration of the subtask in this production environment as the historical single execution duration of the subtask. Exemplarily, the weight value of a subtask can use the average execution duration of each historical execution as the weight value of this subtask. Exemplarily, the historical single durations of a subtask are T1, T2, T3... T n , then the
[0101] In an alternative embodiment, for a computing task that has been scheduled and executed multiple times in the production environment, the calculation logic for the weights of each subtask is as follows:
[0102] First, obtain the execution times of each subtask in the last x times (x >= 3). For subtask b j , the execution times in the last x times are represented by .
[0103] Then, calculate the weights of each subtask based on the obtained historical execution times, and update the values of the weight value variables of each subtask. For subtask b j , the calculation formula for its weight w j is:
[0104]
[0105] Among them, the calculation logic of the weight w j is: take the average of the sum of the average of the last x times of scheduling execution times, the average of the last y times of scheduling execution times, and the last scheduling execution time as the weight of the current subtask, where 1 < y < x. When the subtask is executed in previous times, it may be interfered by multiple factors, resulting in irregular fluctuations in the execution time each time. This calculation method of the weight can smooth out the noise as much as possible, and the calculated weight of the subtask can better represent the recent execution time.
[0106] In an alternative embodiment, the last execution duration of a subtask can also be directly used as the weight value of this subtask.
[0107] Step 32: Based on the weight values of each subtask to be executed, adopt the weight value sum balancing strategy to allocate each subtask to at least two execution units for execution.
[0108] The weight value sum balancing strategy means that by allocating subtasks to multiple computing nodes or execution units for execution, the sum of the weight values of the subtasks allocated to each node or execution unit (that is, the sum of the weight values of the subtasks allocated to this node or execution unit) is as close to or even equal as possible.
[0109] In an optional embodiment, a weight value sum is recorded for each execution unit to record the sum of the weight values of the subtasks that have been pre-assigned to each execution unit. The weight value sum of an execution unit represents the cumulative weight value sum of the subtasks that have been pre-assigned to the execution unit. In the initialization phase of allocating computing tasks, the weight value sum of each execution unit is initialized to 0. The subtasks assigned to an execution unit record a pre-assigned execution queue corresponding to the execution unit, and record the subtask identifiers in sequence. When the task is executed, each execution unit executes the subtasks assigned to each execution unit in parallel in the order of the execution queue.
[0110] In an optional implementation, a random selection method can be used to assign execution units to subtasks to achieve a balanced total weight value. First, sort the total weight values of the execution units in ascending order, and select the execution unit with the smallest total weight value as the execution unit to which the subtask will be assigned. If the total weight value of each execution unit is 0 when the subtask assignment just begins, or if the total weight values of each execution unit happen to be equal, then randomly select one execution unit as the execution unit to which the subtask will be assigned; then, randomly select an unassigned subtask and assign it to the execution unit with the smallest total weight value just selected, and record the extracted subtask identifier at the end of the execution queue of the execution unit to which the subtask is assigned; then update the total weight value of the execution unit to which the subtask has just been assigned to the sum of the original total weight value and the extracted subtask weight value. Repeat the above process until all unassigned subtasks have been assigned, and then end the loop.
[0111] In an optional implementation, the execution unit can be a process, a thread, a CPU core, a virtual machine, a container, a microservice unit, or a computing node. For example, when the execution unit is a number of identical separate computing nodes, an execution unit can have the same computing resources and basically similar execution efficiency each time it executes a task; for another example, the resources allocated to a microservice unit each time are dynamically changing, or when the execution unit is a number of separate computing nodes with different resources, each execution unit can have different resources and the execution efficiency may also be different each time. Regardless of the type of execution unit, the weight value sum balancing strategy used in this application can be applied to task allocation.
[0112] In an optional embodiment, the weight value sum balancing strategy includes: a first weight value sum balancing strategy; or a second weight value sum balancing strategy; the first weight value sum is determined based on the weight value of the subtask; the second weight value sum is determined based on the weight value of the subtask and the load factor of the execution unit; the size of the load factor of the execution unit is related to the load of the execution unit.
[0113] The first weight value sum balancing strategy refers to the use of the weight values of the subtasks assigned to the execution units to determine the sum of the weight values of the execution units as the first weight value sum when the weight value sum balancing strategy is used to allocate subtasks. The first weight value sum is used as the main factor to be considered when implementing the weight value sum balancing strategy.
[0114] In this embodiment, the sum of the first weight values pre-assigned to an execution unit is directly related to the weight values of the subtasks assigned to the execution unit, and the weight values of all subtasks pre-assigned to the execution unit can be summed as the sum of the first weight values of the execution unit.
[0115] In an optional implementation, the first weight value sum balancing strategy can be used when the execution unit resources remain basically unchanged, such as when the execution unit is a separate computing node and the resources of each computing node are basically equivalent. When subtasks are executed, the execution time of the same type of subtasks is only related to the computational amount of the subtasks, the difficulty of model calculation, etc., and is basically unrelated to changes in resources owned by the execution unit. In this case, the first weight value sum balancing strategy can be used to allocate subtasks.
[0116] The second weight value sum balancing strategy, in this application, refers to the situation that when the weight value sum balancing strategy is adopted to allocate subtasks, the sum of the weight values of the execution units determined by the weight values of the subtasks and the load factors of the execution units can be used as the second weight value sum, and the second weight value sum is used as the main factor to be considered when implementing the load balancing strategy.
[0117] In an optional implementation, the second weight value sum balancing strategy can be used in situations where the execution unit resources will change with the actual situation, such as when the execution unit is a process assigned by an operating system, and the computing resources such as memory and network bandwidth owned by the process change according to the different allocations of the operating system each time, and will change with the actual situation, thus affecting the execution time of the subtask. Or even if each execution unit is an independent computing node, but there is a large difference in load, it will also have a relatively large impact on the execution time of the task.
[0118] The load factor of an execution unit characterizes the workload carrying capacity of the execution unit. In the present application, the load factor can be the level of the load value of an execution unit relative to the average load value of other execution units in the entire system. The load factor can be determined based on the load value measured when the execution unit actually undertakes the computing task.
[0119] The load value of an execution unit when executing a subtask refers to the value of the workload currently undertaken by the execution unit. This value quantitatively reflects the workload status of the execution unit at a specific point in time and is also an indicator of the amount of tasks processed at a certain moment. The load value of the execution unit can be measured in many ways, such as CPU usage percentage, memory usage, I / O bandwidth usage, etc.
[0120] In an optional implementation, the size of the load factor of the execution unit is related to the load of the execution unit; that is, the load factor of each execution unit is calculated based on the load value of each execution unit in a certain calculation method. For example, the load value of the execution unit can be measured by a unified physical quantity, such as the load value of each execution unit can be uniformly taken as the memory usage or the I / O bandwidth usage percentage as the data basis for calculating the load factor.
[0121] In an optional implementation, the load value of the execution unit can also be measured by taking a number of physical quantities that can measure the load value of the execution unit and using a unified calculation method to obtain a calculation amount. For example, the load value of each execution unit can be the average value of the CPU usage percentage, memory usage percentage, and I / O bandwidth usage percentage of each execution unit as the load value of each execution unit.
[0122] In an optional implementation, the load factor of an execution unit may be calculated based on an average load value of the execution unit.
[0123] In this embodiment, if it is assumed that there are m execution units, the execution unit a is measured. i (1≤i≤m, i∈positive integer) The corresponding load value is recorded as f i , calculate the load average value f of all execution units avg , the calculation formula is: And record the average load value f of all units avg ; Then calculate the load factor F of the i-th execution unit i , the calculation formula is:
[0124] In an optional embodiment, the load value and load factor are stored for each execution unit. After a total computing task is completed or before executing a large computing task, the load value at the last task execution and the calculated load factor are updated and stored according to the execution situation.
[0125] In an optional implementation, the sum of the second weight values is determined based on the weight values of the subtasks and the load factor of the execution unit; in this embodiment, the sum of the second weight values of an execution unit can be calculated based on the weight values of all subtasks pre-assigned to the execution unit and the load factor of the execution unit.
[0126] Specifically, if it is assumed that the weight values of the j subtasks assigned to the i-th execution unit are w1, w2, w3, ..., w j ; The load factor of this execution unit is F i Then, when assigning the jth subtask to the execution unit, the sum of the second weight values c of the execution unit j It can be calculated by the following formula: j =c j-1 +w j *F i .
[0127] In an optional implementation, the weight value sum balancing strategy may further include a first weight value sum balancing strategy. Based on the first weight value sum balancing strategy, the following method may be used to achieve balanced allocation of each subtask:
[0128] like Figure 4 As shown, during the orchestration cycle for a single subtask, the following are executed respectively:
[0129] Step 41: Select the subtask with the largest weight value from the unassigned subtasks in the subtasks to be executed, and schedule it to the task queue of the execution unit with the smallest sum of the first weight values among at least two execution units;
[0130] The unassigned subtasks mentioned here refer to subtasks that have not yet been scheduled into the task queue of the execution unit.
[0131] Specifically, the subtasks that have not been assigned can be sorted in descending order of weight value, and then, at the beginning of each scheduling cycle, the subtask with the largest weight value in the current sorting sequence is selected as the subtask to be assigned in the current scheduling cycle.
[0132] The first weight value sum refers to the sum of the weight values of all subtasks currently assigned to an execution unit. Each execution unit records a variable for the weight value sum. When the first weight value sum balancing strategy is selected, the first weight value sum variable stores the specific value of the currently calculated first weight value sum.
[0133] In this embodiment, the execution unit with the smallest sum of first weight values can be selected as the execution unit to which the subtask selected in this scheduling cycle is to be assigned. In this way, tasks with larger weight values can be evenly distributed to all execution units as much as possible, thereby achieving a balanced sum of weight values.
[0134] Step 42: Update the sum of the first weight values of the execution units of the subtasks assigned with the maximum weight value.
[0135] In this embodiment, the sum of the weight values of the execution unit changes in real time according to the change of the assigned subtasks, so that the variable of the execution unit can correctly represent the sum of the weight values of the subtasks currently assigned to the execution unit.
[0136] In an optional implementation, after a subtask is assigned within a subtask scheduling cycle, the scheduling cycle ends and a search is performed to see if there are any unassigned subtasks. If all subtasks are assigned, the task execution process is entered; if there are any unassigned subtasks, a new scheduling cycle is restarted to assign the next subtask.
[0137] After all subtasks are arranged, the at least two execution units execute the subtasks in their respective corresponding task queues in parallel.
[0138] Each execution unit corresponds to a variable that records a task queue. The task queue can be recorded in the form of a series, for example, recording the assigned subtask identifier. When the task is executed, each execution unit executes the subtasks recorded in the queue in the order recorded in the task queue. When each execution unit executes a subtask, it does not affect other execution units. Multiple execution units execute the subtasks scheduled in their respective queues at the same time.
[0139] In a specific embodiment, the subtask weight value is calculated based on the weighted average of the historical execution time of the task, which can be regarded as a measure and representation of the recent execution time of the subtask, such as Figure 1 The diagram shown is an example of subtask allocation in the prior art solution, b1 to b 12 Represents a total of 12 subtasks obtained by splitting the same computing task, and each execution unit is assigned 3 subtasks, for example: execution unit a1 is assigned subtasks b1, b2 and b3, execution unit a2 is assigned subtasks b4, b5 and b5, .... The weight of the subtask can be regarded as the time required for the execution of each subtask. The traditional method of allocating subtasks according to the number of subtasks (in this example, the subtasks are allocated in order of subtask number) is used to schedule the execution of each subtask. It takes 271 minutes to complete the execution of all subtasks. Using the task allocation method described in this application (such as Figure 5 As shown in the figure, it takes a total of 143 minutes to complete all subtasks, which improves the efficiency by 47%.
[0140] In an optional implementation, the weight value sum balancing strategy may further include a second weight value sum balancing strategy. Based on the second weight value sum balancing strategy, the following method may be used to achieve balanced allocation of subtasks.
[0141] Obtaining the load factors of the at least two execution units;
[0142] As mentioned above, for the case of adopting the second weight value sum balancing strategy, the load factor has been stored in the variables of each execution unit. The load factor variables updated by each execution unit when the last task execution is completed or before the current task execution are obtained. Each execution unit corresponds to a load factor.
[0143] like Figure 6 As shown, during the orchestration cycle for a single subtask, the following are executed respectively:
[0144] Step 61: Select a subtask with a maximum weight value from the unassigned subtasks of the subtasks to be executed, and estimate the sum of second weight values of the at least two execution units after being assigned the subtask with the maximum weight value based on the maximum weight value and the load factor;
[0145] In this embodiment, the sum of the weight values of the execution units is updated to a new sum of the second weight values, which is the sum of the second weight values of the execution units before the subtasks are assigned, plus the weight value of the subtask with the maximum weight value and the new sum of the second weight values determined by the execution unit load factor.
[0146] In an optional implementation, the second weight value sum may be calculated in the same manner as described above.
[0147] For example, assume that there are n unassigned subtasks, and in a subtask scheduling cycle, the currently unassigned subtask b has been selected. j (1≤j≤n) is the subtask with the largest current weight, and its corresponding weight is w j , multiply the subtask weight by the load factor of each execution unit. There are m execution units, and the corresponding load factors are F1, F2, F3...F m Then add it to the sum of the second weight values of the execution units, and find the execution unit with the smallest sum of the second weight values. The formula for finding the minimum cumulative second weight value is as follows:
[0148] c min =min(c1+w j *F1,c2+w j *F2……,c m +wj *F m )
[0149] The execution unit with the smallest sum of the second weight values is the execution unit to be allocated in this subtask scheduling cycle.
[0150] Step 62: Arrange the subtask with the maximum weight value to the task queue of the execution unit with the smallest sum of the second weight values;
[0151] In this embodiment, the subtask identifier of the current maximum weight value may be added to the end of the task queue of the execution unit with the smallest estimated second weight value sum selected in the previous step.
[0152] Step 63: Update the sum of the second weight values of the execution units of the subtasks assigned the maximum weight value.
[0153] In this embodiment, the aforementioned method may be used to update the sum of weight values of the execution units to a new second sum of weight values.
[0154] After all subtasks are arranged, the at least two execution units execute the subtasks in their respective corresponding task queues in parallel.
[0155] In this embodiment, each execution unit can simultaneously execute the subtasks scheduled in its own queue in accordance with the aforementioned method.
[0156] In an optional embodiment, if Figure 7 In the task allocation execution flow diagram shown, the allocation execution of subtasks is divided into two parts, the first part is the subtask weight calculation, and the second part is the subtask scheduling execution.
[0157] In the first part of the subtask weight calculation process, if the task to be executed is the first time to be scheduled in the production environment, the weight of each subtask is manually initialized, and the weight value of each subtask is determined by obtaining the most recent execution time of each subtask in the non-production environment; if the subtask to be executed has been scheduled for execution multiple times in the production environment, the historical single execution time of each subtask is obtained according to the preset rules and the weight value of the subtask is determined based on the historical single execution time of each subtask.
[0158] The second part is the scheduling and execution of subtasks: according to the principle of the first weight value sum balance strategy or the second weight value sum balance strategy, the weight value of each subtask determines which execution unit the current subtask should be executed in; if the second weight value sum balance strategy is selected, the execution unit load factor and the weight value of the subtask determine which execution unit the current subtask should be executed in; after scheduling, the subtasks are executed in parallel in each execution unit according to the order recorded in the task queue. After each subtask is executed, the execution time needs to be stored in the relevant variables of each subtask so that the next subtask weight value can be updated and calculated.
[0159] Based on the same inventive concept as the previous embodiments, in order to solve the problem in the prior art of how to avoid the large difference in the total task execution time consumed by different execution units, resulting in low efficiency in completing computing tasks, the embodiment of the present application also provides a task allocation device.
[0160] The specific structural diagram of the device is shown in Figure 8 As shown, it includes the following functional units:
[0161] An execution duration acquisition unit is used to acquire the most recent single execution duration of a subtask in a test environment as a historical single execution duration for a subtask that is launched to a production environment for the first time among the subtasks to be executed; and to acquire the average execution duration of the subtask in the production environment as a historical single execution duration for a subtask that is not launched to the production environment for the first time among the subtasks to be executed;
[0162] A subtask weight value determination unit, used to determine the weight value of each subtask based on the historical single execution duration of each subtask;
[0163] The operation execution unit is used to execute the following operation 1 or operation 2 respectively within the scheduling cycle for a single subtask, until all subtasks are scheduled, and at least two execution units execute the subtasks in their respective corresponding task queues in parallel:
[0164] Operation 1: Select the subtask with the maximum weight value from the unassigned subtasks in the subtasks, and arrange it to the task queue of the execution unit with the smallest sum of first weight values among the at least two execution units; update the sum of first weight values of the execution units assigned the subtask with the maximum weight value; after all subtasks are arranged, the at least two execution units execute the subtasks in their respective corresponding task queues in parallel; the first sum of weight values is determined based on the weight values of the subtasks;
[0165] Operation 2: Obtain the load factors of the at least two execution units; the size of the load factor of the execution unit is related to the load of the execution unit; within the scheduling cycle for a single subtask, respectively perform: from the unassigned subtasks in each subtask, select the subtask with the maximum weight value, and based on the maximum weight value and the load factor, respectively estimate the sum of the second weight values of the at least two execution units after being assigned the subtask with the maximum weight value; schedule the subtask with the maximum weight value to the task queue of the execution unit with the smallest sum of the second weight values; update the sum of the second weight values of the execution units assigned the subtask with the maximum weight value.
[0166] Based on the same inventive concept as the previous embodiments, in order to solve the problem in the prior art of how to avoid the large difference in the total task execution time consumed by different execution units, resulting in low efficiency in completing the computing tasks, the embodiment of the present application also provides another task allocation device.
[0167] The specific structural diagram of the device is shown in Fig. 9 As shown, it includes the following functional units:
[0168] The subtask weight value acquisition unit 91 is used to respectively acquire the weight value of each subtask to be executed; the size of the subtask weight value is related to the single execution time of the subtask;
[0169] The subtask allocating unit 92 is used to allocate each subtask to at least two execution units for execution based on the weight value and using a weight value sum balancing strategy.
[0170] In an optional implementation, the subtask weight value acquisition unit 91 may further include: a subtask weight value determination subunit, configured to determine the weight value of each subtask based on the historical single execution duration of each subtask.
[0171] In an optional embodiment, the task allocation device may also include: a subtask historical single execution duration determination unit, used to determine the historical single execution duration of the subtask: for a subtask that is launched into the production environment for the first time, the most recent single execution duration of the subtask in the test environment is obtained as the historical single execution duration of the subtask; for a subtask that is not launched into the production environment for the first time, the average execution duration of the subtask in the production environment is obtained as the historical single execution duration of the subtask.
[0172] In an optional embodiment, the weight value sum balancing strategy includes: a first weight value sum balancing strategy; or a second weight value sum balancing strategy; the first weight value sum is determined based on the weight value of the subtask; the second weight value sum is determined based on the weight value of the subtask and the load factor of the execution unit; the size of the load factor of the execution unit is related to the load of the execution unit.
[0173] In an optional embodiment, the subtask allocation unit 92 can also be used to: within the scheduling cycle for a single subtask, respectively perform: selecting the subtask with the maximum weight value from the unassigned subtasks, and scheduling it to the task queue of the execution unit with the smallest sum of first weight values among the at least two execution units; updating the sum of first weight values of the execution units assigned the subtask with the maximum weight value; after all subtasks are scheduled, the at least two execution units execute the subtasks in their respective corresponding task queues in parallel.
[0174] In an optional embodiment, the subtask allocation unit 92 can also be used to: obtain the load factor of the at least two execution units; within the scheduling cycle for a single subtask, respectively perform: select the subtask with the maximum weight value from the unassigned subtasks, and based on the maximum weight value and the load factor, respectively estimate the sum of the second weight values of the at least two execution units after being assigned the subtask with the maximum weight value; schedule the subtask with the maximum weight value to the task queue of the execution unit with the smallest sum of the second weight values; update the sum of the second weight values of the execution units assigned the subtask with the maximum weight value; after all subtasks are scheduled, the at least two execution units execute the subtasks in their respective corresponding task queues in parallel.
[0175] By using the above-mentioned device provided in the embodiment of the present application, the execution time of each execution unit is taken as the main consideration when allocating execution units to subtasks. The predicted subtask execution time is matched with the cumulative execution time of the execution unit to achieve the goal that the total execution time of each execution unit after task allocation is as close as possible. This avoids the serious time skew phenomenon caused by the large difference in the total execution time between the execution units when each execution unit executes the task, thereby ensuring the completion efficiency of the total task.
[0176] Based on the same inventive concept as the previous embodiments, the embodiments of the present application also provide an electronic device to solve the problem in the prior art of how to avoid the large difference in the total task execution time consumed by different execution units, resulting in low efficiency in completing computing tasks.
[0177] like Fig.10As shown, the electronic device includes: a memory 101 and a processor 102. The memory 101 can be configured to store various other data to support operations on the electronic device. Examples of these data include instructions for any application or method for operating on the electronic device. The memory 101 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, a magnetic disk or an optical disk.
[0178] The processor 102 is coupled to the memory 101 and is used to execute the program stored in the memory 101 to execute the task allocation method described in the embodiment of the present application.
[0179] When the processor 102 executes the program in the memory 101, in addition to the above functions, it can also realize other functions, and the details can be referred to the description of the above embodiments.
[0180] Further, such as Fig.10 As shown, the electronic device also includes: a display 104, a communication component 103, a power component 1010, an audio component 106 and other components. Fig.10 Only some components are shown schematically, which does not mean that the electronic device only includes Fig.10 Components shown.
[0181] Accordingly, an embodiment of the present application also provides a computer program product, including a computer program, which implements the task allocation method provided in the above embodiments when executed by a processor.
[0182] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0183] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0184] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A task allocation method, characterized in that: The method comprises: For the subtask that is launched to the production environment for the first time among the subtasks to be executed, obtain the most recent single execution duration of the subtask in the test environment as the historical single execution duration; For the subtasks that are not launched to the production environment for the first time among the subtasks, the average execution time of the subtasks in the production environment is obtained as the historical single execution time; Determine the weight value of each subtask based on the historical single execution duration of each subtask; During the scheduling cycle for a single subtask, the following operations are performed respectively until all subtasks are scheduled, and then at least two execution units execute the subtasks in their respective task queues in parallel: Operation 1: Select the subtask with the maximum weight value from the unassigned subtasks in the subtasks, and arrange it to the task queue of the execution unit with the smallest sum of first weight values among the at least two execution units; update the sum of first weight values of the execution units assigned the subtask with the maximum weight value; after all subtasks are arranged, the at least two execution units execute the subtasks in their respective corresponding task queues in parallel; the first sum of weight values is determined based on the weight values of the subtasks; Operation 2: Obtain the load factors of the at least two execution units; the size of the load factor of the execution unit is related to the load of the execution unit; within the scheduling cycle for a single subtask, respectively perform: from the unassigned subtasks in each subtask, select the subtask with the maximum weight value, and based on the maximum weight value and the load factor, respectively estimate the sum of the second weight values of the at least two execution units after being assigned the subtask with the maximum weight value; schedule the subtask with the maximum weight value to the task queue of the execution unit with the smallest sum of the second weight values; update the sum of the second weight values of the execution units assigned the subtask with the maximum weight value.
2. A task allocation method, characterized in that: The method comprises: Obtain the weight value of each subtask to be executed respectively; the size of the weight value of the subtask is related to the single execution time of the subtask; Based on the weight values, a weight value sum balancing strategy is adopted to respectively assign the subtasks to at least two execution units for execution.
3. The method according to claim 2, characterized in that Obtaining the weight values of each subtask to be executed includes: Based on the historical single execution duration of each subtask, a weight value of each subtask is determined.
4. The method according to claim 3, characterized in that The method further comprises: For the subtask that is launched to the production environment for the first time among the subtasks, the most recent single execution duration of the subtask in the test environment is obtained as the historical single execution duration of the subtask; For the subtasks that are not launched to the production environment for the first time among the subtasks, the average execution duration of the subtasks in the production environment is obtained as the historical single execution duration of the subtasks.
5. The method according to claim 2, characterized in that The weight value sum balancing strategy includes: The first weight value sum balance strategy; or, the second weight value sum balance strategy; The first weight value sum is determined based on the weight values of the subtasks; The second weight value sum is determined based on the weight values of the subtasks and the load factor of the execution unit; the size of the load factor of the execution unit is related to the load of the execution unit.
6. The method according to claim 5, characterized in that If the weight value sum balancing strategy includes the first weight value sum balancing strategy, then based on the weight value, the weight value sum balancing strategy is adopted to assign each subtask to at least two execution units for execution, including: In the scheduling cycle for a single subtask, the following are respectively performed: selecting a subtask with a maximum weight value from unassigned subtasks, and scheduling it to a task queue of an execution unit with a minimum sum of first weight values among the at least two execution units; updating the sum of first weight values of the execution units to which the subtask with the maximum weight value is assigned; After all subtasks are arranged, the at least two execution units execute the subtasks in their respective corresponding task queues in parallel.
7. The method according to claim 5, characterized in that If the weight value sum balancing strategy includes a second weight value sum balancing strategy, then based on the weight value, the weight value sum balancing strategy is adopted to assign each subtask to at least two execution units for execution, including: Obtaining the load factors of the at least two execution units; In a scheduling cycle for a single subtask, the following are performed respectively: selecting a subtask with a maximum weight value from unassigned subtasks, and estimating, based on the maximum weight value and the load factor, the sum of second weight values of the at least two execution units after being assigned the subtask with the maximum weight value; scheduling the subtask with the maximum weight value to the task queue of the execution unit with the smallest sum of the second weight values; and updating the sum of second weight values of the execution units assigned the subtask with the maximum weight value; After all subtasks are arranged, the at least two execution units execute the subtasks in their respective corresponding task queues in parallel.
8. A task allocation device, characterized in that: include: An execution duration acquisition unit is used to acquire the most recent single execution duration of a subtask in a test environment as a historical single execution duration for a subtask that is launched to a production environment for the first time among the subtasks to be executed; and to acquire the average execution duration of the subtask in the production environment as a historical single execution duration for a subtask that is not launched to the production environment for the first time among the subtasks to be executed; A subtask weight value determination unit, used to determine the weight value of each subtask based on the historical single execution duration of each subtask; The operation execution unit is used to execute the following operation 1 or operation 2 respectively within the scheduling cycle for a single subtask, until all subtasks are scheduled, and at least two execution units execute the subtasks in their respective corresponding task queues in parallel: Operation 1: selecting a subtask with the largest weight value from the unassigned subtasks in the subtasks, and arranging it to a task queue of the execution unit with the smallest sum of the first weight values among the at least two execution units; Updating the sum of first weight values of the execution units of the subtasks assigned the maximum weight value; After all subtasks are arranged, the at least two execution units execute the subtasks in the corresponding task queues in parallel; the first weight value sum is determined based on the weight values of the subtasks; Operation 2: Obtain the load factors of the at least two execution units; the size of the load factor of the execution unit is related to the load of the execution unit; In a scheduling cycle for a single subtask, respectively performing: selecting a subtask with a maximum weight value from unassigned subtasks in each of the subtasks, and estimating, based on the maximum weight value and the load factor, a sum of second weight values of the at least two execution units after being assigned the subtask with the maximum weight value; Arrange the subtask with the maximum weight value to the task queue of the execution unit with the smallest sum of the second weight values; The sum of second weight values of the execution units of the subtasks assigned the maximum weight value is updated.
9. A task allocation device, characterized in that: include: The subtask weight value acquisition unit is used to respectively acquire the weight value of each subtask to be executed; the size of the subtask weight value is related to the single execution time of the subtask; The subtask allocation unit is used to allocate each subtask to at least two execution units for execution based on the weight value and adopt a weight value sum balancing strategy.
10. An electronic device, characterized in that: include: Memory and processor, wherein: The memory is used to store computer programs; The processor is coupled to the memory and is used to execute the computer program stored in the memory to execute the task allocation method described in any one of claims 1 to 7.
11. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a computer, can implement the task allocation method according to any one of claims 1 to 7.
12. A computer program product, characterized in that It comprises a computer program, which, when executed by a processor, implements the task allocation method described in any one of claims 1 to 7.
