Resource adjustment method, device, server and storage medium
By combining GM(1,1) gray model, CNN convolutional neural network and DT classifier, using historical load data to automatically predict and adjust cloud computing resources, the problem of low efficiency of resource scaling in the existing technology is solved, and efficient resource dynamic adjustment is achieved.
Patent Information
- Application Number
- CN202210855905.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-20
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2042-07-20
AI Technical Summary
The resource scaling process in existing cloud computing relies on manual intervention, which is inefficient and difficult to achieve efficient resource dynamic adjustment.
By combining historical workloads on different dates and historical workloads on different time periods, the GM(1,1) gray model and CNN convolutional neural network predict the load, combined with the DT classifier for total resource classification and adjustment, reducing manual intervention.
Improve the accuracy and work efficiency of resource prediction, and realize automated resource adjustment without manual intervention.
Smart Images

Figure CN115269182B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud computing technology, and in particular to a resource adjustment method, device, server and storage medium. Background Art
[0002] With the emergence of large-scale data centers and managed IT services, cloud computing is becoming a key technology in the IT industry. Elastic cloud services refer to the ability of virtual cloud resources within a cloud platform to dynamically adjust allocated cloud resources based on workload changes, ensuring that the actual allocated resources closely match the actual required resources. This allows users to increase or decrease the capacity of virtualized resources on demand, known as scaling, so they only pay for the resources they use. Traditionally, businesses deploy applications or services on cloud platforms in the form of unique virtual machines (VMs) and deliver them to users through the cloud platform provider's virtualized network. Many providers offer this service, claiming to provide "unlimited" virtual resources, which implies scalability.
[0003] Currently, cluster resource scaling is responsive. For example, load conditions are collected in real time, and users modify resources based on these conditions. For example, when the load is high, the number of virtual machines is increased, while when the load is low, the number of virtual machines is reduced. This approach requires more manual intervention and reduces work efficiency. Summary of the Invention
[0004] The present invention provides a resource adjustment method, device, server and storage medium, which predicts the load through historical workloads on different dates and historical workloads on the same date in different time periods, and then determines the target user resource adjustment value based on the load, thereby improving not only the prediction accuracy but also the work efficiency.
[0005] In a first aspect, an embodiment of the present invention provides a resource adjustment method, comprising:
[0006] Predicting a first load for a prediction time period based on target user workloads of a plurality of first historical time periods, and predicting a second load for the prediction time period based on target user workloads of a plurality of second historical time periods; wherein the first historical time period is a time period that is the same as the prediction time period and falls on a date before the prediction time period; and the second historical time period is a time period that is the same as the date before the prediction time period and falls on a date before the prediction time period;
[0007] predicting the load in the prediction time period based on the first load and the second load;
[0008] The load of the predicted time period is classified to obtain the total amount of resources in the predicted time period, and the target user resource adjustment value is determined according to the total amount of resources in the predicted time period.
[0009] The above method can predict the first load by using the target user workload of multiple dates before the prediction time period, and predict the second load by using the target user workload of the time period before the prediction time period of the current date of the prediction time period, and determine the load of the prediction time period based on the first load and the second load. At the same time, the target user resource adjustment value is determined based on the predicted load. In this way, the load after the historical workload prediction of the horizontal time and the vertical time is improved, and at the same time, the resource adjustment value can be determined by classifying the load without the intervention of staff, thereby improving work efficiency.
[0010] In one possible implementation, predicting the load for the prediction time period based on the first load and the second load includes:
[0011] The sum of the product of the first load and the weight corresponding to the first load and the product of the second load and the weight corresponding to the second load is used as the load of the predicted time period.
[0012] The above method can determine the load in the forecast time period by using the load and its corresponding weight, thereby improving the accuracy of the forecast.
[0013] In one possible implementation, before predicting the load in the prediction time period based on the first load and the second load, the method further includes:
[0014] Forecasting the load of each second historical time period based on the loads of multiple historical time periods corresponding to each second historical time period; wherein the historical time period corresponding to the second historical time period is a time period that is before the date to which the second historical time period belongs and is the same as the second historical time period;
[0015] determining an adjustment error and an adjustment direction according to the predicted load of each second historical time period and the actual load of each second historical time period;
[0016] If the adjustment direction is a positive direction, the sum of the adjustment error and the first load is used as a new first load;
[0017] If the adjustment direction is a negative direction, the difference between the adjustment error and the first load is used as a new first load.
[0018] The above method can predict the date before the prediction time period and the workload of the time period before the prediction time period, determine the adjustment error and adjustment direction from these workloads, thereby adjusting the currently predicted first load and improving the accuracy of the predicted first load.
[0019] In one possible implementation, determining an adjustment error based on the predicted load in each second historical time period and the actual load in each second historical time period includes:
[0020] taking the average value of the errors corresponding to each second historical time period between the predicted load in each second historical time period and the actual load in each second historical time period as the adjusted error; or
[0021] An adjustment error is predicted based on an error corresponding to each second historical time period between the predicted load in each second historical time period and the actual load in each second historical time period.
[0022] The above method can use the average value of the error as the adjustment error to reflect the error trend, or predict the adjustment error through multiple errors, thereby improving the accuracy of the prediction.
[0023] In one possible implementation, determining an adjustment direction based on the predicted load in each second historical time period and the actual load in each second historical time period includes:
[0024] If the sum of the errors in the first error group is greater than the sum of the errors in the second error group, the adjustment direction is a positive direction; wherein the errors in the first error group are errors corresponding to the second historical time period in which the predicted load of the second historical time period is greater than the actual load of the second historical time period; and the errors in the second error group are errors corresponding to the second historical time period in which the predicted load of the second historical time period is less than the actual load of the second historical time period;
[0025] If the sum of the errors in the first error group is smaller than the sum of the errors in the second error group, the adjustment direction is a negative direction.
[0026] The above method determines the adjustment direction through the relationship between the size of multiple predicted loads and actual loads, thereby improving the prediction accuracy.
[0027] In one possible implementation, predicting a first load for a prediction period based on a plurality of target user workloads for a first historical period includes: predicting the first load for the prediction period based on the plurality of target user workloads for the first historical period using a GM(1,1) grey model;
[0028] Predicting a second load for the prediction time period based on the target user workloads in the plurality of second historical time periods, comprising: predicting the second load for the prediction time period based on the target user workloads in the plurality of second historical time periods using a CNN convolutional neural network;
[0029] Classifying the load of the prediction time period to obtain the total amount of resources of the prediction time period includes: classifying the load of the prediction time period by a DT classifier to obtain the total amount of resources of the prediction time period.
[0030] The above method can predict the first load, the second load and the load classification respectively through three models, thereby improving the accuracy of calculation.
[0031] In a second aspect, an embodiment of the present invention provides a resource adjustment device, including:
[0032] a first prediction module configured to predict a first load for a prediction time period based on target user workloads for a plurality of first historical time periods, and to predict a second load for the prediction time period based on target user workloads for a plurality of second historical time periods; wherein the first historical time period is a time period that is the same as the prediction time period and falls on a date before the prediction time period; and the second historical time period is a time period that is the same as the date before the prediction time period and falls on a date before the prediction time period;
[0033] a second prediction module, configured to predict the load in the prediction time period based on the first load and the second load;
[0034] The classification module is used to classify the load of the predicted time period to obtain the category of the load of the predicted time period, and determine the target user resource adjustment value according to the category of the load of the predicted time period.
[0035] In one possible implementation, the second prediction module is configured to:
[0036] The sum of the product of the first load and the weight corresponding to the first load and the product of the second load and the weight corresponding to the second load is used as the load of the predicted time period.
[0037] In a third aspect, an embodiment of the present invention provides a server, comprising: a processor and a memory;
[0038] processor;
[0039] a memory for storing instructions executable by the processor;
[0040] The processor is configured to execute the instructions to implement the resource adjustment method as described in any one of the first aspects.
[0041] In a fourth aspect, an embodiment of the present invention provides a storage medium, which, when instructions in the storage medium are executed by a processor of a server, enables the server to execute the resource adjustment method as described in any one of the first aspects.
[0042] In addition, the technical effects brought about by any implementation method in the second to fourth aspects can refer to the technical effects brought about by different implementation methods in the first aspect, and will not be repeated here.
[0043] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A flowchart of a resource adjustment method provided by an embodiment of the present invention;
[0045] Figure 2 A schematic diagram of a first load prediction process provided by an embodiment of the present invention;
[0046] Figure 3 A schematic diagram of a second load prediction process provided by an embodiment of the present invention;
[0047] Figure 4 A flowchart of another resource adjustment method provided by an embodiment of the present invention;
[0048] Figure 5 A flowchart of a resource adjustment method based on a neural network provided by an embodiment of the present invention;
[0049] Figure 6 A schematic diagram of a CNN convolutional neural network provided by an embodiment of the present invention;
[0050] Figure 7 A schematic diagram of resource adjustment provided by an embodiment of the present invention;
[0051] Figure 8 A schematic diagram of another resource adjustment provided by an embodiment of the present invention;
[0052] Figure 9 A flowchart of a method for correcting a first load provided by an embodiment of the present invention;
[0053] Figure 10 A schematic diagram comparing responsive scaling and proactive scaling provided in an embodiment of the present invention;
[0054] Figure 11 This is a structural diagram of a resource adjustment device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0055] The following is a clear and detailed description of the technical solutions in the embodiments of the present application with reference to the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " represents or, for example, A / B can represent A or B. In addition, in the description of the embodiments of the present application, "plurality" means two or more than two.
[0056] The embodiment of the present invention proposes a resource adjustment method, combining Figure 1 Shown, including:
[0057] S100: Predicting a first load in a prediction time period based on a plurality of target user workloads in first historical time periods;
[0058] Among them, the first historical time period is the date before the date of the predicted time period and is the same as the predicted time period; for example, if the predicted time period is 11:00 am to 12:00 am on July 1, then 11:00 am to 12:00 am on June 30, 11:00 am to 12:00 am on June 30, 11:00 am to 12:00 am on June 29, 11:00 am to 12:00 am on June 28, and 11:00 am to 12:00 am on June 27 are all the first historical time period.
[0059] Combine Figure 2 As shown, the time period of historical data is X (0) 、X (1) 、X (2) 、X (3) ,…,X (m-2) 、X (m-1) 、X (m) , that is, the historical time period is 0 to m. The historical days are 1 to n, and the date of the forecast time period is n+1.
[0060] Forecast period X (0) (n+1), time period is X (0) , the date is n+1, according to the multiple first historical time periods X corresponding to the forecast time period (0) (1) X (0) (2),…,X (0) (n) workload, we can predict X (0) (n+1) first load;
[0061] Forecast period X (1) (n+1), time period is X (1) , the date is n+1, according to the multiple first historical time periods X corresponding to the forecast time period (1) (1) X (1) (2),…,X (1) (n) workload, we can predict X (1) (n+1) first load;
[0062] Forecast period X (2) (n+1), time period is X (2) , the date is n+1, according to the multiple first historical time periods X corresponding to the forecast time period (2) (1) X (2) (2),…,X (2) (n) workload, we can predict X (2) (n+1) first load;
[0063] Forecast period X (3) (n+1), time period is X (3) , the date is n+1, according to the multiple first historical time periods X corresponding to the forecast time period (3) (1) X (3) (2),…,X (3) (n) workload, we can predict X (3) (n+1) first load;
[0064] …
[0065] Forecast period X (m-2) (n+1), time period is X (m-2) , the date is n+1, according to the multiple first historical time periods X corresponding to the forecast time period (m-2) (1) X (m-2) (2),…,X (m-2) (n) workload, we can predict X (m-2) (n+1) first load;
[0066] Forecast period X (m-1) (n+1), time period is X (m-1) , the date is n+1, according to the multiple first historical time periods X corresponding to the forecast time period (m-1) (1) X (m-1) (2),…,X (m-1) (n) workload, we can predict X (m-1) (n+1) first load;
[0067] Forecast period X (m) (n+1), time period is X (m) , the date is n+1, according to the multiple first historical time periods X corresponding to the forecast time period (m) (1) X (m) (2),…,X (m) (n) workload, we can predict X (m) The first load of (n+1).
[0068] S110: Predicting a second load in a prediction time period based on the target user workloads in multiple second historical time periods;
[0069] The second historical time period is the time period that precedes the forecast time period and falls on the same date as the forecast time period. For example, if the forecast time period is from 11:00 AM to 12:00 AM on July 1, then 10:00 AM to 11:00 AM on July 1, 9:00 AM to 10:00 AM on July 1, 8:00 AM to 9:00 AM on July 1, and 7:00 AM to 8:00 AM on July 1 are all second historical time periods.
[0070] Combine Figure 3 As shown, if the forecast period is Day(n+1) (1) (n+1), then the second historical period can be X (0) (n+1), according to X (0) (n+1) workload, predict X (1) (n+1) second load;
[0071] If the forecast period is Day(n+1) (2) (n+1), then the second historical period can be X (0) (n+1) and X (1) (n+1), according to X (0) (n+1) and X (1) (n+1) workload, predict X (2) (n+1) second load;
[0072] If the forecast period is Day(n+1) (3) (n+1), then the second historical period can be X (0) (n+1), X (1) (n+1), X (2) (n+1), according to X (0) (n+1), X (1) (n+1), X (2) (n+1) These three workloads, predict X (3) (n+1) second load;
[0073] If the forecast period is Day(n+1) (m-1) (n+1), then the second historical period can be X (0) (n+1), X (1) (n+1),…,X (m-2) (n+1), according to X (0) (n+1), X (1) (n+1),…,X (m-2)(n+1) These m-1 workloads, predict X (m-1) (n+1) second load;
[0074] If the forecast period is Day(n+1) (m) (n+1), then the second historical period can be X (0) (n+1), X (1) (n+1),…,X (m-1) (n+1), according to X (0) (n+1), X (1) (n+1),…,X (m-1) (n+1) These m workloads, predict X (m) The second load of (n+1).
[0075] S120: Predicting a load in a prediction time period based on the first load and the second load;
[0076] Specifically, the sum of the first load and the second load is used as the load in the prediction time period.
[0077] As time goes by, the workload will also change. Therefore, the contribution rates of the first load and the second load to the final determined load are also different. Based on this, the embodiment of the present invention further proposes:
[0078] The sum of the product of the first load and the weight corresponding to the first load and the product of the second load and the weight corresponding to the second load is used as the load of the prediction time period.
[0079] The weight corresponding to the first load and the weight corresponding to the second load may be preset and determined based on historical experience.
[0080] S130: Classify the load of the forecast period to obtain the total amount of resources in the forecast period, and determine the target user resource adjustment value according to the total amount of resources in the forecast period.
[0081] For example, the total resource volume for the forecast period is the number of virtual machines required for the forecast period. The resource adjustment value is the number of additional virtual machines. +2 means adding two virtual machines to the original number; +3 means adding three virtual machines to the original number; -2 means removing two virtual machines from the original number, and so on.
[0082] Among them, the load includes concurrency, CPU utilization, and memory usage; illustratively, the size of concurrency, CPU utilization, and memory usage are predicted by the above method, and then the number of virtual machines required for the predicted time period is determined based on the size of concurrency, CPU utilization, and memory usage. Based on the number of virtual machines required for the predicted time period, the adjusted number of virtual machines for the target user is determined.
[0083] The target user resource adjustment value is determined based on the total amount of resources in the forecast time period, including:
[0084] The target user resource adjustment value is determined by comparing the total resource volume for the predicted time period with the total resource volume for the target second historical time period. The target second historical time period is the first historical time period closest to the predicted time period. For example, if the predicted time period is from 11:00 AM to 12:00 AM on July 1st, the target second historical time period is from 10:00 AM to 11:00 AM on July 1st.
[0085] For example, combined Figure 4 As shown, the present invention provides another resource adjustment method, comprising:
[0086] S400: Predicting a first concurrent volume for a predicted time period based on the concurrent volumes of target users in the multiple first historical time periods, and predicting a second concurrent volume for the predicted time period based on the concurrent volumes of target users in the multiple second historical time periods; and predicting a concurrent volume for the predicted time period based on the first concurrent volume and the second concurrent volume.
[0087] S410: Predicting a first CPU utilization for a prediction period based on the CPU utilizations of the target users in the first historical time period, and predicting a second CPU utilization for the prediction period based on the CPU utilizations of the target users in the second historical time period; and predicting a CPU utilization for the prediction period based on the first CPU utilization and the second CPU utilization.
[0088] S420: predicting a first memory usage for a prediction period based on the memory usage of the target user in the plurality of first historical time periods, and predicting a second memory usage for the prediction period based on the memory usage of the target user in the plurality of second historical time periods; and predicting a memory usage for the prediction period based on the first memory usage and the second memory usage;
[0089] S430: Classify the concurrency, CPU utilization, and memory usage of the predicted time period to obtain the number of virtual machines required for the predicted time period, and determine the adjustment value of the target user virtual machine based on the number of virtual machines required for the predicted time period.
[0090] The above steps can be calculated using a model, specifically:
[0091] Predicting a first load for the prediction time period based on the target user workloads for the plurality of first historical time periods, comprising: predicting the first load for the prediction time period based on the target user workloads for the plurality of first historical time periods using a GM(1,1) grey model;
[0092] Predicting a second load for the prediction time period based on the target user workloads in the plurality of second historical time periods, comprising: predicting the second load for the prediction time period based on the target user workloads in the plurality of second historical time periods using a CNN convolutional neural network;
[0093] Classifying the load of the prediction time period to obtain the total amount of resources of the prediction time period includes: classifying the load of the prediction time period by a DT classifier to obtain the total amount of resources of the prediction time period.
[0094] For example, combined Figure 5 As shown, an embodiment of the present invention provides a resource adjustment method based on a neural network, comprising:
[0095] S500: Predicting a first load in a prediction time period based on a plurality of target user workloads in a first historical time period using a GM(1,1) grey model;
[0096] For example, the GM(1,1) gray model is used to predict the first concurrency of the prediction time period based on the concurrency of multiple first historical time periods; the GM(1,1) gray model is used to predict the first CPU utilization of the prediction time period based on the CPU utilization of multiple first historical time periods; the GM(1,1) gray model is used to predict the first memory usage of the prediction time period based on the memory usage of multiple first historical time periods.
[0097] S510: Predicting a second load in a predicted time period based on the target user workloads in the multiple second historical time periods using a CNN convolutional neural network;
[0098] Exemplarily, the second concurrency of the predicted time period is predicted based on the concurrency of multiple second historical time periods through a CNN convolutional neural network; the second CPU utilization of the predicted time period is predicted based on the CPU utilization of multiple second historical time periods through a CNN convolutional neural network; the second memory usage of the predicted time period is predicted based on the memory usage of multiple second historical time periods through a CNN convolutional neural network.
[0099] S520: Predicting a load in a prediction time period based on the first load and the second load;
[0100] S530: Classify the load of the prediction time period by using the DT classifier to obtain the total amount of resources in the prediction time period, and determine the target user resource adjustment value based on the total amount of resources in the prediction time period.
[0101] Exemplarily, the concurrency, CPU utilization, and memory usage of the forecast period are input into the DT classifier to obtain the load category of the forecast period, and the target user resource adjustment value is determined according to the load category of the forecast period.
[0102] Among them, the concurrent volume, CPU utilization, and memory usage of the historical time period are used as training sets to train the GM(1,1) gray model, and the concurrent volume, CPU utilization, and memory usage of the historical time period are used as training sets to train the CNN convolutional neural network, and the trained GM(1,1) gray model and CNN convolutional neural network are obtained respectively, which can be used.
[0103] Combine Figure 6 As shown in the figure, the CNN convolutional neural network includes one hidden layer, that is, a 1+2 layer structure. The input layer inputs the concurrency, CPU utilization, or memory usage of the previous m time periods, and outputs the predicted data, that is, the concurrency, CPU utilization, or memory usage at time m+1 on the same day.
[0104] The formula of CNN convolutional neural network is:
[0105] f(x)=G(b (2) +W (2) (s(b (1) +W (1) x)))
[0106] All parameters of a CNN are the connection weights and biases between each layer, including W1, b1, W2, and b2. The above formula is trained using historical time periods of concurrent consumption, CPU utilization, and memory usage as a training set to obtain all the parameters of the CNN.
[0107] After training is completed, the weights are combined into a GM-CNN model. Specifically:
[0108] load GM-CNN =ω1load GM +ω2load CNN
[0109] The weights are grouped into ω1 and ω2, where ω1 is the weight corresponding to the first load and ω2 is the weight corresponding to the second load. GM , load output by CNN CNN As a training set, then train the above load GM-CNN Formula, we get ω1 and ω2.
[0110] The DT classifier, trained on historical log data, can derive the optimal set of elastic scaling rules for cluster resource allocation. This classifier is then used to perform elastic scaling adjustments. The predicted concurrency, CPU utilization, and memory usage are then fed into the trained DT classifier to determine the total resources for the predicted time period. The adjustment value is then calculated by subtracting the total resources for the predicted time period from the total resources for the previous adjacent time period. This means increasing or decreasing the number of virtual machines.
[0111] The DT classifier mainly completes the process of resource allocation in the cluster. Resource allocation refers to the allocation of various cloud resources in a distributed form in the cloud according to a fixed threshold setting principle in a specific cluster to meet the needs of different tenants for different resources. Among them, selecting appropriate elastic scaling rules is a key step in the dynamic allocation of resources in the cloud, which mainly solves the problem of cluster system jitter and reduces the number of adjustments and manual interventions. The elastic scaling method selection of the present invention includes two processes. First, the historical data is standardized and analyzed, and the processed data is used to form an elastic scaling rule set, and the processed data is used to train the DT classifier. Then, when the new CPU utilization, memory usage and current environment concurrency are passed to the trained DT classifier, the current total amount of resources required is obtained, and the corresponding adjustment action is obtained by comparison operation. The use of the DT classifier model can improve the efficiency of elastic scaling, reduce the original number of elastic scaling adjustments, reduce the number of manual interventions, and make classifications efficiently.
[0112] For example, combined Figure 7 As shown, one virtual machine is actually used from 8:00 a.m. to 9:00 a.m. on July 1st. When it is predicted that one additional virtual machine is needed from 9:00 a.m. to 10:00 a.m. on July 1st, it is considered that the current number of virtual machines is insufficient, and a request is made to the cloud resources to add one virtual machine. Then, two virtual machines can be obtained from 9:00 a.m. to 10:00 a.m. on July 1st. When it is predicted that one additional virtual machine is needed from 10:00 a.m. to 11:00 a.m. compared to the period from 9:00 a.m. to 10:00 a.m. on July 1st, a request is made to the cloud resources to add one virtual machine, and three virtual machines are used from 10:00 a.m. to 11:00 a.m. on July 1st.
[0113] It should be noted that when the cluster load changes, the resources in the cluster must be changed to increase or decrease the cluster's processing power. There are two ways to increase capacity: vertical scaling and horizontal scaling. Vertical scaling refers to increasing or decreasing the amount of resources in the virtual machines in the cluster. For example, a 2-core 4GB virtual machine can be increased to 4 cores 8GB or decreased to 1 core 2GB. Horizontal scaling, on the other hand, increases or decreases resources by changing the number of virtual machines in the cluster, allowing the cluster to respond to changes in load. In this article, horizontal scaling is selected for elastic scaling. This scaling method does not add resources to the application's virtual machines, but rather increases the number of virtual machines to improve the cluster's service capabilities. This method is more flexible and aligns with the concept of distributed scaling. During horizontal scaling, if the cluster load exceeds the threshold, resource requests are made and the number of virtual machines is increased until the cluster meets the threshold.
[0114] For example, the present invention relates to cluster resource allocation and an OpenStack-based elastic scaling service system for cluster resources. This system was developed using PyCharm and Eclipse-jee-mars-2, a physical server with Tomcat 8.0, and a database using MySQL Server 5.0. The system's front-end interface was created using WebStorm.
[0115] Combine Figure 8 As shown in the figure, since OpenStack comes with its own monitoring service, the data in this article is collected from OpenStack. The data in the Gnocchi service is regularly collected through a script file and stored in the database. If the data format is not what this article requires, the data is processed into the data format required by this article. The GM-CNN model and the DT classifier are trained by processing and analyzing the log information. Then, when new data is monitored, the load at the next moment is predicted. The predicted load is input into the DT classifier for classification, and the corresponding adjustment rule is selected, that is, the scaling rule is selected from the scaling rule set. The scaling rule set includes scaling rule 1, scaling rule 2, scaling rule 3, scaling rule 4, scaling rule 5, etc. The cluster resources are then adjusted through the load balancer, that is, the number of virtual machines is requested from the cloud resources, and 4 virtual machines are requested.
[0116] Among them, the system can monitor the operation of cloud resources and environmental predictions, and the scaling rule set is built and maintained based on performance changes or cloud environment changes.
[0117] In order to improve the accuracy of the first load, the embodiment of the present invention further proposes a method for correcting the first load, combining Figure 9 As shown:
[0118] S900: Predicting the load of each second historical time period based on the loads of multiple historical time periods corresponding to each second historical time period;
[0119] The historical time period corresponding to the second historical time period is a time period before the date to which the second historical time period belongs and is the same as the second historical time period;
[0120] For example, the prediction time period is 11:00 a.m. on July 1 to 12:00 a.m. on July 1, then 10:00 a.m. on July 1 to 11:00 a.m. on July 1, 9:00 a.m. on July 1 to 10:00 a.m. on July 1, 8:00 a.m. on July 1 to 9:00 a.m. on July 1, and 7:00 a.m. on July 1 to 8:00 a.m. on July 1 are all the second historical time periods.
[0121] Then for the second historical time period from 10:00 a.m. on July 1 to 11:00 a.m. on July 1, 10:00 a.m. on June 30 to 11:00 a.m. on June 30, 10:00 a.m. on June 29 to 11:00 a.m. on June 29, and 10:00 a.m. on June 28 to 11:00 a.m. on June 28 are all historical time periods corresponding to the second historical time period.
[0122] Then for the second historical time period from 9:00 a.m. on July 1 to 10:00 a.m. on July 1, 9:00 a.m. on June 30 to 10:00 a.m. on June 30, 9:00 a.m. on June 29 to 10:00 a.m. on June 29, and 9:00 a.m. on June 28 to 10:00 a.m. on June 28 are all historical time periods corresponding to the second historical time period.
[0123] Then for the second historical time period of 8:00 am on July 1 to 9:00 am on July 1, 8:00 am on June 30 to 9:00 am on June 30, 8:00 am on June 29 to 9:00 am on June 29, and 8:00 am on June 28 to 9:00 am on June 28 are all historical time periods corresponding to the second historical time period.
[0124] Then for the second historical time period from 7:00 a.m. on July 1 to 8:00 a.m. on July 1, 7:00 a.m. on June 30 to 8:00 a.m. on June 30, 7:00 a.m. on June 29 to 8:00 a.m. on June 29, and 7:00 a.m. on June 28 to 8:00 a.m. on June 28 are all historical time periods corresponding to the second historical time period.
[0125] S910: Determine an adjustment error and an adjustment direction based on the predicted load of each second historical time period and the actual load of each second historical time period;
[0126] Specifically: taking the average value of the errors corresponding to each second historical time period between the predicted load in each second historical time period and the actual load in each second historical time period as the adjustment error; or
[0127] An adjustment error is predicted based on an error corresponding to each second historical time period between the predicted load in each second historical time period and the actual load in each second historical time period.
[0128] The error corresponding to each second historical time period between the predicted load of each second historical time period and the actual load of each second historical time period is used as input and input into the neural network to obtain an adjusted error.
[0129] For example, the load from 10:00 AM on June 30th to 11:00 AM on June 30th, 10:00 AM on June 29th to 11:00 AM on June 29th, and 10:00 AM on June 28th to 11:00 AM on June 28th is used to predict the load from 10:00 AM on July 1st to 11:00 AM on June 30th. The error corresponding to the second historical time period from 10:00 AM on July 1st to 11:00 AM on July 1st is the difference between the predicted load from 10:00 AM on July 1st to 11:00 AM on June 30th and the actual load detected from 10:00 AM on July 1st to 11:00 AM on June 30th.
[0130] The load from 9:00 AM on June 30th to 10:00 AM on June 30th, 9:00 AM on June 29th to 10:00 AM on June 29th, and 9:00 AM on June 28th to 10:00 AM on June 28th is used to predict the load from 9:00 AM on July 1st to 10:00 AM on June 30th. The error corresponding to the second historical time period, 9:00 AM on July 1st to 10:00 AM on July 1st, is the difference between the predicted load from 9:00 AM on July 1st to 10:00 AM on June 30th and the actual load measured from 9:00 AM on July 1st to 10:00 AM on June 30th.
[0131] The load from 8:00 AM on June 30th to 9:00 AM on June 30th, 8:00 AM on June 29th to 9:00 AM on June 29th, and 8:00 AM on June 28th to 9:00 AM on June 28th is used to predict the load from 8:00 AM on July 1st to 9:00 AM on June 30th. The error corresponding to the second historical time period from 8:00 AM on July 1st to 9:00 AM on July 1st is the difference between the predicted load from 8:00 AM on July 1st to 9:00 AM on June 30th and the actually detected load from 8:00 AM on July 1st to 9:00 AM on June 30th.
[0132] The average of the three errors, namely, the error corresponding to the second historical time period from 10:00 AM on July 1 to 11:00 AM on July 1, the error corresponding to the second historical time period from 9:00 AM on July 1 to 10:00 AM on July 1, and the error corresponding to the second historical time period from 8:00 AM on July 1 to 9:00 AM on July 1, is used as the adjusted error;
[0133] Based on the errors corresponding to the second historical time period from 10:00 a.m. on July 1 to 11:00 a.m. on July 1, the errors corresponding to the second historical time period from 9:00 a.m. on July 1 to 10:00 a.m. on July 1, and the errors corresponding to the second historical time period from 8:00 a.m. on July 1 to 9:00 a.m. on July 1, the adjustment errors are predicted.
[0134] The adjustment direction is determined according to the predicted load of each second historical time period and the actual load of each second historical time period, including:
[0135] If the sum of the errors in the first error group is greater than the sum of the errors in the second error group, the adjustment direction is positive; wherein the errors in the first error group are errors corresponding to the second historical time period when the predicted load of the second historical time period is greater than the actual load of the second historical time period; and the errors in the second error group are errors corresponding to the second historical time period when the predicted load of the second historical time period is less than the actual load of the second historical time period;
[0136] If the sum of the errors in the first error group is less than the sum of the errors in the second error group, the adjustment direction is a negative direction.
[0137] The error in the first error group is the predicted load minus the actual load, which is a positive value. The error in the second error group is the predicted load minus the actual load, which is a negative value.
[0138] When the sum of all errors in the first error group is greater than the sum of errors in the second error group, that is, there are more positive values, then the adjustment direction is positive, that is, increasing the first load; when the sum of all errors in the first error group is less than the sum of errors in the second error group, that is, there are more negative values, then the adjustment direction is negative, that is, reducing the first load.
[0139] S920: If the adjustment direction is positive, the sum of the adjustment error and the first load is used as a new first load;
[0140] S930: If the adjustment direction is a negative direction, the difference between the adjustment error and the first load is used as a new first load.
[0141] In summary, combined with Figure 10As shown, the current algorithm determines the actual load at t5 today and then adjusts resources based on this load, also known as responsive scaling. However, the present invention uses predictive scaling. When the predicted time period is today's t5, the target user's workload from t1 to t4 is used to predict the second load at t5. The workload from the t5 period of the previous few days (Day 1 to Day 5) is used to predict the first load at t5 today. Based on the predicted first and second loads at t5, the load at t5 is calculated. The resource adjustment amount is then calculated based on the load at t5. In practice, prediction improves work efficiency.
[0142] like Figure 11 As shown, the present invention also provides a resource adjustment device, comprising:
[0143] The first prediction module 1100 is configured to predict a first load for a prediction period based on target user workloads in a plurality of first historical time periods, and to predict a second load for the prediction period based on target user workloads in a plurality of second historical time periods; wherein the first historical time period is a time period that is the same as the prediction period and falls on a date before the prediction period; and the second historical time period is a time period that is the same as the prediction period and falls on a date before the prediction period.
[0144] A second prediction module 1110 is configured to predict the load in the prediction time period based on the first load and the second load;
[0145] The classification module 1120 is configured to classify the load of the predicted time period, obtain the total amount of resources of the predicted time period, and determine the target user resource adjustment value according to the total amount of resources of the predicted time period.
[0146] Optionally, the second prediction module 1110 is configured to:
[0147] The sum of the product of the first load and the weight corresponding to the first load and the product of the second load and the weight corresponding to the second load is used as the load of the predicted time period.
[0148] Optionally, the device further comprises: a modification module;
[0149] The modification module is configured to predict the load of each second historical time period based on the loads of multiple historical time periods corresponding to each second historical time period; wherein the historical time period corresponding to the second historical time period is a time period that is before the date to which the second historical time period belongs and is the same as the second historical time period;
[0150] determining an adjustment error and an adjustment direction according to the predicted load of each second historical time period and the actual load of each second historical time period;
[0151] If the adjustment direction is a positive direction, the sum of the adjustment error and the first load is used as a new first load;
[0152] If the adjustment direction is a negative direction, the difference between the adjustment error and the first load is used as a new first load.
[0153] Optionally, the modification module is specifically used to:
[0154] taking the average value of the errors corresponding to each second historical time period between the predicted load in each second historical time period and the actual load in each second historical time period as the adjusted error; or
[0155] An adjustment error is predicted based on an error corresponding to each second historical time period between the predicted load in each second historical time period and the actual load in each second historical time period.
[0156] Optionally, the modification module is specifically used to:
[0157] If the sum of the errors in the first error group is greater than the sum of the errors in the second error group, the adjustment direction is a positive direction; wherein the errors in the first error group are errors corresponding to the second historical time period in which the predicted load of the second historical time period is greater than the actual load of the second historical time period; and the errors in the second error group are errors corresponding to the second historical time period in which the predicted load of the second historical time period is less than the actual load of the second historical time period;
[0158] If the sum of the errors in the first error group is smaller than the sum of the errors in the second error group, the adjustment direction is a negative direction.
[0159] Optional:
[0160] The first prediction module 1100 is specifically configured to predict a first load in a prediction time period based on target user workloads in a plurality of first historical time periods using a GM (1,1) grey model; and predict a second load in the prediction time period based on target user workloads in a plurality of second historical time periods using a CNN convolutional neural network.
[0161] The classification module 1120 is specifically configured to classify the load of the forecast time period by using a DT classifier to obtain the total amount of resources of the forecast time period.
[0162] In addition, combined Figures 1-11 The resource adjustment method and apparatus described in the embodiments of the present invention may be implemented by a server.
[0163] The server includes: a processor and a memory;
[0164] processor;
[0165] a memory for storing instructions executable by the processor;
[0166] The processor is configured to execute the instructions to implement the resource adjustment method as described in any one of the above embodiments.
[0167] The memory can be used to store software programs and data. The processor executes various functions of the server and processes data by running the software programs or data stored in the memory. The memory may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. The memory stores an operating system that enables the server to run. In the present application, the memory can store the operating system and various application programs, and may also store code for executing the method described in the embodiments of the present application.
[0168] The processor is the control center of the server, connecting the various parts of the entire terminal using various interfaces and lines. It executes various functions of the server and processes data by running or executing software programs stored in the memory and calling data stored in the memory. In some embodiments, the processor may include one or more processing units; the processor may also integrate an application processor and a baseband processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the baseband processor mainly processes wireless communications. It is understandable that the above-mentioned baseband processor may not be integrated into the processor. The processor in this application can run the operating system, application programs, user interface display and touch response, as well as the processing method described in the embodiments of this application.
[0169] In addition, in combination with the server in the above embodiment, an embodiment of the present invention may provide a storage medium, which, when the instructions in the storage medium are executed by the processor of the server, enables the server to execute any of the resource adjustment methods described above.
[0170] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0171] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.
Claims
1. A resource adjustment method, characterized in that: include: Predicting a first load for a prediction time period based on target user workloads of a plurality of first historical time periods, and predicting a second load for the prediction time period based on target user workloads of a plurality of second historical time periods; wherein the first historical time period is a time period that is the same as the prediction time period and falls on a date before the prediction time period; and the second historical time period is a time period that is the same as the date before the prediction time period and falls on a date before the prediction time period; predicting the load in the prediction time period based on the first load and the second load; Classifying the load of the predicted time period to obtain the total amount of resources for the predicted time period, and determining the resource adjustment value of the target user according to the total amount of resources for the predicted time period; Before predicting the load in the prediction time period based on the first load and the second load, the method further includes: Forecasting the load of each second historical time period based on the loads of multiple historical time periods corresponding to each second historical time period; wherein the historical time period corresponding to the second historical time period is a time period that is before the date to which the second historical time period belongs and is the same as the second historical time period; determining an adjustment error and an adjustment direction according to the predicted load of each second historical time period and the actual load of each second historical time period; If the adjustment direction is a positive direction, the sum of the adjustment error and the first load is used as a new first load; If the adjustment direction is a negative direction, the difference between the adjustment error and the first load is used as a new first load.
2. The resource adjustment method according to claim 1, characterized in that: Predicting the load for the prediction time period according to the first load and the second load includes: The sum of the product of the first load and the weight corresponding to the first load and the product of the second load and the weight corresponding to the second load is used as the load of the predicted time period.
3. The resource adjustment method according to claim 1, characterized in that: Determining an adjustment error based on the predicted load in each second historical time period and the actual load in each second historical time period includes: taking the average value of the errors corresponding to each second historical time period between the predicted load in each second historical time period and the actual load in each second historical time period as the adjusted error; or An adjustment error is predicted based on an error corresponding to each second historical time period between the predicted load in each second historical time period and the actual load in each second historical time period.
4. The resource adjustment method according to claim 1, characterized in that: Determine the adjustment direction based on the predicted load in each second historical time period and the actual load in each second historical time period, including: If the sum of the errors in the first error group is greater than the sum of the errors in the second error group, the adjustment direction is a positive direction; wherein the errors in the first error group are errors corresponding to the second historical time period in which the predicted load of the second historical time period is greater than the actual load of the second historical time period; and the errors in the second error group are errors corresponding to the second historical time period in which the predicted load of the second historical time period is less than the actual load of the second historical time period; If the sum of the errors in the first error group is smaller than the sum of the errors in the second error group, the adjustment direction is a negative direction.
5. The resource adjustment method according to claim 1, characterized in that: Predicting a first load for the prediction time period based on the target user workloads for the plurality of first historical time periods, comprising: predicting the first load for the prediction time period based on the target user workloads for the plurality of first historical time periods using a GM(1,1) grey model; Predicting a second load for the prediction time period based on the target user workloads in the plurality of second historical time periods, comprising: predicting the second load for the prediction time period based on the target user workloads in the plurality of second historical time periods using a CNN convolutional neural network; Classifying the load of the prediction time period to obtain the total amount of resources of the prediction time period includes: classifying the load of the prediction time period by a DT classifier to obtain the total amount of resources of the prediction time period.
6. A resource adjustment device, characterized in that: include: a first prediction module configured to predict a first load for a prediction time period based on target user workloads for a plurality of first historical time periods, and to predict a second load for the prediction time period based on target user workloads for a plurality of second historical time periods; wherein the first historical time period is a time period that is the same as the prediction time period and falls on a date before the prediction time period; and the second historical time period is a time period that is the same as the date before the prediction time period and falls on a date before the prediction time period; a second prediction module, configured to predict the load in the prediction time period based on the first load and the second load; a classification module, configured to classify the load of the predicted time period, obtain the total amount of resources in the predicted time period, and determine the resource adjustment value of the target user according to the total amount of resources in the predicted time period; The modification module is configured to predict the load of each second historical time period based on the loads of multiple historical time periods corresponding to each second historical time period; wherein the historical time period corresponding to the second historical time period is a time period that is before the date to which the second historical time period belongs and is the same as the second historical time period; determining an adjustment error and an adjustment direction according to the predicted load of each second historical time period and the actual load of each second historical time period; If the adjustment direction is a positive direction, the sum of the adjustment error and the first load is used as a new first load; If the adjustment direction is a negative direction, the difference between the adjustment error and the first load is used as a new first load.
7. The resource adjustment device according to claim 6, characterized in that: The second prediction module is used to: The sum of the product of the first load and the weight corresponding to the first load and the product of the second load and the weight corresponding to the second load is used as the load of the predicted time period.
8. A server, characterized in that: include: processor and memory; processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the resource adjustment method according to any one of claims 1 to 5.
9. A storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of a server, the server is enabled to execute the resource adjustment method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Resource scheduling method, device and system
CN103970587A
Method and device for brushing data, electronic equipment and storage medium
CN114442935A