Model training method, container preheating method, device and electronic equipment
By training a predictive model of Pod scheduling time and multi-dimensional environmental information of nodes, the problem of inaccurate Pod scheduling in Serverless architecture is solved, achieving more efficient container warm-up and improving user experience.
Patent Information
- Application Number
- CN202511357960.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-22
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2045-09-22
AI Technical Summary
In serverless architectures, existing technologies cannot accurately predict which node a Pod will be scheduled to, resulting in low accuracy of container warm-up and affecting scheduling efficiency.
By acquiring the scheduling time of Pods and multi-dimensional environmental information of cluster nodes, a prediction model is trained, a graph matrix is constructed for prediction, and the trained prediction model is used for container warm-up.
It improves the model's adaptability to complex scheduling scenarios, enhances prediction accuracy, provides a more reliable foundation for container preheating, reduces cold start latency, and improves user experience.
Smart Images

Figure CN120850052B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cloud computing technology, specifically to a model training method, a container preheating method, an apparatus, and electronic equipment. Background Technology
[0002] In related technologies, a Pod is the smallest deployable computing unit in a cluster, containing one or more closely related containers. Various warm-up strategies have been proposed to address the container cold start problem in serverless environments. For example, pre-defined rules are used to determine whether containers need to be warmed up to a specific node. These methods improve container startup efficiency to some extent. However, these solutions rely on empirical rules, and in complex and ever-changing real-world scheduling scenarios, they cannot accurately predict the node to which a Pod will be scheduled, resulting in low accuracy in container warm-up and impacting scheduling efficiency. Summary of the Invention
[0003] This application provides a model training method, a container preheating method, an apparatus, and an electronic device.
[0004] The model training method provided in this application includes:
[0005] Obtain multiple training samples and label information for each training sample; wherein, the training samples include: the time when the first Pod was scheduled and multiple dimensions of environmental information of each node in the cluster when the first Pod was scheduled; the label information includes: the node to which the first Pod was scheduled;
[0006] The prediction model is trained using the multiple training samples and the label information of each training sample to obtain the trained prediction model; the trained prediction model is used to predict the node to which the first Pod will be scheduled.
[0007] The container preheating method provided in this application includes:
[0008] Environmental information of each node in the cluster is collected in multiple dimensions according to a preset time; the preset time is related to the historical scheduling time of the first Pod.
[0009] Based on the preset time and the multi-dimensional environmental information of each node in the cluster, a second graph matrix is constructed; the second graph matrix represents the preset time and the multi-dimensional environmental information of each node in the cluster.
[0010] The trained prediction model is used to predict the second graph matrix to obtain prediction information; the trained prediction model is obtained by training the model training method described above; the prediction information represents the first node to which the first Pod will be scheduled.
[0011] Based on the predicted information, container preheating is performed on the first Pod at the first node.
[0012] The model training apparatus provided in this application embodiment includes:
[0013] Acquisition Unit: Used to acquire multiple training samples and label information for each training sample; wherein, the training samples include: the time when the first Pod was scheduled and multiple dimensions of environmental information of each node in all nodes of the cluster when the first Pod was scheduled; the label information includes: the node to which the first Pod was scheduled;
[0014] Training unit: used to train a prediction model using the multiple training samples and the label information of each training sample, to obtain a trained prediction model; the trained prediction model is used to predict the node to which the first Pod will be scheduled.
[0015] The container preheating device provided in this application embodiment includes:
[0016] Collection unit: used to collect environmental information of each node in the cluster from multiple dimensions according to a preset time; the preset time is related to the historical scheduling time of the first Pod;
[0017] Prediction unit: used to construct a second graph matrix based on the preset time and the environmental information of each node in all nodes of the cluster in multiple dimensions; the second graph matrix represents the preset time and the environmental information of each node in all nodes of the cluster in multiple dimensions;
[0018] The prediction unit is used to perform prediction processing on the second graph matrix using a trained prediction model to obtain prediction information; the trained prediction model is obtained by training the model training method described above; the prediction information represents the first node to which the first Pod will be scheduled.
[0019] Preheating unit: used to preheat the container of the first Pod at the first node based on the predicted information.
[0020] The electronic device provided in this application includes: a first processor and a first memory. The first memory is used to store computer programs, and the first processor is used to call and run the computer programs stored in the first memory to execute any model training method or any container preheating method provided in this application.
[0021] The chip provided in this application includes: a second processor, configured to call and run a computer program from a second memory, causing a device equipped with the chip to execute any model training method or any container preheating method provided in this application.
[0022] The storage medium provided in this application embodiment is used to store a computer program, which causes a computer to execute any model training method or any container preheating method provided in this application embodiment.
[0023] The computer program product provided in this application includes a computer program that, when executed by a processor, implements any model training method or any container preheating method provided in this application.
[0024] The model training method, container preheating method, device, and electronic equipment provided in this application's embodiments use the scheduling time of the first Pod and the multi-dimensional environmental information of each node as input features, and train the model using the actual scheduling node as a label. This enables the prediction model to learn and understand the scheduling patterns at different times and under different resource states. Compared with related technologies, this application's solution combines the historical scheduling time of the first Pod with richer environmental information, improving the model's adaptability to complex scheduling scenarios, thereby improving prediction accuracy and providing a more reliable foundation for subsequent container preheating. Attached Figure Description
[0025] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0026] Figure 1 A schematic diagram illustrating the implementation process of the model training method provided in this application embodiment;
[0027] Figure 2 This is a schematic diagram of the process for constructing the first graph matrix provided in an embodiment of this application;
[0028] Figure 3 A schematic diagram comparing the K-channel attention mechanism provided in this application embodiment with the traditional channel attention mechanism;
[0029] Figure 4 This is a schematic diagram of the structure of the prediction model provided in the embodiments of this application;
[0030] Figure 5 A schematic diagram illustrating the implementation process of the container preheating method provided in this application embodiment;
[0031] Figure 6 This is a schematic diagram of the overall process for container preheating provided in an embodiment of this application;
[0032] Figure 7 This is a schematic diagram of the structure of the model training device provided in the embodiments of this application;
[0033] Figure 8 This is a schematic diagram of the structure of the container preheating device provided in the embodiments of this application;
[0034] Figure 9 A schematic structural diagram of an electronic device provided in the embodiments of this application;
[0035] Figure 10 This is a schematic structural diagram of the chip provided in an embodiment of this application. Detailed Implementation
[0036] The technical solutions of the embodiments of this application will now be described with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0037] It should be noted that, in the embodiments of this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, in the embodiments of this application, the character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0038] In the description of the embodiments of this application, the term "correspondence" may indicate that there is a direct or indirect correspondence between two things, or that there is an association between two things, or that there is a relationship of instruction and being instructed, configuration and being configured, etc.
[0039] To facilitate understanding of the technical solutions of the embodiments of this application, the relevant technologies of the embodiments of this application are described below. The following relevant technologies are optional solutions and can be combined with the technical solutions of the embodiments of this application in any way, and they all fall within the protection scope of the embodiments of this application.
[0040] Serverless computing is a cloud computing architecture that allows users to run code on demand without managing underlying server resources. Its core advantages lie in its high elasticity and pay-as-you-go pricing, making it particularly suitable for scenarios with fluctuating resource demands, such as artificial intelligence (AI) inference. With the increasing prevalence of large-model inference services, serverless architecture has demonstrated significant value in reducing operating costs.
[0041] However, serverless architecture also has significant drawbacks, namely the inability to predict in advance which downstream cluster node a user's Pod will be scheduled to. In scenarios where container startup pre-operations are time-consuming (such as loading model files for large model inference services), this will severely impact the user experience. Therefore, how to achieve stable and efficient container pre-warming in a serverless architecture is a key issue that serverless cloud computing technology needs to address.
[0042] In the following description, terms such as Pod, Serverless architecture, and container warm-up are core technical terms of this invention. For ease of understanding, they are briefly explained below:
[0043] 1) Pod: In the Kubernetes (K8s) container orchestration system, a Pod is the smallest deployable unit, typically containing one or more containers that share the same network namespace and storage volumes. A Pod is the basic unit of scheduling; that is, in a K8s cluster, a Pod will be scheduled to run on a specific node.
[0044] 2) Serverless Architecture: A cloud computing service model that allows users to run code without managing the underlying servers. In a serverless scenario, the Function Compute service dynamically creates and destroys container instances based on requests, thereby achieving on-demand billing and highly elastic scaling. Since container startup and initialization can be time-consuming, container preheating becomes an important means of improving user experience.
[0045] 3) Container preheating: This refers to loading the necessary images, configuration files, and dependencies of a container before it is actually invoked, in order to reduce latency during the first invocation. In a serverless environment, container preheating can significantly reduce cold start time and improve response speed and resource utilization.
[0046] refer to Figure 1 , Figure 1 This is a schematic diagram illustrating the implementation process of the model training method provided in the embodiments of this application, as shown below. Figure 1 As shown, the model training method provided in this embodiment includes the following steps:
[0047] Step 101: Obtain multiple training samples and label information for each training sample; wherein, the training samples include: the time when the first Pod was scheduled and the environmental information of each node in the cluster at the time the first Pod was scheduled; the label information includes: the node to which the first Pod was scheduled.
[0048] In this embodiment, each training sample represents a Pod scheduling event, comprising two key components: scheduling time and environmental information. The scheduling time is used to capture user behavior patterns or request patterns, while the environmental information characterizes the overall load state of the Kubernetes cluster at that time. This information collectively constitutes the basic features of the prediction model input. The label information of each training sample represents the actual node corresponding to the scheduling event, used to supervise the learning process and ensure that the model can accurately map the input to the correct output. By collecting a large number of historical scheduling records and constructing multiple training samples, as well as the training samples in the label information of each training sample, the model's generalization ability and prediction accuracy can be significantly improved.
[0049] In this embodiment, the multi-dimensional environmental information includes one or more of the following: Central Processing Unit (CPU) CPU usage (cpu_used), Memory usage (memory_used), the sum of CPU resource limits (limits) for each Pod (cpu_limits), the sum of Memory limits (limits) for each Pod (memory_limits), the sum of CPU resource requests (requests) for each Pod (cpu_requests), and the sum of Memory requests (requests) for each Pod (memory_requests). This multi-dimensional environmental information reflects the current load level and resource allocation of each node in the cluster from different perspectives. For example, cpu_used represents the proportion of CPU resources currently used on the node, memory_used represents the proportion of memory resources currently used on the node, cpu_limits represents the maximum CPU resources declared by all Pods on the node, memory_limits represents the maximum memory resources declared by all Pods on the node, cpu_requests represents the total CPU resources requested by all Pods on the node, and memory_requests represents the total memory resources requested by all Pods on the node.
[0050] In this embodiment of the application, environmental information can be collected in real time based on the K8s Application Programming Interface (API), or it can be captured and stored periodically through a log system.
[0051] Step 102: Train the prediction model using the multiple training samples and the label information of each training sample to obtain the trained prediction model; the trained prediction model is used to predict the node to which the first Pod will be scheduled.
[0052] In this embodiment, the prediction model is a Pod-level prediction model used to predict when a specific Pod will be scheduled to a node at a specific time. The design goal of the prediction model is to model the scheduling scenario of a single Pod, rather than making generalized predictions about the cluster of all nodes in the entire cluster or a certain type of Pod. This fine-grained prediction method can more accurately reflect the personalized needs of Pod scheduling and form a more precise matching relationship with the resource status reflected by the multi-dimensional environmental information of each node in the cluster.
[0053] In this embodiment, for each training sample, the scheduling time of the training sample and the environmental information of each node in the cluster at the corresponding time can be structurally integrated to form a first graph matrix, which serves as the input data for the prediction model. (See reference...) Figure 2 , Figure 2 This is a schematic diagram of the process for constructing the first graph matrix provided in an embodiment of this application, such as... Figure 2 As shown, Figure 2 The top left side of the diagram shows the user behavior matrix, representing the scheduling time of the first Pod; Figure 2 The top right image shows the cluster environment matrix, representing the cluster environment information when the first Pod is scheduled. The first graph matrix can be constructed using a concat operation, merging the user behavior matrix and the cluster environment matrix along the node dimension to generate a complete end-to-end model input graph, i.e., the first graph matrix. For example, if the scheduling time is a one-dimensional time series, and the environment information is a [H-1, W, 1] matrix, then the final graph matrix will be [H, W, 1]. Figure 2 The graph matrix in the lower right corner is used, where W represents the node dimension and H represents the environmental information and scheduling time dimensions. This concatenation method allows the prediction model to simultaneously capture temporal dynamics and spatial distribution characteristics, providing a more comprehensive description of the container scheduling context. Using this first graph matrix improves the accuracy and stability of the prediction model. A more accurate and stable prediction model can better support container warm-up decisions in serverless architectures.
[0054] In this embodiment, the constructed first graph matrix is input into the prediction model for prediction processing. Forward computation is performed through the neural network structure within the prediction model to output prediction information. The prediction information includes the node to which the first Pod will be scheduled.
[0055] In this embodiment, backpropagation training can be performed by combining the prediction information and label information of each training sample, which can effectively optimize the parameters of the prediction model, thereby improving the prediction accuracy and stability of the prediction model, and thus significantly improving the problem of container cold start in serverless environment and improving user experience.
[0056] Based on this, in an optional embodiment of this application, training the prediction model using the plurality of training samples and the label information of each training sample to obtain the trained prediction model includes:
[0057] For each training sample among the plurality of training samples, a first graph matrix is constructed based on the scheduling time of the first Pod and the environmental information of each node in all nodes of the cluster when the first Pod is scheduled;
[0058] The prediction model is used to predict the first graph matrix of each training sample in multiple training samples to obtain the prediction information of each training sample.
[0059] Based on the prediction information and label information of each training sample, the prediction model is trained by backpropagation to obtain the trained prediction model.
[0060] In this embodiment, the feature extraction module in the prediction model can be used to extract features from the first graph matrix, resulting in multiple graph feature matrices. Based on the weights of environmental information in different dimensions of each graph feature matrix, weight calibration is performed on each graph feature matrix, resulting in multiple weight-calibrated graph feature matrices. These weight-calibrated graph feature matrices form the first graph feature matrix. The graph feature matrix is a high-dimensional feature representation generated by the feature extraction module after performing a convolution operation on the original input graph matrix. Each graph feature matrix represents a feature expression at different levels or channels, used to capture different dimensional features of nodes and edges in the graph data. After weight calibration, important feature dimensions are enhanced, while secondary or noisy features are suppressed.
[0061] In this embodiment, the first weight matrix assigns corresponding weight values to different environmental information in each graph feature matrix. For example, in a Kubernetes cluster, environmental information may include CPU utilization, memory usage, total Pod resource requests, etc. By calibrating with the first weight matrix, the prediction model can automatically identify which environmental information has a greater impact on the prediction results and strengthen these environmental information, thereby improving the adaptability and accuracy of the prediction model.
[0062] In this embodiment of the application, by introducing a first weight matrix, the method can effectively extract and enhance the feature representation of key environmental information, improve the accuracy and stability of the prediction model, and achieve more efficient container preheating scheduling.
[0063] Based on this, in an optional embodiment of this application, the step of using the prediction model to predict the first graph matrix of each training sample in a plurality of training samples to obtain prediction information for each training sample includes:
[0064] For any training sample among the plurality of training samples, the following steps are performed: the feature extraction module of the prediction model is used to extract the graph features of the first graph matrix of the training sample to obtain a plurality of graph feature matrices; based on the weights of environmental information of different dimensions in each graph feature matrix, the weights of each graph feature matrix in the plurality of graph feature matrices are weighted to obtain a plurality of graph feature matrices after weighting; the plurality of graph feature matrices after weighting form the first graph feature matrix.
[0065] The prediction information is obtained by using the classification module of the prediction model to perform prediction processing on the feature matrix of the first image.
[0066] In this embodiment, the feature extraction module is an overall structure composed of n feature extraction sub-modules connected sequentially, used to progressively extract and enhance key information in the data. Each feature extraction sub-module receives the output of the previous feature extraction sub-module as input and generates a new feature representation, thereby achieving multi-level abstraction and optimization of the original graph data; wherein, the input matrix of the first feature extraction sub-module is the first graph matrix; the output result of the nth feature extraction sub-module is used as the input matrix of the classification module, i.e., the first graph feature matrix.
[0067] In this embodiment, the feature extraction sub-modules are linked together to exchange information; that is, the output of one feature extraction sub-module serves as the input of the next, forming a continuous data processing flow. This linked approach ensures that the model can perform further information mining based on existing features at each step. It also avoids information loss or redundancy and enhances the model's non-linear expressive power and generalization performance.
[0068] In this embodiment, when n=1, the feature extraction module contains only one feature extraction sub-module. This module is suitable for simple feature extraction tasks, has low computational overhead, and is suitable for resource-constrained edge deployment scenarios. When n≥2, the feature extraction module has stronger modeling capabilities and can adapt to more complex container warm-up prediction needs. This module is suitable for large-scale Kubernetes cluster applications. As n increases, the model can capture higher-order feature interaction relationships, but the feature extraction module will incur higher computational costs. Therefore, in actual deployment, an appropriate value of n can be selected based on specific business needs.
[0069] By introducing a feature extraction module consisting of n feature extraction sub-modules, this embodiment of the application can fully explore the hidden patterns and regularities in the K8s cluster environment by progressively extracting and optimizing graph features layer by layer. This effectively improves the model's prediction accuracy of container scheduling behavior, thereby increasing the success rate and efficiency of container warm-up, significantly reducing cold start latency, and improving the user service experience.
[0070] Based on this, in an optional embodiment of this application, the feature extraction module includes n feature extraction sub-modules; the n feature extraction sub-modules are connected sequentially; wherein, for any feature extraction sub-module, the output result of the previous feature extraction sub-module connected to it is used as the input matrix of the feature extraction sub-module; the output result of the feature extraction sub-module is used as the input matrix of the next feature extraction sub-module connected to it; the input matrix of the first feature extraction sub-module is the first graph matrix; the output result of the nth feature extraction sub-module is used as the input matrix of the classification module; wherein, n is a positive integer.
[0071] In this embodiment, the feature extraction submodule is the basic unit for multi-dimensional feature extraction from the input graph-structured data. It is responsible for extracting environmental information related to container scheduling from different dimensions. For example, one feature extraction submodule might focus on CPU usage, while another focuses on memory usage. By chaining the feature extraction submodules together, the system can progressively uncover more complex and higher-order environmental features. This modular design not only improves the system's scalability but also facilitates dynamic adjustment of the model structure according to actual needs.
[0072] In this embodiment, the output of the feature extraction submodule is passed to the input of the next feature extraction submodule, forming a cascaded feature extraction process. This cascaded feature extraction process helps the model gradually focus on the most representative features when processing data, thereby improving the model's generalization ability.
[0073] In this embodiment, for each feature extraction submodule, after preliminary feature extraction from the input matrix, a second graph feature matrix is obtained. This second graph feature matrix consists of multiple second graph feature submatrices, representing different graph feature information. For example, in one second graph feature submatric, the model might find a strong correlation between CPU utilization and scheduling time, while in another feature submatric, the model might find a pattern between total memory requests and Pod load. These feature submatrices together constitute a richer and more detailed feature space, providing a foundation for subsequent weight calculations.
[0074] In this embodiment of the application, the feature extraction submodule can obtain the second image feature matrix through convolution operation.
[0075] A second weight matrix can be obtained based on the second graph feature matrix using a K-channel attention mechanism. The K-channel attention mechanism can allocate weights in two dimensions: first, it performs global weight assignment on multiple second graph feature sub-matrices; second, it performs fine-grained weight assignment on different environmental information dimensions within each second graph feature sub-matrix. This two-dimensional attention mechanism based on K-channel attention enables the model to identify key features more precisely, avoiding the limitation of traditional channel attention mechanisms that only focus on overall feature weights.
[0076] In this embodiment, the second weight matrix can be generated through pooling, transpose, convolution, and retranspose operations. For example, the size of the second graph feature matrix is [H, W, N], where H represents the environmental information and scheduling time dimension, W represents the node dimension, and N represents the number of second graph feature matrices. N can also represent the size of the convolution kernel. First, node pooling is performed on the second graph feature matrix to obtain an intermediate result of size [H, 1, N]. Then, through transpose, convolution, and retranspose operations, a weight distribution of size [H, 1, N] is obtained, which is the second weight matrix.
[0077] In this embodiment, the second graph feature matrix and the second weight matrix can be multiplied to obtain the third graph feature matrix, which is the final feature representation after weight calibration. The third graph feature matrix not only inherits the richness of the original graph features, but also optimizes the third graph feature matrix through an attention mechanism, thereby giving it stronger discriminative power.
[0078] In this embodiment, the inner product formula is as follows:
[0079] ,in, This represents the matrix after the Nth second-graph feature matrix has been recalculated and recalibrated with weights. These represent the values in the feature matrix of the second graph, which has dimensions [H, W, N]. This represents the values in the second weight matrix of size [H, 1, N].
[0080] In this embodiment of the application, the third graph feature matrix output by the nth feature extraction submodule can be used as the first graph feature matrix output by the feature extraction module.
[0081] refer to Figure 3 , Figure 3 This is a schematic diagram comparing the K-channel attention mechanism provided in the embodiments of this application with the traditional channel attention mechanism, as shown below. Figure 3As shown, the traditional channel attention mechanism performs global pooling on the feature map [H, W, N], resulting in a weight matrix of size [1, 1, N], which only focuses on the weights of the feature submaps; while the K-channel attention mechanism performs node pooling on the feature map [H, W, N], resulting in a weight matrix of size [H, 1, N], which not only completes the labeling of the weights of the feature submaps, but also completes the labeling of the weights of each type of environmental information on a single feature submap.
[0082] In this embodiment, by using n feature extraction sub-modules for iterative processing and combining the K-channel attention mechanism to weight the graph features, the accuracy of the prediction model can be significantly improved.
[0083] Based on this, in an optional embodiment of this application, the step of extracting graph features of the first graph matrix of the training sample using the feature extraction module of the prediction model to obtain multiple graph feature matrices, and then performing weight calibration on each graph feature matrix based on the weights of environmental information of different dimensions in each graph feature matrix, to obtain multiple graph feature matrices after weight calibration, wherein the multiple graph feature matrices after weight calibration constitute the first graph feature matrix; including:
[0084] Using the n feature extraction sub-modules, starting from the first feature extraction sub-module, the first image matrix of the training sample is subjected to n iterative extraction processes until the nth feature extraction sub-module ends, thus obtaining the first image feature matrix; wherein, each iteration of the n iterative extraction processes includes:
[0085] The feature extraction submodule is used to extract the graph features of the input matrix to obtain the second graph feature matrix; the second graph feature matrix includes multiple second graph feature submatrices.
[0086] Based on the second graph feature matrix, a second weight matrix is obtained; the second weight matrix represents the weight of environmental information in different dimensions in the plurality of second graph feature sub-matrices;
[0087] The second feature matrix is weighted by the second weight matrix to obtain the third feature matrix; the third feature matrix is the output of the feature extraction submodule.
[0088] In this embodiment of the application, the feature matrix of the third graph can also be pooled to obtain the pooled feature matrix of the third graph, so as to reduce the amount of computation.
[0089] Based on this, in an optional embodiment of this application, the second graph feature matrix is weighted by the second weight matrix to obtain the third graph feature matrix; wherein, the third graph feature matrix is the pooled third graph feature matrix.
[0090] In this embodiment of the application, for any dimension of environmental information in any second graph feature submatrix, the weight of that dimension of environmental information can be determined based on first information, which includes: the number of nodes in the cluster and the value of that dimension of environmental information in each node of the second graph feature submatrix. The calculation formula is as follows: ,in, This represents the weight of the environmental information dimension h in a single feature submatrix of the second graph after node pooling; Indicates the number of nodes. Representing the characteristic subgraph In the context, the environmental information dimension is h at node [node name missing]. The value of .
[0091] Based on this, in an optional embodiment of this application, for any dimension of environmental information in any second graph feature submatrix, the weight of the environmental information in that dimension is determined based on first information; the first information includes: the number of nodes in the cluster and the value of the environmental information in that dimension for each node in the second graph feature submatrix.
[0092] refer to Figure 4 , Figure 4 This is a schematic diagram of the structure of the prediction model provided in the embodiments of this application, such as... Figure 4 As shown, the prediction model includes a feature extraction module and a classification module. The feature extraction module comprises n feature extraction sub-modules; each feature extraction sub-module includes a convolutional layer, a K-channel attention mechanism, and a pooling layer. The classification module includes three fully connected layers. The feature extraction module extracts features from the input first graph matrix to obtain a first graph feature matrix. The classification module then performs a fully connected mapping calculation on the first graph feature matrix and uses an activation function to obtain the final classification result, which predicts the node to which the first Pod will be scheduled. In this embodiment, the activation function can be the softMax function.
[0093] The model training method provided in this application uses the scheduling time of the first Pod and the multi-dimensional environmental information of each node as input features, and trains with the actual scheduling nodes as labels, enabling the prediction model to learn and understand scheduling patterns at different time points and under different resource states. This introduces richer environmental information, improving the model's adaptability to complex scheduling scenarios, thereby increasing prediction accuracy and providing a more reliable foundation for subsequent container warm-up. A graph structure modeling approach is adopted, integrating time and multi-dimensional environmental information into a graph matrix, allowing the model to process complex scheduling input data end-to-end. Compared to traditional tabular feature extraction methods, graph structures can better express the relationships between nodes, improving the model's generalization ability. A multi-layered stacked feature extraction sub-module is used, with each module further abstracting and refining the output of the previous layer, gradually extracting higher-level feature representations. This approach helps the model capture deeper data patterns, improving its adaptability to complex scheduling scenarios. A K-channel attention mechanism is introduced within each feature extraction sub-module, enabling the model to label graph features according to environmental information weights at different stages, improving overall prediction performance.
[0094] refer to Figure 5 , Figure 5 This is a schematic diagram illustrating the implementation process of the container preheating method provided in the embodiments of this application, as shown below. Figure 5 As shown, the container preheating method provided in this embodiment includes the following steps:
[0095] Step 201: Collect environmental information from multiple dimensions of each node in the cluster according to a preset time; the preset time is related to the historical scheduling time of the first Pod.
[0096] In this embodiment of the application, the preset time is set according to the historical scheduling time of the first Pod. For example, if the historical scheduling time of the first Pod is 8:00 AM, the preset time can be set to 8:00 AM. Alternatively, the preset time can be set before 8:00 AM, such as 7:55 AM or 7:50 AM. The preset time can be set according to the actual situation, and this embodiment of the application does not limit it.
[0097] Understandably, if the first Pod has multiple historical scheduling times, then the preset time can also be multiple.
[0098] In this application embodiment, the multi-dimensional environmental information includes one or more of the following environmental information: CPU usage (cpu_used), Memory usage (memory_used), the sum of limits values of each CPU Pod (cpu_limits), the sum of limits values of each Memory Pod (memory_limits), the sum of requests values of each CPU Pod (cpu_requests), and the sum of requests values of each Memory Pod (memory_requests).
[0099] Step 202: Based on the preset time and the multi-dimensional environmental information of each node in the cluster, construct a second graph matrix; the second graph matrix represents the preset time and the multi-dimensional environmental information of each node in the cluster.
[0100] In this embodiment, a first matrix can be constructed based on a preset time and number of nodes; a second matrix can be constructed based on the number of nodes and the environmental information of each node; and a concat operation can be performed on the first and second matrices according to the node dimension to obtain a second graph matrix. It is understood that the construction process of the second graph matrix can refer to... Figure 2 To understand.
[0101] Step 203: Use the trained prediction model to perform prediction processing on the second graph matrix to obtain prediction information; the trained prediction model is trained using the model training method provided in any embodiment of this application; the prediction information represents the first node to which the first Pod will be scheduled.
[0102] In this embodiment of the application, the second graph matrix is processed by a trained prediction model to obtain prediction information. The prediction information represents the first node to which the first Pod will be scheduled, providing a basis for container warm-up.
[0103] Step 204: Based on the predicted information, preheat the container for the first Pod at the first node.
[0104] In this embodiment, the containers that need to be preheated in the first Pod can be scheduled to the first node in advance based on the prediction information, so as to achieve the effect of container preheating.
[0105] refer to Figure 6 , Figure 6 This is a schematic diagram of the overall process of container preheating provided in the embodiments of this application, as shown below. Figure 6As shown, the user will schedule the first Pod at a specific time. According to the container preheating method provided in this application embodiment, before the user schedules the first Pod, the environmental information of each node is collected according to the preset time. The prediction model predicts the node Node-1 to which the first Pod will be scheduled. The scheduler uses a scheduler to schedule the part of the target container that needs to be preheated to node Node-1 in advance to achieve the effect of container preheating.
[0106] This application also provides a model training apparatus, for reference... Figure 7 , Figure 7 This is a schematic diagram of the structure of the model training device provided in an embodiment of this application. The model training device in this embodiment includes:
[0107] Acquisition Unit: Used to acquire multiple training samples and label information for each training sample; wherein, the training samples include: the time when the first Pod was scheduled and multiple dimensions of environmental information of each node in all nodes of the cluster when the first Pod was scheduled; the label information includes: the node to which the first Pod was scheduled;
[0108] Training unit: used to train a prediction model using the multiple training samples and the label information of each training sample, to obtain a trained prediction model; the trained prediction model is used to predict the node to which the first Pod will be scheduled.
[0109] In this embodiment of the application, the training unit is configured to: construct a first graph matrix for each training sample among the plurality of training samples based on the scheduling time of the first Pod and the environmental information of each node in all nodes of the cluster when the first Pod is scheduled; perform prediction processing on the first graph matrix of each training sample among the plurality of training samples using the prediction model to obtain prediction information for each training sample; and perform backpropagation training on the prediction model based on the prediction information and label information of each training sample to obtain the trained prediction model.
[0110] In this embodiment of the application, the training unit is configured to, for any training sample among the plurality of training samples, perform the following: extract graph features of the first graph matrix of the training sample using the feature extraction module of the prediction model to obtain a plurality of graph feature matrices; perform weight calibration on each graph feature matrix in the plurality of graph feature matrices based on the weights of environmental information of different dimensions in each graph feature matrix to obtain a plurality of graph feature matrices after weight calibration; the plurality of graph feature matrices after weight calibration form a first graph feature matrix; and perform prediction processing on the first graph feature matrix using the classification module of the prediction model to obtain the prediction information.
[0111] In this embodiment, the feature extraction module includes n feature extraction sub-modules; the n feature extraction sub-modules are connected sequentially; wherein, for any feature extraction sub-module, the output result of the previous feature extraction sub-module connected to it is used as the input matrix of the feature extraction sub-module; the output result of the feature extraction sub-module is used as the input matrix of the next feature extraction sub-module connected to it; the input matrix of the first feature extraction sub-module is the first graph matrix; the output result of the nth feature extraction sub-module is used as the input matrix of the classification module; wherein, n is a positive integer.
[0112] In this embodiment, the training unit is configured to utilize the n feature extraction sub-modules to perform n iterative extraction processes on the first graph matrix of the training sample, starting from the first feature extraction sub-module, until the nth feature extraction sub-module ends, to obtain the first graph feature matrix; wherein, each iteration of the n iterative extraction process includes: extracting graph features of the input matrix using the feature extraction sub-modules to obtain a second graph feature matrix; the second graph feature matrix includes multiple second graph feature sub-matrices; obtaining a second weight matrix based on the second graph feature matrix; the second weight matrix represents the weight magnitude of environmental information of different dimensions in the multiple second graph feature sub-matrices; and performing weight calibration on the second graph feature matrix using the second weight matrix to obtain a third graph feature matrix; the third graph feature matrix is the output result of the feature extraction sub-module.
[0113] In this embodiment of the application, for any dimension of environmental information in any second graph feature submatrix, the weight of the environmental information in that dimension is determined based on first information; the first information includes: the number of nodes in the cluster and the value of the environmental information in that dimension for each node in the second graph feature submatrix.
[0114] Those skilled in the art should understand that Figure 7 The functions of each unit in the model training device shown can be understood by referring to the relevant descriptions of the aforementioned methods. Figure 7 The functions of each unit in the model training device shown can be implemented by a program running on a processor or by specific logic circuits.
[0115] This application also provides a container preheating device, see reference. Figure 8 , Figure 8 This is a schematic diagram of the container preheating device provided in an embodiment of this application. The container preheating device in this embodiment includes:
[0116] Collection unit: used to collect environmental information of each node in the cluster from multiple dimensions according to a preset time; the preset time is related to the historical scheduling time of the first Pod;
[0117] Prediction unit: used to construct a second graph matrix based on the preset time and the environmental information of each node in all nodes of the cluster in multiple dimensions; the second graph matrix represents the preset time and the environmental information of each node in all nodes of the cluster in multiple dimensions;
[0118] The prediction unit is used to perform prediction processing on the second graph matrix using a trained prediction model to obtain prediction information; the trained prediction model is trained using the model training method provided in any embodiment of this application; the prediction information represents the first node to which the first Pod will be scheduled.
[0119] Preheating unit: used to preheat the container of the first Pod at the first node based on the predicted information.
[0120] Those skilled in the art should understand that Figure 8 The functions of each unit in the container preheating device shown can be understood by referring to the relevant descriptions of the aforementioned method. Figure 8 The functions of each unit in the container preheating device shown can be implemented by a program running on a processor or by specific logic circuits.
[0121] Figure 9 This is a schematic structural diagram of an electronic device provided in an embodiment of this application. Figure 9 The electronic device shown includes a first processor 910, which can call and run computer programs from memory to implement the model training method and container preheating method provided in the embodiments of this application.
[0122] Optionally, such as Figure 9 As shown, the electronic device 900 may further include a first memory 920. The first processor 910 can call and run computer programs from the first memory 920 to implement the model training method and container preheating method provided in the embodiments of this application.
[0123] The first memory 920 can be a separate device independent of the first processor 910, or it can be integrated into the first processor 910.
[0124] Optionally, such as Figure 9 As shown, the electronic device 900 may also include a transceiver 930, which the first processor 910 can control to communicate with other devices. Specifically, it can send information or data to other devices or receive information or data sent by other devices.
[0125] The transceiver 930 may include a transmitter and a receiver. The transceiver 930 may further include antennas, and the number of antennas may be one or more.
[0126] The electronic device 900 may specifically be a model training device / container preheating device in the embodiments of this application, and the electronic device 900 can implement the corresponding processes implemented by the model training device / container preheating device in the various methods of the embodiments of this application. For the sake of brevity, it will not be described in detail here.
[0127] For example, embodiments of this application also provide a computer program product, including a computer program that can be executed by a first processor 910 of an electronic device 900 to perform the steps described in any of the foregoing methods.
[0128] Figure 10 This is a schematic structural diagram of the chip according to an embodiment of this application. Figure 10 The chip 1000 shown includes a second processor 1010, which can call and run computer programs from memory to implement the methods in the embodiments of this application.
[0129] Optionally, such as Figure 10 As shown, chip 1000 may further include a second memory 1020. The second processor 1010 can call and run computer programs from the second memory 1020 to implement the methods in the embodiments of this application.
[0130] The second memory 1020 can be a separate device independent of the second processor 1010, or it can be integrated into the second processor 1010.
[0131] Optionally, the chip 1000 may also include an input interface 1030. The second processor 1010 can control the input interface 1030 to communicate with other devices or chips; specifically, it can acquire information or data sent by other devices or chips.
[0132] Optionally, the chip 1000 may also include an output interface 1040. The second processor 1010 can control the output interface 1040 to communicate with other devices or chips, specifically, to output information or data to other devices or chips.
[0133] The chip can be applied to the electronic device 900 in the embodiments of this application, and the chip can implement the corresponding processes implemented by the electronic device 900 in the various methods of the embodiments of this application. For the sake of brevity, it will not be described in detail here.
[0134] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0135] It should be understood that the processor in the embodiments of this application may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method embodiments can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor described above can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software units in the decoding processor. The software units can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.
[0136] It is understood that the memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DR RAM). It should be noted that the memory used in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0137] It should be understood that the above-described memory is exemplary and not a limiting description. For example, the memory in the embodiments of this application may also be static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DR RAM), etc. That is to say, the memory in the embodiments of this application is intended to include, but is not limited to, these and any other suitable types of memory.
[0138] This application also provides a storage medium for storing a computer program. This storage medium can be applied to the electronic device 900 in this application embodiment, and the computer program causes the computer to execute the corresponding processes implemented by the electronic device 900 in the various methods of this application embodiment; for brevity, further details are omitted here.
[0139] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0140] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0141] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0142] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0143] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0144] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or electronic device 900, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0145] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A model training method, characterized in that, include: Obtain multiple training samples and label information for each training sample; wherein, the training samples include: the time when the first Pod was scheduled and multiple dimensions of environmental information of each node in the cluster when the first Pod was scheduled; the label information includes: the node to which the first Pod was scheduled; For each training sample among the plurality of training samples, a first graph matrix is constructed based on the scheduling time of the first Pod and the environmental information of each node in all nodes of the cluster when the first Pod is scheduled; The prediction model is used to predict the first graph matrix of each training sample in multiple training samples to obtain the prediction information of each training sample. Based on the prediction information and label information of each training sample, the prediction model is trained by backpropagation to obtain the trained prediction model; the trained prediction model is used to predict the node to which the first Pod will be scheduled.
2. The method according to claim 1, characterized in that, The step of using the prediction model to predict the first graph matrix of each training sample from multiple training samples to obtain prediction information for each training sample includes: For any training sample among the plurality of training samples, the following steps are performed: the feature extraction module of the prediction model is used to extract the graph features of the first graph matrix of the training sample to obtain a plurality of graph feature matrices; based on the weights of environmental information of different dimensions in each graph feature matrix, the weights of each graph feature matrix in the plurality of graph feature matrices are weighted to obtain a plurality of graph feature matrices after weighting; the plurality of graph feature matrices after weighting form the first graph feature matrix. The prediction information is obtained by using the classification module of the prediction model to perform prediction processing on the feature matrix of the first image.
3. The method according to claim 2, characterized in that, The feature extraction module includes n feature extraction sub-modules; the n feature extraction sub-modules are connected sequentially; wherein, for any feature extraction sub-module, the output result of the previous feature extraction sub-module connected to it is used as the input matrix of the feature extraction sub-module; the output result of the feature extraction sub-module is used as the input matrix of the next feature extraction sub-module connected to it; the input matrix of the first feature extraction sub-module is the first graph matrix; the output result of the nth feature extraction sub-module is used as the input matrix of the classification module; wherein, n is a positive integer.
4. The method according to claim 3, characterized in that, The feature extraction module of the prediction model extracts graph features from the first graph matrix of the training sample, resulting in multiple graph feature matrices. Based on the weights of environmental information of different dimensions in each graph feature matrix, weight calibration is performed on each graph feature matrix to obtain multiple graph feature matrices after weight calibration. The multiple graph feature matrices after weight calibration form the first graph feature matrix, including: Using the n feature extraction sub-modules, starting from the first feature extraction sub-module, the first image matrix of the training sample is subjected to n iterative extraction processes until the nth feature extraction sub-module ends, thus obtaining the first image feature matrix; wherein, each iteration of the n iterative extraction processes includes: The feature extraction submodule is used to extract the graph features of the input matrix to obtain the second graph feature matrix; the second graph feature matrix includes multiple second graph feature submatrices. Based on the second graph feature matrix, a second weight matrix is obtained; the second weight matrix represents the weight of environmental information in different dimensions in the plurality of second graph feature sub-matrices; The second feature matrix is weighted by the second weight matrix to obtain the third feature matrix; the third feature matrix is the output of the feature extraction submodule.
5. The method according to claim 4, characterized in that, For any dimension of environmental information in any feature submatrix of the second graph, the weight of that dimension of environmental information is determined based on first information; the first information includes: the number of nodes in the cluster and the value of that dimension of environmental information in each node of the second graph feature submatrix.
6. A method for preheating a container, characterized in that, include: Collect environmental information from multiple dimensions of each node in the cluster at preset times; The preset time is related to the historical scheduling time of the first Pod; Based on the preset time and the environmental information of each node in the cluster in multiple dimensions, a second graph matrix is constructed; The second graph matrix represents the preset time and multiple dimensions of environmental information for each node in the cluster. The second graph matrix is processed using a trained prediction model to obtain prediction information; the trained prediction model is trained using the model training method of any one of claims 1 to 5; the prediction information represents the first node to which the first Pod will be scheduled. Based on the predicted information, container preheating is performed on the first Pod at the first node.
7. A model training device, characterized in that, include: Acquisition Unit: Used to acquire multiple training samples and label information for each training sample; wherein, the training samples include: the time when the first Pod was scheduled and multiple dimensions of environmental information of each node in all nodes of the cluster when the first Pod was scheduled; the label information includes: the node to which the first Pod was scheduled; Training unit: For each training sample among the plurality of training samples, based on the scheduling time of the first Pod and the environmental information of each node in all nodes of the cluster at the time the first Pod is scheduled, constructs a first graph matrix; uses a prediction model to perform prediction processing on the first graph matrix of each training sample among the plurality of training samples to obtain prediction information for each training sample; based on the prediction information and label information of each training sample, performs backpropagation training on the prediction model to obtain a trained prediction model; the trained prediction model is used to predict the node to which the first Pod will be scheduled.
8. A container preheating device, characterized in that, include: Data Acquisition Unit: Used to collect environmental information from each node in the cluster at preset intervals, covering multiple dimensions. The preset time is related to the historical scheduling time of the first Pod; Prediction unit: used to construct a second graph matrix based on the preset time and multiple dimensions of environmental information of each node in the cluster; The second graph matrix represents the preset time and multiple dimensions of environmental information for each node in the cluster. The prediction unit is used to perform prediction processing on the second graph matrix using a trained prediction model to obtain prediction information; the trained prediction model is trained using the model training method of any one of claims 1 to 5; the prediction information represents the first node to which the first Pod will be scheduled. Preheating unit: used to preheat the container of the first Pod at the first node based on the predicted information.
9. An electronic device, characterized in that, include: A first processor and a first memory, the first memory being used to store computer programs, the first processor being used to call and run the computer programs stored in the first memory to perform the model training method as described in any one of claims 1 to 5, or the container preheating method as described in claim 6.
10. A storage medium, characterized in that, Used to store computer programs that cause a computer to perform the model training method as described in any one of claims 1 to 5, or the container preheating method as described in claim 6.
11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the model training method as described in any one of claims 1 to 5, or the container preheating method as described in claim 6.
Citation Information
Patent Citations
Physical resource scheduling method based on Kubernetes and scheduler
CN116841718A