CPU usage rate prediction method and apparatus, and computer device, readable storage medium and storage product
By combining self-attention mechanisms, convolutional neural networks, and recurrent neural network models, the CPU utilization of the registry center node is predicted in real time, solving the problem of CPU utilization prediction in microservice architecture, realizing reasonable load allocation and full utilization of resources, and improving service quality.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- CHINA TELECOM CLOUD TECH CO LTD
- Filing Date
- 2025-11-17
- Publication Date
- 2026-06-11
Smart Images

Figure CN2025135302_11062026_PF_FP_ABST
Abstract
Description
CPU utilization prediction methods, apparatus, computer equipment, readable storage media, and storage products
[0001] Related applications
[0002] This application claims priority to Chinese patent application filed on December 4, 2024, application number 202411769417.4, entitled "CPU Utilization Prediction Method, Apparatus, Computer Equipment, Readable Storage Medium and Storage Product", the entire contents of which are incorporated herein by reference. Technical Field
[0003] This application relates to the field of computer technology, and in particular to a method, apparatus, computer device, computer-readable storage medium, and computer program product for predicting CPU utilization. Background Technology
[0004] With the rise of cloud computing and distributed systems, microservice architecture has gradually become the mainstream system architecture pattern. Microservice architecture breaks down a monolithic application system into multiple independent microservice applications based on functional logic. These microservice applications consume services through remote procedure calls. To address the issue of dynamic changes in microservice applications, middleware called a registry center has emerged. The registry center plays a crucial role in registering these microservice applications, load balancing, and dynamic routing.
[0005] Registries rely on resources such as CPU to provide high availability, and CPU load often determines the response time and quality of services provided by the registry. Therefore, knowing the registry's CPU resource utilization can help system administrators or container platforms adjust the registry's specifications and capacity, prepare resource reserves in advance for peak loads, and avoid service quality degradation due to resource overload. Summary of the Invention
[0006] Therefore, it is necessary to provide a CPU utilization prediction method, apparatus, computer device, computer-readable storage medium, and computer program product to address the aforementioned technical problems.
[0007] In a first aspect, this application provides a method for predicting CPU utilization, the method comprising:
[0008] During the operation of the target software application, for each node in the node cluster where the target software application is deployed, the baseline CPU utilization of the node's central processing unit (CPU) at a preset number of time points before the current time point is obtained in real time.
[0009] The baseline CPU utilization is input into a deep learning network model based on a self-attention mechanism, and the corresponding first feature vector of the node is output.
[0010] The baseline CPU utilization is input into the convolutional neural network model, and the corresponding second feature vector of the node is output.
[0011] The baseline CPU utilization is input into the recurrent neural network model, and the corresponding third feature vector of the node is output.
[0012] The first feature vector, the second feature vector, and the third feature vector are fused together, and the current CPU utilization rate of the node at the current time point is obtained based on the fused feature vector.
[0013] In one embodiment, inputting the baseline CPU utilization rate into a deep learning network model, a convolutional neural network model, and a recurrent neural network model based on a self-attention mechanism includes:
[0014] Obtain a preset matrix, and determine one of the row vectors and column vectors of the preset matrix as the first vector, and determine the other vector as the second vector;
[0015] Obtain the number of nodes in the node cluster;
[0016] Obtain the number of adjacent first vectors of the specified number of nodes from the preset matrix, and determine the obtained first vectors as the target first vector;
[0017] Randomly select a target first vector as the first vector that matches the node;
[0018] For each baseline CPU utilization of the node, the baseline CPU utilization is filled into an element position in the first vector that matches the node;
[0019] The filled preset matrix is input into the deep learning network model based on the self-attention mechanism, the convolutional neural network model, and the recurrent neural network model.
[0020] In one embodiment, before inputting the padded preset matrix into the self-attention-based deep learning network model, the convolutional neural network model, and the recurrent neural network model, the method further includes:
[0021] For the element positions in the preset matrix that are not filled by the baseline CPU utilization, a preset value is filled into the element position.
[0022] In one embodiment, fusing the first feature vector, the second feature vector, and the third feature vector includes:
[0023] Obtain the preset concatenation order among the first feature vector, the second feature vector, and the third feature vector;
[0024] The first feature vector, the second feature vector, and the third feature vector are concatenated according to the preset concatenation order to obtain the fused feature vector.
[0025] In one embodiment, the method further includes:
[0026] For each node in the node cluster, the historical CPU utilization rate of the node at each historical time point within a historical time period is obtained; wherein, the target software application runs continuously within the historical time period;
[0027] The historical CPU usage rates are sorted in chronological order from the previous to the next historical time point.
[0028] For each historical CPU utilization rate in the sorting results, if there are a preset number of historical CPU utilization rates after the historical CPU utilization rate, the historical CPU utilization rate and the preset number of historical CPU utilization rates after the historical CPU utilization rate are included in a utilization rate combination.
[0029] The first preset number of historical CPU utilization rates in the utilization rate combination are determined as the first historical utilization rate, and the last historical CPU utilization rate in the utilization rate combination is determined as the second historical utilization rate.
[0030] Based on the first historical usage rate and the second historical usage rate, the deep learning network model based on the self-attention mechanism, the convolutional neural network model, and the recurrent neural network model are trained.
[0031] In one embodiment, training the self-attention-based deep learning network model, the convolutional neural network model, and the recurrent neural network model based on the first historical usage rate and the second historical usage rate includes:
[0032] For any one of the deep learning network model based on the self-attention mechanism, the convolutional neural network model, or the recurrent neural network model, the first historical usage rate is input into the network model, and the corresponding historical feature vector of the network model is output.
[0033] The historical feature vectors of the three network models are fused together, and the predicted CPU utilization is obtained based on the fused historical feature vectors.
[0034] The predicted CPU utilization rate is compared with the second historical utilization rate, and the model parameters of the three network models are updated based on the comparison results.
[0035] Secondly, this application also provides a CPU utilization prediction device, the device comprising:
[0036] The first acquisition module is configured to, during the operation of the target software application, acquire in real time the baseline CPU utilization of the central processing unit (CPU) of each node in the node cluster where the target software application is deployed, for each node, the CPU utilization of the node at a preset number of time points before the current time point.
[0037] The first input module is configured to input the baseline CPU utilization into a deep learning network model based on a self-attention mechanism and output the first feature vector corresponding to the node.
[0038] The second input module is configured to input the baseline CPU utilization into the convolutional neural network model and output the second feature vector corresponding to the node.
[0039] The third input module is configured to input the baseline CPU utilization into the recurrent neural network model and output the corresponding third feature vector of the node.
[0040] The fusion module is configured to fuse the first feature vector, the second feature vector, and the third feature vector, and obtain the current CPU utilization rate of the node at the current time point based on the fused feature vector.
[0041] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the methods in any of the above embodiments.
[0042] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the methods in any of the above embodiments.
[0043] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the steps of the methods in any of the above embodiments.
[0044] Details of one or more embodiments of this application are set forth in the following drawings and description. Other features, objects, and advantages of this application will become apparent from the specification, drawings, and claims. Attached Figure Description
[0045] To more clearly illustrate the technical solutions in the embodiments of this application or the conventional technology, the drawings used in the description of the embodiments or the conventional technology will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the disclosed drawings without creative effort.
[0046] Figure 1 is a flowchart illustrating the CPU utilization prediction method of one or more embodiments / some embodiments;
[0047] Figure 2 is a flowchart illustrating the feature vector fusion method of one or more embodiments / some embodiments;
[0048] Figure 3 is a schematic diagram of the usage combinations of one or more embodiments / some embodiments;
[0049] Figure 4 is a model structure diagram of one or more embodiments / some embodiments;
[0050] Figure 5 is a structural block diagram of a CPU utilization prediction device in one or more embodiments;
[0051] Figure 6 is an internal structure diagram of a computer device according to one or more embodiments / some embodiments. Detailed Implementation
[0052] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0053] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0054] In one embodiment, as shown in Figure 1, a CPU utilization prediction method is provided. This embodiment illustrates the method by applying it to a terminal. It is understood that this method can also be applied to a server, and further to a system including both a terminal and a server, and is implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0055] 102. During the operation of the target software application, for each node in the node cluster where the target software application is deployed, obtain the baseline CPU utilization of the node's central processing unit (CPU) at a preset number of time points before the current time point in real time.
[0056] Optionally, the target software application can be a registry center, which is a software application in a distributed system used to manage and maintain metadata information of various services in the system; a node cluster refers to a group of nodes working together, and a node refers to a physical machine or a virtual machine; CPU utilization refers to the proportion of CPU resources currently in use to the total amount of CPU resources.
[0057] 104. Input the baseline CPU utilization into the deep learning network model based on the self-attention mechanism, and output the first feature vector of the node.
[0058] Optionally, a self-attention mechanism is used to capture the dependency relationship between every two nodes. The first feature vector generated based on the self-attention mechanism can characterize the dependency relationship between every two nodes and the temporal relationship between all nodes in the node cluster. By calculating the self-attention between every two nodes, the dependency relationship and temporal relationship between every two nodes can be determined, thereby extracting the first feature vector. For example, the node cluster includes a Leader node and a Follower node. The action of the Leader node at time T will affect the action of the Follower node at time T+N, that is, the action of the Follower node depends on the action of the Leader node.
[0059] Optionally, after inputting the baseline CPU utilization into the deep learning network model based on the self-attention mechanism, a function curve between CPU utilization and time points is fitted based on the baseline CPU utilization of all nodes in the node cluster and the corresponding time points of each baseline CPU utilization. This function curve can characterize the temporal relationship between all nodes in the node cluster.
[0060] 106. Input the baseline CPU utilization into the convolutional neural network model and output the second feature vector of the corresponding node.
[0061] Optionally, the second feature vector represents the dependency relationship between two or more nodes, as well as the temporal relationship between all nodes in the node cluster.
[0062] 108. Input the baseline CPU utilization into the recurrent neural network model and output the corresponding third feature vector of the node.
[0063] Optionally, the recurrent neural network (RNN) model can be a long short-term memory (LSTM) network model or a gated recurrent unit (GRU) network model.
[0064] Optionally, the third feature vector only represents the relationship between the CPU utilization of the same node at different time points. After inputting the baseline CPU utilization into the recurrent neural network model, for each node in the node cluster, based on all the baseline CPU utilization of this node and the corresponding time point of each baseline CPU utilization, a function curve between the CPU utilization of this node and the time point is fitted.
[0065] 110. Fuse the first feature vector, the second feature vector, and the third feature vector, and obtain the current CPU utilization rate of the node at the current time point based on the fused feature vector.
[0066] Optionally, the first feature vector, the second feature vector, and the third feature vector can be concatenated according to certain concatenation rules, and the concatenated feature vector can be processed to obtain the current CPU utilization rate.
[0067] In the aforementioned CPU utilization prediction method, during the operation of the target software application, for each node in the node cluster where the target software application is deployed, the baseline CPU utilization of the node's central processing unit (CPU) at a preset number of time points prior to the current time point is obtained in real time. The baseline CPU utilization is input into a deep learning network model based on a self-attention mechanism, outputting a first feature vector for the node. The baseline CPU utilization is then input into a convolutional neural network model, outputting a second feature vector for the node. Finally, the baseline CPU utilization is input into a recurrent neural network model, outputting a third feature vector for the node. The first, second, and third feature vectors are then fused, and the current CPU utilization of the node at the current time point is obtained based on the fused feature vector. The method provided in this application, by accurately predicting the current CPU utilization of nodes, can reasonably distribute the operating load of software applications such as registry centers to each node in the node cluster during operation, thus avoiding node overload and ensuring full utilization of node resources.
[0068] In some embodiments, inputting a baseline CPU utilization rate into a deep learning network model, a convolutional neural network model, and a recurrent neural network model based on a self-attention mechanism includes: obtaining a preset matrix; determining one of the row vectors and column vectors of the preset matrix as a first vector and the remaining vector as a second vector; obtaining the number of nodes in the node cluster; obtaining the number of adjacent first vectors from the preset matrix and determining the obtained first vectors as target first vectors; randomly selecting a target first vector as the first vector that matches the node; for each baseline CPU utilization rate of a node, filling the baseline CPU utilization rate into an element position of the first vector that matches the node; and inputting the filled preset matrix into the deep learning network model, the convolutional neural network model, and the recurrent neural network model based on a self-attention mechanism.
[0069] The number of elements in the first vector in the preset matrix is not less than the number of nodes in the node cluster, and the number of element positions in the first vector is not less than the preset number.
[0070] In this embodiment, the baseline CPU utilization is filled into a preset matrix, and the filled preset matrix is input into the network model to make the obtained feature vector more accurate.
[0071] In some embodiments, before inputting the filled preset matrix into a deep learning network model, a convolutional neural network model, or a recurrent neural network model based on a self-attention mechanism, the method further includes: filling the element positions in the preset matrix that are not filled by the benchmark CPU utilization with preset values.
[0072] Optionally, to ensure the integrity of the preset matrix, the positions of elements in the preset matrix that are not filled with the baseline CPU utilization will be filled with the number 0.
[0073] In this embodiment, for the element positions in the preset matrix that are not filled by the baseline CPU utilization, the preset values are filled into the element positions, which can ensure the integrity of the preset matrix and make the obtained feature vector more accurate.
[0074] In some embodiments, as shown in FIG2, the fusion of the first feature vector, the second feature vector, and the third feature vector includes:
[0075] 202. Obtain the preset concatenation order between the first feature vector, the second feature vector, and the third feature vector.
[0076] 204. Based on the preset splicing order, the first feature vector, the second feature vector, and the third feature vector are spliced together to obtain the fused feature vector.
[0077] Optionally, the preset splicing order can be determined according to actual needs.
[0078] In this embodiment, the first feature vector, the second feature vector, and the third feature vector are concatenated according to a preset concatenation order to obtain a fused feature vector, which makes the current CPU utilization rate more accurate.
[0079] In some embodiments, the method further includes: for each node in the node cluster, obtaining the historical CPU utilization rate of the node at each historical time point within a historical time period; wherein the target software application runs continuously within the historical time period; sorting the historical CPU utilization rates in chronological order according to the corresponding historical time points; for each historical CPU utilization rate in the sorting result, if there are a preset number of historical CPU utilization rates following the historical CPU utilization rate, including the historical CPU utilization rate and the preset number of historical CPU utilization rates following the historical CPU utilization rate into a utilization rate combination; determining the first preset number of historical CPU utilization rates in the utilization rate combination as the first historical utilization rate, and determining the last historical CPU utilization rate in the utilization rate combination as the second historical utilization rate; and training a deep learning network model, a convolutional neural network model, and a recurrent neural network model based on a self-attention mechanism based on the first historical utilization rate and the second historical utilization rate.
[0080] Optionally, the utilization rate combination is shown in Figure 3. The historical CPU utilization rate data in Figure 3 is the first historical utilization rate in the utilization rate combination, and the predicted value in Figure 3 is the second historical utilization rate in the utilization rate combination. The number of first historical utilization rates in the figure is L. As shown in Figure 3, from the historical CPU utilization rate X1 to XS-L, there are at least L historical CPU utilization rates after each of these historical CPU utilization rates. Therefore, utilization rate combinations can be created based on these historical CPU utilization rates.
[0081] In this embodiment, historical CPU usage is incorporated into the usage combination, and the network model is trained based on the usage combination, making the trained network model more accurate.
[0082] In some embodiments, training a deep learning network model, a convolutional neural network model, and a recurrent neural network model based on a self-attention mechanism is performed based on a first historical usage rate and a second historical usage rate. This includes: for any one of the deep learning network model, convolutional neural network model, or recurrent neural network model based on a self-attention mechanism, inputting the first historical usage rate into the network model and outputting the corresponding historical feature vector of the network model; fusing the corresponding historical feature vectors of the three network models and obtaining the predicted CPU usage rate based on the fused historical feature vector; comparing the predicted CPU usage rate with the second historical usage rate, and updating the model parameters of the three network models based on the comparison result.
[0083] Optionally, the model parameters of the network model may include, but are not limited to, weights, biases, gating parameters, and convolutional kernels.
[0084] In this embodiment, the network model is trained based on the first historical usage rate and the second historical usage rate, so that the network model obtained after training is more accurate.
[0085] In one embodiment, another method for predicting CPU utilization is provided, which includes three parts: data collection and preprocessing, model design and construction, and model training and validation.
[0086] (1) Data collection and preprocessing:
[0087] To obtain CPU utilization information of registry cluster nodes for neural network training and validation, time-series data of CPU utilization for each node in multiple registry clusters (containing different registry engines) was collected at certain sampling intervals over a continuous period, forming the original dataset. Upon collecting the CPU utilization time-series dataset, data processing was first required. Because the size and number of nodes of each registry cluster varied, the collected time-series dataset needed to be filled into a matrix of uniform size. Then, according to the data collection time order, the dataset was divided into three subsets in a 6:2:2 ratio: training set, validation set, and test set. The training set was used for training and parameter tuning of the proposed neural network model; the validation set selected the model parameters with the smallest error; and the test set verified the effectiveness of the optimal model parameters.
[0088] To generate trainable samples, this patent uses a sliding window method to generate data samples needed for training a neural network model from the dataset, as shown in Figure 3. A sliding window of size L+1 is set, where the first L parts are the historical CPU utilization sequence, and the last 1 part is the target CPU utilization value to be predicted. The sliding window slides across the traffic matrix sequence, moving one step at a time, thus generating SL data samples from a dataset containing S CPU utilization data points.
[0089] (2) Model Design and Construction:
[0090] As mentioned earlier, in order to capture the spatiotemporal correlations between nodes in the registry cluster, this patent designs a spatiotemporal fusion neural network model (Global-Local Spatio-Temporal Fusion Network, GL-STFN). The structure of this neural network model is shown in Figure 4, and it mainly includes the following three key modules: a global spatiotemporal relation processing module, a local relation processing module, and a temporal relation processing module.
[0091] 1) Global Spatiotemporal Relationship Extraction Module:
[0092] To capture the influence and dependencies between registry nodes, a self-attention mechanism is used to capture the global spatiotemporal relationships between nodes. Self-attention is a mechanism for capturing dependencies between different positions within a tensor, widely used in natural language processing and sequence modeling tasks, especially in Transformer models. Self-attention allows each element in the input vector to be weighted according to the weights of other elements. This weighted combination can be viewed as "self-attention" to the input vector: information from different positions in the vector can influence and adjust each other during computation. By calculating the correlation between each element in the input vector and other elements, and using these correlations to adjust the feature representation of each element, self-attention achieves dependency modeling between different positions. It is widely used in models such as Transformer because it effectively captures long-distance dependencies, improving the model's expressiveness and generalization ability.
[0093] For example, there is an implicit relationship between time T of the Leader node and time T+N of the Follower node. By calculating the self-attention between them, this global spatiotemporal relationship existing in different nodes and at different times can be modeled, and the corresponding features can be extracted.
[0094] 2) Local Relationship Processing Module:
[0095] Besides the global spatiotemporal relationships between different nodes and time steps, local spatiotemporal relationships cannot be ignored. Therefore, this method uses a 2D CNN (Convolutional Neural Network) module to model the spatiotemporal relationships between adjacent nodes and adjacent time steps, capturing local implicit relationships. CNNs are widely used in the image domain to capture local spatial information in images through two-dimensional convolution. Therefore, this method abstracts the clustered time-series data into a single-channel image. The 2D CNN can slide the convolution kernel on adjacent nodes and adjacent time steps, thereby capturing patterns and spatiotemporal relationships within different nodes and time ranges in the vector.
[0096] 3) Time dependency handling module:
[0097] LSTM and GRU are two RNN networks widely used in time series processing tasks. GRU has fewer parameters than LSTM and performs no worse. To extract temporal dependencies in the time series of a single node in the registry, this method uses the GRU module to capture long-term temporal dependencies and outputs a feature sequence.
[0098] 4) Feature fusion:
[0099] The feature vectors at different levels output by the three modules are fused. They can be concatenated to form a unified feature vector. A fully connected layer is then used to process the fused feature vector to ultimately predict the value at the next time step.
[0100] (3) Model training and validation:
[0101] The constructed GLSTFN model is trained using the CPU utilization training set. The model is trained based on the error between the predicted and target values of CPU utilization, and the parameters of each part of the network structure in the model are adjusted.
[0102] The final result is a model capable of predicting cluster CPU utilization. The loss function used in training the network model is mean squared error, calculated as follows:
[0103] In the formula, n represents the number of CPU utilization data values to be predicted, and y i This represents the true value of historical CPU utilization data. This represents the predicted CPU utilization data value.
[0104] The optimal network model parameters are selected using a validation set. The model with the smallest prediction error is chosen from the validation set, and its corresponding parameters and structure are retained, resulting in a network model capable of predicting cluster CPU utilization. The validity of the selected network model parameters is validated using a test set. The network model selected based on its performance on the validation set is then evaluated using the test set to assess its generalization ability. Finally, an effective network model with small error capable of predicting the CPU utilization of the registry cluster is obtained.
[0105] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0106] Based on the same inventive concept, this application also provides a CPU utilization prediction device for implementing the CPU utilization prediction method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more CPU utilization prediction device embodiments provided below can be found in the limitations of the CPU utilization prediction method described above, and will not be repeated here.
[0107] In an exemplary embodiment, as shown in FIG5, a CPU utilization prediction device 500 is provided, including: a first acquisition module 501, a first input module 502, a second input module 503, a third input module 504, and a fusion module 505, wherein:
[0108] The first acquisition module 501 is configured to, during the operation of the target software application, acquire in real time the baseline CPU utilization of the central processing unit (CPU) of each node in the node cluster where the target software application is deployed, for each node, the baseline CPU utilization of the node at a preset number of time points before the current time point.
[0109] The first input module 502 is configured to input the baseline CPU utilization rate into a deep learning network model based on a self-attention mechanism and output the first feature vector corresponding to the node.
[0110] The second input module 503 is configured to input the baseline CPU utilization rate into the convolutional neural network model and output the second feature vector corresponding to the node.
[0111] The third input module 504 is configured to input the baseline CPU utilization into the recurrent neural network model and output the third feature vector corresponding to the node.
[0112] The fusion module 505 is configured to fuse the first feature vector, the second feature vector and the third feature vector, and obtain the current CPU utilization rate of the node at the current time point based on the fused feature vector.
[0113] In some embodiments, the first input module 502 is further configured to: obtain a preset matrix; determine one of the row vectors and column vectors of the preset matrix as a first vector and the remaining vector as a second vector; obtain the number of nodes in the node cluster; obtain the number of adjacent first vectors of the number of nodes from the preset matrix and determine the obtained first vectors as target first vectors; randomly select a target first vector as the first vector matching the node; for each benchmark CPU utilization of the node, fill the benchmark CPU utilization into an element position of the first vector matching the node; and input the filled preset matrix into the deep learning network model based on the self-attention mechanism, the convolutional neural network model, and the recurrent neural network model.
[0114] In some embodiments, the first input module 502 is further configured to fill the element positions in the preset matrix that are not filled by the baseline CPU utilization with preset values.
[0115] In some embodiments, the fusion module 505 is further configured to obtain a preset concatenation order among the first feature vector, the second feature vector, and the third feature vector; and to concatenate the first feature vector, the second feature vector, and the third feature vector based on the preset concatenation order to obtain the fused feature vector.
[0116] In some embodiments, the CPU utilization prediction device 500 further includes:
[0117] The second acquisition module is configured to acquire the historical CPU utilization rate of each node in the node cluster at each historical time point within a historical time period; wherein the target software application runs continuously within the historical time period.
[0118] The sorting module is configured to sort the historical CPU usage in order from front to back according to the corresponding historical time points.
[0119] The combination module is configured to, for each historical CPU utilization rate in the sorting results, combine the historical CPU utilization rate with the preset number of historical CPU utilization rates following the historical CPU utilization rate into a utilization rate combination if there are preset number of historical CPU utilization rates following the historical CPU utilization rate.
[0120] The determination module is configured to determine the first preset number of historical CPU utilization rates in the utilization rate combination as the first historical utilization rate, and the last historical CPU utilization rate in the utilization rate combination as the second historical utilization rate.
[0121] The training module is configured to train the deep learning network model based on the self-attention mechanism, the convolutional neural network model, and the recurrent neural network model based on the first historical usage rate and the second historical usage rate.
[0122] In some embodiments, the training module is further configured to, for any one of the self-attention-based deep learning network model, the convolutional neural network model, or the recurrent neural network model, input the first historical usage rate into the network model and output the corresponding historical feature vector of the network model; fuse the corresponding historical feature vectors of the three network models and obtain the predicted CPU usage rate based on the fused historical feature vector; compare the predicted CPU usage rate with the second historical usage rate, and update the model parameters of the three network models based on the comparison result.
[0123] Each module in the aforementioned CPU utilization prediction device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each module.
[0124] In an exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram is shown in Figure 6. The computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The input / output interface of the computer device is used for exchanging information between the processor and external devices. The communication interface of the computer device is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When the computer program is executed by the processor, it implements a CPU utilization prediction method.
[0125] Those skilled in the art will understand that the structure shown in Figure 6 is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0126] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0127] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0128] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0129] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0130] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0131] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0132] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method for predicting CPU utilization, characterized in that, The method includes: During the operation of the target software application, for each node in the node cluster where the target software application is deployed, the baseline CPU utilization of the node's central processing unit (CPU) at a preset number of time points before the current time point is obtained in real time. The baseline CPU utilization is input into a deep learning network model based on a self-attention mechanism, and the corresponding first feature vector of the node is output. The baseline CPU utilization is input into the convolutional neural network model, and the corresponding second feature vector of the node is output. The baseline CPU utilization is input into the recurrent neural network model, and the corresponding third feature vector of the node is output. The first feature vector, the second feature vector, and the third feature vector are fused; and The current CPU utilization rate of the node at the current time point is obtained based on the fused feature vector.
2. The method according to claim 1, characterized in that, The step of inputting the benchmark CPU utilization rate into a deep learning network model, a convolutional neural network model, and a recurrent neural network model based on a self-attention mechanism includes: Obtain the preset matrix; One of the row vectors and column vectors of the preset matrix is determined as the first vector; The remaining vector is designated as the second vector; Obtain the number of nodes in the node cluster; Obtain the number of adjacent first vectors of the specified number of nodes from the preset matrix; The first vector obtained is determined as the target first vector; Randomly select a target first vector as the first vector that matches the node; For each baseline CPU utilization of the node, the baseline CPU utilization is filled into an element position in the first vector that matches the node; and The filled preset matrix is input into the deep learning network model based on the self-attention mechanism, the convolutional neural network model, and the recurrent neural network model.
3. The method according to claim 2, characterized in that, Before inputting the padded preset matrix into the self-attention-based deep learning network model, the convolutional neural network model, and the recurrent neural network model, the method further includes: For the element positions in the preset matrix that are not filled by the baseline CPU utilization, a preset value is filled into the element position.
4. The method according to claim 1, characterized in that, The step of fusing the first feature vector, the second feature vector, and the third feature vector includes: Obtain the preset concatenation order among the first feature vector, the second feature vector, and the third feature vector; and The first feature vector, the second feature vector, and the third feature vector are concatenated according to the preset concatenation order to obtain the fused feature vector.
5. The method according to claim 1, characterized in that, The method further includes: For each node in the node cluster, the historical CPU utilization rate of the node at each historical time point within a historical time period is obtained; wherein, the target software application runs continuously within the historical time period; The historical CPU usage rates are sorted in chronological order from the previous to the next historical time point. For each historical CPU utilization rate in the sorting results, if there are a preset number of historical CPU utilization rates after the historical CPU utilization rate, the historical CPU utilization rate and the preset number of historical CPU utilization rates after the historical CPU utilization rate are included in a utilization rate combination. The first preset number of historical CPU utilization rates in the utilization rate combination are determined as the first historical utilization rate; The last historical CPU utilization rate in the aforementioned utilization rate combination is determined as the second historical utilization rate; and Based on the first historical usage rate and the second historical usage rate, the deep learning network model based on the self-attention mechanism, the convolutional neural network model, and the recurrent neural network model are trained.
6. The method according to claim 5, characterized in that, The training of the deep learning network model based on the self-attention mechanism, the convolutional neural network model, and the recurrent neural network model based on the first historical usage rate and the second historical usage rate includes: For any one of the deep learning network model based on the self-attention mechanism, the convolutional neural network model, or the recurrent neural network model, the first historical usage rate is input into the network model, and the corresponding historical feature vector of the network model is output. The historical feature vectors of the three network models are fused together; Predicted CPU utilization is obtained based on the fused historical feature vectors; Compare the predicted CPU utilization with the second historical utilization; and The model parameters of the three network models are updated based on the comparison results.
7. A CPU utilization prediction device, characterized in that, The device includes: The first acquisition module is configured to, during the operation of the target software application, acquire in real time the baseline CPU utilization of the central processing unit (CPU) of each node in the node cluster where the target software application is deployed, for each node, the CPU utilization of the node at a preset number of time points before the current time point. The first input module is configured to input the baseline CPU utilization into a deep learning network model based on a self-attention mechanism and output the first feature vector corresponding to the node. The second input module is configured to input the baseline CPU utilization into the convolutional neural network model and output the second feature vector corresponding to the node. The third input module is configured to input the baseline CPU utilization into the recurrent neural network model and output the corresponding third feature vector of the node. The fusion module is configured to fuse the first feature vector, the second feature vector, and the third feature vector, and obtain the current CPU utilization rate of the node at the current time point based on the fused feature vector.
8. The apparatus according to claim 7, characterized in that, The first input module is also configured to: Obtain a preset matrix; determine one of the row vectors and column vectors of the preset matrix as a first vector; determine the other vector as a second vector; obtain the number of nodes in the node cluster; obtain the number of adjacent first vectors of the number of nodes from the preset matrix; determine the obtained first vector as a target first vector; randomly select a target first vector as the first vector that matches the node; for each benchmark CPU utilization of the node, fill the benchmark CPU utilization into one element position of the first vector that matches the node; input the filled preset matrix into the deep learning network model based on the self-attention mechanism, the convolutional neural network model, and the recurrent neural network model.
9. The apparatus according to claim 8, characterized in that, The first input module is also configured to: For the element positions in the preset matrix that are not filled by the baseline CPU utilization, a preset value is filled into the element position.
10. The apparatus according to claim 7, characterized in that, The fusion module is also configured to: Obtain a preset concatenation order among the first feature vector, the second feature vector, and the third feature vector; concatenate the first feature vector, the second feature vector, and the third feature vector based on the preset concatenation order to obtain the fused feature vector.
11. The apparatus according to claim 7, characterized in that, The device further includes: The second acquisition module is configured to acquire the historical CPU utilization rate of each node in the node cluster at each historical time point within a historical time period; wherein the target software application runs continuously within the historical time period. The sorting module is configured to sort the historical CPU usage in order from front to back according to the corresponding historical time points; The combination module is configured to, for each historical CPU utilization rate in the sorting results, if there are a preset number of historical CPU utilization rates after the historical CPU utilization rate, combine the historical CPU utilization rate and the preset number of historical CPU utilization rates after the historical CPU utilization rate into a utilization rate combination. The determination module is configured to determine the first preset number of historical CPU utilization rates in the utilization rate combination as the first historical utilization rate; and to determine the last historical CPU utilization rate in the utilization rate combination as the second historical utilization rate. The training module is configured to train the deep learning network model based on the self-attention mechanism, the convolutional neural network model, and the recurrent neural network model based on the first historical usage rate and the second historical usage rate.
12. The apparatus according to claim 11, characterized in that, The training module is also configured to: For any one of the deep learning network model based on the self-attention mechanism, the convolutional neural network model, or the recurrent neural network model, the first historical usage rate is input into the network model, and the corresponding historical feature vector of the network model is output; the corresponding historical feature vectors of the three network models are fused. The predicted CPU utilization is obtained based on the fused historical feature vector; the predicted CPU utilization is compared with the second historical utilization. The model parameters of the three network models are updated based on the comparison results.
13. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.