Workload prediction method and device for service in service cluster
By clustering the load indicator sequence of the service cluster and applying the sequence prediction model of multi-task training, the problem of low workload prediction accuracy in the existing technology is solved, and the satisfaction of diverse service needs and resource optimization are achieved.
Patent Information
- Application Number
- CN202410742222.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-10-11
AI Technical Summary
Existing technologies cannot accurately predict the diverse workloads served in service clusters, resulting in a waste or shortage of resources, limited prediction accuracy, and inability to meet the needs of diverse online computing services.
By obtaining the load indicator sequence of the service cluster, determine the service representation, and perform clustering processing, obtain the sequence prediction model trained on multiple tasks, divide the service into multiple clusters, and use the corresponding sequence prediction model for each cluster. Workload forecasting.
It improves the accuracy of workload prediction, meets the needs of diverse online computing services, and optimizes resource planning, SLA compliance, cost control and fault tolerance.
Smart Images

Figure CN118760561A_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to the computer field, and more particularly, to a method and apparatus for predicting workload of services in a service cluster. Background Art
[0002] With the widespread application of cloud computing and online computing services, the demand for predicting the workload of services in a service cluster is increasing. The workload of the above services is also called the workload of the service. The future data of the workload of a service is often predicted based on the historical data of the workload of the service, where the historical data may contain privacy information.
[0003] In the existing technology, there are some problems in predicting the workload of services in a service cluster. First, most prediction schemes can only predict specific types of services and cannot meet the diverse needs of online computing services. Second, the prediction accuracy of existing prediction schemes is limited and cannot accurately predict future workloads, resulting in resource waste or insufficient resources. Summary of the invention
[0004] One or more embodiments of this specification describe a method and device for predicting workload of services in a service cluster, which can meet diverse online computing service requirements and improve prediction accuracy.
[0005] In a first aspect, a workload prediction method for a service in a service cluster is provided, comprising:
[0006] Obtaining a load indicator sequence corresponding to a workload indicator of each service in the service cluster in the same historical time period;
[0007] Determine the service representation corresponding to each service based on the load indicator sequence corresponding to each service;
[0008] Perform clustering based on the service representations corresponding to each service to obtain the target cluster to which each service belongs among multiple clusters;
[0009] Acquire multiple sequence prediction models pre-trained for multiple tasks, and correspond the multiple clusters to the multiple tasks, and then to the multiple sequence prediction models;
[0010] At least the load indicator sequence of any service is input into the target sequence prediction model corresponding to the target cluster of the service in the multiple sequence prediction models to obtain a first prediction value of the workload indicator of the service corresponding to the target moment after the historical time period.
[0011] In a possible implementation manner, determining the service representations corresponding to the respective services includes:
[0012] Obtaining a system indicator sequence of a system status indicator related to the workload of each service, and obtaining a first representation corresponding to each service based on the system indicator sequence;
[0013] Determine, based on the load indicator sequences respectively corresponding to the services, the second representations respectively corresponding to the services;
[0014] The first representation of any service and the second representation of the service are combined to obtain a service representation corresponding to the service.
[0015] Furthermore, the workload indicator includes: the number of CPU cores in use; the system status indicator includes at least one of the following: system response time, CPU utilization, and number of CPU requests.
[0016] Furthermore, obtaining the first representation corresponding to each service includes:
[0017] Determining an initial code for each service based on the system indicator sequence for each service;
[0018] The initial codes corresponding to the services are respectively input into the first neural network to obtain the first representations corresponding to the services.
[0019] Furthermore, the determining of the second representations corresponding to the respective services includes:
[0020] The load indicator sequence corresponding to any service is input into the second neural network for time series processing to obtain the time series representation corresponding to the service as its second representation.
[0021] In a possible implementation, the mapping the multiple clusters to the multiple tasks includes:
[0022] Determine the category representation corresponding to the target cluster based on the service representations corresponding to the services corresponding to the same target cluster;
[0023] Based on the category representation of each cluster and the task description information of each task, each cluster is mapped to each task.
[0024] Furthermore, the step of inputting at least the load indicator sequence of any service into a target sequence prediction model corresponding to the target cluster of the service in the multiple sequence prediction models includes:
[0025] The load indicator sequence of any service and the category representation of the target cluster corresponding to the service are input into the target sequence prediction model.
[0026] In a possible implementation, the multiple sequence prediction models are trained in the following manner:
[0027] Determining target initialization parameters shared by the multiple sequence prediction models through a first training phase;
[0028] Through the second training phase, each sequence prediction model is updated respectively based on the target initialization parameters.
[0029] Furthermore, the first training phase includes multiple rounds of iterations, and any round of iterations includes:
[0030] Obtaining current initialization parameters shared by the multiple sequence prediction models;
[0031] For a sequence prediction model corresponding to any task, the current initialization parameters are updated based on a first training sample set corresponding to the task to obtain a current exclusive model for the task;
[0032] Determine the single prediction loss of the current dedicated model corresponding to any task for the first test sample set under the task;
[0033] Based on the sum of the individual prediction losses corresponding to each task, the current initialization parameters are updated.
[0034] Furthermore, the second training stage includes:
[0035] For the sequence prediction model corresponding to any task, the target initialization parameters are updated using the second training sample set under the task to obtain the exclusive parameters of the task.
[0036] In a possible implementation, the method further includes:
[0037] The target sequence prediction model is used to obtain a predicted change trend of the workload indicator corresponding to the target moment after the historical time period relative to the current moment.
[0038] In a second aspect, a workload prediction device for a service in a service cluster is provided, comprising:
[0039] An acquisition unit, used to acquire a load indicator sequence corresponding to a workload indicator of each service in the service cluster in the same historical time period;
[0040] A characterization unit, configured to determine a service characterization corresponding to each service based on the load indicator sequence corresponding to each service obtained by the acquisition unit;
[0041] A clustering unit, configured to perform clustering processing based on the service representations corresponding to the respective services obtained by the representation unit, to obtain a target cluster to which each service belongs among the multiple clusters;
[0042] A matching unit, used to obtain a plurality of sequence prediction models pre-trained for a plurality of tasks, and correspond the plurality of clusters obtained by the clustering unit to the plurality of tasks, and further correspond to the plurality of sequence prediction models;
[0043] A prediction unit is used to input at least the load indicator sequence of any service obtained by the acquisition unit into a target sequence prediction model corresponding to the target cluster of the service obtained by the matching unit in the multiple sequence prediction models, so as to obtain a first prediction value of the workload indicator corresponding to the target moment after the historical time period of the service.
[0044] According to a third aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute the method of the first aspect.
[0045] According to a fourth aspect, a computing device is provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method of the first aspect is implemented.
[0046] Through the method and device provided in the embodiments of this specification, firstly, the load indicator sequence corresponding to the workload indicator of each service in the service cluster in the same historical time period is obtained; then, based on the load indicator sequence corresponding to each service, the service representation corresponding to each service is determined; then, clustering is performed based on the service representation corresponding to each service to obtain the target cluster to which each service belongs in multiple clusters; then, multiple sequence prediction models pre-trained for multiple tasks are obtained, and the multiple clusters are corresponded to the multiple tasks, and then corresponded to the multiple sequence prediction models; finally, the load indicator sequence of at least any service is input into the target sequence prediction model corresponding to the target cluster of the service in the multiple sequence prediction models, and the first predicted value of the workload indicator corresponding to the target moment after the historical time period of the service is obtained. As can be seen from the above, in the embodiments of this specification, multiple sequence prediction models are pre-trained for multiple tasks. Unlike the unified model, the unified model uses a set of parameters for all services, so it has limitations in capturing large-area data changes. Their results will give priority to certain services, while the performance of other services is much worse. The clustering-based model can alleviate these shortcomings. Based on the load indicator sequence corresponding to each service, the service representation corresponding to each service is determined, and the service representation of each service is clustered. According to the clustering results, the corresponding sequence prediction model is found to predict the workload. This can meet the diverse needs of online computing services and improve prediction accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0048] Figure 1 A schematic diagram of an implementation scenario of an embodiment disclosed in this specification;
[0049] Figure 2 A flow chart of a method for predicting workload of services in a service cluster according to one embodiment is shown;
[0050] Figure 3 A schematic diagram showing a method of generating a first representation according to an embodiment;
[0051] Figure 4 A schematic diagram showing a method of generating a second representation according to an embodiment;
[0052] Figure 5 A schematic diagram showing a training method of multiple sequence prediction models according to an embodiment is shown;
[0053] Figure 6 A schematic block diagram of a device for predicting workload for services in a service cluster according to an embodiment is shown. DETAILED DESCRIPTION
[0054] The solution provided in this specification is described below in conjunction with the accompanying drawings.
[0055] Figure 1 The following is a schematic diagram of an implementation scenario of an embodiment disclosed in this specification. The implementation scenario involves workload prediction for services in a service cluster. It is understandable that a service cluster includes multiple services. Generally, using a unified model to predict the future workload of any service based on the historical workload of the service cannot meet the diverse online computing service requirements and cannot accurately predict the future workload.
[0056] Reference Figure 1In the embodiments of the present specification, multiple sequence prediction models are pre-trained for multiple tasks. For example, sequence prediction models corresponding to four tasks are pre-trained, including: a sequence prediction model for task 1, a sequence prediction model for task 2, a sequence prediction model for task 3, and a sequence prediction model for task 4. When predicting the workload of services in a service cluster, the service representations corresponding to each service are determined based on the load indicator sequences corresponding to each service. For example, the service representation of service 1 is determined based on the load indicator sequence of service 1, the service representation of service 2 is determined based on the load indicator sequence of service 2, and ..., the service representation of service N is determined based on the load indicator sequence of service N. Clustering is performed on the service representations of each service. For example, services 1 to 10 are clustered into c 1 This cluster, services 11 to 20 are clustered as c 2 This cluster, services 21 to 30 are clustered as c 3 This cluster, services 31 to N are clustered as c 4 This cluster. Based on the clustering results, find the sequence prediction model corresponding to any service, for example, c 1 This cluster corresponds to task 1, and services 1 to 10 correspond to the sequence prediction model of task 1, c 2 This cluster corresponds to Task 2, and services 11 to 20 correspond to the sequence prediction model of Task 2, c 3 This cluster corresponds to task 3, and services 21 to 30 correspond to the sequence prediction model of task 3, c 4 This cluster corresponds to task 4, and services 31 to N correspond to the sequence prediction model of task 4. The workload of any service is predicted using the sequence prediction model corresponding to the service. For example, the load indicator sequence of service 1 is input into the sequence prediction model of task 1 to obtain the predicted value of the workload indicator of service 1, and the load indicator sequence of service 11 is input into the sequence prediction model of task 2 to obtain the predicted value of the workload indicator of service 11, and so on. It can meet the diverse needs of online computing services and improve the prediction accuracy.
[0057] Workload forecasting, that is, predicting the task volume, is crucial for optimizing resource planning, service-level agreement (SLA) compliance, cost control, and fault tolerance in cloud environments. Accurate task volume forecasting can improve system efficiency and stability, provide users with a better service experience, and improve the overall operational efficiency of the cloud environment.
[0058] In terms of resource planning, accurate task volume forecasting can help cloud environment managers better plan resources. Based on the task volume forecasting results, computing, storage, and network resources can be reasonably allocated to ensure that the system can meet demand during peak or off-peak periods, thus avoiding resource waste or insufficient resources and improving resource utilization.
[0059] In terms of SLA compliance, task volume forecasting can help cloud environment providers better comply with SLAs. By accurately predicting task volume, system configuration and resource allocation can be adjusted to meet the performance indicators specified in the SLA, such as response time, throughput, etc. This helps ensure customer satisfaction and avoid the risk of violating SLAs.
[0060] In terms of cost control, accurate task volume forecasting helps cloud environment managers control costs. By forecasting task volume, resource investment can be adjusted according to demand to avoid overinvestment or underinvestment. This can reduce costs in hardware, energy, and maintenance, improve resource utilization efficiency, and thus reduce overall operating costs.
[0061] In terms of fault tolerance, task volume prediction plays an important role in fault tolerance. By predicting the task volume, fault tolerance mechanisms and disaster recovery plans can be better designed. In the event of a failure or unexpected situation, predicting the task volume can help the system make quick adjustments and recovery to minimize the impact on users.
[0062] In summary, based on the importance of task volume prediction, it is necessary to meet the diverse needs of online computing services and improve prediction accuracy.
[0063] Figure 2 A flowchart of a method for predicting workload of services in a service cluster according to an embodiment is shown. The method can be based on Figure 1 The implementation scenario shown in Figure 1 is as follows. Figure 2As shown, the workload prediction method for services in a service cluster in this embodiment includes the following steps: Step 21, obtaining the load indicator sequence corresponding to the workload indicator of each service in the service cluster in the same historical time period; Step 22, determining the service representation corresponding to each service based on the load indicator sequence corresponding to each service; Step 23, performing clustering processing based on the service representation corresponding to each service, and obtaining the target cluster to which each service belongs in multiple clusters; Step 24, obtaining multiple sequence prediction models pre-trained for multiple tasks, and corresponding the multiple clusters to the multiple tasks, and then corresponding to the multiple sequence prediction models; Step 25, at least inputting the load indicator sequence of any service into the target sequence prediction model corresponding to the target cluster of the service in the multiple sequence prediction models, and obtaining the first predicted value of the workload indicator corresponding to the target moment of the service after the historical time period. The specific execution method of each of the above steps is described below.
[0064] First, in step 21, a load indicator sequence corresponding to the workload indicator of each service in the service cluster in the same historical time period is obtained. It can be understood that the load indicator sequence is the indicator values at each time point arranged in chronological order.
[0065] In one example, the workload indicator includes: the number of CPU cores used.
[0066] The embodiments of this specification can implement workload prediction for services in a service cluster based on stream processing.
[0067] Stream computing: A data processing technology used to process and analyze continuously generated data streams in real time. It can process data from multiple data sources and perform calculations and responses immediately when the data arrives.
[0068] Data stream: An infinite sequence of data that is continuously generated. Data streams can come from a variety of sources, such as sensors, log files, networks, etc., and are usually organized in time order.
[0069] Real-time analytics: By processing and analyzing data streams in real time, timely insights and results about the data can be obtained. Real-time analytics enables decisions to be based on the latest data to support real-time business response and decision-making.
[0070] Data source: The original data source that provides the data stream, which can be a sensor, database, application programming interface (API), etc., which provides the data source of the data stream.
[0071] Then, in step 22, based on the load indicator sequences corresponding to the services, the service representations corresponding to the services are determined. It can be understood that the load indicator sequences of the services can reflect the time characteristics of the evolution of their workload, and thus the service representations can also reflect the time characteristics.
[0072] In one example, determining the service representations corresponding to the respective services includes:
[0073] Obtaining a system indicator sequence of a system status indicator related to the workload of each service, and obtaining a first representation corresponding to each service based on the system indicator sequence;
[0074] Determine, based on the load indicator sequences respectively corresponding to the services, the second representations respectively corresponding to the services;
[0075] The first representation of any service and the second representation of the service are combined to obtain a service representation corresponding to the service.
[0076] In this example, the system indicator sequence of the service can reflect the source of the service, so that the first representation can reflect the spatial characteristics of the evolution of the task volume; the load indicator sequence of the service can reflect the temporal characteristics of the evolution of its task volume, so that the second representation can reflect the temporal characteristics. The first representation of any service and the second representation of the service are combined to obtain the service representation corresponding to the service, which can reflect the temporal and spatial characteristics of the evolution of the task volume. The above combination processing can include but is not limited to splicing and other methods.
[0077] Furthermore, the workload indicator includes: the number of CPU cores in use; the system status indicator includes at least one of the following: system response time, CPU utilization, and number of CPU requests.
[0078] Furthermore, obtaining the first representation corresponding to each service includes:
[0079] Determining an initial code for each service based on the system indicator sequence for each service;
[0080] The initial codes corresponding to the services are respectively input into the first neural network to obtain the first representations corresponding to the services.
[0081] In this example, the correlation between the services can be obtained based on the system indicator sequence of each service, and based on the correlation, the initial coding corresponding to each service can be determined, and then the first neural network can be used to obtain the first representation corresponding to each service. The first representation can reflect the spatial characteristics of the service.
[0082] Figure 3FIG. 1 is a schematic diagram showing a method for generating a first representation according to an embodiment. Figure 3 Based on the correlation between each service, a similarity graph is established. The similarity graph includes multiple nodes, each node represents a service, and there is a connection edge between the nodes corresponding to two related services. Based on the similarity graph, the initial code y corresponding to each service is determined 0 ,y 1 ,y 2 ,……y n , and then use the first neural network to obtain the first representations corresponding to each service. It can be understood that multiple first representations are shown in the figure.
[0083] Furthermore, the determining of the second representations corresponding to the respective services includes:
[0084] The load indicator sequence corresponding to any service is input into the second neural network for time series processing to obtain the time series representation corresponding to the service as its second representation.
[0085] In this example, a second representation of the service is obtained through time series processing, and the second representation can reflect the time characteristics of the service.
[0086] Figure 4 FIG. 1 is a schematic diagram showing a method for generating a second representation according to an embodiment. Figure 4 , each circle represents a service, and the figure shows the load indicator sequences corresponding to multiple services respectively. Accordingly, the second representations corresponding to the multiple services are obtained respectively.
[0087] Then, in step 23, clustering is performed based on the service representations corresponding to each service to obtain the target cluster to which each service belongs in the multiple clusters. It is understandable that when the historical time period is different, the load indicator sequence may change, which will affect the service representation accordingly and may affect the target cluster to which the same service belongs.
[0088] Among them, clustering is an unsupervised learning method used to group data samples with similar characteristics into different categories or clusters. Its goal is to maximize the similarity of samples within the same category and minimize the similarity of samples between different categories. Clustering algorithms calculate the distance or similarity between samples and group them according to similarity to discover hidden patterns and structures in the data. Common clustering algorithms include K-Means, DBSCAN, hierarchical clustering, etc.
[0089] In the embodiment of this specification, the specific number of the multiple clusters can be preset.
[0090] Optionally, when the service representation is obtained based on the first representation and the second representation, the spatial and temporal features of the task volume data can be integrated. The service task volume data is clustered using the integrated features, thereby dividing the services into different categories, so as to better understand the complex spatiotemporal characteristics of the task volume evolution.
[0091] Then in step 24, multiple sequence prediction models pre-trained for multiple tasks are obtained, and the multiple clusters are mapped to the multiple tasks, and then mapped to the multiple sequence prediction models. It can be understood that there is a one-to-one correspondence between clusters and tasks, and there are as many tasks as there are clusters.
[0092] In the embodiments of this specification, the sequence prediction model may be, but is not limited to, a long short-term memory network (LSTM) or a gated recurrent unit (GRU).
[0093] In one example, the step of mapping the plurality of clusters to the plurality of tasks includes:
[0094] Determine the category representation corresponding to the target cluster based on the service representations corresponding to the services corresponding to the same target cluster;
[0095] Based on the category representation of each cluster and the task description information of each task, each cluster is mapped to each task.
[0096] In this example, services with similar characteristics are automatically classified by clustering, and better summarized into clusters. The clusters are automatically mapped to tasks through category representation, that is, the services in the clusters are mapped to tasks.
[0097] In one example, the multiple sequence prediction models are trained in the following manner:
[0098] Determining target initialization parameters shared by the multiple sequence prediction models through a first training phase;
[0099] Through the second training phase, each sequence prediction model is updated respectively based on the target initialization parameters.
[0100] In this example, the meta-learning training method is used to select the corresponding sequence prediction model for prediction according to the category of the task volume data. Each category is regarded as an independent task, and the local parameters are initialized from the global parameters through meta-learning, so that it can quickly adapt to new task volume patterns and changes.
[0101] Meta-learning is a machine learning method that aims to enable machine learning algorithms to learn how to learn. It summarizes the learning experience of multiple different tasks so that it can adapt to new tasks faster and more effectively. Meta-learning focuses on the design and selection of learning algorithms so that they can automatically learn strategies suitable for new tasks from existing experience. Meta-learning usually includes two levels of learning: the meta-learner learns how to learn and generates learners suitable for different tasks.
[0102] Furthermore, the first training phase includes multiple rounds of iterations, and any round of iterations includes:
[0103] Obtaining current initialization parameters shared by the multiple sequence prediction models;
[0104] For a sequence prediction model corresponding to any task, the current initialization parameters are updated based on a first training sample set corresponding to the task to obtain a current exclusive model for the task;
[0105] Determine the single prediction loss of the current dedicated model corresponding to any task for the first test sample set under the task;
[0106] Based on the sum of the individual prediction losses corresponding to each task, the current initialization parameters are updated.
[0107] In this example, by dynamically adapting to specific tasks through meta-learning based on previously acquired categories, it can not only learn the specific patterns of each task, but also learn the common underlying structures or principles across different tasks.
[0108] Furthermore, the second training stage includes:
[0109] For the sequence prediction model corresponding to any task, the target initialization parameters are updated using the second training sample set under the task to obtain the exclusive parameters of the task.
[0110] In this example, a small number of samples can be used to fine-tune these target initial parameters into different refined models to make fast and accurate predictions.
[0111] In the embodiments of the present specification, the sequence prediction model can be jointly trained with the neural network used to obtain the first representation or the second representation, and the fine-tuning of the clustering results is guided by the subsequent prediction error, thereby improving the accuracy.
[0112] Figure 5 A schematic diagram of a training method for multiple sequence prediction models according to an embodiment is shown. Figure 5,After training, multiple sequence prediction models have a unified model structure, but have different model parameters.,The whole training process is divided into the first training stage and the second training,stage.
[0113] In the first training stage, assuming that the shared initialization parameter of each sequence prediction model corresponding to each task is φ, firstly, for the sequence prediction model corresponding to any task, the first gradient descent is performed using the first training sample set corresponding to the task. Assuming that each task only performs one gradient descent, that is, the exclusive parameters of the model obtained for task 1 are Exclusive parameters of the model obtained for Task 2 The dedicated parameters correspond to the dedicated models of the corresponding tasks; then, for the dedicated model corresponding to any task, the single prediction loss is determined using the first test sample set corresponding to the task; then, based on the sum of the single prediction losses corresponding to each task, the second gradient descent is performed, that is, updating the initialization parameter φ, that is, Repeat the first and second gradient descents as above to obtain a better target initialization parameter φ.
[0114] In the second training phase, for the sequence prediction model corresponding to any task, the target initialization parameter φ is updated using the second training sample set under the task to obtain the dedicated parameters of the task. The number of gradient descent steps can be set to be more, unlike the first training phase where only one step of gradient descent is performed. After the training is completed, the second test sample set under the task can be used to evaluate the model.
[0115] Meta-learning can quickly adapt to new tasks or environments by creating different dedicated parameters for different tasks, giving priority to the importance of context. Based on previously acquired categories, it dynamically adapts to specific tasks, not only learning the specific patterns of each task, but also learning the common basic structures or principles of different tasks, and fine-tuning different fine models based on shared initialization parameters to make fast and accurate predictions.
[0116] Finally, in step 25, at least the load indicator sequence of any service is input into the target sequence prediction model corresponding to the target cluster of the service in the multiple sequence prediction models to obtain the first prediction value of the workload indicator corresponding to the target time after the historical time period. It can be understood that the cluster to which a service belongs determines the sequence prediction model used when predicting its workload, thereby making the prediction result more accurate.
[0117] In one example, inputting at least the load indicator sequence of any service into a target sequence prediction model corresponding to the target cluster of the service in the multiple sequence prediction models includes:
[0118] The load indicator sequence of any service and the category representation of the target cluster corresponding to the service are input into the target sequence prediction model.
[0119] In this example, not only the load indicator sequence of the service is input into the target sequence prediction model, but also the category representation of the target cluster corresponding to the service is input into the target sequence prediction model, which is conducive to improving the prediction accuracy.
[0120] In one example, the method further includes:
[0121] The target sequence prediction model is used to obtain a predicted change trend of the workload indicator corresponding to the target moment after the historical time period relative to the current moment.
[0122] For example, a trend of an indicator value increasing or decreasing.
[0123] Through the method provided in the embodiment of this specification, first obtain the load indicator sequence corresponding to the workload indicator of each service in the service cluster in the same historical time period; then determine the service representation corresponding to each service based on the load indicator sequence corresponding to each service; then perform clustering based on the service representation corresponding to each service to obtain the target cluster to which each service belongs in multiple clusters; then obtain multiple sequence prediction models pre-trained for multiple tasks, and correspond the multiple clusters to the multiple tasks, and then correspond to the multiple sequence prediction models; finally, input the load indicator sequence of at least any service into the target sequence prediction model corresponding to the target cluster of the service in the multiple sequence prediction models, and obtain the first predicted value of the workload indicator corresponding to the target moment after the historical time period of the service. As can be seen from the above, in the embodiment of this specification, multiple sequence prediction models are pre-trained for multiple tasks. Unlike the unified model, the unified model uses a set of parameters for all services, so it has limitations in capturing large-area data changes. Their results will give priority to certain services, while the performance of other services is much worse. The clustering-based model can alleviate these shortcomings. Based on the load indicator sequence corresponding to each service, the service representation corresponding to each service is determined, and the service representation of each service is clustered. According to the clustering results, the corresponding sequence prediction model is found to predict the workload. This can meet the diverse needs of online computing services and improve prediction accuracy.
[0124] According to an embodiment of another aspect, a workload prediction device for services in a service cluster is also provided, and the device is used to execute the method provided in the embodiment of this specification. Figure 6 FIG. 1 is a schematic block diagram of a workload prediction device for services in a service cluster according to an embodiment. Figure 6 As shown, the device 600 includes:
[0125] An acquisition unit 61 is used to acquire a load indicator sequence corresponding to a workload indicator of each service in the service cluster in the same historical time period;
[0126] A characterization unit 62, configured to determine a service characterization corresponding to each service based on the load indicator sequence corresponding to each service obtained by the acquisition unit 61;
[0127] A clustering unit 63 is used to perform clustering processing based on the service representations corresponding to each service obtained by the representation unit 62, so as to obtain a target cluster to which each service belongs among multiple clusters;
[0128] A matching unit 64 is used to obtain a plurality of sequence prediction models pre-trained for a plurality of tasks, and correspond the plurality of clusters obtained by the clustering unit 63 to the plurality of tasks, and further correspond to the plurality of sequence prediction models;
[0129] The prediction unit 65 is used to input at least the load indicator sequence of any service obtained by the acquisition unit 61 into the target sequence prediction model corresponding to the target cluster of the service obtained by the matching unit in the multiple sequence prediction models, and obtain a first prediction value of the workload indicator corresponding to the target moment after the historical time period of the service.
[0130] Optionally, as an embodiment, the characterization unit 62 includes:
[0131] A first representation subunit is used to obtain a system indicator sequence of a system status indicator related to the workload of each service, and obtain a first representation corresponding to each service based on the system indicator sequence;
[0132] A second characterization subunit, configured to determine a second characterization corresponding to each service based on a load indicator sequence corresponding to each service;
[0133] The combining subunit is used to combine the first representation of any service obtained by the first representation subunit and the second representation of the service obtained by the second representation subunit to obtain a service representation corresponding to the service.
[0134] Furthermore, the workload indicator includes: the number of CPU cores in use; the system status indicator includes at least one of the following: system response time, CPU utilization, and number of CPU requests.
[0135] Furthermore, the first representation subunit is specifically used to determine the initial code of each service based on the system indicator sequence of each service; input the initial code corresponding to each service into the first neural network to obtain the first representation corresponding to each service.
[0136] Furthermore, the second representation subunit is specifically used to input the load indicator sequence corresponding to any service into the second neural network for time series processing, and obtain the time series representation corresponding to the service as its second representation.
[0137] Optionally, as an embodiment, the matching unit 64 includes:
[0138] The category representation subunit is used to determine the category representation corresponding to the target cluster based on the service representations corresponding to the services corresponding to the same target cluster;
[0139] The matching subunit is used to match each cluster to each task based on the category representation of each cluster obtained by the category representation subunit and the task description information of each task.
[0140] Furthermore, the prediction unit 65 is specifically configured to input the load indicator sequence of any service and the category representation of the target cluster corresponding to the service into the target sequence prediction model.
[0141] Optionally, as an embodiment, the multiple sequence prediction models are trained in the following manner:
[0142] Determining target initialization parameters shared by the multiple sequence prediction models through a first training phase;
[0143] Through the second training phase, each sequence prediction model is updated respectively based on the target initialization parameters.
[0144] Furthermore, the first training phase includes multiple rounds of iterations, and any round of iterations includes:
[0145] Obtaining current initialization parameters shared by the multiple sequence prediction models;
[0146] For a sequence prediction model corresponding to any task, the current initialization parameters are updated based on a first training sample set corresponding to the task to obtain a current exclusive model for the task;
[0147] Determine the single prediction loss of the current dedicated model corresponding to any task for the first test sample set under the task;
[0148] Based on the sum of the individual prediction losses corresponding to each task, the current initialization parameters are updated.
[0149] Furthermore, the second training stage includes:
[0150] For the sequence prediction model corresponding to any task, the target initialization parameters are updated using the second training sample set under the task to obtain the exclusive parameters of the task.
[0151] Optionally, as an embodiment, the prediction unit 65 is further used to obtain, through the target sequence prediction model, a predicted change trend of the workload indicator corresponding to the target moment of the service after the historical time period relative to the current moment.
[0152] Through the device provided by the embodiment of this specification, first, the acquisition unit 61 acquires the load indicator sequence corresponding to the workload indicator of each service in the service cluster in the same historical time period; then the characterization unit 62 determines the service representation corresponding to each service based on the load indicator sequence corresponding to each service; then the clustering unit 63 performs clustering processing based on the service representation corresponding to each service, and obtains the target cluster to which each service belongs in multiple clusters; then the matching unit 64 obtains multiple sequence prediction models pre-trained for multiple tasks, and corresponds the multiple clusters to the multiple tasks, and then corresponds to the multiple sequence prediction models; finally, the prediction unit 65 inputs at least the load indicator sequence of any service into the target sequence prediction model corresponding to the target cluster of the service in the multiple sequence prediction models, and obtains the first predicted value of the workload indicator corresponding to the target moment after the historical time period of the service. As can be seen from the above, in the embodiment of this specification, multiple sequence prediction models are pre-trained for multiple tasks. Unlike the unified model, the unified model uses a set of parameters for all services, so it has limitations in capturing large-area data changes. Their results will give priority to certain services, while the performance of other services is much worse. The clustering-based model can alleviate these shortcomings. Based on the load indicator sequence corresponding to each service, the service representation corresponding to each service is determined, and the service representation of each service is clustered. According to the clustering results, the corresponding sequence prediction model is found to predict the workload. This can meet the diverse needs of online computing services and improve prediction accuracy.
[0153] According to another embodiment, there is also provided a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute a combination of Figure 2 The method described.
[0154] According to another embodiment of the present invention, a computing device is provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the Figure 2 The method described.
[0155] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the present invention can be implemented by hardware, software, firmware or any combination thereof. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.
[0156] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.
Claims
1. A workload prediction method for services in a service cluster, include: Obtaining a load indicator sequence corresponding to a workload indicator of each service in the service cluster in the same historical time period; Determine the service representation corresponding to each service based on the load indicator sequence corresponding to each service; Perform clustering based on the service representations corresponding to each service to obtain the target cluster to which each service belongs among multiple clusters; Acquire multiple sequence prediction models pre-trained for multiple tasks, and correspond the multiple clusters to the multiple tasks, and then to the multiple sequence prediction models; At least the load indicator sequence of any service is input into the target sequence prediction model corresponding to the target cluster of the service in the multiple sequence prediction models to obtain a first prediction value of the workload indicator of the service corresponding to the target moment after the historical time period.
2. The method according to claim 1, in, The determining of the service representations corresponding to the respective services includes: Obtaining a system indicator sequence of a system status indicator related to the workload of each service, and obtaining a first representation corresponding to each service based on the system indicator sequence; Determine, based on the load indicator sequences respectively corresponding to the services, the second representations respectively corresponding to the services; The first representation of any service and the second representation of the service are combined to obtain a service representation corresponding to the service.
3. The method according to claim 2, in, The workload indicator includes: the number of CPU cores in use; the system status indicator includes at least one of the following: system response time, CPU utilization, and the number of CPU requests.
4. The method according to claim 2, in, The obtaining of the first representations corresponding to the respective services includes: Determining an initial code for each service based on the system indicator sequence for each service; The initial codes corresponding to the services are respectively input into the first neural network to obtain the first representations corresponding to the services.
5. The method according to claim 2, in, The determining of the second representations corresponding to the respective services includes: The load indicator sequence corresponding to any service is input into the second neural network for time series processing to obtain the time series representation corresponding to the service as its second representation.
6. The method according to claim 1, in, The step of mapping the plurality of clusters to the plurality of tasks includes: Determine the category representation corresponding to the target cluster based on the service representations corresponding to the services corresponding to the same target cluster; Based on the category representation of each cluster and the task description information of each task, each cluster is mapped to each task.
7. The method according to claim 6, in, The step of inputting at least the load indicator sequence of any service into a target sequence prediction model corresponding to the target cluster of the service in the multiple sequence prediction models comprises: The load indicator sequence of any service and the category representation of the target cluster corresponding to the service are input into the target sequence prediction model.
8. The method according to claim 1, in, The multiple sequence prediction models are trained in the following manner: Determining target initialization parameters shared by the multiple sequence prediction models through a first training phase; Through the second training phase, each sequence prediction model is updated respectively based on the target initialization parameters.
9. The method according to claim 8, in, The first training phase includes multiple rounds of iterations, and any round of iterations includes: Obtaining current initialization parameters shared by the multiple sequence prediction models; For a sequence prediction model corresponding to any task, the current initialization parameters are updated based on a first training sample set corresponding to the task to obtain a current exclusive model for the task; Determine the single prediction loss of the current dedicated model corresponding to any task for the first test sample set under the task; Based on the sum of the individual prediction losses corresponding to each task, the current initialization parameters are updated.
10. The method according to claim 8, in, The second training phase includes: For the sequence prediction model corresponding to any task, the target initialization parameters are updated using the second training sample set under the task to obtain the exclusive parameters of the task.
11. The method according to claim 1, in, The method further comprises: The target sequence prediction model is used to obtain a predicted change trend of the workload indicator corresponding to the target moment after the historical time period relative to the current moment.
12. A workload prediction device for services in a service cluster, include: An acquisition unit, used to acquire a load indicator sequence corresponding to a workload indicator of each service in the service cluster in the same historical time period; A characterization unit, configured to determine a service characterization corresponding to each service based on the load indicator sequence corresponding to each service obtained by the acquisition unit; A clustering unit, configured to perform clustering processing based on the service representations corresponding to the respective services obtained by the representation unit, to obtain a target cluster to which each service belongs among the multiple clusters; A matching unit, used to obtain a plurality of sequence prediction models pre-trained for a plurality of tasks, and correspond the plurality of clusters obtained by the clustering unit to the plurality of tasks, and further correspond to the plurality of sequence prediction models; A prediction unit is used to input at least the load indicator sequence of any service obtained by the acquisition unit into a target sequence prediction model corresponding to the target cluster of the service obtained by the matching unit in the multiple sequence prediction models, so as to obtain a first prediction value of the workload indicator corresponding to the target moment after the historical time period of the service.
13. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 1 to 11.
14. A computing device, comprising a memory and a processor, wherein the memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 11 is implemented.
Citation Information
Cited By
Metalearning fast adaptation method, device, equipment, medium and program product
CN119272851A
Model training method and device, business execution method and device and storage medium
CN119357672A
