A task allocation method, device, equipment and storage medium
By using the resource allocation prediction model in a distributed system, the problem of poor resource allocation flexibility is solved, and the precise matching of dynamic resource allocation and task execution time is achieved, the system intelligence is improved and the capacity expansion is prompted in a timely manner need.
Patent Information
- Application Number
- CN202110127415.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-29
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2041-01-29
AI Technical Summary
The existing distributed systems have poor flexibility in resource allocation, resulting in the inability to accurately and dynamically allocate computing resources, low intelligence, and the inability to adjust resource allocation in real time according to the needs of subtasks.
By obtaining resource allocation information in the current time period, using the trained resource allocation prediction model to predict the resource requirements of the next time period, and determining the task will be performed within a specific time period based on the matching degree. If it does not match, adjust the resource occupancy information or It is prompted that the system needs to be fully loaded.
It realizes the precise matching of dynamic resource allocation and task execution time, improves the intelligence of the allocation plan for distributed task execution, ensures fair execution of tasks and prompts the system to expand capacity in a timely manner.
Smart Images

Figure CN114816690B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of distributed technology, and in particular to a task allocation method, device, equipment and storage medium. Background Art
[0002] With the rapid development of Internet technology, Internet technology has been widely used. In the process of widespread application of Internet technology, data analysis has become increasingly important in various fields. When analyzing data, especially analyzing user behavior, the commonly used method is based on a distributed system, dividing the total computing resources into multiple sub-computing resources according to certain rules, and assigning a sub-task to each sub-computing resource to execute the corresponding sub-task through the sub-computing resource, where the sub-tasks within the sub-computing resource can preempt resources for execution according to the task priority.
[0003] However, in the above scheme, the total computing resources need to be divided into multiple sub-computing resources in advance, and after the total computing resources are divided into multiple sub-computing resources, when the size of the sub-computing resources needs to be adjusted, the user needs to manually adjust it. This results in poor resource allocation flexibility in the above scheme, and makes it impossible to accurately and continuously allocate resources dynamically according to the computing resources required by the sub-tasks, and the degree of intelligence is low. Summary of the invention
[0004] In order to solve the above-mentioned technical problems, the present application hopes to provide a task allocation method, device, equipment and storage medium, which solves the problem of poor flexibility in current resource allocation, proposes a technical solution for dynamic resource allocation and dynamic determination of task execution time, effectively enriches the allocation scheme of distributed task execution, and improves the intelligence level of the allocation scheme.
[0005] The technical solution of this application is implemented as follows:
[0006] In a first aspect, a task allocation method is provided, the method being applied to a distributed system, the method comprising:
[0007] Obtain resource allocation information allocated to a first preset number of time periods in a current time period; wherein the current time period is divided into the first preset number of time periods, and each time period is used to execute a target task;
[0008] The resource allocation information is predicted by a trained resource allocation prediction model to obtain predicted resource allocation information; wherein the predicted resource allocation information includes resource information predicted to be allocated for a first preset number of time periods of a next time period adjacent to the current time period;
[0009] Determine resource reference information required for tasks to be performed within the next time period;
[0010] If the resource reference information matches the resource information corresponding to the first target time period in the predicted resource allocation information, it is determined that the task to be executed is executed within the first target time period.
[0011] Optionally, the method further includes:
[0012] If the resource reference information does not match the resource information corresponding to the first preset number of time periods in the predicted resource allocation information, obtaining resource occupancy information when the target task is executed in the first preset number of time periods in the current time period;
[0013] The resource occupancy information is predicted by a trained resource occupancy prediction model to obtain predicted resource occupancy information; wherein the predicted resource occupancy information includes resource information predicted to be occupied by a first preset number of time periods of a next time period adjacent to the current time period;
[0014] If the resource reference information matches the resource information corresponding to the second target time period in the predicted resource occupancy information, it is determined that the task to be executed is executed within the second target time period.
[0015] Optionally, the method further includes:
[0016] If the resource reference information does not match the resource information corresponding to the first preset number of time periods in the predicted resource occupancy information, a prompt message is generated and displayed; wherein the prompt message is used to prompt the user that the distributed system is fully loaded and needs to be expanded.
[0017] Optionally, the resource reference information includes at least a first core computing quantity and a first memory size of a central processing unit CPU, and if the resource reference information matches the resource information corresponding to the first target time period in the predicted resource allocation information, determining that the task to be executed is executed within the first target time period includes:
[0018] Determine, from the predicted resource allocation information, a reference time period in which the predicted number of core operations of the CPU is greater than or equal to the first number of core operations and the predicted memory size is greater than or equal to the first memory size;
[0019] If the reference time period includes a time period, determining the reference time period as the first target time period, and determining that the task to be executed is executed within the first target time period;
[0020] If the reference time period includes at least two time periods, a time period is determined from the reference time period as the first target time period, and the to-be-executed task is determined to be executed within the first target time period.
[0021] Optionally, if the reference time period includes at least two time periods, determining a time period from the reference time period as the first target time period includes:
[0022] If the reference time period includes at least two time periods, determining a time period closest to the current time period from the reference time period as the first target time period;
[0023] Alternatively, if the reference time period includes at least two time periods, based on a first difference between the predicted number of CPU core operations in each time period in the reference time period and the first number of core operations, and a second difference between the predicted memory size in each time period in the reference time period and the first memory size, a time period in which the first difference is the smallest and / or the second difference is the smallest is determined from the reference time period as the first target time period.
[0024] Optionally, before obtaining resource allocation information allocated to a first preset number of time periods in the current time period, the method further includes:
[0025] If it is determined that the distributed system currently provides distributed services for the user, collecting the first preset number of resource allocation information and the first preset number of resource occupancy information;
[0026] The first preset number of resource allocation information and the first preset number of resource occupation information are stored in a target storage area.
[0027] Optionally, before predicting the resource allocation information by using a trained resource allocation prediction model to obtain the predicted resource allocation information, the method further includes:
[0028] Acquire a second preset number of groups of first historical resource allocation information within a first historical time period and second historical resource allocation information within a second historical time period; wherein the first historical time period is adjacent to the second historical time period, and the second historical time period is after the first historical time period;
[0029] Based on the first historical resource allocation information and the second historical resource allocation information, a preset model is trained to obtain the resource allocation prediction model.
[0030] In a second aspect, a task allocation device is provided, the device comprising: a first acquisition unit, a prediction unit, a determination unit and a processing unit; wherein:
[0031] The first acquisition unit is used to acquire resource allocation information allocated to a first preset number of time periods in a current time period; wherein the current time period is divided into the first preset number of time periods, and each time period is used to execute a target task;
[0032] The prediction unit is used to predict the resource allocation information by using a trained resource allocation prediction model to obtain predicted resource allocation information; wherein the predicted resource allocation information includes resource information predicted to be allocated for a first preset number of time periods of a next time period adjacent to the current time period;
[0033] The determining unit is used to determine the resource reference information required for the task to be executed in the next time period;
[0034] The processing unit is configured to determine that the to-be-executed task is executed within the first target time period if the resource reference information matches the resource information corresponding to the first target time period in the predicted resource allocation information.
[0035] In a third aspect, a task allocation device comprises a memory, a processor and a communication bus; wherein:
[0036] The memory is used to store executable instructions;
[0037] The communication bus is used to realize the communication connection between the processor and the memory;
[0038] The processor is used to execute the task allocation program stored in the memory to implement the steps of any one of the task allocation methods described above.
[0039] In a fourth aspect, a storage medium is provided, wherein a task allocation program is stored on the storage medium, and when the task allocation program is executed by a processor, the steps of any of the above-mentioned task allocation methods are implemented.
[0040] The embodiment of the present application provides a task allocation method, device, equipment and storage medium, which obtains the resource allocation information allocated for the first preset number of time periods in the current time period, predicts the resource allocation information through a trained resource allocation prediction model, obtains the predicted resource allocation information, and determines the resource reference information required for the task to be executed in the next time period. If the resource reference information matches the resource information corresponding to the first target time period in the predicted resource allocation information, it is determined that the task to be executed is executed in the first target time period. In this way, the predicted resource allocation information that can be allocated in each time period in the next time period is first determined by the prediction method, and then if it is determined from the predicted resource allocation information that the resource information in the first target time period included in the predicted resource allocation information matches the resource reference information sequenced for the task to be executed, the task to be executed is allocated to be executed in the first target time period, which solves the problem of poor flexibility in current resource allocation, proposes a technical solution for dynamic resource allocation, and dynamically determines the task execution time, effectively enriches the allocation scheme for distributed task execution, and improves the intelligence of the allocation scheme. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 Schematic diagram of the task allocation method provided in the embodiment of the present application Figure 1 ;
[0042] Figure 2 Schematic diagram of the task allocation method provided in the embodiment of the present application Figure 2 ;
[0043] Figure 3 Schematic diagram of the task allocation method provided in the embodiment of the present application Figure 3 ;
[0044] Figure 4 Schematic diagram of the task allocation method provided in the embodiment of the present application Figure 4 ;
[0045] Figure 5 Schematic diagram of the task allocation method provided in the embodiment of the present application Figure 5 ;
[0046] Figure 6 A schematic diagram of the structure of a distributed system provided in an embodiment of the present application;
[0047] Figure 7 A flowchart of an application scenario provided in an embodiment of the present application;
[0048] Figure 8 A schematic diagram of a model training process provided in an embodiment of the present application;
[0049] Fig. 9A schematic diagram of the structure of a task allocation device provided in an embodiment of the present application;
[0050] Fig.10 A schematic diagram of the structure of another task allocation device provided in an embodiment of the present application;
[0051] Fig.11 A structural diagram of a task allocation device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0052] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0053] The embodiment of the present application provides a task allocation method, referring to Figure 1 As shown, the method is applied to run a distributed system, and the method includes the following steps:
[0054] Step 101: Obtain resource allocation information allocated to a first preset number of time periods in a current time period.
[0055] The current time period is divided into a first preset number of time periods, and each time period is used to execute a target task.
[0056] In an embodiment of the present application, the time period may be determined according to a time rule for executing tasks in a distributed system, and the time period may be divided by seconds, minutes, hours, days, months, or years. Each time period may be divided into different time periods. Among them, the first preset number of divided time periods is an empirical value determined based on the analysis of historical user behavior data. The time periods may be of equal length or of unequal length, and each time period is used to execute a task. Due to the uncertainty of the task, different tasks may be run in different time periods of different time periods. The resource allocation information allocated for each time period may be the upper limit of the computing resources that can be used when executing the task.
[0057] Step 102: predict resource allocation information using a trained resource allocation prediction model to obtain predicted resource allocation information.
[0058] The predicted resource allocation information includes resource information predicted to be allocated for a first preset number of time periods in a next time period adjacent to the current time period.
[0059] In an embodiment of the present application, the resource allocation prediction model is obtained by pre-training the resource allocation initial model through the resource allocation information of different time periods in different historical time periods, and is used to predict the resource allocation information of each time period of the next time period based on the resource allocation information of the current time period, so that when the next time period arrives, the resources of each corresponding time period are allocated according to the corresponding resource information in the predicted resource allocation information.
[0060] Step 103: Determine resource reference information required for the task to be executed in the next time period.
[0061] In an embodiment of the present application, the pending tasks to be executed within the next time period may include at least one, that is, at least one pending task can be run within the next time period. In this way, it is necessary to determine the resource reference information required for each pending task. The resource reference information required for each pending task is usually estimated, and the resource information occupied during actual execution may be less than the resource reference information. In some extreme cases, it may also be greater than the resource reference information.
[0062] Step 104: If the resource reference information matches the resource information corresponding to the first target time period in the predicted resource allocation information, it is determined that the task to be executed is executed within the first target time period.
[0063] In the embodiment of the present application, the first target time period is a time period in the next time cycle. The resource reference information matches the resource information corresponding to the first target time period, which means that the resource information in the first target time period is sufficient to meet the resource information required for the execution of the task to be executed, so that it can be determined that the task to be executed is executed within the first target time period, that is, when the first target time period in the next time cycle arrives, the task to be executed is executed.
[0064] Under the big framework of data analysis, the behavior of analyzing and studying the data obtained by monitoring user behavior can be attributed to user behavior analysis. When analyzing user behavior, it can be realized through user event analysis method. User time analysis method is mainly used to study the impact and degree of impact of a certain user behavior event on the product. Because, in the distributed task scheduling process, the user task execution profile can be established by statistically analyzing the regular tasks performed by users within a regular time. Since the resource usage of a distributed system with stable execution is basically related to the time law, the resources required by the user to execute tasks at a certain time can be predicted based on the established user task execution profile, and the scheduling resource behavior profile can be obtained.
[0065] The embodiment of the present application provides a task allocation method, which obtains resource allocation information allocated for a first preset number of time periods in the current time period, predicts the resource allocation information through a trained resource allocation prediction model, obtains predicted resource allocation information, and determines the resource reference information required for the task to be executed in the next time period. If the resource reference information matches the resource information corresponding to the first target time period in the predicted resource allocation information, it is determined that the task to be executed is executed in the first target time period. In this way, the predicted resource allocation information that can be allocated in each time period in the next time period is first determined by a prediction method, and then if it is determined from the predicted resource allocation information that the resource information in the first target time period included in the predicted resource allocation information matches the resource reference information sequenced for the task to be executed, the task to be executed is allocated to be executed in the first target time period, which solves the current problem of poor flexibility in resource allocation, proposes a technical solution for dynamic resource allocation, and dynamically determines the task execution time, effectively enriches the allocation scheme for distributed task execution, and improves the intelligence of the allocation scheme.
[0066] Based on the above embodiments, the embodiments of the present application provide a task allocation method, referring to Figure 2 As shown, the method is applied to a distributed system, and the method comprises the following steps:
[0067] Step 201: Obtain resource allocation information allocated to a first preset number of time periods in a current time period.
[0068] The current time period is divided into a first preset number of time periods, and each time period is used to execute a target task.
[0069] In an embodiment of the present application, the resource allocation information allocated for the first preset number of time periods in the current time period may be predicted by a trained resource allocation prediction model provided by the present application, but in some application scenarios, it may also be manually allocated by a user at the initial time. The distributed system may obtain the resource allocation information allocated for the first preset number of time periods in the current time period from a storage area corresponding to the distributed system.
[0070] Step 202: predict resource allocation information using a trained resource allocation prediction model to obtain predicted resource allocation information.
[0071] The predicted resource allocation information includes resource information predicted to be allocated for a first preset number of time periods in a next time period adjacent to the current time period.
[0072] In the embodiment of the present application, the trained resource allocation prediction model can also continuously perform self-model training and optimization during actual application as samples increase and change to ensure the accuracy of the prediction.
[0073] Step 203: Determine resource reference information required for the task to be executed in the next time period.
[0074] In an embodiment of the present application, the resource reference information required for the task to be executed in the next time period can be read by the distributed system from the task to be executed, that is, the task to be executed carries the resource reference information required by itself when being executed, or the distributed system can analyze the resource information provided when running different tasks, and obtain methods such as empirical formulas to estimate and determine the task to be executed.
[0075] In the embodiment of the present application, after the distributed system executes step 203, it may choose to execute step 204, or choose to execute steps 205 to 207, or choose to execute steps 205 to 206 and step 208. Among them, if the resource reference information matches the resource information corresponding to the first target time period in the predicted resource allocation information, step 204 is selected to be executed; if the resource reference information does not match the resource information corresponding to the first preset number of time periods in the predicted resource allocation information, steps 205 to 207 are selected to be executed; if the resource reference information does not match the resource information corresponding to the first preset number of time periods in the predicted resource occupancy information, steps 205 to 206 and step 208 are selected to be executed.
[0076] Step 204: If the resource reference information matches the resource information corresponding to the first target time period in the predicted resource allocation information, it is determined that the task to be executed is executed within the first target time period.
[0077] Step 205: If the resource reference information does not match the resource information corresponding to the first preset number of time periods in the predicted resource allocation information, obtain resource occupancy information when executing the target task in the first preset number of time periods in the current time period.
[0078] In the embodiment of the present application, the resource occupancy information when executing the target task in the first preset number of time periods in the current time period refers to the actual resource information occupied by each target task when executing each target task in each time period in the current time period, that is, the resource information actually occupied when executing each target task. The corresponding resource occupancy information when executing the target task in different time periods can be the same or different, and the specific resource occupancy information is determined by the target tasks executed in different time periods.
[0079] Step 206: predict resource occupancy information using the trained resource occupancy prediction model to obtain predicted resource occupancy information.
[0080] The predicted resource occupancy information includes resource occupancy information predicted for a first preset number of time periods in a next time period adjacent to the current time period.
[0081] In an embodiment of the present application, the resource occupancy prediction model is obtained by pre-training an initial resource occupancy model based on the actual resource information occupied when executing the target task in different time periods in each historical time period, and is used to make predictions based on the resource occupancy information in the current time period to obtain prediction information for the resource occupancy information in the next period.
[0082] Step 207: If the resource reference information matches the resource information corresponding to the second target time period in the predicted resource occupancy information, it is determined that the task to be executed is executed within the second target time period.
[0083] In an embodiment of the present application, the resource reference information is matched with the resource information in each time period in the predicted resource occupancy information. If the resource information corresponding to the second target time period determined from the predicted resource occupancy information matches the resource reference information, it can be determined that the task to be executed will be executed in the second target time period of the next time period.
[0084] Step 208: If the resource reference information does not match the resource information corresponding to the first preset number of time periods in the predicted resource occupancy information, a prompt message is generated and displayed.
[0085] The prompt information is used to remind the user that the distributed system is fully loaded and needs to be expanded.
[0086] In the embodiment of the present application, if each resource information in the predicted resource occupancy information does not match the resource reference information, that is, no resource information in the predicted resource occupancy information matches the resource reference information, it indicates that the distributed system is fully loaded and the distributed system needs to be expanded. Therefore, a prompt information can be generated at this time to prompt the user to expand the distributed system. In this way, a method for prompting the need for distributed system expansion is effectively proposed.
[0087] It should be noted that, based on the above-mentioned embodiment, the step content in step 205 "obtaining resource occupation information when executing the target task in the first preset number of time periods in the current time period" can be executed simultaneously with step 201, and correspondingly, step 206 can be executed simultaneously with step 202, or, the step content in step 205 "obtaining resource occupation information when executing the target task in the first preset number of time periods in the current time period" and step 206 can be executed after or before steps 201 to 202. Correspondingly, in both cases, step 207 should be to determine that the task to be executed is executed in the second target time period when the resource reference information does not match the resource information corresponding to the first preset number of time periods in the predicted resource allocation information, but the resource reference information matches the resource information corresponding to the second target time period in the predicted resource occupation information, and correspondingly, step 208 should be to generate and display a prompt message when the resource reference information does not match the resource information corresponding to the first preset number of time periods in the predicted resource allocation information, and the resource reference information does not match the resource information corresponding to the first preset number of time periods in the predicted resource occupation information.
[0088] It should be noted that, for the description of the same steps and the same contents in this embodiment as those in other embodiments, reference can be made to the description in other embodiments and will not be repeated here.
[0089] The embodiment of the present application provides a task allocation method, which obtains resource allocation information allocated for a first preset number of time periods in the current time period, predicts the resource allocation information through a trained resource allocation prediction model, obtains predicted resource allocation information, and determines the resource reference information required for the task to be executed in the next time period. If the resource reference information matches the resource information corresponding to the first target time period in the predicted resource allocation information, it is determined that the task to be executed is executed in the first target time period. In this way, the predicted resource allocation information that can be allocated in each time period in the next time period is first determined by a prediction method, and then if it is determined from the predicted resource allocation information that the resource information in the first target time period included in the predicted resource allocation information matches the resource reference information sequenced for the task to be executed, the task to be executed is allocated to be executed in the first target time period, which solves the current problem of poor flexibility in resource allocation, proposes a technical solution for dynamic resource allocation, and dynamically determines the task execution time, effectively enriches the allocation scheme for distributed task execution, and improves the intelligence of the allocation scheme. By predicting the execution time period of each task to be executed, fairness between each task to be executed is effectively guaranteed, ensuring that each task to be executed can be executed, and accurately reflecting the real-time resource occupancy; and effectively proposing a prompt method for the distributed system to expand its capacity.
[0090] Based on the above embodiments, the embodiments of the present application provide a task allocation method, referring to Figure 3 As shown, the method is applied to a distributed system. In this embodiment, the resource information at least includes the number of core operations of a central processing unit (CPU) and the size of the running memory. The method includes the following steps:
[0091] Step 301: Obtain resource allocation information allocated to a first preset number of time periods in a current time period.
[0092] The current time period is divided into a first preset number of time periods, each of which is used to execute a target task. The resource allocation information includes the number of CPU core operations and the memory size allocated for each time period.
[0093] In the embodiment of the present application, the first preset number of time periods in the current time period obtained can be recorded as (t(0)~t(1), t(1)~t(2), ..., t(n-1)~t(n)), n is the first preset number, and n is an integer greater than or equal to 1. Among them, the time periods are arranged from near to far. For example, assuming that the current moment in the current time period is 14:00 on a certain day, the next time period is 14:00~15:00, and n is 3, the corresponding set of 3 time periods can be recorded as (14:00~14:25, 14:25~14:40, 14:40~15:00).
[0094] Resource allocation information may be recorded in the form of a set or a matrix. Exemplarily, when a set is used to represent resource allocation information, the number of CPU core operations included in the resource allocation information corresponding one-to-one to the first preset number of time periods (t(0) to t(1), t(1) to t(2), ..., t(n-1) to t(n)) in the current time period may be recorded as (C1, C2, ..., Cn), and the memory size included in the resource allocation information corresponding one-to-one to the first preset number of time periods (t(0) to t(1), t(1) to t(2), ..., t(n-1) to t(n)) in the current time period may be recorded as (M1, M2, ..., Mn).
[0095] Step 302: predict resource allocation information using a trained resource allocation prediction model to obtain predicted resource allocation information.
[0096] The predicted resource allocation information includes resource information predicted to be allocated for a first preset number of time periods of the next time period adjacent to the current time period, and includes the predicted number of CPU core operations and memory size to be allocated for each time period of the next time period.
[0097] In the embodiment of the present application, the trained resource allocation prediction model may be obtained by training a wavelet basis function such as Mexican Hat (mexh).
[0098] Step 303: Determine resource reference information required for the task to be executed in the next time period.
[0099] The resource reference information at least includes a first core computing quantity and a first memory size of a central processing unit (CPU).
[0100] In other embodiments of the present application, after the distributed system executes step 303, it may choose to execute steps 304 to 306, or steps 307 to 309, or steps 307 to 308 and step 310:
[0101] Step 304: Determine, from the predicted resource allocation information, a reference time period in which the predicted core operation quantity of the CPU is greater than or equal to the first core operation quantity and the predicted memory size is greater than or equal to the first memory size.
[0102] In an embodiment of the present application, when the resource information is the number of core operations and the memory size of the CPU, the resource reference information matches the resource information corresponding to the first target time period in the predicted resource allocation information, which means that the predicted number of core operations corresponding to the first target event segment is greater than or equal to the first number of core operations, and the predicted memory size is greater than or equal to the first memory size.
[0103] In the embodiment of the present application, after the distributed system executes step 304, it may choose to execute step 305 or step 306. If the reference time period includes one time period, step 305 is selected to execute; if the reference time period includes at least two time periods, step 306 is selected to execute:
[0104] Step 305: If the reference time period includes a time period, determine the reference time period as a first target time period, and determine that the task to be executed is executed within the first target time period.
[0105] Step 306: If the reference time period includes at least two time periods, determine a time period from the reference time period as a first target time period, and determine that the task to be executed is executed within the first target time period.
[0106] In other embodiments of the present application, step 306 may be implemented by step a11 or step a12:
[0107] Step a11: If the reference time period includes at least two time periods, determine a time period closest to the current time period from the reference time period as the first target time period.
[0108] In an embodiment of the present application, if the determined reference time period includes three time periods: t(0)~t(1), t(3)~t(4) and t(7)~t(8), correspondingly, the time period t(0)~t(1) closest to the current time period is determined from these three time periods as the first target time period.
[0109] Step a12: If the reference time period includes at least two time periods, based on a first difference between the predicted number of CPU core operations in each time period in the reference time period and the first number of CPU core operations, and a second difference between the predicted memory size in each time period in the reference time period and the first memory size, determine a time period with the smallest first difference and / or the smallest second difference from the reference time period as the first target time period.
[0110] In an embodiment of the present application, when the reference time period includes at least two time periods, the first difference between the predicted number of core operations of the CPU and the first number of core operations in each time period in the reference time period is calculated, wherein the number of the first difference is the same as the number of time periods included in the reference time period, and the time period corresponding to the minimum first difference is determined from the reference time period as the first target time period; if there are multiple time periods corresponding to the minimum first difference, a time period can be randomly selected from the multiple time periods corresponding to the minimum first differences as the first target time period, or a time period closest to the current moment can be selected from the multiple time periods corresponding to the minimum first differences as the first target time period.
[0111] When the reference time period includes at least two time periods, the second difference between the predicted memory size and the first memory size of each time period in the reference time period is calculated, wherein the number of the second difference values is the same as the number of time periods included in the reference time period, and a time period corresponding to the minimum second difference value is determined from the reference time period as the first target time period; if there are multiple time periods corresponding to the minimum second difference value, a time period can be randomly selected from the multiple time periods corresponding to the minimum second differences as the first target time period, or a time period closest to the current moment can be selected from the multiple time periods corresponding to the minimum second differences as the first target time period.
[0112] When the reference time period includes at least two time periods, a first difference between the predicted number of core operations of the CPU and the first number of core operations in each time period in the reference time period is calculated, wherein the number of the first difference is the same as the number of time periods included in the reference time period, and a second difference between the predicted memory size and the first memory size in each time period in the reference time period is calculated, wherein the number of the second difference is the same as the number of time periods included in the reference time period; a time period in which the first difference is the smallest and the second difference is also the smallest is determined from the reference time period as the first target time period; if there are multiple time periods in which the first difference is the smallest and the second difference is also the smallest, a time period can be randomly selected from the multiple time periods as the first target time period, or a time period closest to the current moment can be selected from the multiple time periods as the first target time period.
[0113] In other embodiments of the present application, after the distributed system executes step 305 or step 306, it may choose to execute steps 307 to 309, or steps 307 to 308 and step 310:
[0114] Step 307: If the resource reference information does not match the resource information corresponding to the first preset number of time periods in the predicted resource allocation information, obtain resource occupancy information when executing the target task in the first preset number of time periods in the current time period.
[0115] Step 308: predict resource occupancy information using the trained resource occupancy prediction model to obtain predicted resource occupancy information.
[0116] The predicted resource occupancy information includes resource occupancy information predicted for a first preset number of time periods in a next time period adjacent to the current time period.
[0117] Step 309: If the resource reference information matches the resource information corresponding to the second target time period in the predicted resource occupancy information, it is determined that the task to be executed is executed within the second target time period.
[0118] Step 310: If the resource reference information does not match the resource information corresponding to the first preset number of time periods in the predicted resource occupancy information, a prompt message is generated and displayed.
[0119] The prompt information is used to remind the user that the distributed system is fully loaded and needs to be expanded.
[0120] In an embodiment of the present application, the prompt information can be displayed in a specific display area corresponding to the distributed system to provide prompts to the user.
[0121] In other embodiments of the present application, before the distributed system executes step 301, refer to Figure 4 As shown, steps 311 to 312 may also be performed:
[0122] Step 311: If it is determined that the distributed system currently provides distributed services for the user, collect a first preset number of resource allocation information and a first preset number of resource occupancy information.
[0123] Step 312: Store a first preset number of resource allocation information and a first preset number of resource occupancy information into a target storage area.
[0124] In other embodiments of the present application, before the distributed system executes step 302, refer to Figure 5 As shown, it is also used to execute steps 313 to 314:
[0125] Step 313: Obtain a second preset number of groups of first historical resource allocation information within a first historical time period and second historical resource allocation information within a second historical time period.
[0126] The first historical time period is adjacent to the second historical time period, and the second historical time period is after the first historical time period.
[0127] Step 314: Based on the first historical resource allocation information and the second historical resource allocation information, a preset model is trained to obtain a resource allocation prediction model.
[0128] In the embodiment of the present application, a preset model can be used to predict the first historical resource allocation information, and the obtained prediction result and the second historical resource allocation information are used to perform error calculation, and the coefficients of the preset model are feedback-adjusted according to the obtained error until the error meets the preset requirements, thereby outputting a resource allocation prediction model. It should be noted that steps 313 to 314 can also be performed separately, or before any step before step 301.
[0129] Based on the above embodiments, the present application provides a distributed system. Figure 6 As shown, the distributed system B includes an indicator collection module B1, a distribution scheduling module B2 and an indicator storage module B3; wherein the indicator collection module B1 is used to collect the real-time resources of each node in the distributed system, usually mainly the usage of CPU and memory and the allocated resources allocated to each task when each node executes each task, and write the collected real-time resources and allocated resources into the indicator storage module of the distributed system. The indicator collection module B1 has a corresponding copy running on each node in the distributed system. The indicators collected by the indicator collection module B1 are mainly used for drawing a profile of the resource usage of the distributed system. The indicator collection module B1 can be implemented as follows Figure 7 The steps shown include:
[0130] Step b1, start.
[0131] Step b2: The indicator collection module B1 is currently in the awake state.
[0132] Step b3, the indicator collection module B1 determines whether the distributed scheduling module B2 is currently providing services to the user. If the distributed scheduling module B2 is not currently providing services to the user, step b4 is selected for execution; if the distributed scheduling module B2 is currently providing services to the user, step b5 is executed.
[0133] Step b4, the indicator collection module B1 determines whether the indicator collection module B1 receives the stop collection instruction sent by the user. If the indicator collection module B1 receives the stop collection instruction, step b10 is executed, that is, the indicator collection module B1 stops collecting the current resource usage of the distributed scheduling module, otherwise step b6 is executed.
[0134] Step b5: After the indicator collection module B1 collects all current resource information of the distributed scheduling module B2, step b7 is executed.
[0135] Step b6: the indicator collection module B1 enters a dormant state, waits to be reawakened, and executes step b2 after being awakened.
[0136] Step b7: The indicator collection module B1 publishes all collected resource information to the distributed scheduling module B2, and then executes step b8.
[0137] The indicator collection module B1 may use a remote procedure call (RPC) to implement the process of publishing resource information to the distributed scheduling module B2.
[0138] Step b8, the indicator collection module B1 determines whether the release is successful. If the release is successful, execute step b4; if the release fails, execute step b9.
[0139] Among them, after the distributed scheduling module B2 receives the resource information released by the indicator collection module B1, it stores the resource information in the indicator storage module B3. If the distributed scheduling module B2 successfully stores the resource information in the indicator storage module B3, it feeds back the indication information of successful release to the indicator collection module B1. If the distributed scheduling module B2 fails to successfully store the resource information in the indicator storage module B3, it feeds back the indication information of failed release to the indicator collection module B1.
[0140] Step b9, the indicator collection module B1 determines whether the current number of publications exceeds the preset maximum number of publications. If the current number of publications exceeds the preset maximum number of publications, execute step b4; if the current number of publications does not exceed the preset maximum number of publications, execute step b7.
[0141] Step b10: the index collection module B1 ends the operation.
[0142] When the distributed scheduling module B2 stores the resource information in the indicator storage module B3, the resource information can be stored in the form of a matrix. For example, assuming that the set of tasks executed within a certain time period is recorded as {job1, job2, ..., job m}, that is, the total number of tasks executed in this time period is m. Correspondingly, this time period can be divided into n time periods according to the duration of executing each task, recorded as {t1, t2, ..., tn}. The corresponding resource information takes computing resources, i.e., the number of CPU core operations and memory resources, i.e., the size of the above-mentioned memory, as examples. The number of CPU core operations can be represented by cpu, and the memory resource is memory. Therefore, the corresponding resource information representation matrix includes two, using matrix (cpu) to represent the CPU core operation matrix, and using matrix (memory) to represent the CPU core operation matrix. Correspondingly, matrix (cpu) is recorded as: Matrix(memory) is recorded as:
[0143] Among them, cpu ij Represented as a task job i The CPU allocated in the tj period. The CPU allocated here is not the CPU used to execute the job. i The actual CPU consumption is not the CPU that the distributed scheduling module pre-allocates to the task job when scheduling the task execution. i CPU resources. Assume that the distributed scheduling module pre-allocates the CPU resources to the user task job. i The CPU resource is c, and the corresponding task job i The time period for task execution is from tL to tP (tL≤tP), which can be expressed as:
[0144] Correspondingly, memory ij Indicates the task job i In t j The memory allocated in the time period is not the memory allocated in the task job. i In t j The actual memory usage when scheduling tasks is not the actual memory usage when scheduling tasks, but the memory allocated to the task job in advance by the distributed scheduling module when scheduling tasks. i Assume that the distributed system pre-allocates memory resources to the task job i The memory resource is m, and the time period for task execution is tP (tL≤tP), which can be expressed as:
[0145]
[0146] In this way, the distributed scheduling module can use the trained resource allocation prediction model to predict the allocation resource matrix (cpu) and matrix (memory) collected in the current time period, and predict the allocation resources for the next time period.
[0147] Among them, the trained resource allocation prediction model can be Figure 8 The steps shown are to achieve this:
[0148] Step c1, start.
[0149] Step c2: construct an initial prediction model.
[0150] The initial prediction model can be a wavelet neural network algorithm model, and the output of the wavelet neural network algorithm model can be expressed as follows: y(k) = ∑w ik h(i), where w ik is the weight, and h(i) is the hidden layer output. Because what needs to be predicted is the allocation of resources, not the actual resource consumption, so w ik It can be set to a constant. In the embodiment of the present application, Mexican Hat (mexh) can be used as the wavelet basis function.
[0151] Step c3: Obtain the CPU value and memory value allocated to tasks in different time periods within two consecutive time periods.
[0152] Step c4: using the initial prediction model, predict the allocated CPU value and the allocated memory value in the previous time period of two consecutive time periods to obtain the predicted CPU value and the predicted memory value for the next time period.
[0153] Step c5, calculating a CPU error between the predicted CPU value and the CPU value in the later time period of two consecutive time periods, and a memory error between the predicted memory value and the memory value in the later time period of two consecutive time periods.
[0154] Step c6: Determine whether the CPU error and the memory error are within the expected range.
[0155] Step c7: If the CPU error and the memory error are within the expected range, the trained resource allocation prediction model is obtained and step c9 is executed.
[0156] Step c8: If the CPU error and the memory error are not within the expected range, the adjustable coefficients of the initial prediction model are optimized according to the CPU error and the memory error to obtain an optimized prediction model. Then, the operations of steps c3 to c6 are repeated using the optimized prediction model until a trained resource allocation prediction model is obtained.
[0157] Step c9, end.
[0158] It should be noted that the way in which the distributed scheduling module B2 stores resource occupancy information of different time periods and time periods can refer to the matrix form of the resource allocation information of different time periods and time periods mentioned above, which will not be described in detail here. And the process of obtaining the trained resource occupancy prediction model can refer to steps c1 to c9, wherein the allocated CPU value and the allocated memory value in step c3 need to be replaced with the corresponding actual occupied CPU value and actual occupied memory value.
[0159] In this way, assuming that there are currently two tasks running in the distributed scheduling module, and the corresponding time period can be divided into two time intervals, the allocated CPU value and allocated memory value in the current time period are predicted by the trained resource allocation prediction model, and the generated predicted allocated CPU value is and the predicted allocated memory value is The CPU in m1(cpu) 11 =2 means that 2 CPU cores can be allocated in time period t1, and the memory in m1 (memory) 11 =2 means that 2G of memory can be allocated within time period t1.
[0160] The trained resource occupancy prediction model is used to predict the CPU usage and memory usage values in the current time period. The generated predicted CPU usage value is and the predicted memory usage is Among them, the CPU in m2(cpu) 11 =1 means that when executing tasks in time period t1, 1 CPU core is actually used, and the memory in m2 (memory) 11 =1 means that 1G of memory is actually used when executing the task in time period t1.
[0161] Assume that the resource information required by a task is (2G, 4 cores). First, determine whether m1(cpu) and m1(memory) meet (2G, 4 cores). From m1(cpu), we can determine the cpu 11 and cpu 22 Both meet the 2G requirement, but the memory in m1 (memory) 11and memory 22 Both do not meet the requirement of 4 cores, therefore, it can be determined that m1(cpu) and m1(memory) do not meet (2G, 4 cores); then continue to judge whether m2(cpu) and m2(memory) meet (2G, 4 cores); from m2(cpu), it can be determined that cpu22 meets the requirement of 2G, but memory11 and memory22 in m2(memory) do not meet the requirement of 4 cores, therefore, it can be determined that m2(cpu) and m2(memory) do not meet the requirement of (2G, 4 cores), that is, the task requiring resource information of (2G, 4 cores) cannot be executed within the time period t1 and the time period t2, indicating that the system resources are already fully loaded and the system needs to be expanded.
[0162] It should be noted that, for the description of the same steps and the same contents in this embodiment as those in other embodiments, reference can be made to the description in other embodiments and will not be repeated here.
[0163] The embodiment of the present application provides a task allocation method, which obtains resource allocation information allocated for a first preset number of time periods in the current time period, predicts the resource allocation information through a trained resource allocation prediction model, obtains predicted resource allocation information, and determines the resource reference information required for the task to be executed in the next time period. If the resource reference information matches the resource information corresponding to the first target time period in the predicted resource allocation information, it is determined that the task to be executed is executed in the first target time period. In this way, the predicted resource allocation information that can be allocated in each time period in the next time period is first determined by a prediction method, and then if it is determined from the predicted resource allocation information that the resource information in the first target time period included in the predicted resource allocation information matches the resource reference information sequenced for the task to be executed, the task to be executed is allocated to be executed in the first target time period, which solves the current problem of poor flexibility in resource allocation, proposes a technical solution for dynamic resource allocation, and dynamically determines the task execution time, effectively enriches the allocation scheme for distributed task execution, and improves the intelligence of the allocation scheme. By predicting the execution time period of each task to be executed, fairness between each task to be executed is effectively guaranteed, ensuring that each task to be executed can be executed, and accurately reflecting the real-time resource occupancy; and effectively proposing a prompt method for the distributed system to expand its capacity.
[0164] Based on the above embodiments, the embodiments of the present application provide a task allocation device, which can be applied to Figures 1 to 5 In the task allocation method provided in the corresponding embodiment, the device is used to run a distributed system, referring to Fig. 9As shown, the task allocation device 4 may include: a first acquisition unit 41, a prediction unit 42, a determination unit 43 and a processing unit 44, wherein:
[0165] A first acquisition unit 41 is used to acquire resource allocation information allocated to a first preset number of time periods in a current time period; wherein the current time period is divided into a first preset number of time periods, and each time period is used to execute a target task;
[0166] The prediction unit 42 is used to predict the resource allocation information by using the trained resource allocation prediction model to obtain the predicted resource allocation information; wherein the predicted resource allocation information includes the resource information predicted to be allocated for a first preset number of time periods of the next time period adjacent to the current time period;
[0167] A determination unit 43, used to determine resource reference information required for a task to be executed in a next time period;
[0168] The processing unit 44 is configured to determine that the task to be executed is executed within the first target time period if the resource reference information matches the resource information corresponding to the first target time period in the predicted resource allocation information.
[0169] In other embodiments of the present application, refer to Fig.10 As shown, the task processing device further includes: a second acquisition unit 45; wherein:
[0170] The second acquisition unit 45 is further configured to acquire resource occupancy information when executing the target task in the first preset number of time periods in the current time period if the resource reference information does not match the resource information corresponding to the first preset number of time periods in the predicted resource allocation information;
[0171] The prediction unit 42 is further configured to predict the resource occupancy information by using a trained resource occupancy prediction model to obtain predicted resource occupancy information; wherein the predicted resource occupancy information includes resource information predicted to be occupied by a first preset number of time periods of a next time period adjacent to the current time period;
[0172] The processing unit 44 is further configured to determine that the task to be executed is executed within the second target time period if the resource reference information matches the resource information corresponding to the second target time period in the predicted resource occupancy information.
[0173] In other embodiments of the present application, the processing unit 44 is also used to generate and display a prompt message if the resource reference information does not match the resource information corresponding to the first preset number of time periods in the predicted resource occupancy information; wherein the prompt message is used to prompt the user that the distributed system is fully loaded and needs to be expanded.
[0174] In other embodiments of the present application, the resource reference information includes at least the first core operation quantity and the first memory size of the central processing unit CPU, and the processing unit 44 includes: a determination module and a processing module; wherein:
[0175] A determination module, configured to determine, from the predicted resource allocation information, a reference time period in which the predicted number of core operations of the CPU is greater than or equal to the first number of core operations and the predicted memory size is greater than or equal to the first memory size;
[0176] a processing module, configured to determine, if the reference time period includes a time period, that the reference time period is a first target time period, and to determine that the task to be executed is executed within the first target time period;
[0177] The processing module is further configured to, if the reference time period includes at least two time periods, determine a time period from the reference time period as a first target time period, and determine that the task to be executed is executed within the first target time period.
[0178] In other embodiments of the present application, the processing module is used to perform the steps of: if the reference time period includes at least two time periods, when determining a time period from the reference time period as the first target time period, it can be implemented by the following steps:
[0179] If the reference time period includes at least two time periods, a time period closest to the current time period is determined from the reference time period as the first target time period;
[0180] Alternatively, if the reference time period includes at least two time periods, based on a first difference between the predicted number of core operations of the CPU in each time period in the reference time period and the first number of core operations, and a second difference between the predicted memory size in each time period in the reference time period and the first memory size, a time period with the smallest first difference and / or the smallest second difference is determined from the reference time period as the first target time period.
[0181] In other embodiments of the present application, refer to Fig.10 As shown, before the first acquisition unit 41, the task allocation device further includes: a collection unit 46 and a storage unit 47; wherein:
[0182] A collecting unit 46 is configured to collect a first preset number of resource allocation information and a first preset number of resource occupancy information if it is determined that the distributed system currently provides a distributed service for the user;
[0183] The storage unit 47 is used to store a first preset number of resource allocation information and a first preset number of resource occupancy information in a target storage area.
[0184] In other embodiments of the present application, refer to Fig.10As shown, before the prediction unit 42, the task allocation device further includes: a model training unit 48; wherein:
[0185] The model training unit 48 is used to obtain the first historical resource allocation information in the first historical time period and the second historical resource allocation information in the second historical time period of the second preset number of groups; wherein the first historical time period is adjacent to the second historical time period, and the second historical time period is after the first historical time period;
[0186] The model training unit 48 is further used to perform model training on a preset model based on the first historical resource allocation information and the second historical resource allocation information to obtain a resource allocation prediction model.
[0187] It should be noted that the specific implementation process of the steps performed by the task allocation device in this embodiment can refer to Figures 1 to 5 The implementation process of the task allocation method provided in the corresponding embodiment will not be repeated here.
[0188] The embodiment of the present application provides a task allocation device, which obtains resource allocation information allocated for a first preset number of time periods in the current time period, predicts the resource allocation information through a trained resource allocation prediction model, obtains predicted resource allocation information, and determines the resource reference information required for the task to be executed in the next time period. If the resource reference information matches the resource information corresponding to the first target time period in the predicted resource allocation information, it is determined that the task to be executed is executed in the first target time period. In this way, the predicted resource allocation information that can be allocated in each time period in the next time period is first determined by a prediction method, and then if it is determined from the predicted resource allocation information that the resource information in the first target time period included in the predicted resource allocation information matches the resource reference information sequenced for the task to be executed, the task to be executed is allocated to be executed in the first target time period, which solves the current problem of poor flexibility in resource allocation, proposes a technical solution for dynamic resource allocation, and dynamically determines the task execution time, effectively enriches the allocation scheme for distributed task execution, and improves the intelligence of the allocation scheme. By predicting the execution time period of each task to be executed, fairness between each task to be executed is effectively guaranteed, ensuring that each task to be executed can be executed, and accurately reflecting the real-time resource occupancy; and effectively proposing a prompt method for the distributed system to expand its capacity.
[0189] Based on the above embodiments, the embodiments of the present application provide a task allocation device, which can be applied to Figures 1 to 5 In the task allocation method provided in the corresponding embodiment, the task allocation device is used to run the distributed system, referring to Fig.11As shown, the task allocation device 5 may include: a processor 51, a memory 52 and a communication bus 53, wherein:
[0190] A communication bus 53, used to realize the communication connection between the processor 51 and the memory 52;
[0191] The processor 51 is used to execute the task allocation program stored in the memory 52 to achieve Figures 1 to 5 The implementation process of the task allocation method provided in the corresponding embodiment will not be repeated here.
[0192] Based on the foregoing embodiments, the embodiments of the present application provide a computer-readable storage medium, referred to as a storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement reference Figures 1 to 5 The implementation process of the task allocation method provided in the corresponding embodiment will not be repeated here.
[0193] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of hardware embodiments, software embodiments, or embodiments in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.
[0194] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0195] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0196] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0197] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application.
Claims
1. A task allocation method, characterized in that: The method is applied to a distributed system, and the method comprises: Obtain resource allocation information allocated to a first preset number of time periods in a current time period; wherein the current time period is divided into the first preset number of time periods, each time period is used to execute a target task, and the resource reference information includes at least a first core computing number and a first memory size of a central processing unit CPU; The resource allocation information is predicted by a trained resource allocation prediction model to obtain predicted resource allocation information; wherein the predicted resource allocation information includes resource information predicted to be allocated for a first preset number of time periods of a next time period adjacent to the current time period; Determine resource reference information required for tasks to be performed within the next time period; If the resource reference information matches the resource information corresponding to the first target time period in the predicted resource allocation information, it is determined that the task to be executed is executed within the first target time period.
2. The method according to claim 1, characterized in that The method further comprises: If the resource reference information does not match the resource information corresponding to the first preset number of time periods in the predicted resource allocation information, obtaining resource occupancy information when the target task is executed in the first preset number of time periods in the current time period; The resource occupancy information is predicted by using a trained resource occupancy prediction model to obtain predicted resource occupancy information; wherein the predicted resource occupancy information includes resource information predicted to be occupied by a first preset number of time periods of a next time period adjacent to the current time period; If the resource reference information matches the resource information corresponding to the second target time period in the predicted resource occupancy information, it is determined that the task to be executed is executed within the second target time period.
3. The method according to claim 2, characterized in that The method further comprises: If the resource reference information does not match the resource information corresponding to the first preset number of time periods in the predicted resource occupancy information, a prompt message is generated and displayed; wherein the prompt message is used to prompt the user that the distributed system is fully loaded and needs to be expanded.
4. The method according to any one of claims 1 to 3, characterized in that: If the resource reference information matches the resource information corresponding to the first target time period in the predicted resource allocation information, determining that the to-be-executed task is executed within the first target time period includes: Determine, from the predicted resource allocation information, a reference time period in which the predicted number of core operations of the CPU is greater than or equal to the first number of core operations and the predicted memory size is greater than or equal to the first memory size; If the reference time period includes a time period, determining the reference time period as the first target time period, and determining that the task to be executed is executed within the first target time period; If the reference time period includes at least two time periods, a time period is determined from the reference time period as the first target time period, and the to-be-executed task is determined to be executed within the first target time period.
5. The method according to claim 4, characterized in that If the reference time period includes at least two time periods, determining a time period from the reference time period as the first target time period includes: If the reference time period includes at least two time periods, determining a time period closest to the current time period from the reference time period as the first target time period; Alternatively, if the reference time period includes at least two time periods, based on a first difference between the predicted number of CPU core operations in each time period in the reference time period and the first number of core operations, and a second difference between the predicted memory size in each time period in the reference time period and the first memory size, a time period in which the first difference is the smallest and / or the second difference is the smallest is determined from the reference time period as the first target time period.
6. The method according to claim 2, characterized in that Before obtaining resource allocation information allocated to a first preset number of time periods in the current time period, the method further includes: If it is determined that the distributed system currently provides distributed services for the user, collecting the first preset number of resource allocation information and the first preset number of resource occupancy information; The first preset number of resource allocation information and the first preset number of resource occupation information are stored in a target storage area.
7. The method according to claim 1, characterized in that Before predicting the resource allocation information by using the trained resource allocation prediction model to obtain the predicted resource allocation information, the method further includes: Acquire a second preset number of groups of first historical resource allocation information within a first historical time period and second historical resource allocation information within a second historical time period; wherein the first historical time period is adjacent to the second historical time period, and the second historical time period is after the first historical time period; Based on the first historical resource allocation information and the second historical resource allocation information, a preset model is trained to obtain the resource allocation prediction model.
8. A task allocation device, characterized in that: The device comprises: a first acquisition unit, a prediction unit, a determination unit and a processing unit; wherein: The first acquisition unit is used to acquire resource allocation information allocated to a first preset number of time periods in a current time period; wherein the current time period is divided into the first preset number of time periods, each time period is used to execute a target task, and the resource reference information includes at least a first core computing number and a first memory size of a central processing unit CPU; The prediction unit is used to predict the resource allocation information by using a trained resource allocation prediction model to obtain predicted resource allocation information; wherein the predicted resource allocation information includes resource information predicted to be allocated for a first preset number of time periods of a next time period adjacent to the current time period; The determining unit is used to determine the resource reference information required for the task to be executed in the next time period; The processing unit is configured to determine that the to-be-executed task is executed within the first target time period if the resource reference information matches the resource information corresponding to the first target time period in the predicted resource allocation information.
9. A task allocation device, characterized in that: The device comprises a memory, a processor and a communication bus; wherein: The memory is used to store executable instructions; The communication bus is used to realize the communication connection between the processor and the memory; The processor is used to execute the task allocation program stored in the memory to implement the steps of the task allocation method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium stores a task allocation program, which, when executed by a processor, implements the steps of the task allocation method according to any one of claims 1 to 7.
