Resource prediction method, device and equipment and readable storage medium
By using a long and short-term memory network model with better hyperparameters on the cloud computing platform for resource prediction, the problem of insufficient accuracy of resource demand prediction in the existing technology is solved, and more accurate resource prediction and more stable cloud services are achieved.
Patent Information
- Application Number
- CN202411708562.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-21
AI Technical Summary
The existing technology has insufficient accuracy in the resource demand forecast of cloud computing platforms, which cannot meet actual needs, resulting in uneven resource allocation and waste of resources.
A long and short-term memory network model with better hyperparameters is adopted to perform prediction analysis based on resource load data. By creating a sparrow population that matches the hyperparameters in the long and short-term memory network model, the initial position is optimized, and the optimal hyperparameters are determined iteratively searched to determine the optimal hyperparameters, and then resource use prediction is carried out.
It realizes more accurate resource demand prediction results, and can adjust and configure the infrastructure of the cloud computing platform based on more accurate prediction results, meet user business needs, and ensure the stability and reliability of services.
Smart Images

Figure CN119670800A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information processing technology, and in particular to a resource prediction method, device, equipment and readable storage medium. Background Art
[0002] Compared with the traditional cloud computing model, container cloud technology has advantages such as less resource consumption and faster startup, but due to its short development history, there is still room for improvement in resource management and scheduling. At present, the main challenges include uneven resource allocation and resource waste. Insufficient resource allocation may lead to breach of service level agreement and deterioration of service quality, which in turn may cause customer dissatisfaction and ultimately lead to customer churn and economic losses. On the contrary, if resources are allocated too much, although it will not affect the user experience, it will cause energy waste and increase operation and maintenance costs. Therefore, the reasonable allocation and recycling of resources are crucial issues.
[0003] Since cloud computing platforms need to handle a large number of computing tasks and data storage requirements, it is necessary to accurately predict resource requirements in the future so that the infrastructure of the cloud computing platform can be adjusted and configured based on the predicted resource requirements to meet user business needs and ensure the stability and reliability of services. However, the current resource prediction of cloud computing platforms is still inaccurate and cannot meet the actual prediction needs.
[0004] In summary, how to effectively solve problems such as resource demand prediction of cloud computing platforms is a technical problem that technical personnel in this field urgently need to solve. Summary of the invention
[0005] The purpose of this application is to provide a resource prediction method, device, equipment and readable storage medium, which uses a long short-term memory network model with better hyperparameters to perform predictive analysis based on resource load data, so as to obtain more accurate resource demand prediction results. Further, based on the more accurate resource demand prediction results, the infrastructure of the cloud computing platform can be adjusted and configured to meet user business needs and ensure the stability and reliability of the service.
[0006] In order to solve the above technical problems, this application provides the following technical solutions:
[0007] A resource prediction method, comprising:
[0008] Obtain resource load data of a cloud computing platform, and use the resource load data to create a sparrow population that matches hyperparameters in a long short-term memory network model;
[0009] Optimizing the initial positions of the sparrows in the sparrow population to obtain a target sparrow population;
[0010] Iteratively searching the target sparrow population to determine the optimal hyperparameters;
[0011] The target resource load data of the cloud computing platform is obtained, and the target resource load data is input into a long short-term memory network model with the optimal hyperparameters to perform resource usage prediction, so as to obtain a resource demand prediction result.
[0012] Preferably, iteratively searching the target sparrow population to determine the optimal hyperparameters includes:
[0013] Determine multiple fitness functions of the current iteration round according to the latest target sparrow population;
[0014] Selecting a target fitness function with the smallest value from the multiple fitness functions;
[0015] Determine the hyperparameter corresponding to the target fitness function as the optimal hyperparameter for the current iteration round;
[0016] Determine whether the optimal hyperparameters of the current iteration round meet the optimization termination conditions;
[0017] If not, the sparrows in the current latest target sparrow population are divided into roles, and the positions of the sparrows in the target sparrow population are updated according to the position update method of different roles to obtain a new target sparrow population, and the execution is returned to determine multiple fitness functions of the current iteration round according to the current latest target sparrow population;
[0018] If yes, the iterative search ends, and the optimal hyperparameter of the current iteration round is determined as the optimal hyperparameter obtained by the iterative search.
[0019] Preferably, after updating the positions of the sparrows in the target sparrow population to obtain a new target sparrow population, before returning to execute a plurality of fitness functions for determining the current iteration round according to the latest target sparrow population, the method further includes:
[0020] Using the spiral mechanism in the bubble net method, re-determine the position of each sparrow in the latest target sparrow population;
[0021] The newly determined sparrow positions are used to update the sparrow positions in the current latest target sparrow population to disturb the current optimal solution.
[0022] Preferably, after updating the positions of the sparrows in the target sparrow population to obtain a new target sparrow population, before returning to execute a plurality of fitness functions for determining the current iteration round according to the latest target sparrow population, the method further includes:
[0023] Using the golden sine algorithm and the golden section coefficient, the follower position in the current target sparrow population is re-determined;
[0024] The newly determined follower positions are used to update the positions of the followers in the current latest target sparrow population to enhance the local search capability.
[0025] Preferably, the sparrows in the current latest target sparrow population are divided into roles, and the positions of the sparrows in the target sparrow population are updated according to the position update mode of different roles to obtain a new target sparrow population, including:
[0026] Calculate the distance between the sparrows in the current target sparrow population and the current latest fitness function;
[0027] According to the distance, the sparrows in the current latest target sparrow population are divided into different roles; wherein the roles include: discoverer, follower and guard;
[0028] For the finder, updating the location according to the finder location updating method;
[0029] For the follower, updating the location according to the follower location updating method;
[0030] For the alerter, updating the location according to the alerter location updating method;
[0031] After the positions of the sparrows in the target sparrow population are updated, a new target sparrow population is obtained.
[0032] Preferably, optimizing the initial positions of the sparrows in the sparrow population to obtain a target sparrow population comprises:
[0033] Determine a new initial position of the sparrow by Chebyshev chaos mapping;
[0034] The positions of the sparrows in the sparrow population are updated using the new initialized positions to obtain the target sparrow population.
[0035] Preferably, obtaining the target resource load data of the cloud computing platform includes:
[0036] According to the collection frequency, a set of resource load data corresponding to the current period of the cloud computing platform is obtained; wherein the set of resource load data includes at least one of the processor utilization, memory utilization, network utilization and disk utilization in the current period;
[0037] Determine whether this prediction is the first prediction;
[0038] If not, normalize the latest set of resource load data to obtain a set of data vectors;
[0039] Get the last target resource load data;
[0040] From the last target resource load data, determine a group of longest-existing data vectors with the longest collection time;
[0041] Delete the oldest data vector in the previous target resource load data, and insert the latest collected set of data vectors to obtain the current target resource load data;
[0042] If yes, then obtaining the number of load samples of the long short-term memory network model;
[0043] According to the most recent time, read the N groups of resource load data collected N times most recently; the value of N is the same as the number of load samples;
[0044] After normalizing N groups of resource load data, N groups of data vectors are obtained;
[0045] The N groups of data vectors are determined as the target resource load data for this time.
[0046] A resource prediction device, comprising:
[0047] A population creation module, used to obtain resource load data of the cloud computing platform, and use the resource load data to create a sparrow population that matches the hyperparameters in the long short-term memory network model;
[0048] An initial optimization module, used for optimizing the initial positions of the sparrows in the sparrow population to obtain a target sparrow population;
[0049] An iterative search module, used for iteratively searching the target sparrow population to determine the optimal hyperparameters;
[0050] The demand forecasting module is used to obtain the target resource load data of the cloud computing platform, and input the target resource load data into the long short-term memory network model with the optimal hyperparameters to predict resource usage and obtain a resource demand forecast result.
[0051] An electronic device, comprising:
[0052] Memory for storing computer programs;
[0053] A processor is used to implement the steps of the above-mentioned resource prediction method when executing the computer program.
[0054] A readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the resource prediction method are implemented.
[0055] A computer program product includes a computer program / instruction, which implements the steps of the above-mentioned resource prediction method when executed by a processor.
[0056] By using the method provided in the embodiment of the present application, the resource load data of the cloud computing platform is obtained, and the resource load data is used to create a sparrow population that matches the hyperparameters in the long short-term memory network model; the initial position of the sparrows in the sparrow population is optimized to obtain a target sparrow population; the target sparrow population is iteratively searched to determine the optimal hyperparameters; the target resource load data of the cloud computing platform is obtained, and the target resource load data is input into the long short-term memory network model with the optimal hyperparameters to perform resource usage prediction, and obtain a resource demand prediction result.
[0057] In this application, the long short-term memory network in the long short-term memory network model is a special recurrent neural network that can capture the long-term dependencies in the resource load data, thereby realizing resource demand prediction. In order to make the prediction results more accurate, this application optimizes the sparrow search algorithm to find the optimal hyperparameters, and finally enables the long short-term memory network model to predict more accurate resource demand prediction results based on the resource load data of the cloud computing platform.
[0058] Specifically, in the process of addressing the optimal hyperparameters based on the sparrow search algorithm, the resource load data of the cloud computing platform is used to create a sparrow population that matches the hyperparameters in the long short-term memory network model. Because the initialization position of the sparrow population is too random, there will be too scattered or dense situations, which will affect the iterative optimization of the entire population and fall into a local optimal solution. In the present application, after the sparrow population is created, the positions of the sparrows in the sparrow population can be initially optimized to enrich the diversity of the population, so as to avoid the optimal hyperparameters found in the subsequent iterative search process being a partial optimal solution. Because the iterative search is based on the initial position optimization of the sparrows in the sparrow population to obtain the target sparrow population, the optimal hyperparameters obtained by the iterative search are not local optimal solutions. Subsequently, resource usage prediction is performed based on the long short-term memory network model to which the optimal hyperparameters are applied, and accurate resource demand prediction results can be obtained.
[0059] The technical effect of the present application is as follows: With the help of a long short-term memory network model with better hyperparameters, predictive analysis is performed based on resource load data to obtain more accurate resource demand prediction results. The infrastructure of the cloud computing platform can be further adjusted and configured based on the more accurate resource demand prediction results to meet user business needs and ensure the stability and reliability of the service.
[0060] Correspondingly, the embodiments of the present application also provide resource prediction devices, equipment, readable storage media and computer program products corresponding to the above-mentioned resource prediction method, which have the above-mentioned technical effects and are not repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0062] Figure 1 This is a flowchart of an implementation method of a resource prediction method in an embodiment of the present application;
[0063] Figure 2 This is a schematic diagram of a data sliding update in an embodiment of the present application;
[0064] Figure 3 This is a schematic diagram of a model training prediction implementation in an embodiment of the present application;
[0065] Figure 4 This is a schematic diagram of the structure of a resource prediction device in an embodiment of the present application;
[0066] Figure 5 This is a schematic diagram of the structure of an electronic device in an embodiment of the present application;
[0067] Figure 6 This is a schematic diagram of the specific structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0068] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0069] Please refer to Figure 1 , Figure 1 This is a flow chart of a resource prediction method in an embodiment of the present application, the method comprising the following steps:
[0070] S101. Obtain resource load data of a cloud computing platform, and use the resource load data to create a sparrow population that matches hyperparameters in a long short-term memory network model.
[0071] The cloud computing platform may be any cloud platform that needs to perform resource demand prediction. For example, the cloud computing platform may be a container cloud platform.
[0072] The resource load data may specifically be at least one of processor utilization, memory utilization, network utilization, and disk utilization. The load data of a certain type of resource may be acquired based on the type of resource prediction that needs to be performed.
[0073] Specifically, the resource load data of the cloud computing platform can be read in first, and the resource load data of the cloud computing platform in a certain period of time is selected as training data, and the resource load data in another period of time is used as test data. These resource load data include the resource utilization information of CPU, memory, network, disk, etc. in the period of time, and the resource utilization information is normalized to obtain the data vector.
[0074] Secondly, please refer to Figure 2 , establish a multi-scale sliding update method to update the resource load data that needs to be input into the long short-term memory network model in real time. In order to make full use of historical resource load data, multi-scale sliding updates can be performed, so that better data vectors can be established to better reflect the characteristics of the prediction system. The data vector construction is implemented as follows: the actual resource load data at time i (i = 1, 2, 3, ..., n) is r(i), and the resource load data vector is R = [r(1), r(2), r(3), ..., r(n)]. If the current time is t, and the number of load samples of the long short-term memory network model is s, then the data vector is R t =[r(t-s+1),r(t-s+2),r(t-s+3),...,r(t)], when time t becomes t+1, the last data vector will be deleted, the latest resource load data will be added, and the data vector becomes R t+1 =[r(t-s+2),r(t-s+3),...,r(t+1)]. Other resource data will also undergo such a change process, and finally construct a new input vector to perform dynamic update of the data set.
[0075] For ease of understanding, the long short-term memory network model is described in detail below.
[0076] The long short-term memory network model has a long short-term memory network, namely LSTM, which includes LSTM cell units. Among them, the LSTM cell unit includes three gate structures: input gate, forget gate and output gate, so long time series data can be analyzed.
[0077] In LSTM, the data processing flow is as follows:
[0078] The information to be retained and discarded is determined by the forget gate, which takes the output h of a cell. t-1 and the input x of the current cell t , after calculation, the value is assigned to the cell state C t-1 For each number in, the forget gate f t The numerical expression of is: t =σ(W f ×[h t-1 ,x t ]+b f ), where σ represents the Sigmod function, W f and b f They represent the weight parameters and bias of the forget gate network training respectively.
[0079] The new information added to the cell state is determined by the input gate. First, the Sigmoid layer determines the information that needs to be updated, and then t The anh layer generates a vector as an alternative update state, and finally combines the two parts to update the cell state. Then the input gate i t , Candidate Status Final update status C t :
[0080] i t =σ(W i ×[h t-1 ,x t ]+b i ),
[0081]
[0082] Among them, tanh is the activation function, W i and W c is the weight function of the input gate and the update state, b i and b c is the network bias of the two.
[0083] The output gate is used to determine the output information. First, the Sigmoid layer is used to determine the output, and then the output information is finally obtained through the tanh and Sigmoid functions. The output gate o t And the final output h t for:
[0084] O t =σ(W o ×[h t-1 , x i ]+b o ),
[0085] h t =o t *t anh C t ,
[0086] Among them, W o With b o are the weight parameters of the output gate and the network bias respectively.
[0087] In order to optimize the hyperparameters of LSTM (i.e., W i , W c and W o ), in order to improve the generalization performance of the model, the improved sparrow search algorithm is used for iterative search in this embodiment.
[0088] Use matrix X to represent the sparrow population, that is, the resource data of each node.
[0089] Where n represents the number of sparrow populations, d represents the number of LSTM hyperparameters to be optimized, and x nd Represents each sparrow in the sparrow population.
[0090] S102, optimizing the initial positions of the sparrows in the sparrow population to obtain a target sparrow population.
[0091] Since the initialization position of the sparrow population is too random, there may be too scattered or too dense situations, which affects the iterative optimization of the entire population and falls into a local optimal solution. In this embodiment, the initial position of the sparrows in the sparrow population can be optimized to obtain the target sparrow population.
[0092] In a specific implementation of the present application, the initial positions of sparrows in a sparrow population are optimized to obtain a target sparrow population, including:
[0093] Step 1: Determine the new initial position of the sparrow through Chebyshev chaos mapping;
[0094] Step 2: Use the new initialized position to update the position of the sparrows in the sparrow population to obtain the target sparrow population.
[0095] Specifically, Chebyshev chaotic mapping can be used to enrich the diversity of the population, that is, the new position of each sparrow in the sparrow population can be determined by the following formula:
[0096] x n,d+1 =cos(ncos -1 (x n,d )),x n,d ∈[0,1], after optimizing and updating the positions in the sparrow population, the target sparrow population can be obtained.
[0097] S103, iteratively searching the target sparrow population to determine the optimal hyperparameters.
[0098] After the target sparrow population is identified, the optimal solution can be iteratively searched for the target sparrow population to determine the optimal hyperparameters.
[0099] The method of iteratively searching the target sparrow population can refer to the specific implementation and details of the sparrow searching algorithm.
[0100] In a specific implementation of this application, please refer to Figure 3 , iteratively search the target sparrow population to determine the optimal hyperparameters, including:
[0101] Determine multiple fitness functions of the current iteration round according to the latest target sparrow population;
[0102] Select the target fitness function with the minimum value from multiple fitness functions;
[0103] Determine the hyperparameters corresponding to the target fitness function as the optimal hyperparameters for the current iteration round;
[0104] Determine whether the optimal hyperparameters of the current iteration round meet the optimization termination conditions;
[0105] If not, the sparrows in the current latest target sparrow population are divided into roles, and the positions of the sparrows in the target sparrow population are updated according to the position update method of different roles to obtain a new target sparrow population, and the execution is returned to determine multiple fitness functions of the current iteration round according to the current latest target sparrow population;
[0106] If yes, the iterative search ends, and the optimal hyperparameter of the current iteration round is determined as the optimal hyperparameter obtained by the iterative search.
[0107] The sparrows in the current latest target sparrow population are divided into roles, and the positions of the sparrows in the target sparrow population are updated according to the position update methods of different roles to obtain a new target sparrow population, including:
[0108] Calculate the distance between the sparrows in the current target sparrow population and the current latest fitness function;
[0109] According to the distance, the sparrows in the current latest target sparrow population are divided into different roles; the roles include: discoverer, follower and vigilant;
[0110] For the discoverer, the location is updated according to the discoverer's location update method;
[0111] For followers, the location is updated according to the follower location update method;
[0112] For the alerter, the location is updated according to the alerter's location update method;
[0113] After the positions of the sparrows in the target sparrow population are updated, a new target sparrow population is obtained.
[0114] For ease of description, the above steps are combined for explanation below.
[0115] The hyperparameters of each group of LSTM can be determined from the current latest target sparrow population, and then n fitness functions are obtained based on the hyperparameters of each group of LSTM:
[0116] In this set of fitness functions, there is an optimal fitness function, that is, a set of LSTM hyperparameters with the smallest fitness function value, that is, best1 = [x n1 ,x n2 ,...,x nd ].
[0117] After obtaining the optimal hyperparameters of the current round, determine whether the optimization termination condition is met. The optimization termination condition may be that the optimization difference between the optimal hyperparameters of the current optimal hyperparameters and the optimal hyperparameters of the previous round is 0 or close to a preset threshold, or the optimization termination condition may be that the iteration round reaches a preset upper limit, or other conditions corresponding to the optimization judgment criteria.
[0118] If it is determined that the optimization termination condition is met, the iterative optimization ends and the optimal hyperparameters found are output.
[0119] If the optimization termination condition is not met, the current latest target sparrow population will be divided into two types. Sparrows closer to the fitness function are called discoverers, and sparrows farther from the optimal fitness function are called followers. Sentinels are randomly assigned to avoid danger. After obtaining the optimal fitness function, the positions of discoverers and followers will be changed.
[0120] The corresponding formula for the discoverer's location update method is:
[0121] Among them, i termax represents the maximum number of iterations set in the sparrow optimization algorithm, α represents a uniform random number in [0,1]; Q represents a standard normal random number; R2 represents that the predator is a random number in [0,1]; ST represents the warning value of the discoverer discovering the predator; Indicates the updated position; Indicates the position before the update.
[0122] The corresponding formula for the follower position update method is:
[0123] in, Indicates the node with the worst fitness in the current population; Indicates the node with the best fitness in the current population.
[0124] The corresponding formula for updating the position of the sentinel is:
[0125] Where β represents the step length control parameter; K represents the movement direction of the sparrow, that is, the step length control factor, f w and f g Respectively represent the highest and lowest fitness of the current population.
[0126] In a specific implementation of the present application, after the positions of sparrows in the target sparrow population are updated to obtain a new target sparrow population, before returning to execute multiple fitness functions for determining the current iteration round according to the latest target sparrow population, the method further includes:
[0127] Using the spiral mechanism in the bubble net method, re-determine the position of each sparrow in the latest target sparrow population;
[0128] The newly determined sparrow positions are used to update the sparrow positions in the current latest target sparrow population to disturb the current optimal solution.
[0129] For ease of description, the above steps are combined for explanation below.
[0130] The original sparrow algorithm gets closer and closer to the global optimal solution in the early stage of iteration, which easily causes the population to fall into the local optimal solution. The whale algorithm imitates the behavior of whales when hunting prey, in which whales use the bubble net method to approach and attack prey. This embodiment optimizes the spiral mechanism in the bubble net method and uses it to disturb the current optimal solution to improve the ability to overcome the local optimal solution. The specific implementation is as follows:
[0131] Among them, b determines the shape of the whale's spiral forward, and is set to b=1 to represent a normal spiral line; l∈[0,1] is a random number.
[0132] In a specific implementation of the present application, after the positions of sparrows in the target sparrow population are updated to obtain a new target sparrow population, before returning to execute multiple fitness functions for determining the current iteration round according to the latest target sparrow population, the method further includes:
[0133] Using the golden sine algorithm and the golden section coefficient, the follower position in the current target sparrow population is re-determined;
[0134] The newly determined follower positions are used to update the positions of the followers in the current latest target sparrow population to enhance the local search capability.
[0135] For ease of description, the above steps are combined for explanation below.
[0136] The golden sine algorithm uses the sine function for optimization, where the golden ratio coefficient makes the local search ability of the sparrow algorithm better and better coordinates the ability of global development and local exploration. In this embodiment, the golden sine algorithm is used to optimize the position of the follower:
[0137] Among them, x1 and x2 are random numbers obtained by the golden section coefficient t; r1∈[0,2π], r2∈[0,π], is the individual's current location, is the optimal position for an individual.
[0138] In a specific implementation of the present application, for an alerter, performing location update according to the alerter location update method includes:
[0139] Get the latest maximum and minimum fitness of the population;
[0140] Calculate the difference between the highest fitness of the population and the lowest fitness of the population;
[0141] The difference is used to constrain the value of the random number in the position update method of the alerter, so as to fully search during the search process.
[0142] Use the constrained random numbers to update the position of the sentinel.
[0143] Specifically, the random number K for updating the position of the sentinel in the sparrow search algorithm plays a great role in balancing the global search capability and jumping out of the local optimum. K represents a random number from -1 to 1. This parameter setting will cause the sparrow search algorithm to fail to obtain a sufficient search when querying the optimal value, and may fall into the local optimum. In this embodiment, the random number K in the corresponding formula in the sentinel position update method can be improved:
[0144] K=(f g -f w )·(2·rand-1) 1.5 ,By improving K, compared with the random method, this method optimizes the selection of the initial value of the population and can make the population more evenly distributed in the search space.
[0145] By improving the sparrow search method, the optimal parameter combination of LSTM is found, so that the model can accurately predict cloud computing resources in the future.
[0146] S104: Obtain target resource load data of the cloud computing platform, and input the target resource load data into a long short-term memory network model with optimal hyperparameters to perform resource usage prediction, and obtain a resource demand prediction result.
[0147] After obtaining the optimal hyperparameters based on the sparrow search algorithm, it can be applied to the long short-term memory network model. After the long short-term memory network model is trained based on the resource load data of the cloud computing platform, the resource demand of the cloud computing platform can be predicted.
[0148] In order to distinguish it from the resource load data used in the training phase, in this application, the resource load data input into the long short-term memory network model for resource demand prediction is referred to as target resource load data.
[0149] In this embodiment, the format of the target resource load data may be the same as the input data portion of a training sample in the training phase, that is, the target resource load data may include data vectors of resource load data corresponding to multiple times.
[0150] In order to obtain a more accurate resource demand prediction, in this embodiment, the target resource load data can be constructed based on the number of load samples of the long short-term memory network model. For example, if the number of load samples is N, the data vector in the target resource load data can correspond to the resource load data collected in the last N times. The target resource load data is input into the long short-term memory network model with the optimal hyperparameters for prediction processing to obtain the resource demand prediction result. The resource demand prediction result can be a prediction of the utilization rate of one or more resources in the future.
[0151] After obtaining the resource demand forecast results, the infrastructure of the cloud computing platform can be adjusted and configured based on the resource demand forecast results to meet user business needs and ensure the stability and reliability of the service.
[0152] By using the method provided in the embodiment of the present application, the resource load data of the cloud computing platform is obtained, and the resource load data is used to create a sparrow population that matches the hyperparameters in the long short-term memory network model; the initial position of the sparrows in the sparrow population is optimized to obtain a target sparrow population; the target sparrow population is iteratively searched to determine the optimal hyperparameters; the target resource load data of the cloud computing platform is obtained, and the target resource load data is input into the long short-term memory network model with the optimal hyperparameters to perform resource usage prediction, and obtain a resource demand prediction result.
[0153] In this application, the long short-term memory network in the long short-term memory network model is a special recurrent neural network that can capture the long-term dependencies in the resource load data, thereby realizing resource demand prediction. In order to make the prediction results more accurate, this application optimizes the sparrow search algorithm to find the optimal hyperparameters, and finally enables the long short-term memory network model to predict more accurate resource demand prediction results based on the resource load data of the cloud computing platform.
[0154] Specifically, in the process of addressing the optimal hyperparameters based on the sparrow search algorithm, the resource load data of the cloud computing platform is used to create a sparrow population that matches the hyperparameters in the long short-term memory network model. Because the initialization position of the sparrow population is too random, there will be too scattered or dense situations, which will affect the iterative optimization of the entire population and fall into a local optimal solution. In the present application, after the sparrow population is created, the positions of the sparrows in the sparrow population can be initially optimized to enrich the diversity of the population, so as to avoid the optimal hyperparameters found in the subsequent iterative search process being a partial optimal solution. Because the iterative search is based on the initial position optimization of the sparrows in the sparrow population to obtain the target sparrow population, the optimal hyperparameters obtained by the iterative search are not local optimal solutions. Subsequently, resource usage prediction is performed based on the long short-term memory network model to which the optimal hyperparameters are applied, and accurate resource demand prediction results can be obtained.
[0155] The technical effect of the present application is as follows: With the help of a long short-term memory network model with better hyperparameters, predictive analysis is performed based on resource load data to obtain more accurate resource demand prediction results. The infrastructure of the cloud computing platform can be further adjusted and configured based on the more accurate resource demand prediction results to meet user business needs and ensure the stability and reliability of the service.
[0156] It should be noted that, based on the above embodiments, the embodiments of the present application also provide corresponding improved solutions. In the preferred / improved embodiments, the same steps or corresponding steps as those in the above embodiments can be referenced to each other, and the corresponding beneficial effects can also be referenced to each other, which will not be described one by one in the preferred / improved embodiments of this article.
[0157] In a specific implementation of the present application, obtaining target resource load data of a cloud computing platform includes:
[0158] According to the collection frequency, a set of resource load data corresponding to the current period of the cloud computing platform is obtained; wherein the set of resource load data includes at least one of the processor utilization, memory utilization, network utilization and disk utilization in the current period;
[0159] Determine whether this forecast is the first forecast;
[0160] If not, normalize the latest set of resource load data to obtain a set of data vectors;
[0161] Get the last target resource load data;
[0162] From the last target resource load data, determine a group of longest-existing data vectors with the longest collection time;
[0163] Delete the oldest data vector in the previous target resource load data, and insert the latest collected set of data vectors to obtain the current target resource load data;
[0164] If yes, get the number of load samples of the LSTM network model;
[0165] Read the N sets of resource load data collected the most recently according to the most recent time; N is the same as the number of load samples;
[0166] After normalizing N groups of resource load data, N groups of data vectors are obtained;
[0167] The N groups of data vectors are determined as the target resource load data for this time.
[0168] For ease of description, the above steps are combined for explanation below.
[0169] In this embodiment, a set of resource load data corresponding to the current time period / current moment of the cloud computing platform can be regularly acquired and normalized according to the acquisition frequency to obtain the latest data vector. A set of resource load data can include the utilization rate of one or more resources. That is, the actual resource data at time i (i=1, 2, 3, ..., n) is r(i).
[0170] If this is the first time to make a prediction, it is necessary to newly construct the target resource load data, that is, to construct a load data vector, where the load data vector is R = [r(1), r(2), r(3), ..., r(n)].
[0171] If this is not the first time to make a prediction, then if the current time is t and the number of load samples is s, then the resource data vector is R t =[r(t-s+1),r(t-s+2),r(t-s+3),...,r(t)], when time t becomes t+1, the last data will be deleted and the latest data will be added, and the data vector becomes R t+1 =[r(t-s+2),r(t-s+3),...,r(t+1)]. That is, the current resource load data can be obtained by replacing the previous target resource load data, which can save the data processing of repeated normalization.
[0172] Corresponding to the above method embodiment, the embodiment of the present application further provides a resource prediction device. The resource prediction device described below and the resource prediction method described above can refer to each other.
[0173] See also Figure 4 As shown, the device includes the following modules:
[0174] A population creation module 101 is used to obtain resource load data of the cloud computing platform and use the resource load data to create a sparrow population that matches the hyperparameters in the long short-term memory network model;
[0175] An initial optimization module 102 is used to optimize the initial positions of the sparrows in the sparrow population to obtain a target sparrow population;
[0176] Iterative search module 103, used for iteratively searching the target sparrow population to determine the optimal hyperparameter;
[0177] The demand forecasting module 104 is used to obtain the target resource load data of the cloud computing platform, and input the target resource load data into the long short-term memory network model with optimal hyperparameters to predict resource usage and obtain resource demand prediction results.
[0178] By using the device provided in the embodiment of the present application, the resource load data of the cloud computing platform is obtained, and the resource load data is used to create a sparrow population that matches the hyperparameters in the long short-term memory network model; the initial position of the sparrows in the sparrow population is optimized to obtain a target sparrow population; the target sparrow population is iteratively searched to determine the optimal hyperparameters; the target resource load data of the cloud computing platform is obtained, and the target resource load data is input into the long short-term memory network model with the optimal hyperparameters to perform resource usage prediction, and obtain a resource demand prediction result.
[0179] In this application, the long short-term memory network in the long short-term memory network model is a special recurrent neural network that can capture the long-term dependencies in the resource load data, thereby realizing resource demand prediction. In order to make the prediction results more accurate, this application optimizes the sparrow search algorithm to find the optimal hyperparameters, and finally enables the long short-term memory network model to predict more accurate resource demand prediction results based on the resource load data of the cloud computing platform.
[0180] Specifically, in the process of addressing the optimal hyperparameters based on the sparrow search algorithm, the resource load data of the cloud computing platform is used to create a sparrow population that matches the hyperparameters in the long short-term memory network model. Because the initialization position of the sparrow population is too random, there will be too scattered or dense situations, which will affect the iterative optimization of the entire population and fall into a local optimal solution. In the present application, after the sparrow population is created, the positions of the sparrows in the sparrow population can be initially optimized to enrich the diversity of the population to avoid the optimal hyperparameters found in the subsequent iterative search process from being a partial optimal solution. Because the iterative search is based on the optimization of the initial positions of the sparrows in the sparrow population to obtain the target sparrow population, the optimal hyperparameters obtained by the iterative search are not local optimal solutions. Subsequently, resource usage prediction is performed based on the long short-term memory network model to which the optimal hyperparameters are applied, and accurate resource demand prediction results can be obtained.
[0181] The technical effect of the present application is as follows: With the help of a long short-term memory network model with better hyperparameters, predictive analysis is performed based on resource load data to obtain more accurate resource demand prediction results. The infrastructure of the cloud computing platform can be further adjusted and configured based on the more accurate resource demand prediction results to meet user business needs and ensure the stability and reliability of the service.
[0182] In a specific implementation of the present application, the iterative search module is specifically used to determine multiple fitness functions of the current iteration round according to the latest target sparrow population;
[0183] Select the target fitness function with the minimum value from multiple fitness functions;
[0184] Determine the hyperparameters corresponding to the target fitness function as the optimal hyperparameters for the current iteration round;
[0185] Determine whether the optimal hyperparameters of the current iteration round meet the optimization termination conditions;
[0186] If not, the sparrows in the current latest target sparrow population are divided into roles, and the positions of the sparrows in the target sparrow population are updated according to the position update method of different roles to obtain a new target sparrow population, and the execution is returned to determine multiple fitness functions of the current iteration round according to the current latest target sparrow population;
[0187] If yes, the iterative search ends, and the optimal hyperparameter of the current iteration round is determined as the optimal hyperparameter obtained by the iterative search.
[0188] In a specific implementation of the present application, the iterative search optimization module is used to update the position of the sparrows in the target sparrow population, and after obtaining the new target sparrow population, before returning to execute the multiple fitness functions of the current iteration round determined according to the current latest target sparrow population, the spiral mechanism in the bubble net method is used to re-determine the position of each sparrow in the current latest target sparrow population;
[0189] The newly determined sparrow positions are used to update the sparrow positions in the current latest target sparrow population to disturb the current optimal solution.
[0190] In a specific implementation of the present application, the iterative search optimization module is used to update the position of the sparrows in the target sparrow population, and after obtaining the new target sparrow population, before returning to execute the multiple fitness functions of the current iteration round determined according to the current latest target sparrow population, use the golden sine algorithm in combination with the golden section coefficient to re-determine the follower position in the current latest target sparrow population;
[0191] The newly determined follower positions are used to update the positions of the followers in the current latest target sparrow population to enhance the local search capability.
[0192] In a specific implementation of the present application, the iterative search module is specifically used to calculate the distance between the sparrows in the current latest target sparrow population and the current latest fitness function;
[0193] According to the distance, the sparrows in the current latest target sparrow population are divided into different roles; the roles include: discoverer, follower and vigilant;
[0194] For the discoverer, the location is updated according to the discoverer's location update method;
[0195] For followers, the location is updated according to the follower location update method;
[0196] For the alerter, the location is updated according to the alerter's location update method;
[0197] After the positions of the sparrows in the target sparrow population are updated, a new target sparrow population is obtained.
[0198] In a specific implementation of the present application, the initial optimization module is specifically used to determine a new initial position of the sparrow by Chebyshev chaotic mapping;
[0199] The positions of the sparrows in the sparrow population are updated using the new initialized positions to obtain the target sparrow population.
[0200] In a specific implementation of the present application, the demand forecasting module is specifically used to obtain a set of resource load data corresponding to the current period of the cloud computing platform according to the collection frequency; wherein the set of resource load data includes at least one of the processor utilization, memory utilization, network utilization and disk utilization in the current period;
[0201] Determine whether this prediction is the first prediction;
[0202] If not, normalize the latest set of resource load data to obtain a set of data vectors;
[0203] Get the last target resource load data;
[0204] From the last target resource load data, determine a group of longest-existing data vectors with the longest collection time;
[0205] Delete the oldest data vector in the previous target resource load data, and insert the latest collected set of data vectors to obtain the current target resource load data;
[0206] If yes, get the number of load samples of the LSTM network model;
[0207] Read the N sets of resource load data collected the most recently according to the most recent time; N is the same as the number of load samples;
[0208] After normalizing N groups of resource load data, N groups of data vectors are obtained;
[0209] The N groups of data vectors are determined as the target resource load data for this time.
[0210] Corresponding to the above method embodiment, an embodiment of the present application further provides an electronic device, and the electronic device described below and the resource prediction method described above can refer to each other.
[0211] See also Figure 5 As shown, the electronic device includes:
[0212] A memory 332, for storing computer programs;
[0213] The processor 322 is configured to implement the steps of the resource prediction method of the above method embodiment when executing a computer program.
[0214] For details, please refer to Figure 6 , Figure 6A specific structural diagram of an electronic device provided for this embodiment, the electronic device may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) (for example, one or more processors) and a memory 332, and the memory 332 stores one or more computer programs 342 or data 344. Among them, the memory 332 can be a temporary storage or a permanent storage. The program stored in the memory 332 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the data processing device. Furthermore, the processor 322 can be configured to communicate with the memory 332 to execute a series of instruction operations in the memory 332 on the electronic device 301.
[0215] The electronic device 301 may further include one or more power supplies 326 , one or more wired or wireless network interfaces 350 , one or more input and output interfaces 358 , and / or one or more operating systems 341 .
[0216] The steps in the resource prediction method described above can be implemented by the structure of an electronic device.
[0217] Corresponding to the above method embodiment, the embodiment of the present application further provides a readable storage medium. The readable storage medium described below and the resource prediction method described above can refer to each other.
[0218] A readable storage medium stores a computer program, which implements the steps of the resource prediction method of the above method embodiment when the computer program is executed by a processor.
[0219] The readable storage medium may specifically be a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or other readable storage medium that can store program codes.
[0220] Corresponding to the above method embodiment, the embodiment of the present application further provides a computer program product. The computer program product described below and the resource prediction method described above can refer to each other.
[0221] A computer program product includes a computer program / instruction. When the computer program / instruction is executed by a processor, the steps of the resource prediction method are implemented.
[0222] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0223] Those skilled in the art may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0224] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0225] Finally, it should be noted that, in this article, relationships such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms include, include or any other variations are intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0226] Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A resource prediction method, characterized in that: include: Obtain resource load data of a cloud computing platform, and use the resource load data to create a sparrow population that matches hyperparameters in a long short-term memory network model; Optimizing the initial positions of the sparrows in the sparrow population to obtain a target sparrow population; Iteratively searching the target sparrow population to determine the optimal hyperparameters; The target resource load data of the cloud computing platform is obtained, and the target resource load data is input into a long short-term memory network model with the optimal hyperparameters to perform resource usage prediction, so as to obtain a resource demand prediction result.
2. The method according to claim 1, characterized in that: Iteratively search the target sparrow population to determine the optimal hyperparameters, including: Determine multiple fitness functions of the current iteration round according to the latest target sparrow population; Selecting a target fitness function with the smallest value from the multiple fitness functions; Determine the hyperparameter corresponding to the target fitness function as the optimal hyperparameter for the current iteration round; Determine whether the optimal hyperparameters of the current iteration round meet the optimization termination conditions; If not, the sparrows in the current latest target sparrow population are divided into roles, and the positions of the sparrows in the target sparrow population are updated according to the position update method of different roles to obtain a new target sparrow population, and the execution is returned to determine multiple fitness functions of the current iteration round according to the current latest target sparrow population; If yes, the iterative search ends, and the optimal hyperparameter of the current iteration round is determined as the optimal hyperparameter obtained by the iterative search.
3. The method according to claim 2, characterized in that After the positions of the sparrows in the target sparrow population are updated to obtain a new target sparrow population, before returning to execute a plurality of fitness functions for determining the current iteration round according to the latest target sparrow population, the method further includes: Using the spiral mechanism in the bubble net method, re-determine the position of each sparrow in the latest target sparrow population; The newly determined sparrow positions are used to update the sparrow positions in the current latest target sparrow population to disturb the current optimal solution.
4. The method according to claim 2, characterized in that: After the positions of the sparrows in the target sparrow population are updated to obtain a new target sparrow population, before returning to execute a plurality of fitness functions for determining the current iteration round according to the latest target sparrow population, the method further includes: Using the golden sine algorithm and the golden section coefficient, the follower position in the current target sparrow population is re-determined; The newly determined follower positions are used to update the positions of the followers in the current latest target sparrow population to enhance the local search capability.
5. The method according to claim 2, characterized in that: The sparrows in the current latest target sparrow population are divided into roles, and the positions of the sparrows in the target sparrow population are updated according to the position update methods of different roles to obtain a new target sparrow population, including: Calculate the distance between the sparrows in the current target sparrow population and the current latest fitness function; According to the distance, the sparrows in the current latest target sparrow population are divided into different roles; wherein the roles include: discoverer, follower and guard; For the finder, updating the location according to the finder location updating method; For the follower, updating the location according to the follower location updating method; For the alerter, updating the location according to the alerter location updating method; After the positions of the sparrows in the target sparrow population are updated, a new target sparrow population is obtained.
6. The method according to claim 1, characterized in that Optimizing the initial positions of the sparrows in the sparrow population to obtain a target sparrow population includes: Determine a new initial position of the sparrow by Chebyshev chaos mapping; The positions of the sparrows in the sparrow population are updated using the new initialized positions to obtain the target sparrow population.
7. The method according to any one of claims 1 to 6, characterized in that: Obtaining target resource load data of the cloud computing platform includes: According to the collection frequency, a set of resource load data corresponding to the current period of the cloud computing platform is obtained; wherein the set of resource load data includes at least one of the processor utilization, memory utilization, network utilization and disk utilization in the current period; Determine whether this forecast is the first forecast; If not, normalize the latest set of resource load data to obtain a set of data vectors; Get the last target resource load data; From the last target resource load data, determine a group of longest-existing data vectors with the longest collection time; Delete the oldest data vector in the previous target resource load data, and insert the latest collected set of data vectors to obtain the current target resource load data; If yes, then obtaining the number of load samples of the long short-term memory network model; According to the most recent time, read the N groups of resource load data collected for the most recent N times; the value of N is the same as the number of load samples; After normalizing N groups of resource load data, N groups of data vectors are obtained; The N groups of data vectors are determined as the target resource load data for this time.
8. A resource prediction device, characterized in that: include: A population creation module, used to obtain resource load data of the cloud computing platform, and use the resource load data to create a sparrow population that matches the hyperparameters in the long short-term memory network model; An initial optimization module, used for optimizing the initial positions of the sparrows in the sparrow population to obtain a target sparrow population; An iterative search module, used for iteratively searching the target sparrow population to determine the optimal hyperparameters; The demand forecasting module is used to obtain the target resource load data of the cloud computing platform, and input the target resource load data into the long short-term memory network model with the optimal hyperparameters to predict resource usage and obtain a resource demand forecast result.
9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the resource prediction method according to any one of claims 1 to 7 when executing the computer program.
10. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the resource prediction method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Optical resource optimal path acquisition method based on improved sparrow search algorithm
CN115983101A
Method for evaluating adjustable potential of air conditioner load under demand side response
CN117913813A
Resource allocation priority determination method and device, equipment, medium and computer program product
CN118804386A
