Container migration method and device, equipment, storage medium and program product
By using resource utilization prediction models of encoding and decoding networks in container migration, the problem of migration lag is solved, enabling forward-looking and refined container migration, and improving system stability and business continuity.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD
- Filing Date
- 2025-12-29
- Publication Date
- 2026-05-01
AI Technical Summary
Existing container migration mechanisms suffer from migration lag and unnecessaryness, affecting node utilization efficiency, failing to respond promptly to changes in business needs, and leading to performance degradation or interruption.
A resource utilization prediction model is adopted, including an encoding network and a decoding network. The container resource utilization is predicted through the encoding attention layer and the decoding attention layer to determine in advance whether to migrate and select target nodes with matching resource preferences for migration.
It enables forward-looking and refined container migration, reduces unnecessary migration operations, improves system stability and business continuity, and avoids resource waste and performance fluctuations.
Smart Images

Figure CN121957776A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of cloud computing technology, and in particular to a container migration method, apparatus, device, storage medium, and program product. Background Technology
[0002] In a cloud environment, containers serve as the carriers of business operations. If the resources of containers cannot meet business needs, containers may experience performance degradation or interruption due to overload, thereby affecting business continuity and the stability of business systems.
[0003] In related technologies, containers with excessive load can usually be migrated to other nodes in a timely manner through a reasonable migration mechanism to ensure the smooth operation of business systems. However, this migration mechanism usually occurs after node resources start to trigger alerts or temporary fluctuations in business cause a sudden surge in resource utilization, resulting in migration delays and unnecessary migration, thus affecting the efficiency of node utilization. Summary of the Invention
[0004] This disclosure is made in view of the above-mentioned problems. This disclosure provides a container migration method, apparatus, device, storage medium, and program product.
[0005] According to one aspect of this disclosure, a container migration method is provided, comprising: If the current resource utilization rate of at least one dimension of the container to be migrated is greater than or equal to a preset resource utilization rate, the resource utilization sequence of the multiple dimensions of the container to be migrated within a preset historical time period and a pre-built resource utilization prediction model are obtained; wherein, the resource utilization prediction model includes an encoding network and a decoding network, the encoding network includes an encoding attention layer and an encoder, and the decoding network includes a decoding attention layer and a decoder. Using the encoding attention layer, the encoding attention weights of each resource utilization sequence in multiple time steps included in the preset historical time period are determined; the encoder processes each resource utilization sequence at each time step based on the encoding attention weights to obtain the encoding hidden state of each resource utilization sequence at each time step. Using the decoding attention layer, the decoding attention weights of each resource utilization sequence at each time step are determined based on the encoded hidden state at each time step; the decoder processes the encoded hidden state of each resource utilization sequence at each time step based on the decoding attention weights to obtain the predicted resource utilization rate of each resource utilization sequence at each time step. If the predicted resource utilization rate of at least one of the resource utilization sequences is greater than the preset resource utilization rate at the last time step, a target node is determined from multiple nodes based on the dimension of at least one of the resource utilization sequences, and the container to be migrated is migrated to the target node.
[0006] According to another aspect of this disclosure, a container migration apparatus is provided, comprising: The acquisition module is used to acquire the resource utilization sequence of the multiple dimensions of resources of the container to be migrated within a preset historical time period, and a pre-built resource utilization prediction model, when the current resource utilization rate of at least one dimension of the multiple dimensions of resources of the container to be migrated is greater than or equal to a preset resource utilization rate; wherein, the resource utilization prediction model includes an encoding network and a decoding network, the encoding network includes an encoding attention layer and an encoder, and the decoding network includes a decoding attention layer and a decoder. The processing module is used to determine the encoding attention weights of each resource utilization sequence in multiple time steps within the preset historical time period using the encoding attention layer; and to process each resource utilization sequence at each time step using the encoder based on the encoding attention weights to obtain the encoding hidden state of each resource utilization sequence at each time step. The processing module is used to utilize the decoding attention layer to determine the decoding attention weight of each resource utilization sequence at each time step based on the encoded hidden state at each time step; and to use the decoder to process the encoded hidden state of each resource utilization sequence at each time step based on the decoding attention weight to obtain the predicted resource utilization rate of each resource utilization sequence at each time step. The processing module is used to determine a target node from multiple nodes based on the dimension of at least one of the resource utilization sequences when the predicted resource utilization rate of at least one of the resource utilization sequences is greater than the preset resource utilization rate at the last time step, and to migrate the container to be migrated to the target node.
[0007] In another aspect of exemplary embodiments of this disclosure, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory, the processor executing the computer program to implement the methods described in exemplary embodiments of this disclosure.
[0008] In another aspect of exemplary embodiments of the present disclosure, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the methods described in exemplary embodiments of the present disclosure.
[0009] In another aspect of the exemplary embodiments of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the methods described in the exemplary embodiments of this disclosure.
[0010] As will be described in detail below, the container migration method according to embodiments of this disclosure involves obtaining a resource utilization sequence of multiple dimensions of resources in the container to be migrated within a preset historical time period, and a pre-built resource utilization prediction model, when the current resource utilization rate of at least one dimension of the multiple dimensions of resources is greater than or equal to a preset resource utilization rate. The resource utilization prediction model includes an encoding network and a decoding network. The encoding network includes an encoding attention layer and an encoder, and the decoding network includes a decoding attention layer and a decoder. The encoding attention layer is used to determine the encoding attention weights of each resource utilization sequence at multiple time steps within the preset historical time period. The encoder processes each resource utilization sequence at each time step based on the encoding attention weights to obtain the encoded hidden state of each resource utilization sequence at each time step. The decoding network then... The attention layer determines the decoding attention weights of each resource utilization sequence at each time step based on the encoded hidden state at each time step. The decoder processes the encoded hidden state of each resource utilization sequence at each time step based on the decoding attention weights to obtain the predicted resource utilization rate of each resource utilization sequence at each time step. If the predicted resource utilization rate of at least one resource utilization sequence at the last time step is greater than the preset resource utilization rate, a target node is identified from multiple nodes based on the dimension of at least one resource utilization sequence, and the container to be migrated is migrated to the target node. This fundamentally changes the passive and delayed migration mode that only begins after a node resource alarm. By predicting resource utilization in advance, migration assessment can be triggered before the actual resource bottleneck occurs, reserving a time window for migration operations, achieving smooth and seamless migration, and avoiding sharp performance drops. Simultaneously, a dual judgment logic of "threshold + continuous prediction" is introduced, greatly reducing unnecessary migrations caused by temporary business fluctuations. In other words, short-term resource peaks will not trigger migration; only predicted continuous overload will trigger it. This reduces the network overhead, performance jitter, and resource waste caused by migration itself. Furthermore, the selection of migration target nodes has shifted from randomness and simply choosing the lowest load to resource preference matching. Nodes are grouped according to resource preferences, and containers are migrated to the nodes with the most remaining resources corresponding to those preferences, achieving fine-grained resource scheduling. In addition, this proactive migration avoids container crashes, application interruptions, or even node avalanches caused by resource exhaustion, enhancing system stability and business continuity.
[0011] It should be understood that both the foregoing general description and the following detailed description are exemplary and intended to provide further illustration of the claimed technology. Attached Figure Description
[0012] The above and other objects, features, and advantages of this disclosure will become more apparent from the more detailed description of the embodiments thereof in conjunction with the accompanying drawings. The drawings are provided to further illustrate the embodiments of this disclosure and form part of the specification. They are used together with the embodiments of this disclosure to explain the disclosure and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same components or steps.
[0013] Figure 1 A flowchart illustrating a container migration method provided in an exemplary embodiment of this disclosure is shown. Figure 2 A schematic diagram of the architecture of the resource utilization prediction model provided in an exemplary embodiment of this disclosure is shown; Figure 3 A schematic diagram illustrating the classification results of multiple nodes provided by an exemplary embodiment of this disclosure is shown; Figure 4 A schematic diagram illustrating the calculation process of the encoded attention weights provided in an exemplary embodiment of this disclosure is shown. Figure 5 A schematic diagram of the structure of the container migration apparatus provided in an exemplary embodiment of this disclosure is shown; Figure 6 A schematic diagram of the structure of an electronic device provided in an exemplary embodiment of this disclosure is shown; Figure 7 A schematic diagram of the structure of a computer system provided in an exemplary embodiment of this disclosure is shown. Detailed Implementation
[0014] To make the objectives, technical solutions, and advantages of this disclosure more apparent, exemplary embodiments according to this disclosure will now be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this disclosure, and not all embodiments of this disclosure. It should be understood that this disclosure is not limited to the exemplary embodiments described herein.
[0015] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0016] The term "comprising" and its variations as used herein are open-ended, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc., used in this disclosure are only used to distinguish different devices, modules, or units, and are not intended to limit the order of functions performed by these devices, modules, or units or their interdependencies.
[0017] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0018] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0019] Due to the inherent randomness of business operations, the utilization rate of various resources by containers is constantly changing. When a container cannot meet the resource capacity requirements of a particular business, the container may experience performance degradation or even be taken offline due to excessive pressure. This could affect the normal operation of the entire business system, or even paralyze the entire system. To address this, container orchestration systems need to have a reasonable container migration mechanism to promptly alleviate excessive pressure on containers, thereby ensuring the normal operation of the system.
[0020] Currently, container migration often only considers one type of resource limitation, or the migration time is often determined only after node resources start to trigger alerts, resulting in a migration lag; or temporary fluctuations in business operations cause a sudden surge in resource utilization, leading to unnecessary migrations. These migration methods typically impact node efficiency.
[0021] In related technologies, resource prediction models can be divided into three main categories: The first category is traditional statistical algorithms, including exponential smoothing and autoregressive techniques. These two algorithms have high requirements for historical data and can be well used to predict linearly changing and relatively stable data sources; however, their accuracy is relatively low for nonlinear data. The second category is machine learning algorithms. When using machine learning for resource prediction, a large amount of computing resources and storage space are required, and machine learning models may suffer from overfitting or underfitting problems during training. The third category is neural network algorithms. When using neural networks for resource prediction, there is also the problem of high computational complexity.
[0022] Therefore, in order to solve the above problems, this disclosure provides a container migration method that can efficiently and accurately predict the multi-dimensional resource requirements of containers, and based on this prediction, intelligently and proactively formulate a container migration decision-making scheme to solve the problems of migration lag, blindness and insufficient consideration of multi-resource coordination, thereby achieving further optimization of cloud resource utilization and reduction of operation and maintenance costs while ensuring application performance.
[0023] The container migration method provided in this disclosure can be executed by an electronic device or by a chip applied to the electronic device. Here, the electronic device can be a terminal or a server.
[0024] For example, the terminal may include one or more of the following: mobile phone, tablet computer, wearable device, in-vehicle device, laptop computer, ultra-mobile personal computer (UMPC), netbook, PDA, and wearable device based on augmented reality (AR) and / or virtual reality (VR) technology. The exemplary embodiments disclosed herein do not impose specific limitations on these.
[0025] For example, the server described above can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. This exemplary embodiment does not limit the scope of the disclosure.
[0026] Figure 1 A flowchart illustrating the container migration method provided in an exemplary embodiment of this disclosure is shown, as follows: Figure 1 As shown, the container migration method includes: S101, if the current resource utilization rate of at least one dimension of the resources of the container to be migrated is greater than or equal to the preset resource utilization rate, obtain the resource utilization sequence of the resources of the container to be migrated in multiple dimensions within a preset historical time period, as well as the pre-built resource utilization prediction model; wherein, the resource utilization prediction model includes an encoding network and a decoding network, the encoding network includes an encoding attention layer and an encoder, and the decoding network includes a decoding attention layer and a decoder. S102, using the coding attention layer, determine the coding attention weights of each resource utilization sequence in multiple time steps within a preset historical time period; use the encoder to process each resource utilization sequence at each time step based on the coding attention weights to obtain the coding hidden state of each resource utilization sequence at each time step. S103, using the decoding attention layer, the decoding attention weight of each resource utilization sequence at each time step is determined based on the encoded hidden state at each time step; the decoder processes the encoded hidden state of each resource utilization sequence at each time step based on the decoding attention weight to obtain the predicted resource utilization rate of each resource utilization sequence at each time step. S104, if the predicted resource utilization rate of at least one resource utilization sequence is greater than the preset resource utilization rate at the last time step, a target node is determined from multiple nodes based on the dimension of at least one resource utilization sequence, and the container to be migrated is migrated to the target node.
[0027] Specifically, the aforementioned nodes can serve as containers to handle different business processes. When processing these business processes, containers require resources across various dimensions. Furthermore, the resource utilization of containers across these dimensions changes constantly. Therefore, it is necessary to analyze in real-time whether the business being handled by the container meets the resource capacity requirements of the business itself, in order to prevent the container from experiencing performance degradation or even going offline due to excessive pressure. Here, the resource dimension can refer to the type of resource, which may include, but is not limited to, CPU, memory, I / O, etc., and is selected according to actual needs. This embodiment does not impose specific limitations on this.
[0028] The aforementioned resource utilization sequence can be a time series assembled from resource indicators of multiple dimensions. Here, resource indicators may include, but are not limited to, CPU utilization, memory utilization, I / O utilization, etc., and are selected according to actual needs. This disclosure does not impose specific limitations on this.
[0029] For example, the services carried by the container to be migrated may change over time. Therefore, the resources consumed by the container to be migrated in different time periods can be collected and assembled into a time series with resource indicators to form a resource utilization sequence of the container to be migrated in multiple dimensions within a preset historical time period.
[0030] Because containerized applications often have resource relationships with other resource types during runtime, for example, when complex calculations are required, the more user requests there are, the more network traffic the application needs, and consequently, the more CPU resources it requires. Therefore, when predicting the resources needed by an application, it's crucial to consider different types of computing resources, not just one.
[0031] Based on this, in this embodiment, when the current resource utilization rate of at least one dimension of the resources of the container to be migrated is greater than or equal to a preset resource utilization rate, the resource utilization sequence of the container to be migrated within a preset historical time period and a pre-built resource utilization prediction model are obtained. The resource utilization prediction model is then used to analyze the resource utilization sequence of each dimension to predict the utilization of each dimension's resources by the container to be migrated in future time periods, thereby determining whether to migrate the container, determining the migration timing, and avoiding unnecessary migration operations due to temporary fluctuations in business load. Here, the preset historical time period can be a past historical period, which can be selected according to actual needs; this embodiment does not specifically limit this. The preset resource utilization rate can be selected according to actual needs; this embodiment does not specifically limit this.
[0032] The embodiments of this disclosure pre-construct a resource utilization prediction model. Figure 2 This illustration shows a schematic diagram of the architecture of the resource utilization prediction model provided in an exemplary embodiment of this disclosure, such as... Figure 2 As shown, the resource utilization prediction model 200 includes an encoding network 210 and a decoding network 220. The encoding network 210 includes an encoding attention layer 211 and an encoder 212, and the decoding network 220 includes a decoding attention layer 221 and a decoder 222. Here, the specific structures of the encoding attention layer 211, encoder 212, decoding attention layer 221, and decoder 222 can be selected according to actual needs, and this embodiment does not impose specific limitations on them. In the method of this embodiment, both the encoding attention layer 211 and the decoding attention layer 221 employ an attention mechanism, and both the encoder 212 and the decoder 222 use Long Short-Term Memory (LSTM) networks to learn and remember the temporal variation patterns of the resource utilization of the container to be transferred.
[0033] For each time step within a preset historical time period, the encoding attention layer 211 can comprehensively consider resource utilization sequences across multiple dimensions. This allows for dynamic weight allocation for each resource utilization sequence during the subsequent feature extraction process of the encoder 212, determining the encoding attention weight of each resource utilization sequence at each time step. Here, the sum of the encoding attention weights of multiple resource utilization sequences at each time step equals 1.
[0034] The encoding attention weights can be understood as feature-level attention weights, focusing on which resource utilization sequences are more important in the multi-dimensional resource utilization sequences input to the encoder 212. Guided by these encoding attention weights, the encoder 212 processes each resource utilization sequence at each time step to obtain the encoded hidden state of each resource utilization sequence at that time step. At each time step, the encoder 212 can determine the degree of attention given to resource utilization sequences of different dimensions based on the dynamically changing encoding attention weights, achieving intelligent, adaptive dimensionality reduction and feature selection for high-dimensional input data, thus adapting to the complex and ever-changing multi-dimensional load scenarios of containers.
[0035] The decoding attention layer 221 can comprehensively consider resource utilization sequences across multiple dimensions, dynamically assigning weights to each resource utilization sequence in the subsequent feature fusion process of the decoder 222, thus determining the decoding attention weights of each resource utilization sequence at each time step. Here, the sum of the decoding attention weights of multiple resource utilization sequences at each time step equals 1.
[0036] The decoding attention weights can be understood as time-step attention weights. Guided by these decoding attention weights, the decoder 222 processes the encoded hidden states of each resource utilization sequence at each time step to obtain the predicted resource utilization rate of each resource utilization sequence at each time step. When predicting the predicted resource utilization rate of each resource utilization sequence at each time step, the decoder 222 can review the hidden states of the encoder 212 at all time steps, rather than relying solely on the last hidden state. This effectively solves the problem of information decay in traditional RNN / LSTM when the sequence is too long, and can better capture the periodic and trend changes in resource utilization over a long period, thus making more accurate predictions over a longer time span.
[0037] To verify the accuracy of the prediction, the root mean square error and mean absolute error between the predicted and actual values are calculated to determine the loss during the training phase of the resource utilization prediction model, thus training the model.
[0038] After determining the resource utilization prediction model, the container orchestration system can predict the resource usage of containers to be migrated at any given time. When the resource usage of any container to be migrated in a certain dimension reaches a pre-set resource threshold (preset resource utilization rate), the system continues to predict whether the resource usage of the container to be migrated in that dimension will still exceed the set threshold (preset resource utilization rate) in the next time period. This determines whether the container to be migrated meets the conditions for migration. This is mainly to prevent unnecessary container migration due to temporary fluctuations in business operations.
[0039] In the inference phase of the resource utilization prediction model, the predicted resource utilization rate of each resource utilization sequence at the last time step can be used to judge the continuous trend of future resource utilization. If the predicted resource utilization rate of at least one of the multiple resource utilization sequences at the last time step is greater than the preset resource utilization rate, it indicates that the overload of the container to be migrated in this dimension of resources is not due to temporary fluctuations in business load, but to continuous overload. At this time, based on the dimension of at least one resource utilization sequence, the target node is determined from multiple nodes, and the container to be migrated is migrated to the target node.
[0040] For example, Figure 3 This illustration shows a classification result diagram of multiple nodes provided by an exemplary embodiment of the present disclosure, such as... Figure 3 As shown, since each node carrying the container may have different preferences for resources in different dimensions, they can be grouped by their preference for resources and sorted according to their resource usage.
[0041] When a container to be migrated meets the conditions for triggering migration, the system identifies the resource dimension that triggered the migration to determine which node the container should be migrated to. To ensure that all nodes can fully utilize resources of any dimension, the target node is selected based on the node with the lowest usage of that resource dimension among all nodes of that preferred resource type. This transforms the selection of migration target nodes from random and simply based on minimum load to resource preference matching. Nodes are grouped according to resource preferences, and containers are migrated to the node with the most remaining resources corresponding to their preferred preferences, achieving fine-grained resource scheduling. In addition, this proactive migration avoids container crashes, application interruptions, or even node avalanches caused by resource exhaustion, enhancing system stability and business continuity.
[0042] According to the technical solution of the exemplary embodiments of this disclosure, when the current resource utilization rate of at least one dimension of the resources in the container to be migrated is greater than or equal to a preset resource utilization rate, the resource utilization sequence of the resources in multiple dimensions of the container to be migrated within a preset historical time period and a pre-built resource utilization prediction model are obtained. The resource utilization prediction model includes an encoding network and a decoding network. The encoding network includes an encoding attention layer and an encoder, and the decoding network includes a decoding attention layer and a decoder. The encoding attention layer is used to determine the encoding attention weights of each resource utilization sequence at multiple time steps within the preset historical time period. The encoder processes each resource utilization sequence at each time step based on the encoding attention weights to obtain the encoded hidden state of each resource utilization sequence at each time step. The decoding attention layer... Based on the encoded hidden state at each time step, the decoding attention weight of each resource utilization sequence at each time step is determined. The decoder then processes the encoded hidden state of each resource utilization sequence at each time step based on the decoding attention weight, obtaining the predicted resource utilization rate of each resource utilization sequence at each time step. If the predicted resource utilization rate of at least one resource utilization sequence at the last time step is greater than the preset resource utilization rate, a target node is identified from multiple nodes based on the dimension of at least one resource utilization sequence, and the container to be migrated is migrated to the target node. This fundamentally changes the passive and delayed migration mode that only begins after a node resource alarm. By predicting resource utilization in advance, migration assessment can be triggered before the actual resource bottleneck occurs, reserving a time window for migration operations, achieving smooth and seamless migration, and avoiding sharp performance drops. Simultaneously, a dual judgment logic of "threshold + continuous prediction" is introduced, greatly reducing unnecessary migrations caused by temporary business fluctuations. That is, short-term resource peaks will not trigger migration; only predicted continuous overload will trigger it. This reduces the network overhead, performance jitter, and resource waste caused by the migration itself. Furthermore, the selection of migration target nodes has shifted from randomness and simply choosing the lowest load to resource preference matching. Nodes are grouped according to resource preferences, and containers are migrated to the nodes with the most remaining resources corresponding to their preferences, achieving fine-grained resource scheduling. In addition, this proactive migration avoids container crashes, application interruptions, or even node avalanches caused by resource exhaustion, enhancing system stability and business continuity.
[0043] In some embodiments, using an encoding attention layer to determine the encoding attention weights of each resource utilization sequence across multiple time steps within a preset historical time period may include: The encoder obtains the encoded input features of each resource utilization sequence in the encoder at the current time step in multiple time steps within a preset historical time period, as well as the encoded hidden state and encoded cell state at the previous time step. The encoding attention layer is used to calculate the encoding attention score of each resource utilization sequence at the current time step based on the encoding input features, encoding hidden state, and encoding cell state. The encoding attention score is normalized to obtain the encoding attention weight of each resource utilization sequence at the current time step.
[0044] Specifically, Figure 4 A schematic diagram illustrating the calculation process of the encoded attention weights provided in an exemplary embodiment of this disclosure is shown, such as... Figure 4 As shown, the encoded input features of each resource utilization sequence in the encoder are obtained at the current time step within multiple time steps of a preset historical time period. and the encoded hidden state of the previous time step at the current time step. and encoding cell state ;Utilize an encoding attention layer to encode input features With encoding hidden state and encoding cell state Perform a linear combination and use the activation function tanh to calculate the resource utilization sequence at the current time step. t Encoding attention score Then, the softmax function is used to score the encoding attention. Normalization is performed to obtain the resource utilization sequence at the current time step. t Encoding attention weights .
[0045] For example, the formula for calculating the attention weights can be:
[0046]
[0047] in, Indicates the first i A resource utilization sequence in t Attention weights in the encoding of time steps; Indicates the first i A resource utilization sequence in t Attention score for time step encoding; Indicates the first i A resource utilization sequence in t -1 time step encoded hidden state; Indicates the first i A resource utilization sequence in t -1 time step encodes cell state; Indicates the first i A resource utilization sequence at time step t The encoded input features; , and This represents the model parameters that encode the attention layer.
[0048] In some embodiments, the encoder processes each resource utilization sequence at each time step based on the encoding attention weights to obtain the encoded hidden state of each resource utilization sequence at each time step, which may include: The encoder determines the encoding hidden state of each resource utilization sequence at the current time step based on the encoding attention weights and encoding input features of each resource utilization sequence at the current time step, as well as the encoding hidden state at the previous time step.
[0049] Specifically, the encoder can base its attention on the encoding weights of each resource utilization sequence at the current time step. and encoded input features The input data for the current time step is calculated. ;in, Then, based on the input data at the current time step... The encoded hidden state of the previous time step Determine the encoded hidden state of each resource utilization sequence at the current time step. ;in, By using this method, the encoder can focus more on relevant features.
[0050] In some embodiments, using a decoding attention layer to determine the decoding attention weights of each resource utilization sequence at each time step based on the encoded hidden state at each time step may include: Obtain the encoded hidden state of each resource utilization sequence in the decoder at the current time step, as well as the decoded hidden state and decoded cell state at the previous time step. The decoding attention layer is used to calculate the decoding attention score of each resource utilization sequence at the current time step based on the encoded hidden state, the decoded hidden state, and the decoded cell state. The decoding attention score is normalized to obtain the decoding attention weight of each resource utilization sequence at the current time step.
[0051] Specifically, the encoded hidden state of each resource utilization sequence in the decoder at the current time step across multiple time steps is obtained. And the decoded hidden state of the previous time step at the current time step. and decoding cell state ;Utilizing a decoding attention layer based on the encoded hidden state Decoding hidden state and decoding cell state Calculate the decoding attention score for each resource utilization sequence at the current time step. Attention score for decoding After normalization, the decoding attention weights of each resource utilization sequence at the current time step are obtained. ; For example, the formula for calculating the decoding attention weights can be:
[0052]
[0053] in, Indicates the first i A resource utilization sequence in t Decoding attention weights at each time step; Indicates the first i A resource utilization sequence in t Decoding attention scores for time steps; Indicates the first i A resource utilization sequence in t Decoding hidden states at time step -1; Indicates the first i A resource utilization sequence in t Decoding cell states at time step -1; Indicates the first i A resource utilization sequence at time step t The encoded hidden state; , and This represents the model parameters for decoding the attention layer.
[0054] In some embodiments, the decoder processes the encoded hidden states of each resource utilization sequence at each time step based on the decoding attention weights to obtain the predicted resource utilization rate of each resource utilization sequence at each time step, which may include: Based on the encoded hidden state and decoding attention weight of each resource utilization sequence at each time step, the context vector of each time step is calculated. The decoder determines the hidden state of the current time step based on the context vector and the hidden state of the previous time step. Based on the decoded hidden state and context vector at the current time step, the predicted resource utilization rate of each resource utilization sequence at the current time step is determined.
[0055] Specifically, based on the encoded hidden state of each resource utilization sequence at each time step. and Decoding Attention Weights Calculate the context vector at each time step. The formula for calculating the context vector at each time step is as follows:
[0056] Utilizing the decoder based on the context vector from the previous time step Decoding hidden state Determine the decoding hidden state at the current time step. The formula for calculating the decoded hidden state at the current time step is:
[0057]
[0058] in, Indicates weight, Indicates bias.
[0059] Decoding hidden state based on the current time step and context vector This determines the predicted resource utilization rate for each resource utilization sequence at the current time step. Taking the last time step as an example, the formula for calculating the predicted resource utilization rate at the current time step is:
[0060] in, This represents the predicted resource utilization rate at the last time step. This indicates the decoded hidden state at the last time step; Represents the context vector of the last time step; and Indicates weight; and Indicates bias.
[0061] Based on this, the resource utilization prediction model constructed in this embodiment, building upon the Seq2 framework and using an encoder-decoder architecture, combines the Attention mechanism with LSTM in both the encoding and decoding stages. The Attention mechanism provides different levels of attention to resource data across different dimensions, giving greater emphasis to important features. Simultaneously, in the decoding stage, it considers the states of the hidden layers at all time steps during encoding instead of using fixed context vectors, avoiding the problem of failing to capture long-term data when the sequence is too long. Furthermore, by predicting resource utilization across different dimensions, it determines the selection of the container to be migrated and the target node, avoids meaningless migrations by predicting resource utilization, and improves migration efficiency by grouping nodes according to their resource preference.
[0062] The foregoing mainly describes the solutions provided by the embodiments of this disclosure. It is understood that, in order to achieve the above functions, the electronic device includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein, this disclosure can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware 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 disclosure.
[0063] This disclosure embodiment can divide the electronic device into functional units according to the above method example. For example, each function can be divided into a separate functional module, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in this disclosure embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0064] By dividing each functional module according to its corresponding function, an exemplary embodiment of this disclosure provides a container migration apparatus, which can be an electronic device or a chip applied to an electronic device. Figure 5 A schematic diagram of the structure of a container migration apparatus provided in an exemplary embodiment of this disclosure is shown. Figure 5 As shown, the device 500 includes: The acquisition module 501 is used to acquire the resource utilization sequence of the multiple dimensions of resources of the container to be migrated within a preset historical time period and a pre-built resource utilization prediction model when the current resource utilization rate of at least one dimension of the multiple dimensions of resources of the container to be migrated is greater than or equal to a preset resource utilization rate; wherein, the resource utilization prediction model includes an encoding network and a decoding network, the encoding network includes an encoding attention layer and an encoder, and the decoding network includes a decoding attention layer and a decoder. Processing module 502 is used to determine the encoding attention weights of each resource utilization sequence in multiple time steps within the preset historical time period using the encoding attention layer; and to process each resource utilization sequence at each time step using the encoder based on the encoding attention weights to obtain the encoding hidden state of each resource utilization sequence at each time step. The processing module 502 is used to utilize the decoding attention layer to determine the decoding attention weight of each resource utilization sequence at each time step based on the encoded hidden state at each time step; and to use the decoder to process the encoded hidden state of each resource utilization sequence at each time step based on the decoding attention weight to obtain the predicted resource utilization rate of each resource utilization sequence at each time step. The processing module 502 is used to determine a target node from multiple nodes based on the dimension of at least one of the resource utilization sequences when the predicted resource utilization rate of at least one of the resource utilization sequences at the last time step is greater than the preset resource utilization rate, and to migrate the container to be migrated to the target node.
[0065] In some embodiments, the processing module 502 is further configured to obtain the encoded input features of each resource utilization sequence in the encoder at the current time step in the multiple time steps included in the preset historical time period, as well as the encoded hidden state and encoded cell state at the previous time step of the current time step. The encoding attention layer calculates the encoding attention score for each resource utilization sequence at the current time step based on the encoding input features, the encoding hidden state, and the encoding cell state. The encoding attention score is normalized to obtain the encoding attention weight of each resource utilization sequence at the current time step.
[0066] In some embodiments, the formula for calculating the encoding attention weight is:
[0067]
[0068] in, Indicates the first i A resource utilization sequence in t Attention weights in the encoding of time steps; Indicates the first i A resource utilization sequence in t Attention score for time step encoding; Indicates the first i A resource utilization sequence in t -1 time step encoded hidden state; Indicates the first i A resource utilization sequence in t -1 time step encodes cell state; Indicates the first i A resource utilization sequence at time step t The encoded input features; , and This represents the model parameters that encode the attention layer.
[0069] In some embodiments, the processing module 502 is further configured to use the encoder to determine the encoding hidden state of each resource utilization sequence at the current time step based on the encoding attention weight and encoding input features of each resource utilization sequence at the current time step, and the encoding hidden state at the previous time step.
[0070] In some embodiments, the processing module 502 is further configured to obtain the encoding hidden state of each resource utilization sequence in the decoder at the current time step of the plurality of time steps, and the decoding hidden state and decoding cell state at the previous time step of the current time step; The decoding attention layer calculates the decoding attention score for each resource utilization sequence at the current time step based on the encoded hidden state, the decoded hidden state, and the decoded cell state. The decoding attention score is normalized to obtain the decoding attention weight of each resource utilization sequence at the current time step; The formula for calculating the decoding attention weight is as follows:
[0071]
[0072] in, Indicates the first i A resource utilization sequence in t Decoding attention weights at each time step; Indicates the first i A resource utilization sequence in t Decoding attention scores for time steps; Indicates the first i A resource utilization sequence in t Decoding hidden states at time step -1; Indicates the first i A resource utilization sequence in t Decoding cell states at time step -1; Indicates the first i A resource utilization sequence at time step t The encoded hidden state; , and This represents the model parameters for decoding the attention layer.
[0073] In some embodiments, the processing module 502 is further configured to calculate the context vector for each time step based on the encoded hidden state and the decoded attention weight of each resource utilization sequence at each time step; The decoder determines the hidden state of the current time step based on the context vector of the previous time step and the hidden state of the decoder. Based on the decoded hidden state at the current time step and the context vector, the predicted resource utilization rate of each resource utilization sequence at the current time step is determined.
[0074] This disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the methods disclosed in this disclosure.
[0075] Figure 6 A schematic diagram of the structure of an electronic device provided in an exemplary embodiment of this disclosure is shown. For example... Figure 6 As shown, the electronic device 600 includes at least one processor 601 and a memory 602 coupled to the processor 601. The processor 601 can perform the corresponding steps in the methods disclosed in the embodiments of this disclosure.
[0076] The processor 601 described above can also be referred to as a Central Processing Unit (CPU), which can be an integrated circuit chip with signal processing capabilities. Each step in the method disclosed in this embodiment can be implemented by the integrated logic circuitry in the processor 601 or by software instructions. The processor 601 can be a general-purpose processor, a digital signal processor (DSP), an ASIC, a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this embodiment can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software modules can be located in the memory 602, such as 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 processor 601 reads information from the memory 602 and, in conjunction with its hardware, completes the steps of the method described above.
[0077] Furthermore, various operations / processes according to this disclosure, implemented via software and / or firmware, can be transmitted from a storage medium or network to a computer system with a dedicated hardware architecture, for example, Figure 7 The computer system 700 shown is equipped with the programs that constitute the software. When various programs are installed, the computer system is able to perform various functions, including functions such as those described above. Figure 7 A schematic diagram of the structure of a computer system provided in an exemplary embodiment of this disclosure is shown.
[0078] Computer system 700 is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0079] like Figure 7 As shown, the computer system 700 includes a computing unit 701, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. The RAM 703 may also store various programs and data required for the operation of the computer system 700. The computing unit 701, ROM 702, and RAM 703 are interconnected via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0080] Multiple components in the computer system 700 are connected to the I / O interface 705, including: an input unit 706, an output unit 707, a storage unit 708, and a communication unit 709. The input unit 706 can be any type of device capable of inputting information into the computer system 700. The input unit 706 can receive input numerical or character information and generate key signal inputs related to user settings and / or function control of the electronic device. The output unit 707 can be any type of device capable of presenting information and may include, but is not limited to, a monitor, speaker, video / audio output terminal, vibrator, and / or printer. The storage unit 708 may include, but is not limited to, a hard disk and an optical disk. The communication unit 709 allows the computer system 700 to exchange information / data with other devices via a network such as the Internet, and may include, but is not limited to, a modem, network card, infrared communication device, wireless communication transceiver, and / or chipset, such as Bluetooth™ devices, WiFi devices, WiMax devices, cellular communication devices, and / or the like.
[0081] The computing unit 701 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 performs the various methods and processes described above. For example, in some embodiments, the methods disclosed in this disclosure can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed on an electronic device via ROM 702 and / or communication unit 709. In some embodiments, the computing unit 701 can be configured to perform the methods disclosed in this disclosure by any other suitable means (e.g., by means of firmware).
[0082] This disclosure also provides a computer-readable storage medium, wherein when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is able to perform the methods disclosed in this disclosure.
[0083] The computer-readable storage medium in this disclosure can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. The aforementioned computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specifically, the aforementioned computer-readable storage medium may include electrical connections based on one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0084] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0085] This disclosure also provides a computer program product, including a computer program, wherein when the computer program is executed by a processor, it implements the methods disclosed in the embodiments of this disclosure.
[0086] In embodiments of this disclosure, computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof. These programming languages include, but are not limited to, object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network (including a local area network (LAN) or a wide area network (WAN)), or it can be connected to an external computer.
[0087] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0088] The modules, components, or units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the modules, components, or units do not necessarily constitute a limitation on the module, component, or unit itself.
[0089] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary hardware logic components that can be used include: field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), and so on.
[0090] The above description is merely an illustration of some embodiments of this disclosure and the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0091] While specific embodiments of this disclosure have been described in detail by way of example, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of this disclosure. Those skilled in the art should understand that modifications can be made to the above embodiments without departing from the scope and spirit of this disclosure. The scope of this disclosure is defined by the appended claims.
Claims
1. A container migration method, characterized in that, include: If the current resource utilization rate of at least one dimension of the container to be migrated is greater than or equal to a preset resource utilization rate, the resource utilization sequence of the multiple dimensions of the container to be migrated within a preset historical time period and a pre-built resource utilization prediction model are obtained; wherein, the resource utilization prediction model includes an encoding network and a decoding network, the encoding network includes an encoding attention layer and an encoder, and the decoding network includes a decoding attention layer and a decoder. Using the encoding attention layer, the encoding attention weights of each resource utilization sequence in multiple time steps included in the preset historical time period are determined; the encoder processes each resource utilization sequence at each time step based on the encoding attention weights to obtain the encoding hidden state of each resource utilization sequence at each time step. Using the decoding attention layer, the decoding attention weights of each resource utilization sequence at each time step are determined based on the encoded hidden state at each time step; the decoder processes the encoded hidden state of each resource utilization sequence at each time step based on the decoding attention weights to obtain the predicted resource utilization rate of each resource utilization sequence at each time step. If the predicted resource utilization rate of at least one of the resource utilization sequences is greater than the preset resource utilization rate at the last time step, a target node is determined from multiple nodes based on the dimension of at least one of the resource utilization sequences, and the container to be migrated is migrated to the target node.
2. The method as described in claim 1, characterized in that, The step of using the encoding attention layer to determine the encoding attention weights of each resource utilization sequence across multiple time steps within the preset historical time period includes: The encoder obtains the encoded input features of each resource utilization sequence in the encoder at the current time step in the multiple time steps included in the preset historical time period, as well as the encoded hidden state and encoded cell state at the previous time step. The encoding attention layer calculates the encoding attention score for each resource utilization sequence at the current time step based on the encoding input features, the encoding hidden state, and the encoding cell state. The encoding attention score is normalized to obtain the encoding attention weight of each resource utilization sequence at the current time step.
3. The method as described in claim 2, characterized in that, The formula for calculating the encoding attention weight is: in, Indicates the first i A resource utilization sequence in t Attention weights in the encoding of time steps; Indicates the first i A resource utilization sequence in t Attention score for time step encoding; Indicates the first i A resource utilization sequence in t -1 time step encoded hidden state; Indicates the first i A resource utilization sequence in t -1 time step encodes cell state; Indicates the first i A resource utilization sequence at time step t The encoded input features; , and This represents the model parameters that encode the attention layer.
4. The method as described in claim 2, characterized in that, The step of processing each resource utilization sequence at each time step using the encoder based on the encoding attention weight to obtain the encoded hidden state of each resource utilization sequence at each time step includes: The encoder determines the encoding hidden state of each resource utilization sequence at the current time step based on the encoding attention weight and encoding input features of each resource utilization sequence at the current time step, and the encoding hidden state at the previous time step.
5. The method according to any one of claims 1 to 4, characterized in that, The step of using the decoding attention layer to determine the decoding attention weights of each resource utilization sequence at each time step based on the encoded hidden state at each time step includes: Obtain the encoded hidden state of each resource utilization sequence in the decoder at the current time step of the plurality of time steps, as well as the decoded hidden state and decoded cell state at the previous time step of the current time step; The decoding attention layer calculates the decoding attention score for each resource utilization sequence at the current time step based on the encoded hidden state, the decoded hidden state, and the decoded cell state. The decoding attention score is normalized to obtain the decoding attention weight of each resource utilization sequence at the current time step; The formula for calculating the decoding attention weight is as follows: in, Indicates the first i A resource utilization sequence in t Decoding attention weights at each time step; Indicates the first i A resource utilization sequence in t Decoding attention scores for time steps; Indicates the first i A resource utilization sequence in t Decoding hidden states at time step -1; Indicates the first i A resource utilization sequence in t Decoding cell states at time step -1; Indicates the first i A resource utilization sequence at time step t The encoded hidden state; , and This represents the model parameters for decoding the attention layer.
6. The method as described in claim 5, characterized in that, The step of processing the encoded hidden state of each resource utilization sequence at each time step using the decoder based on the decoding attention weight to obtain the predicted resource utilization rate of each resource utilization sequence at each time step includes: Based on the encoded hidden state and the decoded attention weight of each resource utilization sequence at each time step, the context vector of each time step is calculated; The decoder determines the hidden state of the current time step based on the context vector of the previous time step and the hidden state of the decoder. Based on the decoded hidden state at the current time step and the context vector, the predicted resource utilization rate of each resource utilization sequence at the current time step is determined.
7. A container migration device, characterized in that, include: The acquisition module is used to acquire the resource utilization sequence of the multiple dimensions of resources of the container to be migrated within a preset historical time period, and a pre-built resource utilization prediction model, when the current resource utilization rate of at least one dimension of the multiple dimensions of resources of the container to be migrated is greater than or equal to a preset resource utilization rate; wherein, the resource utilization prediction model includes an encoding network and a decoding network, the encoding network includes an encoding attention layer and an encoder, and the decoding network includes a decoding attention layer and a decoder. The processing module is used to determine the encoding attention weights of each resource utilization sequence in multiple time steps within the preset historical time period using the encoding attention layer; and to process each resource utilization sequence at each time step using the encoder based on the encoding attention weights to obtain the encoding hidden state of each resource utilization sequence at each time step. The processing module is used to utilize the decoding attention layer to determine the decoding attention weight of each resource utilization sequence at each time step based on the encoded hidden state at each time step; and to use the decoder to process the encoded hidden state of each resource utilization sequence at each time step based on the decoding attention weight to obtain the predicted resource utilization rate of each resource utilization sequence at each time step. The processing module is used to determine a target node from multiple nodes based on the dimension of at least one of the resource utilization sequences when the predicted resource utilization rate of at least one of the resource utilization sequences is greater than the preset resource utilization rate at the last time step, and to migrate the container to be migrated to the target node.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the method described in any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the steps of the method described in any one of claims 1 to 6.