Task execution time adjustment method and device, medium and product

By analyzing task execution time periods in the MPP database, the execution time of resource-sensitive tasks was adjusted to coincide with idle time periods, thus resolving resource contention and load imbalance issues and improving task execution efficiency and resource utilization.

CN121350084APending Publication Date: 2026-01-16LU ZE TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202511914947.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-18
Publication Date
2026-01-16

AI Technical Summary

Technical Problem

MPP databases suffer from resource contention and load imbalance issues in high-concurrency or periodic tasks, leading to low task execution efficiency.

Method used

By analyzing the task execution time periods, we can identify the task-intensive and task-idle time periods, and divide the resource-busy time periods according to resource utilization. We can then adjust the execution time of resource-sensitive tasks to the task-idle time periods.

Benefits of technology

It improves server resource utilization and task execution efficiency, reduces resource idleness and conflicts, and ensures that tasks are completed on time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121350084A_ABST
    Figure CN121350084A_ABST
Patent Text Reader

Abstract

The invention discloses a task execution time adjusting method and device, a medium and a product, and relates to the technical field of database management.The method comprises the steps that a task intensive time period and a task idle time period are determined from task execution time periods according to the number of executed tasks, the task execution time period is a preset time period for executing a timed task; determining a resource busy time period from the task execution time periods according to a resource utilization rate during task execution; determining resource sensitive tasks of which the execution time falls in the task intensive time period and the resource busy time period from the timed tasks; and adjusting the execution time of the resource sensitive task to the task idle time period. The task execution efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of database management technology, and in particular to a method, device, medium and product for adjusting task execution time. Background Technology

[0002] With the rapid development of cloud services and lightweight architectures, emerging Massively Parallel Processing (MPP) databases (such as ClickHouse, StarRocks, and Doris) are gradually replacing traditional Hadoop processing frameworks and becoming the mainstream choice for big data processing. While MPP databases improve query performance through parallel processing technology, they have significant shortcomings in resource management. For example, in high-concurrency or periodic tasks (such as daily data computation tasks at dawn), MPP databases are prone to resource contention and load imbalance.

[0003] Specifically, MPP databases are typically used to support daily business reports and data analysis. Computational tasks are often concentrated in the early morning hours (e.g., 1 AM to 7 AM) to ensure data preparation is completed before the workday begins. Existing MPP databases store a fixed schedule for task execution, which is followed by the execution of tasks. However, this results in idle server resources, reducing the overall efficiency of task execution. Summary of the Invention

[0004] The purpose of this application is to provide a method, device, medium, and product for adjusting task execution time, in order to solve the problem of low task execution efficiency described in the background art.

[0005] To achieve the above objectives, this application provides the following solution: Firstly, this application provides a method for adjusting task execution time, including: Based on the number of tasks to be executed, task-intensive periods and task-idle periods are determined from the task execution time periods, wherein the task execution time periods are predetermined time periods for executing scheduled tasks; Based on the resource utilization rate during task execution, determine the resource busy period from the task execution time period; From the scheduled tasks, identify resource-sensitive tasks whose execution times fall within both the task-intensive time period and the resource-busy time period; Adjust the execution time of the resource-sensitive task to the task's idle time period.

[0006] Optionally, determining the task-intensive time period and the task-idle time period from the task execution time period according to the number of tasks executed includes: Obtain historical task execution data for the task execution time period, the historical task execution data including the task identifier, start time and end time of each task executed within the task execution time period; Based on the task identifier, start time, and end time of each task, the task-intensive time period and the task-idle time period are determined.

[0007] Optionally, after determining the task-intensive time periods and task-idle time periods from the task execution time periods according to the number of tasks executed, the method further includes: Based on the resource utilization rate during task execution, a resource idle period is determined from the task-intensive period and denoted as the intensive idle period. The resource idle period and the resource busy period do not overlap. From the scheduled tasks, identify resource-insensitive tasks whose execution times fall within both the task-intensive time period and the resource-busy time period; Adjust the execution time of the resource-insensitive tasks to the intensive-idle time period.

[0008] Optionally, determining the resource busy period from the task execution time based on the resource utilization rate during task execution includes: The task execution time period is divided into multiple sub-time periods; Determine the CPU utilization and memory utilization for each of the sub-time periods; When the CPU utilization rate is greater than or equal to the first preset utilization rate, or the memory utilization rate is greater than or equal to the second preset utilization rate, the sub-time period is determined to be a resource busy time period. When the CPU utilization rate is less than the third preset utilization rate and the memory utilization rate is less than the fourth preset utilization rate, the sub-time period is determined to be a resource idle time period, wherein the third preset utilization rate is less than or equal to the first preset utilization rate and the fourth preset utilization rate is less than or equal to the second preset utilization rate.

[0009] Optionally, determining the resource busy period from the task execution time based on the resource utilization rate during task execution can also be achieved through the following methods: The task execution time period is divided into multiple sub-time periods; Determine the CPU utilization and memory utilization for each of the sub-time periods; The CPU utilization and memory utilization of each sub-time period are sent to the K-means clustering model so that the K-means clustering model outputs the clustering results of the CPU utilization and memory utilization of each sub-time period, and the clustering results include resource busy time periods and resource idle time periods. For each sub-time period, if the CPU utilization or memory utilization is clustered into a resource busy time period, then the sub-time period is determined to be a resource idle time period; otherwise, it is determined to be a resource idle time period.

[0010] Optionally, determining the resource busy period from the task execution time based on the resource utilization rate during task execution can also be achieved through the following methods: The historical data corresponding to the first time period is sent to the ARIMA model so that the ARIMA model can output the first CPU utilization rate and the first memory utilization rate for future days. The first time period is the time period included in the task execution time period, and the duration of storing the historical data is greater than or equal to the first predetermined duration. The historical data includes CPU utilization rate and memory utilization rate. The historical data corresponding to the second time period is sent to the LSTM model so that the LSTM model outputs the second CPU utilization rate and the second memory utilization rate for future days. The second time period is the time period included in the task execution time period, and the storage duration of the historical data is less than the second predetermined duration. The historical data includes CPU utilization rate and memory utilization rate. The first predetermined duration is longer than the second predetermined duration. The average utilization of the CPU is obtained by determining the weighted average of the first CPU utilization and the second CPU utilization. The weighted average of the first memory utilization rate and the second memory utilization rate is determined to obtain the average memory utilization rate; For the first time period and the second time period, if the average CPU utilization is greater than or equal to the first preset average utilization, or the average memory utilization is greater than or equal to the second preset average utilization, the corresponding time period is determined to be a resource busy time period; otherwise, it is determined to be a resource idle time period.

[0011] Optionally, the resource-sensitive task is determined by the following method: Determine the base execution time of the task, which is the execution time of the task under conditions of no resource contention; The non-basic execution time of a task is determined, wherein the non-basic execution time is the execution time of the task when the CPU utilization rate is greater than a first predetermined utilization rate, or the memory utilization rate is greater than or equal to a second predetermined utilization rate; When the quotient of the non-basic execution time divided by the basic execution time is greater than a predetermined value, the task is determined to be a resource-sensitive task.

[0012] In a second aspect, this application provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method described in any one of the first aspects above.

[0013] Thirdly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in any one of the first aspects above.

[0014] Fourthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the method described in any one of the first aspects above.

[0015] According to the specific embodiments provided in this application, the following technical effects are disclosed: The task execution time adjustment method provided in this application first determines the task-intensive period and the task-idle period; then it determines the resource-busy period; and finally, it adjusts the execution time of resource-sensitive tasks that fall within both the task-intensive and resource-busy periods to the task-idle period. In contrast, existing technologies rely on fixed schedules for task execution, leading to slow execution speeds during peak periods and resource idleness during off-peak periods. Therefore, compared to existing technologies, the embodiments provided in this application can solve the problem of uneven resource allocation in existing technologies, improving server utilization and task execution efficiency. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This is a diagram illustrating the application environment of the task execution time adjustment method in one embodiment of this application. Figure 2 A flowchart illustrating a task execution time adjustment method provided in an embodiment of this application; Figure 3 A flowchart illustrating a task execution time adjustment method provided in an embodiment of this application; Figure 4 A schematic diagram of a timed task and its dependent tasks provided in an embodiment of this application; Figure 5A flowchart illustrating a method for determining a task-intensive rush period and a task-idle period, provided in an embodiment of this application; Figure 6 A flowchart illustrating a task execution time adjustment method provided in an embodiment of this application; Figure 7 This is a schematic diagram illustrating the division of task execution time periods according to an embodiment of this application; Figure 8 A flowchart illustrating a method for determining resource busy periods and resource idle periods according to an embodiment of this application; Figure 9 A flowchart illustrating another method for determining resource busy time periods and resource idle time periods provided in an embodiment of this application; Figure 10 A flowchart illustrating another method for determining resource busy time periods and resource idle time periods provided in an embodiment of this application; Figure 11 A flowchart illustrating a method for determining resource-sensitive tasks according to an embodiment of this application; Figure 12 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0018] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0019] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the contents of this application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0020] This application provides an environment in which the task execution time adjustment method can be applied. See also... Figure 1 The application environment includes terminals and servers.

[0021] The data storage system stores the data that the server needs to process. This system can be set up independently, integrated into the server, or located in the cloud or on another server. Furthermore, the data storage system stores relevant data required for the task execution time adjustment method. This includes historical task execution data from the server, such as task execution time periods, task-intensive time periods, task-idle time periods, resource-busy time periods, and resource-idle time periods. The data storage system also stores intermediate data generated during the execution of the task execution time adjustment method, allowing for timely retrieval when needed.

[0022] In this system, the terminal communicates with the server via a network. The terminal can send data to be processed to the server. After receiving the data, the server can store it and retrieve it from the storage location when processing is needed, or it can perform the processing task while storing the data. The server can then provide feedback on the adjustments made to the terminal.

[0023] In addition, in some embodiments, the task execution time adjustment method can also be implemented by the server or the terminal alone. For example, the terminal can directly execute the task execution time adjustment method, or the server can obtain the data to be processed from the data storage system and adjust the task execution time for the data to be processed.

[0024] The terminals can be, but are not limited to, various desktop computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, and smart in-vehicle devices. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices. Servers can be implemented using independent servers, server clusters composed of multiple servers, or cloud servers.

[0025] In one exemplary embodiment, see Figure 2 and Figure 3 As shown, a method for adjusting task execution time is provided. This method is executed by a computer device, specifically by a terminal or server alone, or by both a terminal and a server. In this embodiment, the method is applied to... Figure 1 Taking the server in the example, the following steps 101 to 104 are used as an example: Step 101: Based on the number of tasks to be executed, determine the task-intensive time period and the task-idle time period from the task execution time period, wherein the task execution time period is a predetermined time period for executing timed tasks; A scheduled task is a task that executes at a fixed time. This fixed time can be a specific time each day, such as starting at 1 AM, 2 AM, and 3 AM every day, or it can be another regular fixed time, such as starting at a specific time every Monday. Furthermore, a scheduled task can have dependent tasks; the scheduled task depends on these dependent tasks, and the scheduled task can only execute after the dependent tasks have completed. For example, see [link to example]. Figure 4 The codes in the diagram are task codes. For timed task 2214, there are three dependent tasks: 1246, 1439 and 2212. For task 774, there are three dependent tasks: 1246, 2528 and 1983. For task 543, there are three dependent tasks: 1246, 2528 and 2654.

[0026] Furthermore, during the entire task execution period, the tasks executed may be scheduled tasks or dependent tasks of those scheduled tasks. Therefore, the tasks in "according to the number of tasks executed" in step 101 include both scheduled tasks and dependent tasks.

[0027] In addition, although the scheduled task starts execution at a fixed time, the start execution time of the scheduled task in this application will also fluctuate slightly because the scheduled task depends on its dependent tasks, and the execution time of the dependent tasks may fluctuate.

[0028] Furthermore, fixed tasks can be concentrated in a certain time period each day, for example, daily tasks can be concentrated in the time period from 1 a.m. to 7 a.m.

[0029] Optionally, the time period in which the number of tasks executed is greater than or equal to a first predetermined number is designated as a task-intensive time period; the time period in which the number of tasks executed is less than a second predetermined number is designated as a task-idle time period. Further, the first predetermined number is greater than or equal to the second predetermined number.

[0030] Furthermore, the first and second predetermined quantities can be empirical values, for example, the first predetermined quantity is equal to the second predetermined quantity, and is set to 5.

[0031] The task execution time period can be set according to actual needs. For example, if the scheduled task is a daily task, the execution time period is usually from 1 a.m. to 7 a.m., then the task execution time period is set to 1 a.m. to 7 a.m.

[0032] In addition, only one service is deployed on a single server, and one service corresponds to multiple scheduled tasks.

[0033] Furthermore, the task-intensive time period and the task-idle time period do not overlap, and the sum of these two time periods is the task execution time period.

[0034] In addition to the periods of high task intensity and low task availability, this application may also include other time periods, such as the period of moderate task availability, during which tasks are neither high nor low.

[0035] Step 102: Determine the resource busy period from the task execution time according to the resource utilization rate during task execution; Similarly, the tasks in "according to resource utilization when executing tasks" in step 102 include both scheduled tasks and dependent tasks.

[0036] The resources include the server's CPU and memory.

[0037] The "busy resource period" refers to a time when resource utilization is high. Furthermore, the busy resource period is the time when CPU and memory utilization reach predetermined requirements. The process for determining the busy resource period can be found in the following description and will not be elaborated upon here.

[0038] Furthermore, the criteria for dividing resource busy periods, task-intensive periods, and task idle periods are different. They are derived by using different criteria to divide task execution time periods. Therefore, there will be some overlap between resource busy periods, task-intensive periods, and task idle periods.

[0039] In addition, this application uses a node in an MPP database cluster as an example for illustration, where a node is a single server or computing unit in the MPP database cluster.

[0040] In actual use, a data collection service is deployed on each node of the MPP database cluster, configured with a collection interval of 1 minute, continuously collecting CPU and memory data, primarily CPU and memory usage. The collected data is then stored in a time-series database.

[0041] For example, the table below contains data collected on October 11, 2025.

[0042] Table 1 Example of resource data

[0043] In addition, data acquisition is typically performed by acquisition services or software programs deployed locally on each MPP database node. These acquisition services are responsible for periodically collecting node resource usage data, such as CPU utilization and memory utilization, and sending this data to a central time-series database for storage and analysis. Specifically, the acquisition process does not rely on specific hardware devices, but rather on software programs running on the nodes to achieve data acquisition and transmission.

[0044] Step 103: Identify resource-sensitive tasks from the scheduled tasks whose execution times fall within both the task-intensive time period and the resource-busy time period. The determination of whether a task is a resource-sensitive task is related to the degree of influence of resource utilization on task execution time. When the degree of influence is greater than the preset condition, it is a resource-sensitive task; when the degree of influence is less than the preset condition, it is a resource-insensitive task.

[0045] Step 104: Adjust the execution time of the resource-sensitive task to the idle time period of the task.

[0046] Since there are very few tasks during the idle period, resources are basically not utilized. Therefore, the idle period can be considered a resource-idle period, and the resource-idle state can be maintained stably. So, the execution time of resource-sensitive tasks is adjusted to this period to ensure that resource-sensitive tasks can be executed stably.

[0047] This embodiment adjusts the execution time of resource-sensitive tasks that occur during both peak and resource-intensive periods to off-peak periods, thereby improving the execution efficiency of these resource-sensitive tasks and the overall execution efficiency of scheduled tasks. It also improves the balance and utilization of resources.

[0048] In addition, this application has the following advantages: Improve resource utilization: By monitoring and predicting in real time, avoid server resource idleness or overload, and improve the overall performance of MPP database.

[0049] Enhance task reliability: Dynamically adjust task execution time, reduce resource conflicts, lower the risk of task failure, and ensure that computing tasks are completed on time in the early morning.

[0050] High degree of automation: Reduces manual configuration costs and adapts to the elastic needs of cloud environments.

[0051] High versatility: Applicable to various MPP databases (such as ClickHouse, StarRocks, etc.) and easy to integrate into existing systems.

[0052] Optionally, see Figure 5In another exemplary embodiment of this application, step 101 includes steps 201 and 202: Step 201: Obtain historical task execution data for the task execution time period. The historical task execution data includes the task identifier, start time, and end time of each task executed within the task execution time period. The tasks executed during the task execution period include scheduled tasks, dependent tasks, and all other tasks.

[0053] Step 202: Based on the task identifier, start time, and end time of each task, determine the task-intensive time period and the task-idle time period.

[0054] For each task executed, the start and end times of the task are marked in the task execution time period. This allows us to determine the time period in which the number of tasks executed is greater than or equal to a first predetermined number, which is called the task-intensive time period. We can also determine the time period in which the number of tasks executed is less than a second predetermined number, which is called the task-idle time period. Thus, we can determine the task-intensive time period and the task-idle time period from the task execution time period.

[0055] Furthermore, historical task execution data is obtained by reading the system logs of the MPP database to retrieve historical task execution information, such as task ID, actual start time, actual end time, execution duration, and status. This data is then synchronized to the time-series database. For example, the collected data is shown in Table 2 below.

[0056] Table 2 Historical mission execution data as of October 11, 2025

[0057] Optionally, see Figure 6 In another exemplary embodiment of this application, after step 101, the method further includes the following steps 301 to 303: Step 301: Based on the resource utilization rate during task execution, determine the resource idle time period from the task-intensive time period and record it as the intensive idle time period. The resource idle time period and the resource busy time period do not overlap. Similarly, the tasks in "according to the resource utilization rate when executing the task" in step 301 include both scheduled tasks and dependent tasks.

[0058] The idle resource period refers to the period when resource utilization is low. The process for determining the idle resource period can be found in the relevant description below, and will not be repeated here.

[0059] Furthermore, for details regarding the division of each time period, please refer to [link / reference]. Figure 7 .

[0060] Step 302: Determine from the scheduled tasks resource-insensitive tasks whose execution time falls within both the task-intensive time period and the resource-busy time period; Step 303: Adjust the execution time of the resource-insensitive task to the intensive-idle time period.

[0061] Since resource-insensitive tasks are less sensitive to resources, the execution time of resource-insensitive tasks during peak task and resource-busy periods is adjusted to peak task but resource-slack periods. This ensures the smooth execution of resource-insensitive tasks, and even if there are occasional resource-busy periods during peak task periods, the impact on the execution of resource-insensitive tasks is small, while also improving resource balance and utilization.

[0062] Optionally, see Figure 8 In another exemplary embodiment of this application, step 102 includes steps 401 to 404: Step 401: Divide the task execution time period into multiple sub-time periods; Each sub-time period has the same duration, which can be determined based on experience, for example, by setting it to 5 minutes.

[0063] Step 402: Determine the CPU utilization and memory utilization for each of the sub-time periods; The CPU utilization rate can be the average CPU utilization rate for that sub-period. The memory utilization rate can be the average memory utilization rate for that sub-period.

[0064] In this application, CPU utilization and memory utilization can be collectively referred to as resource utilization.

[0065] CPU utilization and memory utilization can be calculated using existing technologies, which will not be detailed here.

[0066] Step 403: When the CPU utilization rate is greater than or equal to the first preset utilization rate, or the memory utilization rate is greater than or equal to the second preset utilization rate, the sub-time period is determined to be a resource busy time period. The first and second preset usage rates can be empirical values, for example, both the first and second preset usage rates can be set to 0.8.

[0067] The content described in step 403 refers to the predetermined requirements for CPU utilization and memory utilization that need to be achieved.

[0068] Step 404: When the CPU utilization rate is less than the third preset utilization rate and the memory utilization rate is less than the fourth preset utilization rate, the sub-time period is determined to be a resource idle time period, wherein the third preset utilization rate is less than or equal to the first preset utilization rate and the fourth preset utilization rate is less than or equal to the second preset utilization rate.

[0069] The third and fourth preset usage rates can be empirical values, for example, both the third and fourth preset usage rates can be set to 0.8.

[0070] In addition to busy resource periods and idle resource periods, this application may also include other time periods, such as moderate resource periods, during which resources are neither busy nor idle.

[0071] Optionally, see Figure 9 In another exemplary embodiment of this application, step 102 can also be implemented by the following steps 501 to 504: Step 501: Divide the task execution time period into multiple sub-time periods; Step 502: Determine the CPU utilization and memory utilization for each of the sub-time periods; Step 503: Send the CPU utilization and memory utilization of each sub-time period to the K-means clustering model so that the K-means clustering model outputs the clustering results of the CPU utilization and memory utilization of each sub-time period, the clustering results including resource busy time periods and resource idle time periods; Furthermore, for the K-means optimization model: Input characteristics: Average CPU and memory usage per hour (two-dimensional data).

[0072] Steps: Randomly initialize two cluster centers (busy and idle), iteratively calculate the distance from each data point to the cluster center, and reallocate the cluster centers until convergence.

[0073] The distance formula uses Euclidean distance, denoted as d.

[0074] Here, a and b are weighting coefficients, because different server configurations have different pressures on memory and CPU; the values ​​of a and b can be empirical values.

[0075] Where CPU1 and CPU2 represent the CPU utilization at any two points in time, and MEN1 and MEN2 represent the memory utilization at any two points in time. For example, see Table 3 below.

[0076] Table 3. Cluster data busy / idle time labeling on October 11, 2025

[0077] Step 504: For each sub-time period, if the CPU utilization or memory utilization is clustered into a resource busy time period, then the sub-time period is determined to be a resource idle time period; otherwise, it is determined to be a resource idle time period.

[0078] The determination of the resource busy time period described in step 504 is the predetermined requirement for the aforementioned CPU utilization and memory utilization to be achieved.

[0079] Optionally, see Figure 10 In another exemplary embodiment of this application, step 102 can also be implemented by the following steps 601 to 605: Step 601: Send the historical data corresponding to the first time period to the ARIMA model so that the ARIMA model outputs the first CPU utilization rate and the first memory utilization rate for future days. The first time period is the time period included in the task execution time period, and the duration of storing the historical data is greater than or equal to the first predetermined duration. The historical data includes the CPU utilization rate and the memory utilization rate. The future date can be determined based on the actual situation; for example, it can be the day after the current time or several days after the current time.

[0080] Among them, the ARIMA (Autoregressive Integral Moving Average) model is mainly responsible for long-term predictions, so the first preset time period is generally quite long. The first preset time period can be an empirical value, for example, the first preset time period is one year.

[0081] For example, if there is at least one year of historical data on CPU and memory usage between 1 a.m. and 2 a.m., this data can be sent to the ARIMA model for prediction.

[0082] Furthermore, the ARIMA model is applicable to stationary time series. The model comprises autoregressive (AR), differencing (I), and moving average (MA) components. The model execution steps are as follows: Check the stationarity of the sequence (using the ADF test); if it is not stationary, perform differencing (d times). Determine the AR order (p) and MA order (q) using ACF and PACF plots; ARIMA(p, d, q) model formula: Where d is the difference order, p is the AR order, q is the MA order, and p, d, and q can be empirical values; θ is the moving average coefficient, and B is the lag operator; For random shocks or white noise at time t, it represents the part that the model cannot explain. It is usually assumed to have a mean of 0, a constant variance, and to be independent of each period.

[0083] Prediction: Fit the model using maximum likelihood estimation and predict future values.

[0084] Step 602: Send the historical data corresponding to the second time period to the LSTM model so that the LSTM model outputs the second CPU utilization rate and the second memory utilization rate for future days. The second time period is the time period included in the task execution time period, and the storage duration of the historical data is less than the second predetermined duration. The historical data includes CPU utilization rate and memory utilization rate. The first predetermined duration is longer than the second predetermined duration. The LSTM (Long Short-Term Memory) model is primarily responsible for long-term predictions, so the second preset duration is generally short. The second preset duration can be an empirical value, for example, one month.

[0085] For example, if only one month's worth of historical data is saved for CPU usage and memory usage between 3 AM and 4 AM, this data can be sent to the LSTM model for prediction.

[0086] LSTM principle: LSTM is a special type of recurrent neural network (RNN) designed specifically to solve the vanishing and exploding gradient problems in long training sequences. Its core lies in the introduction of a "gating mechanism" and "cell states".

[0087] Key structures include: Forget gate: determines which information to discard from the cell state.

[0088] Input gate: determines which new information is stored in the cell state.

[0089] Output gate: Determines the final output based on the current input and cell state.

[0090] The unique "cellular state" acts like an information superhighway, running through the entire chain, enabling key information to be transmitted over long distances with minimal alteration during sequence processing. Through the coordinated regulation of three gates, LSTM can selectively remember, forget, and output information, thereby effectively capturing long-term dependencies in time series and performing exceptionally well in tasks such as machine translation and speech recognition.

[0091] Step 603: Determine the weighted average of the first CPU utilization rate and the second CPU utilization rate to obtain the average CPU utilization rate; The average CPU utilization can be expressed by the following formula: in, It is a weighting coefficient, ranging from (0, 1), and is based on the sensitivity configured by the server; it can be an empirical value. CPU second utilization rate.

[0092] Step 604: Determine the weighted average of the first memory utilization rate and the second memory utilization rate to obtain the average memory utilization rate; in, It is a weighting coefficient, ranging from (0, 1), and is based on the sensitivity configured by the server; it can be an empirical value. Second highest memory usage.

[0093] Step 605: For the first time period and the second time period, if the average CPU utilization rate is greater than or equal to the first preset average utilization rate, or the average memory utilization rate is greater than or equal to the second preset average utilization rate, the corresponding time period is determined to be a resource busy time period; otherwise, it is determined to be a resource idle time period.

[0094] The resource busy period described in step 605 refers to the predetermined requirements for CPU utilization and memory utilization to be achieved.

[0095] The first preset average usage rate and the second preset average usage rate are empirical values; for example, both can be set to 0.6.

[0096] For example, the prediction results are shown in Table 4 below.

[0097] Table 4. Forecast for October 12, 2025 based on historical data

[0098] In addition, for time periods other than the first and second time periods, since they do not meet the historical data storage duration, the other two methods given above can be used to determine them.

[0099] Optionally, before using the resource data, it can be preprocessed, such as cleaned or transformed, to ensure data quality. Preprocessing includes: Missing value handling: For missing data points, linear interpolation is used to fill them. The linear interpolation algorithm calculates missing values ​​based on values ​​from adjacent time points, using the following formula: in, and It is the nearest non-missing value before and after the missing value. For timestamps.

[0100] Outlier handling: Use the Z-score method to detect and handle outliers. Calculate the Z-score for each data point: in, For data point values, This represents the average of all data within the task execution period. This represents the standard deviation of all data within the task execution period. If If the value is not found in the median, it is considered an outlier and replaced with the median for that period. For example, see Table 5 below.

[0101] Table 5. Revision of resource data as of October 11, 2025

[0102] Optionally, see Figure 11 In another exemplary embodiment of this application, the resource-sensitive task is determined through the following steps 701 to 703: Step 701: Determine the basic execution time of the task, whereby the basic execution time is the execution time of the task under conditions of no resource contention; The execution time can be either the average execution time or the maximum execution time.

[0103] Step 702: Determine the non-basic execution time of the task. The non-basic execution time is the execution time of the task when the CPU utilization rate is greater than the first predetermined utilization rate, or the memory utilization rate is greater than or equal to the second predetermined utilization rate.

[0104] Step 703: When the quotient of the non-basic execution time divided by the basic execution time is greater than a predetermined value, the task is determined to be a resource-sensitive task.

[0105] Among them, the predetermined value is an empirical value. For example, for the average duration, when the quotient is greater than 2 times, it is a resource-sensitive task; for the maximum duration, when the quotient is greater than 3 times, it is a resource-sensitive task.

[0106] For example, the determined base duration and non-base duration are shown in Table 6 below.

[0107] Table 6 Examples of Basic Duration and Non-Basic Duration

[0108] After the execution times of the scheduled tasks are adjusted, they are reorganized according to the new execution times of each task to obtain a new task execution schedule.

[0109] In one exemplary embodiment, a computer device is provided, which may be a server or a terminal, and its internal structure diagram can be found in [reference needed]. Figure 12 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores data related to a task execution time adjustment method. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it can implement a task execution time adjustment method.

[0110] Those skilled in the art will understand, see Figure 12 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0111] In one exemplary embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0112] In one exemplary embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0113] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0114] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data that have been agreed to by the user or have been fully agreed to by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0115] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. In the embodiments provided in this application, any reference to memory, database, or other media can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).

[0116] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic units, data processing logic units, etc., and are not limited to these.

[0117] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0118] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method of adjusting execution time of a task, characterized by, The method comprises the following steps: determining a task-intensive time period and a task-idle time period from a task execution time period according to the number of tasks executed, the task execution time period being a predetermined time period for executing scheduled tasks, the task-intensive time period being a time period in which the number of executed tasks is greater than or equal to a first predetermined number, and the task-idle time period being a time period in which the number of executed tasks is less than a second predetermined number, the first predetermined number being greater than or equal to the second predetermined number; determining a resource busy time period from the task execution time period according to the resource usage when the tasks are executed, the resource including a CPU and a memory, and the resource busy time period being a time period in which the CPU usage and the memory usage meet predetermined requirements; determining a resource-sensitive task from the scheduled tasks, the execution time of the resource-sensitive task falling within both the task-intensive time period and the resource busy time period; adjusting the execution time of the resource-sensitive task to the task-idle time period.

2. The task execution time adjustment method according to claim 1, characterized by, The method of determining a task-intensive time period and a task-idle time period from a task execution time period according to the number of tasks executed comprises the following steps: obtaining historical task execution data of the task execution time period, the historical task execution data including the task identifier, the start time and the end time of each task executed within the task execution time period; determining the task-intensive time period and the task-idle time period based on the task identifier, the start time and the end time of each task.

3. The task execution time adjustment method according to claim 2, characterized by, After the method of determining a task-intensive time period and a task-idle time period from a task execution time period according to the number of tasks executed, the method further comprises the following steps: determining a resource idle time period from the task-intensive time period according to the resource usage when the tasks are executed, the resource idle time period being recorded as an intensive idle time period, and the resource idle time period not overlapping in time with the resource busy time period; determining a resource-non-sensitive task from the scheduled tasks, the execution time of the resource-non-sensitive task falling within both the task-intensive time period and the resource busy time period; adjusting the execution time of the resource-non-sensitive task to the intensive idle time period.

4. The task execution time adjustment method according to claim 1, characterized by, The method of determining a resource busy time period from the task execution time period according to the resource usage when the tasks are executed comprises the following steps: dividing the task execution time period into a plurality of sub-time periods; determining the CPU usage and the memory usage of each sub-time period; determining the sub-time period as a resource busy time period when the CPU usage is greater than or equal to a first preset usage or the memory usage is greater than or equal to a second preset usage; determining the sub-time period as a resource idle time period when the CPU usage is less than a third preset usage and the memory usage is less than a fourth preset usage, the third preset usage being less than or equal to the first preset usage, and the fourth preset usage being less than or equal to the second preset usage.

5. The task execution time adjustment method according to claim 1, characterized by, The method of determining a resource busy time period from the task execution time period according to the resource usage when the tasks are executed can also be implemented by the following method: dividing the task execution time period into a plurality of sub-time periods; determining the CPU usage and the memory usage of each sub-time period; sending the CPU usage and the memory usage of each of the sub-time periods to a K-means clustering model, so that the K-means clustering model outputs a clustering result of the CPU usage and the memory usage of each of the sub-time periods, the clustering result including a resource busy time period and a resource idle time period; for each of the sub-time periods, when the CPU usage or the memory usage is clustered into the resource busy time period, determining that the sub-time period is determined as the resource idle time period; otherwise, determining as the resource idle time period.

6. The task execution time adjustment method according to claim 1, characterized by, The resource busy time period is determined from the task execution time period according to the resource usage when the task is executed, and can also be realized by the following method: sending historical data corresponding to a first time period to an ARIMA model, so that the ARIMA model outputs CPU first usage and memory first usage of a future day, the first time period being a time period included in the task execution time period, and a time length of the stored historical data being greater than or equal to a first predetermined time length, the historical data including CPU usage and memory usage; sending historical data corresponding to a second time period to an LSTM model, so that the LSTM model outputs CPU second usage and memory second usage of a future day, the second time period being a time period included in the task execution time period, and a time length of the stored historical data being less than a second predetermined time length, the historical data including CPU usage and memory usage, the first predetermined time length being greater than the second predetermined time length; determining a weighted average of the CPU first usage and the CPU second usage to obtain an average CPU usage; determining a weighted average of the memory first usage and the memory second usage to obtain an average memory usage; for the first time period and the second time period, when the average CPU usage is greater than or equal to a first preset average usage, or the average memory usage is greater than or equal to a second preset average usage, determining that the corresponding time period is a resource busy time period; otherwise, determining as a resource idle time period.

7. The task execution time adjustment method according to any one of claims 1 to 6, characterized by, The resource-sensitive task is determined by the following method: determining a basic execution time length of the task, the basic execution time length being an execution time length of the task in the case of no resource competition; determining a non-basic execution time length of the task, the non-basic execution time length being an execution time length of the task when the CPU occupancy rate is greater than a first predetermined occupancy rate, or the memory occupancy rate is greater than or equal to a second predetermined occupancy rate; when a quotient of the non-basic execution time length divided by the basic execution time length is greater than a predetermined value, determining that the task is a resource-sensitive task.

8. A computer device comprising: A memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that the processor executes the computer program to implement the task execution time adjustment method of any one of claims 1-7.

9. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the task execution time adjustment method of any one of claims 1-7.

10. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the task execution time adjustment method in any one of claims 1-7.

Citation Information

Patent Citations

  • Task scheduling method and device, computer equipment and storage medium

    CN113821330A

  • Multi-model fusion intelligent power grid cloud data center resource load prediction method

    CN118363831A

  • CPU utilization rate monitoring method and device, equipment and storage medium

    CN118796587A

  • Task processing method and device, electronic equipment and storage medium

    CN119668803A

  • Task resource allocation method and related device

    CN120780447A