Container resource management method and device, equipment and medium

Through the prediction method combining hollow space convolution pooling pyramid and long-term short-term memory model, combined with blockchain technology, the problems of inaccurate prediction and low manual configuration efficiency in container resource management are solved, and intelligent dynamic adjustment and efficient management of container resources are realized.

CN120508382APending Publication Date: 2025-08-19CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510502802.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-21
Publication Date
2025-08-19

AI Technical Summary

Technical Problem

In the prior art, container resource management methods are limited in application in resource-limited environments due to inaccurate predictions, and rely on manual configuration efficiency, making it difficult to adjust immediately.

Method used

A prediction method combining hollow space convolution pooling pyramid and long-term short-term memory model is adopted to obtain historical container resource usage data, extract multi-scale features and perform attention weight fusion, and combine blockchain technology to achieve dynamic adjustment and optimization of container resources.

Benefits of technology

It improves the accuracy and efficiency of container resource management, realizes intelligent dynamic adjustment of container resources, and improves resource utilization and applicability of management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120508382A_ABST
    Figure CN120508382A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of cloud computing, and discloses a container resource management method and device, equipment and a medium, and the method comprises the steps: obtaining historical container resource use data of each container on a cloud platform based on a time sequence, inputting an average pooling layer and a maximum pooling layer, adding and inputting the average pooling layer and the maximum pooling layer into the hollow space convolution pooling pyramid to obtain multi-scale feature data of different time scales; after splicing is carried out, a convolution layer is input, and matrix multiplication is carried out through a sigmoid layer and historical container resource use data to obtain enhanced feature data; and inputting a long-short-term memory model for prediction, then inputting a full-connection layer to obtain predicted container resource use data of each container on the cloud platform, and performing container resource adjustment by using the predicted data. According to the method, the high-frequency data and the long-term trend can be captured at the same time, so that the prediction result is more accurate, the accuracy of follow-up container resource management is improved, the consumed resources are few, the management efficiency of the container resources is improved, and the method has good applicability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of cloud computing technology, and in particular to a container resource management method, device, equipment and medium. Background Art

[0002] In the era of big data and computing, cloud computing has become an increasingly popular new business model. This model is highly sought after by government, enterprises, and small and medium-sized startups. Users can purchase cloud computing services on demand, and cloud service providers charge based on usage. This convenient model eliminates the need to purchase large servers, install, operate, and maintain them themselves. Instead, users can request server, computing, network, storage, and other resources from cloud service providers anytime, anywhere. Cloud service providers offer a variety of resource specifications to meet customer needs, and customers can also customize their own private clouds.

[0003] With the rapid development of cloud computing technology, some cloud service providers are no longer relying on complex, cumbersome, and difficult-to-deploy installation packages to deploy cloud computing services. Instead, they are using container technology to deploy and manage applications. Containers offer numerous advantages, such as agility, resource isolation, cross-platform compatibility, security, portability, scalability, ease of management, and high efficiency. These advantages are particularly pronounced in small and medium-sized private cloud scenarios. Therefore, better resource management and scheduling for containerized applications are crucial. Existing container resource management solutions have drawbacks. Most cloud service providers still rely on manual configuration, which is inefficient and cannot be adjusted instantly. Additionally, some technologies use prediction methods to predict container resource usage and adjust resources. However, existing prediction methods are relatively simple, require large models, and consume a lot of resources. This inaccuracy limits the applicability of container resource management in resource-constrained environments. Summary of the Invention

[0004] In view of this, the present invention provides a container resource management method, apparatus, device and storage medium to solve the problem that the container resource management method in the related art is limited in applicability in resource-limited environments due to inaccurate prediction of container resource usage.

[0005] In a first aspect, the present invention provides a container resource management method, which is applied to a host machine deployed with a cloud platform, wherein the cloud platform has multiple containers, and the method includes:

[0006] Obtain historical container resource usage data for each container on the cloud platform based on time series;

[0007] Inputting the historical container resource usage data into an average pooling layer and a maximum pooling layer and adding them together to obtain first feature data;

[0008] Inputting the first feature data into the dilated spatial convolution pooling pyramid to obtain multi-scale feature data of different time scales;

[0009] The multi-scale feature data is spliced and input into the convolution layer and then passed through the sigmoid layer to obtain the attention weight of the historical container resource usage data;

[0010] Performing matrix multiplication on the attention weight of the historical container resource usage data and the historical container resource usage data to obtain enhanced feature data;

[0011] The enhanced feature data is input into the long short-term memory model for prediction and then input into the fully connected layer to obtain the predicted container resource usage data of each container on the cloud platform;

[0012] Container resources of each container on the cloud platform are adjusted based on the predicted container resource usage data of each container on the cloud platform.

[0013] The present invention uses a dilated spatial convolution pooling pyramid to extract features of different time scales in historical container resource usage data to better characterize the changing trend of container resource consumption in different time periods, and obtains the attention weight of the historical container resource usage data by splicing multi-scale feature data, inputting it into the convolution layer and then passing it through the sigmoid layer. Then, the enhanced feature data is obtained by fusing the attention weight with the historical container resource usage data for use in a long-short-term memory model to predict container resource usage, thereby strengthening the feature information of the long-short-term memory model input features through the attention mechanism, and capturing the multi-scale of the time series through the dilated spatial convolution pooling pyramid, so that in time series prediction, high-frequency data and long-term trends can be captured at the same time, making the final prediction result more accurate, thereby improving the accuracy of subsequent container resource management, and the entire prediction model has a simple structure, consumes less resources, improves the management efficiency of container resources, and makes container resource management not restricted by the resource environment, and has good applicability.

[0014] In an optional embodiment, the dilated spatial convolution pooling pyramid consists of three dilated convolution layers and one normal convolution layer, and the dilation rates of the three dilated convolution layers are 2, 3, and 4, respectively.

[0015] By setting the composition structure and dilation rate of the dilated spatial convolution pooling pyramid, the present invention can better extract the multi-scale feature information of the time series, reflecting that real time data of different scales have different correlations and trends, and can better capture the dynamic changes of time series data at different time scales, further improving the accuracy of subsequent prediction results.

[0016] In an optional embodiment, each container on the cloud platform serves as a blockchain node to form a blockchain, and each container has a block with a corresponding address in the blockchain. Adjusting container resources for each container on the cloud platform based on the predicted container resource usage data of each container on the cloud platform includes:

[0017] The predicted container resource usage data of each container on the cloud platform is stored in the block corresponding to the address of each container;

[0018] Compare the predicted container resource usage data stored in the corresponding block of each container with the current container resource usage data in the corresponding block of the container, and publish the comparison results in the blockchain;

[0019] Based on the comparison result, container resource adjustment is performed on the current container resource usage data in the block corresponding to each container.

[0020] The present invention applies blockchain technology on the host machine, with each container serving as a blockchain node to form a blockchain. By comparing and publishing the actual resources of the container and the predicted information of future container resources in the blockchain, and using blockchain technology to dynamically adjust and optimize the allocation of container resources, the trusted collaboration between containers is strengthened, thereby ensuring that the resource requirements of each container are met, improving the utilization rate of container resources, and significantly enhancing product competitiveness.

[0021] In an optional embodiment, comparing the predicted container resource usage data stored in the block corresponding to each container with the current container resource usage data in the block corresponding to the container, and publishing the comparison result in the blockchain, includes:

[0022] Determine whether the current container resource usage data in the block corresponding to the current container can meet the requirements for predicting container resource usage data;

[0023] When the current container resource usage data in the block corresponding to the current container can meet the requirements of the predicted container resource usage data, the excess container resources in the block corresponding to the current container are calculated and published in the blockchain;

[0024] When the current container resource usage data in the block corresponding to the current container does not meet the requirements of the predicted container resource usage data, the container resources that need to be increased in the block corresponding to the current container are calculated and published in the blockchain.

[0025] The present invention determines the amount of container resources that need to be adjusted for each container by comparing the actual resource usage data of each container with the predicted resource usage data, and publishes it in the blockchain to enable trusted collaboration among the containers to adjust resources, thereby improving the efficiency of resource adjustment.

[0026] In an optional implementation, adjusting the container resource usage data of the current container in the block corresponding to each container based on the comparison result includes:

[0027] Determine whether the sum of all redundant container resources in the blockchain can meet the increased container resources required by the target container;

[0028] When the sum of all excess container resources in the blockchain can meet the container resources that need to be increased for the target container, the excess container resources are adjusted to the target container according to the container resources that need to be increased for the target container.

[0029] The present invention compares all redundant container resources in the blockchain with the size of the additional container resources required by the target container, reduces the resources of the container with redundant container resources, and adjusts them to the target container that needs to increase container resources, thereby ensuring that the resources of each container can be met and improving resource utilization.

[0030] In an optional embodiment, the method further includes:

[0031] When the sum of all excess container resources in the blockchain does not meet the container resources that need to be increased for the target container, the host's container resources are increased according to the difference between the container resources that need to be increased for the target container and the sum of all excess container resources in the blockchain, and the excess container resources and the host's increased container resources are adjusted to the target container.

[0032] When all the redundant container resources in the blockchain are compared and cannot meet the demand for additional container resources required by the target container, the present invention combines the redundant container resources in the blockchain to ensure that each container resource can be met, thereby improving resource utilization.

[0033] In an optional embodiment, the method further includes:

[0034] Record the number of times container resources are adjusted for each container on the cloud platform;

[0035] When it is monitored that the number of container resource adjustments of any container reaches the number of container resource alarms, the model weight of the long short-term memory model is adjusted, and after clearing the recorded number of container resource adjustments, the process returns to the step of obtaining the historical container resource usage data of each container on the cloud platform based on the time series.

[0036] The present invention determines the stability of container resources by observing the number of times each container resource is adjusted, and sets the number of container resource alarms as the basis for adjusting the model weight of the long-short-term memory model, thereby further improving the prediction accuracy of the entire prediction model during use, reducing the frequency of resource adjustments, avoiding the situation where invalid adjustments of containers are always made, and further improving the efficiency and accuracy of container resource management.

[0037] In a second aspect, the present invention provides a container resource management device, which is applied to a host machine deployed with a cloud platform, wherein the cloud platform has multiple containers, and the device includes:

[0038] The acquisition module is used to obtain the historical container resource usage data of each container on the cloud platform based on time series;

[0039] A first processing module is configured to input the historical container resource usage data into an average pooling layer and a maximum pooling layer and then add the input data to obtain first feature data;

[0040] A second processing module is configured to input the first feature data into a dilated spatial convolution pooling pyramid to obtain multi-scale feature data at different time scales;

[0041] A third processing module is used to splice the multi-scale feature data, input the convolutional layer, and then pass it through the sigmoid layer to obtain the attention weight of the historical container resource usage data;

[0042] a fourth processing module, configured to perform matrix multiplication on the attention weight of the historical container resource usage data and the historical container resource usage data to obtain enhanced feature data;

[0043] A fifth processing module is configured to input the enhanced feature data into a long short-term memory model for prediction and then input the enhanced feature data into a fully connected layer to obtain predicted container resource usage data of each container on the cloud platform;

[0044] The sixth processing module is configured to adjust container resources for each container on the cloud platform based on the predicted container resource usage data of each container on the cloud platform.

[0045] In a third aspect, the present invention provides a computer device comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes the method provided in the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0046] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the method provided in the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0048] Figure 1 is a flowchart of a container resource management method according to an embodiment of the present invention;

[0049] Figure 2 is a flowchart of another container resource management method according to an embodiment of the present invention;

[0050] Figure 3 1 is a schematic diagram of the structure of the AA_LSTM model according to an embodiment of the present invention;

[0051] Figure 4 is a schematic diagram of the structure of a container resource management system according to an embodiment of the present invention;

[0052] Figure 5 is a schematic diagram of the working process of the container resource management system according to an embodiment of the present invention;

[0053] Figure 6 is a schematic structural diagram of a container resource management device according to an embodiment of the present invention;

[0054] Figure 7 2 is a schematic structural diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0055] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative efforts shall fall within the scope of protection of the present invention.

[0056] Some existing technologies for container resource management have drawbacks. For example, most cloud service providers still rely on manual configuration, which is inefficient and cannot be adjusted instantly. Kubernetes, abbreviated as K8s, replaces the eight characters in the middle of its name, "ubernete." It is an open-source framework for managing containerized applications across multiple hosts in a cloud platform. Kubernetes aims to make deploying containerized applications simple and efficient, providing a mechanism for application deployment, planning, updating, and maintenance. Kubernetes recently introduced a new feature that dynamically adjusts container CPU and memory resource limits, but manual pod configuration is still required, making it difficult to adapt to dynamically changing resource requirements. Additionally, some technologies use prediction methods to predict container resource usage. However, these methods are relatively simple, require large models, and consume a lot of resources. This leads to inaccuracies and limits their applicability in resource-constrained environments.

[0057] After analysis, it was found that existing technologies lack solutions for managing container resources with relatively accurate prediction results and minimal resource consumption.

[0058] Therefore, this invention aims to propose a container resource management solution that eliminates the need for manual configuration adjustments and instead implements intelligent, automated methods to dynamically adjust and manage container resources. Specifically, when it is discovered that some containers have low resource consumption and others have high resource consumption, container resources can be more efficiently allocated and managed. Improvements to the prediction model enable more accurate predictions of future container usage. By optimizing resource allocation based on container resource usage, this solution improves container resource utilization and enhances the reliability and stability of container resource management.

[0059] According to an embodiment of the present invention, an embodiment of a container resource management method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0060] Based on the above problems, a container resource management method is provided in this embodiment, which is applied to a host machine deployed with a cloud platform, such as a cloud server, a physical server, a computer, etc. There are multiple containers on the cloud platform. Figure 1 FIG. 1 is a flow chart of a container resource management method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0061] Step S101: Obtain historical container resource usage data of each container on the cloud platform based on time series.

[0062] Specifically, the required information can be collected through the cloud platform's resource monitoring system, mainly focusing on the resource usage of each container on the cloud platform and the remaining capacity of the current container resources. The historical container resource usage data includes the CPU, memory, network and other resource usage of the container at each historical time point, and is sorted by historical time.

[0063] Acquiring historical container resource usage data provides foundational data for the subsequent machine learning prediction module to predict future container resource usage. It should be noted that in this embodiment of the present invention, only CPU and memory are used as container resources to illustrate the specific implementation process of container resource management. In actual applications, container resources are not limited to this, and will not be further elaborated here.

[0064] Step S102: input the historical container resource usage data into the average pooling layer and the maximum pooling layer, and then add them together to obtain first feature data.

[0065] Specifically, by taking the historical container resource usage data based on time series as the original feature map F in , sent to the average pooling layer and the maximum pooling layer, as shown in formula (1) and formula (2), the input feature information F is obtained avg and F max The two pooling results are added together to obtain the feature map F'.

[0066] F avg =AVGPOOL(F in ) (1)

[0067] F max =MAXPOOL(F in ) (2)

[0068] Step S103: input the first feature data into the dilated spatial convolution pooling pyramid to obtain multi-scale feature data of different time scales.

[0069] Specifically, the input dilated spatial convolutional pooling pyramid is referred to as the ASPP module. By feeding the feature map F' in the above step S102 into the ASPP module, as shown in formula (3), the multi-scale features F at different time scales are obtained. multi .

[0070] F multi =ASPP(F') (3)

[0071] In step S104, the multi-scale feature data is spliced and input into the convolution layer and then passed through the sigmoid layer to obtain the attention weight of the historical container resource usage data.

[0072] Specifically, as shown in formula (4), by taking the multi-scale feature F multi After splicing, it is sent to the convolution layer and then through the sigmoid layer to obtain the feature map F".

[0073] F"=σ(CONV(CONCA T(F multi ))) (4)

[0074] Step S105 : performing matrix multiplication on the attention weight of the historical container resource usage data and the historical container resource usage data to obtain enhanced feature data.

[0075] Specifically, as shown in formula (5), by combining the feature map F' and the original feature map F in Perform matrix multiplication to obtain the enhanced feature map F''.

[0076]

[0077] In step S106, the enhanced feature data is input into the long short-term memory model for prediction and then input into the fully connected layer to obtain the predicted container resource usage data of each container on the cloud platform.

[0078] Specifically, the Long-Short Term Memory (LSTM) model solves the long memory problem that traditional RNN models lack by introducing a gate mechanism. The LSTM neural network algorithm can infer the development trend of things through statistical analysis of past time series data. Since time data at different scales often have different correlations and trends, for example, during the day, customer business is at its peak, and platform resource consumption is high, while at night, customer traffic is low, and platform resource consumption also decreases accordingly. It can be seen that the LSTM prediction model has certain problems. It does not take into account the multi-scale nature of time and cannot better capture the dynamic changes of time series data at different time scales. To solve this problem and obtain more accurate prediction results, the embodiment of the present invention first extracts multi-time scale features and introduces attention weights to obtain enhanced feature data, and then inputs the enhanced feature data into the LSTM model for prediction. In this way, in time series prediction, an improved prediction model is used to simultaneously capture high-frequency data and long-term trends, thereby ensuring the accuracy of the prediction results.

[0079] Specifically, as shown in formula (6), by feeding the enhanced feature map F'' into the LSTM layer and the fully connected layer, the output predicted container resource usage data F is obtained. out In general, by taking the usage of container resources as input and feeding it into the above-mentioned improved attention multi-scale temporal prediction network model (hereinafter referred to as AA_LSTM model), the future usage information of container resources can be predicted.

[0080] F out =FC(LSTM(F')) (6)

[0081] Step S107 : adjusting container resources for each container on the cloud platform based on the predicted container resource usage data of each container on the cloud platform.

[0082] Specifically, in one possible implementation method, the resource amount of the corresponding resource type in the cloud platform can be adjusted based on the predicted resource usage corresponding to each resource type; or the resource adjustment plan for the container can be comprehensively determined based on the predicted resource usage corresponding to each resource type, and the resource amount of the container can be adjusted based on the resource adjustment plan. The resource adjustment plan can be a pre-set adjustment plan corresponding to each resource type. In principle, if the amount of a certain type of resource in the cloud platform is low, such as memory, the memory resources of each container can be increased by increasing the memory of the host machine. Alternatively, the resources of some containers with a large amount of remaining resources can be released to containers with insufficient resources to improve the utilization of container resources.

[0083] The embodiment of the present invention uses a dilated spatial convolution pooling pyramid to extract features of different time scales in historical container resource usage data to better characterize the changing trend of container resource consumption in different time periods, and obtains the attention weight of the historical container resource usage data by splicing multi-scale feature data, inputting it into a convolution layer, and then passing it through a sigmoid layer. Then, the enhanced feature data is obtained by fusing the attention weight with the historical container resource usage data for use in a long-short-term memory model to predict container resource usage, thereby strengthening the feature information of the long-short-term memory model input features through the attention mechanism, and capturing the multi-scale of the time series through the dilated spatial convolution pooling pyramid, so that in time series prediction, high-frequency data and long-term trends can be captured at the same time, making the final prediction result more accurate, thereby improving the accuracy of subsequent container resource management, and the entire prediction model has a simple structure, consumes less resources, improves the management efficiency of container resources, and makes container resource management not restricted by the resource environment, and has good applicability.

[0084] In this embodiment, a container resource management method is also provided, which is applied to a host machine deployed with a cloud platform, such as a cloud server, a physical server, a computer, etc. There are multiple containers on the cloud platform. Figure 2 FIG. 1 is a flow chart of a container resource management method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0085] Step S201, obtain the historical container resource usage data of each container on the cloud platform based on the time series. Figure 1 The description of step S101 is omitted here.

[0086] Step S202: Input the historical container resource usage data into the average pooling layer and the maximum pooling layer and add them together to obtain the first feature data. Figure 1 The description of step S102 is omitted here.

[0087] Step S203: input the first feature data into the dilated spatial convolution pooling pyramid to obtain multi-scale feature data of different time scales.

[0088] In some optional implementations, the dilated spatial convolutional pooling pyramid consists of four branches, all of which are normalized and include a ReLU layer. Specifically, Figure 3 As shown in Figure 1, the above-mentioned atrous spatial convolution pooling pyramid ASPP consists of three atrous convolution layers and one normal convolution layer, and the atrous rates of the three atrous convolution layers are 2, 3, and 4, respectively. The ASPP module can extract multi-scale feature information of the time series.

[0089] The embodiment of the present invention sets the composition structure and dilation rate of the dilated spatial convolution pooling pyramid, so that it can better extract the multi-scale feature information of the time series, reflecting that real time data of different scales have different correlations and trends, and can better capture the dynamic changes of time series data at different time scales, further improving the accuracy of subsequent prediction results.

[0090] Step S204: After the multi-scale feature data is spliced, it is input into the convolution layer and then passed through the sigmoid layer to obtain the attention weight of the historical container resource usage data. Figure 1 The description of step S104 is omitted here.

[0091] Step S205: Perform matrix multiplication on the attention weight of the historical container resource usage data and the historical container resource usage data to obtain enhanced feature data. Figure 1 The description of step S105 is omitted here.

[0092] In step S206, the enhanced feature data is input into the long short-term memory model for prediction and then input into the fully connected layer to obtain the predicted container resource usage data of each container on the cloud platform.

[0093] For example, the improved attention multi-scale time prediction network model established through the above steps, namely the AA_LSTM model, has a model structure as follows: Figure 3 shown.

[0094] Step S207 : adjusting container resources for each container on the cloud platform based on the predicted container resource usage data of each container on the cloud platform.

[0095] In some optional implementations, each container on the cloud platform serves as a blockchain node to form a blockchain, and each container has a block with a corresponding address in the blockchain, thereby achieving trusted collaboration between containers by adding blockchain technology in the host machine.

[0096] Furthermore, the above step S207 specifically includes the following steps:

[0097] In step S2071 , the predicted container resource usage data of each container on the cloud platform is stored in a block corresponding to the address of each container.

[0098] For example, taking the container resources as CPU and memory, since each container has a corresponding address in the blockchain, after the improved attention multi-scale time prediction network model predicts the CPU size and memory size of each container, the container with the block accounting right will match the predicted result with the address of each container and record it in the block, as shown in formula (7).

[0099]

[0100] Among them, the subscript i represents the ID of each container, D i Indicates the i-th container, Address i represents the address of the i-th container in the blockchain, Indicates the predicted value of the CPU of the i-th container. Indicates the predicted memory size of the i-th container.

[0101] The above formula (7) indicates that the container D that has the block accounting right i The CPU prediction value corresponding to each container and memory prediction size The address corresponding to the container stored in the blockchain i middle.

[0102] In step S2072, the predicted container resource usage data stored in the block corresponding to each container is compared with the current container resource usage data in the block corresponding to the container, and the comparison result is published in the blockchain.

[0103] Specifically, the above step S2072 includes the following steps:

[0104] Step a1: determine whether the current container resource usage data in the block corresponding to the current container can meet the requirements for predicting the container resource usage data.

[0105] Step a2: When the current container resource usage data in the block corresponding to the current container can meet the requirements of the predicted container resource usage data, the excess container resources in the block corresponding to the current container are calculated and published in the blockchain.

[0106] Step a3: When the current container resource usage data in the block corresponding to the current container does not meet the requirements of the predicted container resource usage data, the container resources that need to be increased in the block corresponding to the current container are calculated and published in the blockchain.

[0107] In practical applications, taking container resources such as CPU and memory as an example, the predicted CPU size and memory size of each container's own address are obtained from the blockchain, and formula (8) is used to determine whether the current CPU size and memory size meet the requirements. If the requirements are met, the excess CPU and memory size will be calculated using formula (9) and published to the blockchain, as shown in formula (10); if the requirements are not met, the required CPU and memory size will be calculated using formula (11) and published to the blockchain, as shown in formula (12).

[0108]

[0109] in, Indicates the current CPU size of the i-th container, Indicates the current memory size of the i-th container.

[0110]

[0111] in, Indicates the CPU size of the excess part of the i-th container, Indicates the memory size of the excess part of the i-th container.

[0112]

[0113] Formula (10) represents the container D that has the block accounting right i The excess CPU size corresponding to the i-th container and the memory size of the excess The address corresponding to the container stored in the blockchain i middle.

[0114]

[0115] in, Indicates the CPU size required by the i-th container. Indicates the memory size required by the i-th container.

[0116]

[0117] Formula (12) represents the container D that has the block accounting right i The CPU size required for the i-th container And the required memory size The address corresponding to the container stored in the blockchain i middle.

[0118] The embodiment of the present invention determines the amount of container resources that need to be adjusted for each container by comparing the actual resource usage data of each container with the predicted resource usage data, and publishes it in the blockchain to enable trusted collaboration between the containers to adjust resources, thereby improving the efficiency of resource adjustment.

[0119] Step S2073 : adjusting the container resources of the current container resource usage data in the corresponding block of each container based on the comparison result.

[0120] The embodiment of the present invention applies blockchain technology on the host machine, and forms a blockchain with each container as a blockchain node. By comparing and publishing the actual resources of the container and the predicted information of future container resources in the blockchain, and using blockchain technology to dynamically adjust and optimize the allocation of container resources, it strengthens the trusted collaboration between containers, thereby ensuring that the resource requirements of each container are met, improving the utilization rate of container resources, and significantly enhancing product competitiveness.

[0121] Furthermore, the above step S2073 includes:

[0122] Step b1: Determine whether the sum of all redundant container resources in the blockchain can meet the increased container resources required by the target container.

[0123] In step b2, when the sum of all the excess container resources in the blockchain can satisfy the container resources required to be increased by the target container, the excess container resources are adjusted to the target container according to the container resources required to be increased by the target container.

[0124] The embodiment of the present invention compares all redundant container resources in the blockchain with the size of the additional container resources required by the target container, reduces the resources of the container with redundant container resources, and adjusts them to the target container that needs to increase container resources, thereby ensuring that the resources of each container can be met and improving resource utilization.

[0125] In step b3, when the sum of all excess container resources in the blockchain does not meet the container resources that need to be increased for the target container, the container resources of the host are increased according to the difference between the container resources that need to be increased for the target container and the sum of all excess container resources in the blockchain, and the excess container resources and the container resources increased by the host are adjusted to the target container.

[0126] When all redundant container resources in the blockchain are compared and cannot meet the demand for additional container resources required by the target container, the embodiment of the present invention increases the container resources of the host machine and combines the redundant container resources in the blockchain to ensure that each container resource can be met, thereby improving resource utilization.

[0127] For example, taking the container resources as CPU and memory, by taking out all the redundant CPU size and memory size from the blockchain and using formula (13) to calculate the total redundant size, formula (14) is used to determine whether the container D that needs to increase the CPU size and memory size is satisfied. i If the requirements are met, the size of other containers will be reduced by the corresponding CPU size and memory size, and container D i The corresponding size will be increased to meet the demand; if it is not met, the CPU and memory capacity of the host machine will need to be increased.

[0128]

[0129] Among them, TE CPU Indicates the total size of the redundant CPU, TE M Indicates the total size of the excess memory.

[0130]

[0131] The above formula (14) can be used to determine the specific operations that the host and container need to perform.

[0132] It should be noted that in actual applications, based on the actual business needs and business characteristics of each container, when some container resources are insufficient, the excess resources can be preferentially taken from specific containers. For example, priority can be given to extracting from containers with low container resource usage or low container resource usage in a certain period of time, so as to minimize the frequency of container resource adjustment and avoid affecting the business of other containers. This is only an example and the present invention is not limited to this.

[0133] In some optional implementations, the container resource management method provided by the embodiment of the present invention further includes the following steps:

[0134] Step S208: Record the number of times container resources are adjusted for each container on the cloud platform.

[0135] Specifically, container resource adjustment includes increasing container resources and decreasing container resources. For example, the container resource adjustment count is increased every time the CPU size is increased or decreased. The initial value of the count is set to 0. The purpose of recording is to observe the number of resource adjustments of each container. If it is found that the number of resource adjustments of some containers is very small, it means that the container resources are relatively stable; if the number of resource adjustments is large, it means that the container resources are unstable, which may be due to inaccurate prediction results of the container resources in the previous step.

[0136] Step S209: When it is monitored that the number of container resource adjustments of any container reaches the number of container resource alarms, the model weight of the long short-term memory model is adjusted, and after clearing the recorded number of container resource adjustments, the step of obtaining the historical container resource usage data of each container on the cloud platform based on the time series is returned.

[0137] Specifically, by using the number of container resource alarms as the container resource alarm mark line, when it is monitored that the number of resource adjustments reaches the alarm mark line, in order to improve the stability of container resources, it is necessary to adjust the weight value of the prediction module in the above step, namely the LSTM module, to further improve the accuracy of container resource prediction, thereby further improving the management efficiency of container resources of the entire cloud platform.

[0138] The embodiment of the present invention determines the stability of container resources by observing the number of times each container resource is adjusted, and sets the number of container resource alarms as the basis for adjusting the model weight of the long-short-term memory model, thereby further improving the prediction accuracy of the entire prediction model during use, reducing the frequency of resource adjustments, avoiding the situation where invalid adjustments are always made to the container, and further improving the efficiency and accuracy of container resource management.

[0139] The specific implementation process of the container resource management method provided by the embodiment of the present invention will be described in detail below with reference to specific application examples.

[0140] First, a container resource management system is built on a hybrid cloud platform by adopting the container resource management method provided by the embodiment of the present invention. Figure 4 As shown in the figure, the system mainly includes the following three modules, with the key modules being the AA_LSTM prediction module and the blockchain dynamic adjustment module. Figure 5 A schematic diagram of the working process of the entire system.

[0141] 1. AA_LSTM prediction module: This module uses an improved multi-scale time prediction network model, AA_LSTM, to predict future container resource usage. This network algorithm considers the multi-scale characteristics of time series, improves the attention algorithm, and introduces the multi-scale ASPP algorithm to make predictions more accurate.

[0142] 2. Blockchain dynamic adjustment module: Based on the remaining container resources and future container resource forecast information, blockchain technology is used to dynamically adjust and optimize the allocation of container resources, thereby ensuring that the resource needs of each container are met and strengthening trusted collaboration between containers.

[0143] 3. Automated Configuration Adjustment Module: Set a container resource alarm mark and a container resource adjustment counter. When monitoring finds that the number of container resource adjustments exceeds the alarm mark, the results obtained in the previous step are imported into the configuration adjustment script. The weight value of the AA_LSTM prediction module is adjusted, and the script is used to set each container resource in the current environment to the optimal value.

[0144] After configuring the cloud platform according to the above solution, the cloud platform can dynamically monitor and collect the usage of container resources, and add a blockchain technology to the host machine to optimize and adjust the container resources. Through the automated configuration module, the resource configuration of each container can be dynamically adjusted in real time.

[0145] The container resource management solution provided by the embodiments of the present invention has the following advantages over existing solutions:

[0146] 1. Utilizing an improved attention-based multi-scale temporal prediction network model, AA_LSTM, we predict future container resource consumption, simulating container resource usage and preventing restarts or crashes caused by insufficient resources. This network algorithm excels in its multi-scale feature extraction capabilities. This model utilizes an attention mechanism to enhance the characteristic information of input features while also utilizing the ASPP module to capture multiple scales of time series. In time series forecasting, this model simultaneously captures high-frequency data and long-term trends, resulting in more accurate predictions and lower resource consumption.

[0147] 2. Based on the remaining container resources and future container resource forecast information, blockchain technology is used to dynamically adjust and optimize the allocation of container resources, thereby ensuring that the resource needs of each container are met, strengthening trusted collaboration between containers, and improving resource utilization, significantly improving product competitiveness.

[0148] 3. Set a container resource alarm threshold and a container resource adjustment counter. When monitoring detects that a container exceeds the alarm threshold, import the results from the previous step into a configuration adjustment script. This script can be used to set each container resource in the current environment to the optimal value. Using automated scripts for configuration improves efficiency and reduces labor costs.

[0149] The present invention also provides a container resource management device for implementing the aforementioned embodiments and preferred implementations. Details already described will not be repeated. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. While the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.

[0150] This embodiment provides a container resource management device, which is applied to a host machine with a cloud platform deployed. The cloud platform has multiple containers, such as Figure 6 As shown, the device includes:

[0151] Acquisition module 601 is used to obtain the historical container resource usage data of each container on the cloud platform based on the time series;

[0152] A first processing module 602 is configured to input the historical container resource usage data into an average pooling layer and a maximum pooling layer and then add the data to obtain first feature data;

[0153] The second processing module 603 is used to input the first feature data into the dilated spatial convolution pooling pyramid to obtain multi-scale feature data of different time scales;

[0154] The third processing module 604 is used to splice the multi-scale feature data and input it into the convolution layer and then pass it through the sigmoid layer to obtain the attention weight of the historical container resource usage data;

[0155] A fourth processing module 605 is configured to perform matrix multiplication on the attention weight of the historical container resource usage data and the historical container resource usage data to obtain enhanced feature data;

[0156] A fifth processing module 606 is configured to input the enhanced feature data into the long short-term memory model for prediction and then input the enhanced feature data into the fully connected layer to obtain predicted container resource usage data of each container on the cloud platform;

[0157] The sixth processing module 607 is configured to adjust container resources for each container on the cloud platform based on the predicted container resource usage data of each container on the cloud platform.

[0158] In some optional embodiments, the above-mentioned dilated spatial convolution pooling pyramid is composed of three dilated convolution layers and one normal convolution layer, and the dilation rates of the three dilated convolution layers are 2, 3 and 4 respectively.

[0159] In some optional implementations, each container on the cloud platform serves as a blockchain node to form a blockchain, and each container has a block with a corresponding address in the blockchain. The sixth processing module 607 includes:

[0160] A first processing unit is configured to store the predicted container resource usage data of each container on the cloud platform into a block corresponding to an address of each container;

[0161] A second processing unit is configured to compare the predicted container resource usage data stored in the block corresponding to each container with the current container resource usage data in the block corresponding to the container, and publish the comparison result in the blockchain;

[0162] The third processing unit is configured to adjust the container resources based on the comparison result with respect to the current container resource usage data in the block corresponding to each container.

[0163] In some optional implementations, the second processing unit includes:

[0164] The first judgment subunit is used to judge whether the current container resource usage data in the block corresponding to the current container can meet the requirements of the predicted container resource usage data;

[0165] A first processing sub-unit is configured to calculate excess container resources in the block corresponding to the current container when the current container resource usage data in the block corresponding to the current container meets the requirements for predicting the container resource usage data, and publish the excess container resources in the blockchain;

[0166] The second processing sub-unit is configured to calculate the container resources that need to be increased in the block corresponding to the current container when the current container resource usage data in the block corresponding to the current container does not meet the requirements of the predicted container resource usage data, and publish the container resources that need to be increased in the blockchain.

[0167] In some optional implementations, the third processing unit includes:

[0168] The second judgment subunit is used to judge whether the sum of all redundant container resources in the blockchain can meet the container resources required to be increased by the target container;

[0169] The third processing subunit is configured to adjust the excess container resources to the target container according to the container resources required to be increased by the target container when the sum of all excess container resources in the blockchain can meet the container resources required to be increased by the target container.

[0170] In some optional implementations, the third processing unit further includes:

[0171] The fourth processing sub-unit is configured to increase the container resources of the host machine by the difference between the container resources required to be increased by the target container and the sum of all the excess container resources in the blockchain, when the sum of all the excess container resources in the blockchain does not meet the container resources required to be increased by the target container, and adjust the excess container resources and the container resources increased by the host machine to the target container.

[0172] In some optional embodiments, the device further comprises:

[0173] The recording module is used to record the number of times container resources are adjusted for each container on the cloud platform;

[0174] The alarm processing module is used to adjust the model weight of the long short-term memory model when the number of container resource adjustments of any container reaches the container resource alarm number, and call the acquisition module 601 to work after clearing the recorded number of container resource adjustments.

[0175] The container resource management device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0176] The further functional description of each of the above modules and units is the same as that of the above corresponding method embodiments and will not be repeated here.

[0177] See also Figure 7 , Figure 7 is a structural diagram of a computer device provided by an optional embodiment of the present invention, such as Figure 7As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components utilize different buses to communicate with each other and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of a GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Equally, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 7 A processor 10 is taken as an example.

[0178] The processor 10 may be a central processing unit, a network processor, or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic, or any combination thereof.

[0179] The memory 20 stores instructions that can be executed by at least one processor 10, so as to enable at least one processor 10 to execute the method shown in the above embodiment.

[0180] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created based on the use of a computer device for displaying a small program landing page, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0181] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid-state drive; the memory 20 may also include a combination of the above types of memory.

[0182] The computer device further comprises a communication interface 30 for the control unit to communicate with other devices or a communication network.

[0183] The embodiment of the present invention also provides a computer-readable storage medium. The above-mentioned method according to the embodiment of the present invention can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and downloaded through a network and will be stored in a local storage medium, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor or hardware, the method shown in the above embodiment is implemented.

[0184] Although the embodiments of the present invention have been described with reference to the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention. Such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A container resource management method, applied to a host machine deployed with a cloud platform, wherein the cloud platform has multiple containers, characterized in that: The method comprises: Obtain historical container resource usage data for each container on the cloud platform based on time series; Inputting the historical container resource usage data into an average pooling layer and a maximum pooling layer and adding them together to obtain first feature data; Inputting the first feature data into the dilated spatial convolution pooling pyramid to obtain multi-scale feature data of different time scales; The multi-scale feature data is spliced and input into the convolution layer and then passed through the sigmoid layer to obtain the attention weight of the historical container resource usage data; Performing matrix multiplication on the attention weight of the historical container resource usage data and the historical container resource usage data to obtain enhanced feature data; The enhanced feature data is input into the long short-term memory model for prediction and then input into the fully connected layer to obtain the predicted container resource usage data of each container on the cloud platform; Container resources of each container on the cloud platform are adjusted based on the predicted container resource usage data of each container on the cloud platform.

2. The method according to claim 1, characterized in that The dilated spatial convolution pooling pyramid consists of three dilated convolutional layers and one normal convolutional layer, and the dilation rates of the three dilated convolutional layers are 2, 3, and 4, respectively.

3. The method according to claim 1, characterized in that Each container on the cloud platform is used as a blockchain node to form a blockchain. Each container has a block with a corresponding address in the blockchain. The container resource adjustment for each container on the cloud platform based on the predicted container resource usage data of each container on the cloud platform includes: The predicted container resource usage data of each container on the cloud platform is stored in the block corresponding to the address of each container; Compare the predicted container resource usage data stored in the corresponding block of each container with the current container resource usage data in the corresponding block of the container, and publish the comparison results in the blockchain; Based on the comparison result, container resource adjustment is performed on the current container resource usage data in the block corresponding to each container.

4. The method according to claim 3, characterized in that The method of comparing the predicted container resource usage data stored in the block corresponding to each container with the current container resource usage data in the block corresponding to the container, and publishing the comparison results in the blockchain, includes: Determine whether the current container resource usage data in the block corresponding to the current container can meet the requirements for predicting container resource usage data; When the current container resource usage data in the block corresponding to the current container can meet the requirements of the predicted container resource usage data, the excess container resources in the block corresponding to the current container are calculated and published in the blockchain; When the current container resource usage data in the block corresponding to the current container does not meet the requirements of the predicted container resource usage data, the container resources that need to be increased in the block corresponding to the current container are calculated and published in the blockchain.

5. The method according to claim 4, characterized in that The adjusting container resources based on the comparison result on the current container resource usage data in the block corresponding to each container includes: Determine whether the sum of all redundant container resources in the blockchain can meet the increased container resources required by the target container; When the sum of all excess container resources in the blockchain can meet the container resources that need to be increased for the target container, the excess container resources are adjusted to the target container according to the container resources that need to be increased for the target container.

6. The method according to claim 5, characterized in that The method further comprises: When the sum of all excess container resources in the blockchain does not meet the container resources that need to be increased for the target container, the host's container resources are increased according to the difference between the container resources that need to be increased for the target container and the sum of all excess container resources in the blockchain, and the excess container resources and the host's increased container resources are adjusted to the target container.

7. The method according to any one of claims 1 to 6, characterized in that The method further comprises: Record the number of times container resources are adjusted for each container on the cloud platform; When it is monitored that the number of container resource adjustments of any container reaches the number of container resource alarms, the model weight of the long short-term memory model is adjusted, and after clearing the recorded number of container resource adjustments, the process returns to the step of obtaining the historical container resource usage data of each container on the cloud platform based on the time series.

8. A container resource management device, applied to a host machine deployed with a cloud platform, wherein the cloud platform has multiple containers, characterized in that: The device comprises: The acquisition module is used to obtain the historical container resource usage data of each container on the cloud platform based on time series; A first processing module is configured to input the historical container resource usage data into an average pooling layer and a maximum pooling layer and then add the input data to obtain first feature data; A second processing module is configured to input the first feature data into a dilated spatial convolution pooling pyramid to obtain multi-scale feature data at different time scales; A third processing module is used to splice the multi-scale feature data, input the convolutional layer, and then pass it through the sigmoid layer to obtain the attention weight of the historical container resource usage data; a fourth processing module, configured to perform matrix multiplication on the attention weight of the historical container resource usage data and the historical container resource usage data to obtain enhanced feature data; A fifth processing module is configured to input the enhanced feature data into a long short-term memory model for prediction and then input the enhanced feature data into a fully connected layer to obtain predicted container resource usage data of each container on the cloud platform; The sixth processing module is configured to adjust container resources for each container on the cloud platform based on the predicted container resource usage data of each container on the cloud platform.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 7.