Container resource management method and device, computer equipment and storage medium
Through the virtual platform, resource collection management and predictive adjustment of multiple container cloud platforms are solved, which solves the problem of low resource allocation efficiency of container cloud platforms and improves task processing efficiency and resource utilization.
Patent Information
- Application Number
- CN202410570340.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-09
- Publication Date
- 2024-10-18
AI Technical Summary
Existing container cloud platforms only allocate resources when resources are insufficient or excessively idle, resulting in low resource allocation efficiency and affecting task processing efficiency.
Use the virtual platform to manage resource collections on multiple container cloud platforms, use historical resource usage data to generate resource time series, predict resource usage based on time series and prediction models, and perform resource adjustment based on the predicted amount to achieve pre-regulation and optimization of resources. .
It improves resource allocation efficiency, improves task processing efficiency, enhances the accuracy of resource volume prediction and allocation, and avoids idleness and waste of resources.
Smart Images

Figure CN118796448A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of microservice framework technology, and in particular to a container resource management method, apparatus, computer equipment, and storage medium. Background Art
[0002] Microservice tasks refer to splitting traditional monolithic applications into a group of small, independent service units, each of which is dedicated to performing a specific task or function. These service units can be independently deployed, expanded, and managed, and interact with each other through lightweight communication mechanisms to work together to complete complex business needs, which can achieve higher flexibility, scalability, and maintainability. Currently, microservice tasks are run through container cloud platforms, which provide container management and orchestration functions, and can easily deploy, run, and manage a large number of containerized microservices.
[0003] In the related technology, each container cloud platform can automatically increase or decrease container resources according to changes in system load and resource requirements to achieve system elasticity and high availability; however, the current container cloud platform only allocates resources at the moment when resources are insufficient or too idle, resulting in low resource allocation efficiency, which in turn affects the execution of tasks, making resource allocation untimely, and thus affecting task processing efficiency. Summary of the invention
[0004] The embodiments of the present application provide a container resource management method, apparatus, computer equipment and storage medium, which can realize the pre-adjustment of container cloud platform resources, improve resource allocation efficiency, and thus improve task processing efficiency. The technical solution is as follows.
[0005] In one aspect, a container resource management method is provided, the method being executed by a virtual platform, the virtual platform being used to collectively manage resources of at least two container cloud platforms, the method comprising:
[0006] Obtain historical resource usage data of the container cloud platform; the historical resource usage data includes usage data of resources of at least two resource types; the historical resource usage data is used to indicate resource usage at each historical time point;
[0007] Generate resource time series corresponding to each resource type based on resource data used at each historical time point indicated by the historical resource usage data;
[0008] Based on the resource time series corresponding to each resource type and the time series resource prediction model corresponding to the sequence type of the resource time series, resource usage is predicted to obtain the predicted resource usage corresponding to each resource type;
[0009] Based on the predicted resource usage corresponding to each resource type, the resource amount of the container cloud platform is adjusted.
[0010] On the other hand, a container resource management device is provided, which is applied in a virtual platform, and the virtual platform is used to collectively manage resources of at least two container cloud platforms, and the device includes:
[0011] A historical data acquisition module, used to acquire historical resource usage data of the container cloud platform; the historical resource usage data includes usage data of resources of at least two resource types; the historical resource usage data is used to indicate resource usage at each historical time point;
[0012] A sequence generation module, used to generate a resource time series sequence corresponding to each resource type based on the resource data used at each historical time point indicated by the historical resource usage data;
[0013] A prediction module is used to predict resource usage based on the resource time series corresponding to each resource type and the time series resource prediction model corresponding to the sequence type of the resource time series, so as to obtain the predicted resource usage corresponding to each resource type;
[0014] The adjustment module is used to adjust the resource amount of the container cloud platform based on the predicted resource usage corresponding to each resource type.
[0015] In a possible implementation, the prediction module is used to:
[0016] In the case where the type of the resource timing sequence of the first resource type is a short-dependency timing sequence, the resource timing sequence of the first resource type is input into a short-dependency timing resource prediction model to obtain a predicted resource usage corresponding to the first resource type; the first resource type is any one of the resource types; the short-dependency timing resource prediction model is a model constructed based on a Transformer network;
[0017] When the type of the resource timing sequence of the second resource type is a long-dependence timing sequence, the resource timing sequence of the second resource type is input into a long-dependence timing resource prediction model to obtain a predicted resource usage corresponding to the second resource type; the second resource type is any one of the resource types; the long-dependence timing resource prediction model is a model constructed based on a long short-term memory (LSTM) network.
[0018] In a possible implementation, the adjustment module includes:
[0019] The sorting submodule is used to obtain the priority sorting of each resource type;
[0020] A weighting submodule is used to perform weighted processing on the predicted resource usage corresponding to each resource type based on the priority ranking of each resource type, so as to obtain the weighted predicted resource usage corresponding to each resource type;
[0021] The regulating submodule is used to regulate the resource amount of the container cloud platform based on the weighted predicted resource usage corresponding to each resource type.
[0022] In a possible implementation, the regulating submodule includes:
[0023] A policy acquisition unit, used to acquire a resource allocation policy of the container cloud platform; the resource management policy is determined based on the resource utilization of the container cloud platform;
[0024] An adjustment unit is used to adjust the resource amount of the container cloud platform based on the weighted predicted resource usage corresponding to each resource type when the predicted resource usage of the container cloud platform meets the adjustment conditions corresponding to the resource allocation strategy of the container cloud platform.
[0025] In a possible implementation, the adjusting unit is used to:
[0026] When the resource allocation strategy of the container cloud platform is a dynamic resource allocation strategy and the predicted resource usage of the container cloud platform is greater than the resource usage threshold, the container cloud platform is expanded; the dynamic allocation strategy refers to a strategy for dynamically allocating resources according to real-time resource usage;
[0027] When the resource allocation strategy of the container cloud platform is a static resource allocation strategy and the predicted resource usage of the container cloud platform is less than the resource usage threshold, the container cloud platform is scaled down; the static resource allocation strategy refers to a strategy for statically allocating resources based on idle resources.
[0028] In a possible implementation manner, the device further includes:
[0029] Image information acquisition module, used to obtain container image information of each container cloud platform;
[0030] A set determination module, used to determine whether there is a target container cloud platform set based on the container image information of each container cloud platform, and the execution tasks of each container cloud platform in the target container cloud platform set are the same task;
[0031] A task allocation module is used to allocate tasks corresponding to the target container cloud platform set to the target container cloud platform for execution when it is determined that the target container cloud platform set exists, and the target container cloud platform is the container cloud platform with the lowest resource utilization in the target container cloud platform set.
[0032] In a possible implementation, the determining module is used to:
[0033] Match the container image information of each container cloud platform;
[0034] If the similarity between the container image information of at least two container cloud platforms is higher than the similarity threshold, a set consisting of the at least two container cloud platforms is obtained as the target container cloud platform set.
[0035] In a possible implementation, the device includes:
[0036] A resource requirement acquisition module is used to acquire the resource requirement of the task to be processed when receiving the task to be processed;
[0037] The container information acquisition module is used to obtain the resource allocation strategy of each container cloud platform and the remaining resources indicated by the resource usage data;
[0038] The platform determination module is used to determine the container cloud platform for processing the task to be processed according to the task allocation rules, based on the resource requirements of the task to be processed, the resource allocation strategies of each container cloud platform and the remaining resources.
[0039] In a possible implementation, the task allocation rule includes a first rule, a second rule and a third rule, the first rule has a higher priority than the second rule, and the second rule has a higher priority than the third rule;
[0040] The first rule means that the container cloud platform simultaneously satisfies the resource allocation strategy as a static resource allocation strategy and the remaining resource data is greater than the resource demand of the task to be processed;
[0041] The second rule means that the remaining resource data of the container cloud platform is greater than the resource demand of the task to be processed, and the resource allocation strategy is a dynamic allocation strategy;
[0042] The third rule means that the remaining resource data of the container cloud platform is less than the resource demand of the task to be processed, and the resource allocation strategy is a dynamic allocation strategy.
[0043] On the other hand, a computer device is provided, the computer device comprising a processor and a memory, the memory storing at least one computer program, the at least one computer program being loaded and executed by the processor to implement the above container resource management method.
[0044] On the other hand, a computer-readable storage medium is provided, wherein at least one computer program is stored in the computer-readable storage medium, and the computer program is loaded and executed by a processor to implement the above container resource management method.
[0045] On the other hand, a computer program product is provided, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, which, when executed by a computer, cause the computer to execute to implement the container resource management method provided in the above-mentioned various optional implementations.
[0046] The technical solution provided by this application may have the following beneficial effects:
[0047] The container resource management method provided in the embodiment of the present application generates a resource time series sequence corresponding to each resource management type based on the resource data used at each historical time point indicated by the historical resource usage data of the container cloud platform, and predicts resource usage based on the resource time series sequence corresponding to each resource type and the time series resource prediction model corresponding to the sequence type of the resource time series sequence, so as to obtain the predicted resource usage corresponding to each resource type, so as to adjust the resource amount of the container cloud platform according to the predicted resource usage corresponding to each resource type; through the above method, it is possible to pre-adjust the resources of the container cloud platform, improve the efficiency of resource allocation, and thus improve the efficiency of task processing. In this process, by predicting the resource usage by sequence type, it is possible to improve the accuracy of resource amount prediction, thereby improving the accuracy of resource allocation.
[0048] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0050] Figure 1 A schematic diagram showing a container resource management system corresponding to a container resource management method provided by an exemplary embodiment of the present application is shown;
[0051] Figure 2 A flowchart of a container resource management method provided by an exemplary embodiment of the present application is shown;
[0052] Figure 3 A flowchart of a container resource management method provided by an exemplary embodiment of the present application is shown;
[0053] Figure 4 A schematic diagram of a short-term dependent time series resource prediction model provided by an exemplary embodiment of the present application is shown;
[0054] Figure 5 A schematic diagram of the structure of an encoder provided by an exemplary embodiment of the present application is shown;
[0055] Figure 6 A schematic diagram of the structure of a long-term dependent time series resource prediction model provided by an exemplary embodiment of the present application is shown;
[0056] Figure 7 A flowchart of a container resource management method provided by an exemplary embodiment of the present application is shown;
[0057] Figure 8 A flowchart of a container resource management method provided by an exemplary embodiment of the present application is shown;
[0058] Fig. 9 A block diagram of a container resource management device provided by an exemplary embodiment of the present application is shown;
[0059] Fig.10 A structural block diagram of a computer device shown in an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION
[0060] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0061] An embodiment of the present application provides a container resource management method, which can realize timely allocation of resources in a container cloud platform through a virtual platform, wherein the virtual platform integrates multiple container cloud platforms, thereby improving resource allocation efficiency and task processing efficiency. Figure 1 A schematic diagram of a container resource management system corresponding to a container resource management method provided by an exemplary embodiment of the present application is shown. Figure 1 As shown, the container resource management system includes a virtual platform 110 and at least two container cloud platforms 120 ; at least two container cloud platforms 120 are integrated and managed in the virtual platform 110 .
[0062] In a possible implementation, a virtual platform integrating multiple container cloud platforms is built using OpenStack technology and an interface is opened, and at least two container cloud platforms that need to be managed are registered on the virtual platform through the open interface. Among them, OpenStack is an open source cloud computing platform composed of a series of interrelated components. OpenStack at least includes Nova components responsible for virtual machine management and computing resource allocation, Glance components used for virtual machine image management and storage, and Heat components used for orchestration and automated deployment of complex applications and resources. At the same time, OpenStack provides an API interface (Application Programming Interface) to provide access and management of each component through the HTTP protocol (HyperText Transfer Protocol). Multiple cluster container cloud platforms are registered on the virtual platform as virtual machines through the API interface, and the virtual resources of different cluster container cloud platforms are subsequently allocated through the Nova component.
[0063] During the construction of the virtual platform, OpenStack can be deployed in a suitable network environment, and a project to host the virtual platform can be created on OpenStack. The container cloud platform that needs to be managed can be registered on the virtual platform through an open interface, so that the container cloud platform can be managed and monitored through the virtual platform in the future.
[0064] Among them, the resources in the virtual platform can be divided into computing resources for carrying and executing the computing power of containers, network resources for infrastructure for communication between containers and between containers and the outside world, and storage resources for storage and management of container data. The embodiment of the present application utilizes OpenStack's Nova component to configure a computing resource pool that accommodates the computing resources of multiple container cloud platforms, OpenStack's Nova component to configure a storage resource pool that accommodates the storage resources of multiple container cloud platforms, and OpenStack's Neutron component to configure a network resource pool that accommodates the network resources of multiple container cloud platforms. The computing resource pool / storage resource pool / network resource pool are aggregated to obtain a virtual pool of the virtual platform.
[0065] In addition, in an embodiment of the present application, a unique tag can be created for each container cloud platform in the virtual platform, and the tag can be attached to the relevant resources, so that the resources of multiple container cloud platforms in the virtual resource pool can be effectively managed subsequently.
[0066] It should be noted that the container cloud platform applicable to the solution provided in the embodiments of the present application includes a self-hosted container cloud platform and a hosted container cloud platform. The self-hosted container cloud platform includes but is not limited to Kubernetes (K8s) / DockerSwarm / Apache Mesos, etc., and the hosted container cloud platform includes but is not limited to Amazon Elastic Container Service (ECS), Google Kubernetes Engine (GKE) and Microsoft Azure Container Instances (ACI), and this application does not impose any restrictions on this.
[0067] By integrating multiple cluster container cloud platforms into a virtual platform for management, unified resource management and task identification and allocation can be achieved, making the most of resources and avoiding idleness and waste of resources. In addition, the virtual platform can also optimize resources and load balance. By monitoring the resource utilization and load of different container cloud platforms, the virtual platform can select the appropriate container cloud platform to perform tasks based on indicators such as resource fragmentation rate, optimize resource allocation and load balancing, and improve the performance and efficiency of the overall system. Finally, the unified interface and management functions of the virtual platform simplify the complexity of management and integration. Administrators can manage and monitor multiple container cloud platforms through the unified interface of the virtual platform, simplify the access steps, and avoid the trouble of accessing the management interface of each container cloud platform one by one.
[0068] exist Figure 1 Based on the container resource management system shown in FIG. 1 , the present application embodiment provides a container resource management method. Figure 2 A flowchart of a container resource management method provided by an exemplary embodiment of the present application is shown. The method can be executed by a virtual platform, which is used to collectively manage resources of at least two container cloud platforms. The virtual platform can be implemented as a server, such as Figure 2 As shown, the container resource management method may include the following steps:
[0069] Step 210, obtaining historical resource usage data of the container cloud platform; the historical resource usage data includes usage data of resources of at least two resource types; the historical resource usage data is used to indicate resource usage at each historical time point.
[0070] In the embodiment of the present application, the container cloud platform has its own monitoring and indicator collection mechanism. For example, Prometheus can be used in Kubernetes to collect and display the resource usage data and resource utilization of the container. The monitoring module is used in Docker Swarm and Apache Mesos to collect and display the resource usage data and resource utilization of the nodes in the container cluster. The virtual platform can collect and store the resource usage data and resource utilization of each registered container cloud platform. When storing relevant data, the virtual platform can annotate and store the resource usage data and resource utilization of the corresponding container cloud platform based on the unique label corresponding to each container cloud platform, so as to facilitate the query and acquisition of relevant data of the container cloud platform.
[0071] When obtaining the historical resource usage data of the container cloud platform, the virtual platform can perform data query based on the unique label of the current container cloud platform to obtain the historical resource usage data of the current container cloud platform. The historical resource usage data is used to indicate the resource usage at each historical time point. The historical resource usage data can indicate the resource data used and the remaining resource data at each historical time point; wherein, the current container cloud platform can be a container cloud platform among at least two container cloud platforms for which resource adjustment is to be performed.
[0072] In the embodiments of the present application, the computer resources used by the container cloud platform may include CPU (Central Processing Unit) and memory, network resources include network bandwidth, IP (Internet Protocol) address allocation, routing configuration, storage resources include local disk, network storage, database, etc. Correspondingly, the resource types corresponding to the resource usage data of the container cloud platform may include computing resources, network resources, storage resources, etc. Based on different type classification standards, the number and type of resource types may be different, and the present application does not limit this. Among them, the resource usage data includes the data used in the container cloud platform, which refers to the amount of resources occupied by tasks in the container cloud platform.
[0073] Step 220: Generate a resource time series sequence corresponding to each resource type based on the resource data used at each historical time point indicated by the historical resource usage data.
[0074] The resource time series sequence refers to a sequence obtained by arranging the resource data of each resource type used at each historical time point in chronological order, and each resource type has a corresponding resource time series sequence.
[0075] Step 230 , predicting resource usage based on the resource time series sequence corresponding to each resource type and the time series resource prediction model corresponding to the sequence type of the resource time series sequence, to obtain the predicted resource usage corresponding to each resource type.
[0076] In an embodiment of the present application, the resource timing sequence is divided into short-term dependency timing sequence (Short-term Dependency) and long-term dependency timing sequence (Long-term Dependency) based on the intrinsic time dependency of data in the resource timing sequence; wherein, the short-term dependency timing sequence means that the current state in the sequence is closely related to its more recent past state, while the more distant past state has little influence on the current state; the long-term dependency timing sequence means that the current state in the sequence is significantly affected by the more distant past state; that is, the sequence types of the resource timing sequence include short-term dependency timing sequence and long-term dependency timing sequence.
[0077] In an embodiment of the present application, each sequence type has a corresponding timing resource prediction model, which is used to predict the resource usage at future time points based on the input timing resource sequence to obtain the corresponding predicted resource usage; wherein, the short-term dependent timing type has a corresponding short-term dependent timing resource prediction model, and the long-term dependent timing type has a corresponding long-term dependent timing resource prediction model.
[0078] Step 240: Adjust the resource amount of the container cloud platform based on the predicted resource usage amount corresponding to each resource type.
[0079] In one possible implementation, the virtual platform may adjust the resource amounts of corresponding resource types in the container cloud platform based on the predicted resource usage amounts corresponding to each resource type; in another possible implementation, the virtual platform may comprehensively determine a resource adjustment plan for the container cloud platform based on the predicted resource usage amounts corresponding to each resource type, and adjust the resource amounts of the container cloud platform based on the resource adjustment plan, wherein the resource adjustment plan may be a pre-set adjustment plan corresponding to each resource type. In an illustrative manner, if the predicted resource usage amounts of each resource type indicate that the overall resource amount in the current container cloud platform is too small, the resource amount of the container cloud platform is adjusted through a resource adjustment plan that indicates an increase in the overall resource amount (such as increasing the resource amount of all resource types).
[0080] To summarize, the container resource management method provided in the embodiment of the present application generates a resource timing sequence corresponding to each resource management type based on the resource data used at each historical time point indicated by the historical resource usage data of the container cloud platform, and predicts resource usage based on the resource timing sequence corresponding to each resource type and the timing resource prediction model corresponding to the sequence type of the resource timing sequence, so as to obtain the predicted resource usage corresponding to each resource type, so as to adjust the resource amount of the container cloud platform according to the predicted resource usage corresponding to each resource type; through the above method, it is possible to pre-adjust the resources of the container cloud platform, improve the efficiency of resource allocation, and thus improve the efficiency of task processing. In this process, by predicting resource usage by sequence type, it is possible to improve the accuracy of resource amount prediction, and thus improve the accuracy of resource allocation.
[0081] In the embodiment of the present application, different sequence types correspond to different time series resource prediction models. For example, the sequence types include short dependent time series and long dependent time series. Figure 3 A flowchart of a container resource management method provided by an exemplary embodiment of the present application is shown. The method can be executed by a virtual platform, which is used to collectively manage resources of at least two container cloud platforms. The virtual platform can be implemented as a server, such as Figure 3 As shown, the container resource management method may include the following steps:
[0082] Step 310, obtaining historical resource usage data of the container cloud platform; the historical resource usage data includes usage data of resources of at least two resource types; the historical resource usage data is used to indicate resource usage at each historical time point.
[0083] Obtain historical resource usage data of the current container cloud platform, wherein, during the data acquisition process, the virtual platform can obtain the historical resource usage data of the container cloud platform at a specified time interval, and store the acquired historical resource usage data and the corresponding acquisition time accordingly; wherein, the time interval can be set based on actual needs, and this application does not impose any restrictions on this.
[0084] Step 320: Generate a resource time series sequence corresponding to each resource type based on the resource data used at each historical time point indicated by the historical resource usage data.
[0085] The virtual platform can organize different types of historical resource usage data and acquisition time into a resource timing matrix composed of resource timing sequences; wherein, the historical resource usage data of the same resource type and the corresponding acquisition time constitute a resource timing sequence corresponding to the current type of resource, and the resource timing sequences of different resource types are arranged in rows to obtain the resource timing matrix; schematically, the resource timing sequence can be expressed as: x1, x2, x3, ..., xt, wherein x represents the resource usage, t represents the acquisition time, and different resource types have corresponding resource timing sequences.
[0086] Furthermore, after generating a resource timing sequence of each resource type, the virtual platform can determine and mark the sequence type of the resource timing sequence of each resource type; in this process, the virtual platform can set time windows of different sizes. Taking the process of determining and marking the sequence type of a resource timing sequence as an example, if the data fluctuations in a short time window are obvious, but the data fluctuations in a long time window are stable, then the current resource timing sequence is confirmed and marked as a short dependent timing sequence; if the data fluctuations in a short time window are stable, but the data fluctuations in a long time window are obvious, then the current resource timing sequence is confirmed and marked as a long dependent timing sequence; among them, short time and long time are relative, and the size of each time window can be set based on actual needs, and the present application does not impose any restrictions on this.
[0087] When the virtual platform predicts resource usage, it inputs the resource timing sequences of different resource types into the corresponding timing resource prediction model to predict resource usage, wherein a short-term dependency timing resource prediction model is set corresponding to the short-term dependency timing, and a long-term dependency timing resource prediction model is set corresponding to the long-term dependency timing. The resource timing sequence of the short-term dependency timing is input into the short-term resource prediction model, and the resource timing sequence of the long-term dependency timing is input into the long-term dependency timing resource prediction model.
[0088] Step 330, when the type of the resource timing sequence of the first resource type is a short dependency timing sequence, the resource timing sequence of the first resource type is input into a short-time dependency timing resource prediction model to obtain a predicted resource usage corresponding to the first resource type; the first resource type is any one of the resource types; the short-time dependency timing resource prediction model is a model constructed based on a Transformer network.
[0089] Since the data in the resource timing sequence with short dependency timing is greatly affected by short time, the Transformer network is used to build the model in the embodiment of the present application, wherein the core of the Transformer network is the self-attention mechanism (Self-Attention), which obtains context information by modeling the relationship between each element and other elements in the input resource timing sequence, so that the model can better focus on the before and after characteristics of the current resource usage.
[0090] Figure 4 FIG. 4 shows a schematic diagram of a short-term dependent time series resource prediction model provided by an exemplary embodiment of the present application, such as Figure 4 As shown, the short-term dependent temporal resource prediction model 400 is obtained by connecting multiple encoders 410 and decoders 420 with the same number as the encoders. The output of the last encoder is used as the input of the first decoder, and the input result of the last decoder is input into the prediction header for resource usage prediction.
[0091] Figure 5 FIG. 4 shows a schematic diagram of the structure of an encoder provided by an exemplary embodiment of the present application. Figure 5 As shown in the figure, the convolution data obtained by passing the short dependent time series resource time series sequence through the convolution layer is taken as the input vector of the first encoder, and the input vector is positionally encoded and input into the improved multi-head attention mechanism layer for attention mechanism calculation. The calculated features are residually connected with the input vector and then normalized to obtain the output features. The output features are input into the next encoder as the input vector for forward propagation.
[0092] Schematically, in each encoder, the input vector {x1, x2, ..., xt} is linearly mapped in the multi-head attention mechanism to obtain three vectors Q, K, and V. The three vectors Q, K, and V are self-attentioned, and the calculation formula is as follows:
[0093]
[0094] Among them, QK T is the attention matrix, d k The purpose is to process the attention matrix into a normal distribution. After multiplying it with the V vector, it is normalized using the softmax function to obtain features with the same embedding dimension as the input vector. Then it is directly added to the input vector for residual connection, and then the normalized features are forward propagated to the next encoder or decoder.
[0095] Step 340, when the type of the resource timing sequence of the second resource type is a long-dependence timing sequence, the resource timing sequence of the second resource type is input into the long-dependence timing sequence resource prediction model to obtain the predicted resource usage corresponding to the second resource type; the second resource type is any one of the resource types; the long-dependence timing sequence resource prediction model is a model constructed based on a long short-term memory (LSTM) network.
[0096] Since the data in the resource time series sequence of long-dependent time series is greatly affected by long time, the use of LSTM (Long Short-Term Memory) network in the embodiment of the present application can enable the model to better extract long-term features. Furthermore, the long-term dependent time series resource prediction model also includes a convolutional neural network, which can perform convolution processing on the resource time series sequences intercepted from different time periods so that the LSTM network pays more attention to the impact of time characteristics on resource usage. Figure 6 FIG. 4 shows a schematic diagram of a long-term dependent time series resource prediction model provided by an exemplary embodiment of the present application. Figure 6 As shown, the long-term dependent time series resource prediction model includes a convolutional neural network, an LSTM network, a fully connected layer and a prediction head connected in sequence, wherein the convolutional neural network includes multiple groups of convolutional architectures for resource time series sequences in different time periods, each group of convolutional architectures includes a convolutional layer, a pooling layer, and a flattening layer in sequence, and the LSTM network includes multiple groups of LSTM layers of convolutional architectures. The features output by the flattening layer of each convolutional architecture are input into the corresponding LSTM unit, and the adjacent LSTM units progressively process the features to obtain the prediction features of the corresponding multi-layer LSTM units. The prediction features are connected to each other and input into the fully connected layer to obtain the prediction results.
[0097] like Figure 6 As shown, in the process of predicting resource usage using a long-term dependent timing resource prediction model, the resource timing sequence of the long-term dependent timing is divided according to fixed time periods to obtain multiple resource timing sequence fragments, wherein the first resource timing sequence fragment includes a timing sequence fragment from the last moment to one time period before, the second resource timing sequence fragment includes a timing sequence fragment from the last moment to two time periods before, and the Nth resource timing sequence fragment includes a timing sequence fragment from the last moment to N time periods before, wherein the resource timing sequence is composed of timing resource sequence fragments corresponding to N time periods; the length of the time period can be set based on actual needs, and N is a positive integer.
[0098] Taking the processing process of one of the resource time series sequence fragments as an example, the Nth resource time series sequence fragment is input into the Nth convolution architecture of the convolutional neural network for processing to obtain the corresponding convolution data: the Nth resource time series sequence fragment passes through the convolution layer, pooling layer, and flattening layer of the Nth convolution architecture in sequence to obtain the flattened data including the Nth time period as the convolution data of the current convolution architecture; after completing the convolution processing of each resource time series sequence fragment, there is still a time series relationship between the convolution data corresponding to each resource time series sequence fragment; the convolution data of each time step is used as the input of the LSTM unit of the LSTM network, and the output of the previous LSTM unit is also used as the input of the current LSTM unit; wherein, the LSTM unit has mechanisms such as input gate, forget gate and output gate, which can process the input sequence data and retain long-term dependencies. The LSTM unit will process the input data step by step in chronological order, update the internal state and generate the corresponding output as the prediction feature; the prediction feature is connected in the fully connected layer and input into the prediction head to obtain the predicted resource usage.
[0099] Step 350: Adjust the resource amount of the container cloud platform based on the predicted resource usage amount corresponding to each resource type.
[0100] In a possible implementation, each resource type has a corresponding priority. In this case, the process of adjusting the resource amount of the container cloud platform by the virtual platform can be implemented as follows:
[0101] Get the priority ranking of each resource type;
[0102] Based on the priority ranking of each resource type, weighted processing is performed on the predicted resource usage corresponding to each resource type to obtain the weighted predicted resource usage corresponding to each resource type;
[0103] Based on the weighted predicted resource usage corresponding to each resource type, the resource amount of the container cloud platform is adjusted.
[0104] Among them, the priority of each resource type can be pre-set based on actual application requirements. Schematically, in some scenarios, the priority of computing resources is higher than that of network resources, and the priority of network resources is higher than that of storage resources; in other scenarios, the priority of network resources is higher than that of computing resources, and the priority of computing resources is higher than that of storage resources. This application does not impose any restrictions on this.
[0105] In one possible implementation, each level has its own weighted weight. After weighting the predicted resource usage corresponding to each resource type, the resource usage is summed to obtain a total predicted resource usage. The total predicted resource usage is compared with a resource usage threshold. If the total predicted resource usage is greater than the resource usage threshold, indicating that the resource usage in the future will be large, the container cloud platform is expanded. If the total predicted resource usage is less than the resource usage threshold, indicating that the resource usage in the future will be small, the container cloud platform is reduced in size. The resource usage threshold can be set by relevant personnel based on actual needs, or the resource usage threshold can also be the current remaining resources of the container cloud platform.
[0106] Alternatively, in another possible implementation, the virtual platform may adjust the resource volume of the container cloud platform based on the predicted resource usage of the top K resource types with the highest priority, where K is a positive integer. Schematically, the virtual platform compares the predicted resource usage of the resource type with the highest priority with the resource usage threshold corresponding to the resource type. If the predicted resource usage of the resource type is higher than the corresponding resource usage threshold, the container cloud platform is expanded; otherwise, the container cloud platform is reduced in capacity. The resource usage threshold of each resource type can be set differently by relevant personnel based on actual needs, or the resource usage threshold of each resource type is the current remaining resource volume of the corresponding resource type in the container cloud platform.
[0107] In order to avoid unnecessary shrinking and expansion caused by sudden resource demand, it is necessary to determine whether the set conditions are met before shrinking or expanding the capacity, and then expand or shrink the container cloud platform after the set conditions are met; optionally, based on the weighted predicted resource usage corresponding to each resource type, the process of adjusting the resource amount of the container cloud platform can be implemented as follows:
[0108] Obtain the resource allocation strategy of the container cloud platform; the resource management strategy is determined based on the resource utilization of the container cloud platform;
[0109] When the predicted resource usage of the container cloud platform meets the adjustment conditions corresponding to the resource allocation strategy of the container cloud platform, the resource amount of the container cloud platform is adjusted based on the weighted predicted resource usage corresponding to each resource type.
[0110] That is to say, the setting condition is that the predicted resource usage of the container cloud platform meets the adjustment condition corresponding to the resource allocation strategy of the container cloud platform; different resource allocation strategies correspond to different adjustment conditions.
[0111] Among them, the resource allocation strategy includes dynamic resource allocation strategy and static resource allocation strategy; when obtaining the resource allocation strategy of the container cloud platform, the virtual platform can obtain the resource utilization of the container cloud platform. If the resource utilization of the container cloud platform exceeds the resource utilization threshold, the resource allocation strategy of the container cloud platform is determined to be a dynamic resource allocation strategy, wherein the dynamic resource allocation strategy refers to a strategy for dynamically allocating resources according to real-time resource usage; if the resource utilization of the container cloud platform does not exceed the resource utilization threshold, the resource allocation strategy of the container cloud platform is determined to be a static resource allocation strategy, wherein the static resource allocation strategy refers to a strategy for statically allocating resources according to idle resources. That is to say, there are many available resources in the container cloud platform, and there is no need to make dynamic adjustments. Only idle resources need to be called directly. Among them, the resource utilization threshold can be set based on the resource management strategy and needs of each container cloud platform itself. The resource utilization threshold is a limit set in the resource management of the corresponding container cloud platform. When the resource utilization exceeds the resource utilization threshold, it means that the current container cloud platform is under load and needs to sort out and allocate resources. The corresponding resource allocation strategy is the dynamic resource allocation strategy. Otherwise, there is no need to sort out and allocate resources. The corresponding resource allocation strategy is the static resource allocation strategy.
[0112] When making an expansion / reduction judgment, if the resource allocation strategy of the container cloud platform is a dynamic resource allocation strategy and the predicted resource usage of the container cloud platform is greater than the resource usage threshold, the container cloud platform is expanded.
[0113] When the resource allocation strategy of the container cloud platform is a static resource allocation strategy and the predicted resource usage of the container cloud platform is less than the resource usage threshold, the container cloud platform is scaled down.
[0114] By determining the above-mentioned set conditions, the impact of emergencies on the judgment of future resource usage can be reduced, and the accuracy of the judgment of resource usage in the future period can be improved, thereby avoiding unnecessary shrinking and expanding capacity.
[0115] To summarize, the container resource management method provided in the embodiment of the present application generates a resource time series sequence corresponding to each resource management type based on the resource data used at each historical time point indicated by the historical resource usage data of the container cloud platform, and predicts resource usage based on the resource time series sequence corresponding to each resource type and the time series resource prediction model corresponding to the sequence type of the resource time series sequence, so as to obtain the predicted resource usage corresponding to each resource type, so as to adjust the resource amount of the container cloud platform according to the predicted resource usage corresponding to each resource type; through the above method, it is possible to pre-adjust the resources of the container cloud platform, expand or shrink the capacity in advance, improve the efficiency of resource allocation, and thus improve the efficiency of task processing. In this process, by predicting the resource usage by sequence type, it is possible to improve the accuracy of resource amount prediction, and thus improve the accuracy of resource allocation.
[0116] In one possible implementation, in addition to pre-scaling or shrinking the container cloud platform based on the historical resource usage of the container cloud platform itself, the virtual platform can also coordinate and allocate tasks between multiple container cloud platforms based on the task allocation and resource usage of each container cloud platform. In one possible implementation, the virtual platform can coordinate and allocate tasks based on the container image information of each container cloud platform. Figure 7 A flowchart of a container resource management method provided by an exemplary embodiment of the present application is shown. The method can be executed by a virtual platform, which is used to collectively manage resources of at least two container cloud platforms. The virtual platform can be implemented as a server, such as Figure 7 As shown, the container resource management method may include the following steps:
[0117] Step 710: Obtain container image information of each container cloud platform.
[0118] Container cloud platforms usually use container image repositories to store and manage container image information for tasks. Container cloud platforms can view container image information for tasks through the command line or management interface of container orchestration tools. Different container cloud platforms exchange container image information of currently executing tasks with virtual platforms through open interfaces (such as API interfaces). Accordingly, virtual platforms can call the API interfaces provided by container cloud platforms to obtain container image information of various container cloud platforms. Alternatively, container cloud platforms can actively push container image information to virtual platforms. For example, container cloud platforms can push container image information to virtual platforms through Webhooks mechanisms.
[0119] Step 720: determine whether there is a target container cloud platform set based on the container image information of each container cloud platform, and the execution tasks of each container cloud platform in the target container cloud platform set are the same task.
[0120] Since the same task may use the same container image on different container cloud platforms, the virtual platform can analyze the container image information of different container cloud platforms and determine whether the execution tasks of different container cloud platforms are the same task based on the similarity between the container image information. This process can be implemented as follows:
[0121] Match the container image information of each container cloud platform;
[0122] If the similarity between the container image information of at least two container cloud platforms is higher than the similarity threshold, a set consisting of the at least two container cloud platforms is obtained as the target container cloud platform set.
[0123] Among them, the container image information may include the name, version number or image summary of the container image; when matching the container image information, the similarity between the container image information can be determined based on the above information. When the similarity is higher than the similarity threshold, it is determined that the tasks corresponding to the two container image information are the same task.
[0124] Step 730, when it is determined that there is a target container cloud platform set, the tasks corresponding to the target container cloud platform set are allocated to the target container cloud platform for execution, and the target container cloud platform is the container cloud platform with the lowest resource utilization in the target container cloud platform set.
[0125] If the virtual platform determines through the container image information that the tasks executed by different container cloud platforms are the same task, and there is a target container cloud platform set, then based on the resource utilization of each container cloud platform in the target container cloud platform set, the task is assigned to the container cloud platform with lower resource utilization in the target container cloud platform set, and the task execution of other container cloud platforms is released; wherein the resource utilization of each container cloud platform is the total resource utilization obtained by summarizing the resource utilization of each resource type, for example, the resource utilization is the total resource utilization obtained by summarizing the CPU resource utilization, memory utilization, network utilization, and storage resource utilization.
[0126] To summarize, the container resource management method provided in the embodiment of the present application collectively manages the resources of at least two container cloud platforms through a virtual platform, and obtains the container image information of each container cloud platform to determine whether there are multiple container cloud platforms executing the same task based on the container image information of each container cloud platform. If so, the task is assigned to the target container cloud platform with the lowest resource utilization among the multiple container cloud platforms executing the same task, thereby avoiding the repeated execution of the same task on different isolated container cloud platforms, saving resources and improving task execution efficiency.
[0127] In another possible implementation, the virtual platform may coordinate and allocate tasks based on the resource allocation strategies and remaining resource amounts of each container cloud platform; Figure 8 A flowchart of a container resource management method provided by an exemplary embodiment of the present application is shown. The method can be executed by a virtual platform, which is used to collectively manage resources of at least two container cloud platforms. The virtual platform can be implemented as a server, such as Figure 8 As shown, the container resource management method may include the following steps:
[0128] Step 810: upon receiving a task to be processed, obtaining resource requirements of the task to be processed.
[0129] Among them, the task requirements of the tasks to be processed can be determined based on the task description information of the tasks to be processed. The task description information may include task type, CPU requirements, memory requirements, disk space requirements, network bandwidth requirements, etc. The resource requirements of the tasks can be estimated based on the task description information.
[0130] Step 820: Obtain the resource allocation strategy of each container cloud platform and the remaining resource amount indicated by the resource usage data.
[0131] The resource allocation strategy of each container cloud platform can be determined based on the resource utilization threshold corresponding to each container cloud platform. For related content, please refer to Figure 3 The relevant contents in the illustrated embodiment will not be repeated here.
[0132] Step 830, according to the task allocation rules, based on the resource requirements of the task to be processed, the resource allocation strategies of each container cloud platform and the remaining resources, determine the container cloud platform that processes the task to be processed.
[0133] In a possible implementation, the task allocation rule includes a first rule, a second rule and a third rule, the first rule has a higher priority than the second rule, and the second rule has a higher priority than the third rule;
[0134] The first rule means that the container cloud platform satisfies the resource allocation strategy of static resource allocation strategy and the remaining resource data is greater than the resource demand of the task to be processed;
[0135] The second rule means that the remaining resource data of the container cloud platform is greater than the resource requirements of the task to be processed, and the resource allocation strategy is a dynamic allocation strategy;
[0136] The third rule means that the remaining resource data of the container cloud platform is less than the resource demand of the task to be processed, and the resource allocation strategy is a dynamic allocation strategy.
[0137] That is to say, when the virtual platform allocates tasks to be processed, the preferred solution (i.e., the solution that satisfies the first rule) is to allocate the tasks to be processed to the container cloud platform that satisfies the static resource allocation strategy and the resource demand of the remaining resources is greater than the task to be processed; optionally, when there are multiple container cloud platforms that satisfy the first rule, the tasks to be processed are allocated to the container cloud platform with the largest remaining resources; the second-choice solution (i.e., the solution that satisfies the second rule) is to allocate the tasks to be processed to the container cloud platform with the remaining resources greater than the resource demand of the tasks to be processed, but in the dynamic resource allocation strategy; optionally, when there are multiple container cloud platforms that satisfy the second rule, the tasks to be processed are allocated to the container cloud platform with the largest remaining resources; the third-choice solution (i.e., the solution that satisfies the third rule) is to allocate the tasks to be processed to the container cloud platform with the remaining resources less than the resource demand of the tasks to be processed, but in the dynamic allocation strategy. When there are multiple container cloud platforms that satisfy the third rule, the tasks to be processed are allocated to the container cloud platform with a larger difference between the resource utilization rate of the container cloud platform and the corresponding resource utilization rate threshold.
[0138] To summarize, the container resource management method provided in the embodiment of the present application manages the resources of at least two container cloud platforms collectively through a virtual platform, and when receiving pending tasks, allocates the pending tasks according to the resource requirements of the pending tasks, the resource allocation strategies of each container cloud platform, and the remaining resources indicated by the resource usage data, combined with the pre-set task allocation rules, so as to allocate the pending tasks to the container cloud platforms that respond in a timely manner, thereby achieving reasonable allocation of tasks, reducing the execution waiting time of pending tasks, and improving task execution efficiency; in addition, it is also possible to optimize resources and achieve load balancing to avoid excessive concentration of resources or excessive load.
[0139] It should be noted that the scheme for task coordination and task allocation based on the container image information of each container cloud platform, the scheme for task coordination and task allocation based on the resource allocation strategy and remaining resource amount of each container cloud platform, and the scheme for pre-expanding or reducing the capacity of the container cloud platform based on the container cloud platform's own historical resource usage provided in the embodiments of the present application can be combined and applied in the process of container cloud platform management, or they can also be applied separately, and the present application does not impose any restrictions on this.
[0140] Fig. 9 A block diagram of a container resource management device provided by an exemplary embodiment of the present application is shown. The device can be applied in a virtual platform, which is used to collectively manage resources of at least two container cloud platforms. The device can be used to perform the following steps: Figure 2 , Figure 3 , Figure 7 or Figure 8All or part of the steps shown in any embodiment, such as Fig. 9 As shown, the device comprises:
[0141] A historical data acquisition module 910 is used to acquire historical resource usage data of the container cloud platform; the historical resource usage data includes usage data of resources of at least two resource types; the historical resource usage data is used to indicate resource usage at each historical time point;
[0142] A sequence generation module 920, configured to generate a resource time series sequence corresponding to each resource type based on the resource data used at each historical time point indicated by the historical resource usage data;
[0143] Prediction module 930, used to predict resource usage based on the resource time series sequence corresponding to each resource type and the time series resource prediction model corresponding to the sequence type of the resource time series sequence, to obtain the predicted resource usage corresponding to each resource type;
[0144] The adjustment module 940 is used to adjust the resource amount of the container cloud platform based on the predicted resource usage corresponding to each resource type.
[0145] In a possible implementation, the prediction module 930 is used to:
[0146] In the case where the type of the resource timing sequence of the first resource type is a short-dependency timing sequence, the resource timing sequence of the first resource type is input into a short-dependency timing resource prediction model to obtain a predicted resource usage corresponding to the first resource type; the first resource type is any one of the resource types; the short-dependency timing resource prediction model is a model constructed based on a Transformer network;
[0147] When the type of the resource timing sequence of the second resource type is a long-dependence timing sequence, the resource timing sequence of the second resource type is input into a long-dependence timing resource prediction model to obtain a predicted resource usage corresponding to the second resource type; the second resource type is any one of the resource types; the long-dependence timing resource prediction model is a model constructed based on a long short-term memory (LSTM) network.
[0148] In a possible implementation, the adjustment module 940 includes:
[0149] The sorting submodule is used to obtain the priority sorting of each resource type;
[0150] A weighting submodule is used to perform weighted processing on the predicted resource usage corresponding to each resource type based on the priority ranking of each resource type, so as to obtain the weighted predicted resource usage corresponding to each resource type;
[0151] The regulating submodule is used to regulate the resource amount of the container cloud platform based on the weighted predicted resource usage corresponding to each resource type.
[0152] In a possible implementation, the regulating submodule includes:
[0153] A policy acquisition unit, used to acquire a resource allocation policy of the container cloud platform; the resource management policy is determined based on the resource utilization of the container cloud platform;
[0154] An adjustment unit is used to adjust the resource amount of the container cloud platform based on the weighted predicted resource usage corresponding to each resource type when the predicted resource usage of the container cloud platform meets the adjustment conditions corresponding to the resource allocation strategy of the container cloud platform.
[0155] In a possible implementation, the adjusting unit is used to:
[0156] When the resource allocation strategy of the container cloud platform is a dynamic resource allocation strategy and the predicted resource usage of the container cloud platform is greater than the resource usage threshold, the container cloud platform is expanded; the dynamic allocation strategy refers to a strategy for dynamically allocating resources according to real-time resource usage;
[0157] When the resource allocation strategy of the container cloud platform is a static resource allocation strategy and the predicted resource usage of the container cloud platform is less than the resource usage threshold, the container cloud platform is scaled down; the static resource allocation strategy refers to a strategy for statically allocating resources based on idle resources.
[0158] In a possible implementation manner, the device further includes:
[0159] Image information acquisition module, used to obtain container image information of each container cloud platform;
[0160] A set determination module, used to determine whether there is a target container cloud platform set based on the container image information of each container cloud platform, and the execution tasks of each container cloud platform in the target container cloud platform set are the same task;
[0161] A task allocation module is used to allocate tasks corresponding to the target container cloud platform set to the target container cloud platform for execution when it is determined that the target container cloud platform set exists, and the target container cloud platform is the container cloud platform with the lowest resource utilization in the target container cloud platform set.
[0162] In a possible implementation, the determining module is used to:
[0163] Match the container image information of each container cloud platform;
[0164] If the similarity between the container image information of at least two container cloud platforms is higher than the similarity threshold, a set consisting of the at least two container cloud platforms is obtained as the target container cloud platform set.
[0165] In a possible implementation, the device includes:
[0166] A resource requirement acquisition module is used to acquire the resource requirement of the task to be processed when receiving the task to be processed;
[0167] The container information acquisition module is used to obtain the resource allocation strategy of each container cloud platform and the remaining resources indicated by the resource usage data;
[0168] The platform determination module is used to determine the container cloud platform for processing the task to be processed according to the task allocation rules, based on the resource requirements of the task to be processed, the resource allocation strategies of each container cloud platform and the remaining resources.
[0169] In a possible implementation, the task allocation rule includes a first rule, a second rule and a third rule, the first rule has a higher priority than the second rule, and the second rule has a higher priority than the third rule;
[0170] The first rule means that the container cloud platform simultaneously satisfies the resource allocation strategy as a static resource allocation strategy and the remaining resource data is greater than the resource demand of the task to be processed;
[0171] The second rule means that the remaining resource data of the container cloud platform is greater than the resource demand of the task to be processed, and the resource allocation strategy is a dynamic allocation strategy;
[0172] The third rule means that the remaining resource data of the container cloud platform is less than the resource demand of the task to be processed, and the resource allocation strategy is a dynamic allocation strategy.
[0173] To summarize, the container resource management device provided in the embodiment of the present application generates a resource timing sequence corresponding to each resource management type based on the resource data used at each historical time point indicated by the historical resource usage data of the container cloud platform, and predicts resource usage based on the resource timing sequence corresponding to each resource type and the timing resource prediction model corresponding to the sequence type of the resource timing sequence, so as to obtain the predicted resource usage corresponding to each resource type, so as to adjust the resource amount of the container cloud platform according to the predicted resource usage corresponding to each resource type; it can realize the pre-adjustment of the resources of the container cloud platform, improve the efficiency of resource allocation, and thus improve the efficiency of task processing. In this process, by predicting the resource usage by sequence type, it is possible to improve the accuracy of resource amount prediction, thereby improving the accuracy of resource allocation.
[0174] Fig.10 The structural block diagram of a computer device 1000 shown in an exemplary embodiment of the present application is shown. The computer device can be implemented as a virtual platform or a container cloud platform in the above-mentioned scheme of the present application. The computer device 1000 includes a central processing unit (CPU) 1001, a system memory 1004 including a random access memory (RAM) 1002 and a read-only memory (ROM) 1003, and a system bus 1005 connecting the system memory 1004 and the central processing unit 1001. The computer device 1000 also includes a mass storage device 1006 for storing an operating system 1009, an application program 1010, and other program modules 1011.
[0175] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, Erasable Programmable Read Only Memory (EPROM), Electronically-Erasable Programmable Read-Only Memory (EEPROM) flash memory or other solid-state storage technology, CD-ROM, Digital Versatile Disc (DVD) or other optical storage, cassettes, tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that the computer storage medium is not limited to the above. The above-mentioned system memory 1004 and mass storage device 1006 can be collectively referred to as memory.
[0176] According to various embodiments of the present disclosure, the computer device 1000 can also be connected to a remote computer on a network through a network such as the Internet. That is, the computer device 1000 can be connected to the network 1008 through the network interface unit 1007 connected to the system bus 1005, or the network interface unit 1007 can be used to connect to other types of networks or remote computer systems (not shown).
[0177] The memory also includes at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is stored in the memory. The central processor 1001 implements all or part of the steps in the container resource management method shown in the above embodiments by executing the at least one instruction, at least one program, code set or instruction set.
[0178] In an exemplary embodiment, a computer-readable storage medium is also provided, in which at least one computer program is stored, and the computer program is loaded and executed by a processor to implement all or part of the steps in the above container resource management method. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0179] In an exemplary embodiment, a computer program product is also provided, which includes a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, when the program instructions are executed by a computer, the computer is executed to implement the above Figure 2 , Figure 3 , Figure 7 or Figure 8 All or part of the steps of the container resource management method shown in any embodiment.
[0180] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the claims.
[0181] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A container resource management method, It is characterized in that The method is performed by a virtual platform, and the virtual platform is used to collectively manage resources of at least two container cloud platforms. The method includes: Obtain historical resource usage data of the container cloud platform; the historical resource usage data includes usage data of resources of at least two resource types; the historical resource usage data is used to indicate resource usage at each historical time point; Generate resource time series corresponding to each resource type based on resource data used at each historical time point indicated by the historical resource usage data; Based on the resource time series corresponding to each resource type and the time series resource prediction model corresponding to the sequence type of the resource time series, resource usage is predicted to obtain the predicted resource usage corresponding to each resource type; Based on the predicted resource usage corresponding to each resource type, the resource amount of the container cloud platform is adjusted.
2. The method according to claim 1, It is characterized in that The resource usage prediction is performed based on the resource time series sequence corresponding to each resource type and the time series resource prediction model corresponding to the sequence type of the resource time series sequence to obtain the predicted resource usage corresponding to each resource type, including: In the case where the type of the resource timing sequence of the first resource type is a short-dependency timing sequence, the resource timing sequence of the first resource type is input into a short-dependency timing resource prediction model to obtain a predicted resource usage corresponding to the first resource type; the first resource type is any one of the resource types; the short-dependency timing resource prediction model is a model constructed based on a Transformer network; When the type of the resource timing sequence of the second resource type is a long-dependence timing sequence, the resource timing sequence of the second resource type is input into a long-dependence timing resource prediction model to obtain a predicted resource usage corresponding to the second resource type; the second resource type is any one of the resource types; the long-dependence timing resource prediction model is a model constructed based on a long short-term memory (LSTM) network.
3. The method according to claim 1, It is characterized in that The adjusting the amount of resources of the container cloud platform based on the predicted resource usage amount corresponding to each resource type includes: Get the priority ranking of each resource type; Based on the priority ranking of each resource type, weighted processing is performed on the predicted resource usage corresponding to each resource type to obtain the weighted predicted resource usage corresponding to each resource type; Based on the weighted predicted resource usage corresponding to each resource type, the resource amount of the container cloud platform is adjusted.
4. The method according to claim 3, It is characterized in that The adjusting the amount of resources of the container cloud platform based on the weighted predicted resource usage corresponding to each resource type includes: Obtaining a resource allocation strategy for the container cloud platform; the resource management strategy is determined based on resource utilization of the container cloud platform; When the predicted resource usage of the container cloud platform meets the adjustment conditions corresponding to the resource allocation strategy of the container cloud platform, the resource amount of the container cloud platform is adjusted based on the weighted predicted resource usage corresponding to each resource type.
5. The method according to claim 4, It is characterized in that When the predicted resource usage of the container cloud platform meets the adjustment condition corresponding to the resource allocation strategy of the container cloud platform, adjusting the resource amount of the container cloud platform includes: When the resource allocation strategy of the container cloud platform is a dynamic resource allocation strategy and the predicted resource usage of the container cloud platform is greater than the resource usage threshold, the container cloud platform is expanded; the dynamic allocation strategy refers to a strategy for dynamically allocating resources according to real-time resource usage; When the resource allocation strategy of the container cloud platform is a static resource allocation strategy and the predicted resource usage of the container cloud platform is less than the resource usage threshold, the container cloud platform is scaled down; the static resource allocation strategy refers to a strategy for statically allocating resources based on idle resources.
6. The method according to claim 1, It is characterized in that The method further comprises: Obtain container image information of each container cloud platform; Determining whether there is a target container cloud platform set based on container image information of each container cloud platform, wherein execution tasks of each container cloud platform in the target container cloud platform set are the same task; When it is determined that the target container cloud platform set exists, tasks corresponding to the target container cloud platform set are allocated to the target container cloud platform for execution, and the target container cloud platform is the container cloud platform with the lowest resource utilization in the target container cloud platform set.
7. The method according to claim 6, It is characterized in that The determining whether there is a target container cloud platform set based on the container image information of each container cloud platform includes: Match the container image information of each container cloud platform; If the similarity between the container image information of at least two container cloud platforms is higher than the similarity threshold, a set consisting of the at least two container cloud platforms is obtained as the target container cloud platform set.
8. The method according to claim 1, It is characterized in that The method further comprises: When receiving a task to be processed, obtaining resource requirements of the task to be processed; Obtain the resource allocation strategy of each container cloud platform and the remaining resources indicated by resource usage data; According to the task allocation rules, based on the resource requirements of the task to be processed, the resource allocation strategies of each container cloud platform and the remaining resources, the container cloud platform that processes the task to be processed is determined.
9. The method according to claim 8, It is characterized in that The task allocation rules include a first rule, a second rule and a third rule, the first rule has a higher priority than the second rule, and the second rule has a higher priority than the third rule; The first rule means that the container cloud platform simultaneously satisfies the resource allocation strategy as a static resource allocation strategy and the remaining resource data is greater than the resource demand of the task to be processed; The second rule means that the remaining resource data of the container cloud platform is greater than the resource demand of the task to be processed, and the resource allocation strategy is a dynamic allocation strategy; The third rule means that the remaining resource data of the container cloud platform is less than the resource demand of the task to be processed, and the resource allocation strategy is a dynamic allocation strategy.
10. A container resource management device, It is characterized in that The device is applied in a virtual platform, and the virtual platform is used to collectively manage resources of at least two container cloud platforms. The device includes: A historical data acquisition module, used to acquire historical resource usage data of the container cloud platform; the historical resource usage data includes usage data of resources of at least two resource types; the historical resource usage data is used to indicate resource usage at each historical time point; A sequence generation module, used to generate a resource time series sequence corresponding to each resource type based on the resource data used at each historical time point indicated by the historical resource usage data; A prediction module is used to predict resource usage based on the resource time series corresponding to each resource type and the time series resource prediction model corresponding to the sequence type of the resource time series, so as to obtain the predicted resource usage corresponding to each resource type; The adjustment module is used to adjust the resource amount of the container cloud platform based on the predicted resource usage corresponding to each resource type.
11. A computer device, It is characterized in that The computer device includes a processor and a memory, the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the container resource management method according to any one of claims 1 to 9.
12. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores at least one computer program, and the computer program is loaded and executed by a processor to implement the container resource management method according to any one of claims 1 to 9.
13. A computer program product, It is characterized in that The computer program product includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer is caused to execute to implement the container resource management method as described in any one of claims 1 to 9.
Citation Information
Cited By
Resource processing method and device of resource node, electronic equipment and storage medium
CN121441919A
Resource data processing method and device, storage medium and electronic equipment
CN121563159A
Container resource management method and apparatus, and device and medium
WO2026223025A1
