A container resource adjustment method and device, electronic equipment and storage medium

By acquiring historical evaluation metrics of containers, the amount of resource requests can be estimated and adjusted, thus solving the problem of unreasonable container resource allocation and improving resource utilization and service stability.

CN115167980BActive Publication Date: 2026-06-23CHINA TELECOM CORP LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA TELECOM CORP LTD
Filing Date
2022-06-30
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

In existing technologies, setting container resource request volumes based on experience or stress test results leads to unreasonable resource allocation, resulting in low resource utilization and service interruption issues.

Method used

By acquiring historical evaluation metrics of containers, the resource request volume at the target time is estimated, and the resource request volume is adjusted when the target time arrives to match the actual needs of the containers.

Benefits of technology

This improves the rationality of resource allocation, enhances the matching degree between the amount of resources allocated to containers and the amount of resources required, and avoids resource waste and service interruption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115167980B_ABST
    Figure CN115167980B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure provide a container resource adjustment method and device, electronic equipment and storage medium, and relate to the technical field of cloud platforms. The container resource adjustment method comprises: obtaining evaluation index information corresponding to a container; based on the evaluation index information, estimating an expected resource request amount of the container for a target resource when the container runs at a target time; when the target time is reached, if it is detected that the container meets a predetermined resource demand adjustment condition based on a comparison result of the expected resource request amount and a target resource request amount, adjusting first configuration information of a resource request amount of the container for the target resource according to the expected resource request amount, so that the cloud platform allocates resources for the target resource to the container according to the adjusted first configuration information. It can be seen that the rationality of resource allocation can be improved by the present solution.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of cloud platform technology, and in particular to a container resource adjustment method, apparatus, electronic device, and storage medium. Background Technology

[0002] A large number of applications run in containers in the cloud environment. Applications can be packaged in containers, which can simplify the process of building, deploying, and running applications. In order for containers to run normally in the cloud environment, resource request volumes for various resources are usually pre-set for containers. Then, when deploying containers, the cloud platform schedules containers to cluster nodes with sufficient resources based on the resource request volumes.

[0003] In existing technologies, the resource request amounts for various resources pre-set for containers are usually determined based on experience or stress test results.

[0004] However, setting resource request limits based on experience or stress test results can easily lead to an amount exceeding actual demand, resulting in low resource utilization, excessive pre-occupied but unused resources in the cluster, and containers for newly added applications being unable to request resources and thus unable to be scheduled. In addition, resource demand may also be underestimated, causing service interruptions and failures.

[0005] It is evident that in existing technologies, setting resource request volumes based on experience or stress test results can lead to unreasonable allocation of container resources, resulting in low resource utilization. Summary of the Invention

[0006] The purpose of this disclosure is to provide a container resource adjustment method, apparatus, electronic device, and storage medium to solve the problem of unreasonable resource allocation. The specific technical solution is as follows:

[0007] In a first aspect, embodiments of this disclosure provide a container resource adjustment method, applied to a container resource adjustment device, the method comprising:

[0008] Obtain evaluation indicator information corresponding to the container, wherein the evaluation indicator information includes a first sequence composed of first indicator data corresponding to each historical time, and / or a second sequence composed of second indicator data corresponding to each historical time. The first indicator data corresponding to each historical time is used to characterize the actual usage of the target resources by the container when it runs at that historical time, and the second indicator data corresponding to each historical time is used to characterize the business operation of the container when it runs at that historical time.

[0009] Based on the evaluation metrics, the expected resource request volume for the target resource when the container runs at the target time is estimated.

[0010] When the target time is reached, if the container is detected to meet the predetermined resource demand adjustment conditions based on the comparison result between the expected resource request amount and the target resource request amount, the first configuration information of the container regarding the target resource is adjusted according to the expected resource request amount, so that the cloud platform allocates resources for the container regarding the target resource according to the adjusted first configuration information;

[0011] The target resource request amount is the current resource request amount indicated by the first configuration information before the adjustment.

[0012] Optionally, the method for detecting whether the container meets the predetermined resource demand adjustment conditions based on the comparison result of the expected resource request amount and the target resource request amount includes:

[0013] Determine whether the comparison result between the expected resource request amount and the target resource request amount indicates that the target resource request amount and the expected resource request amount do not match; if so, it is detected that the container meets the predetermined resource demand adjustment conditions.

[0014] Wherein, if the expected resource request amount is a single value, the mismatch between the target resource request amount and the expected resource request amount includes: the target resource request amount and the expected resource request amount are different, or the target resource request amount and the expected resource request amount are different and the difference exceeds a predetermined threshold;

[0015] If the expected resource request amount is a range value, then the mismatch between the target resource request amount and the expected resource request amount includes: the target resource request amount is not included in the expected resource request amount.

[0016] Optionally, each historical time is the same specified time in at least one predetermined operating cycle corresponding to the container; the target time is the specified time in a future operating cycle.

[0017] Optionally, the evaluation index information includes a first sequence;

[0018] The step of estimating the expected resource request volume of the container for the target resource at the target time based on the evaluation index information includes:

[0019] Perform at least one specified mathematical operation on the elements in the first sequence to obtain at least one operation result;

[0020] Based on the calculation results, the actual demand for the target resource is determined when the container runs for a specified time period in any running cycle;

[0021] Using the actual demand, and the predetermined upper and lower limits of expected utilization for the target resource, the expected resource request amount for the target resource when the container runs at the target time is estimated.

[0022] Optionally, the evaluation index information includes the second sequence;

[0023] The step of estimating the expected resource request volume of the container for the target resource at the target time based on the evaluation index information includes:

[0024] The second sequence is used as input data and fed into a pre-trained resource prediction model to obtain the expected resource request amount of the container for the target resource when it runs at the target time.

[0025] The resource prediction model is a model trained using sample sequences and their corresponding ground truth values. The sample sequence is a sequence of second indicator data corresponding to the historical time of each sample. The historical time of each sample is a specified time of the same sample in at least one running cycle corresponding to the sample container. The ground truth value is the expected resource request amount of the sample container for the target resource when the sample target time is running. The target time is the specified time of the sample in the future running cycle corresponding to the sample container.

[0026] Optionally, it also includes:

[0027] If the container is configured with a resource limit for the target resource, then the expected resource limit for the target resource when the container runs at the target time is determined according to the expected limit determination method that matches the target resource.

[0028] When the target time is reached, if the container is detected to meet the predetermined resource limit adjustment conditions based on the comparison result between the expected resource limit and the target resource limit, the second configuration information of the container's resource limit regarding the target resource is adjusted according to the expected resource limit, so that the cloud platform performs rate limiting on the container's resources regarding the target resource according to the adjusted second configuration information; wherein, the target resource limit is the current resource limit indicated by the second configuration information before the adjustment.

[0029] Optionally, the target resource includes a central processing unit (CPU);

[0030] Determining the expected resource limit for the target resource when the container runs at a target time, according to the expected limit determination method matching the target resource, includes:

[0031] The percentage of CPU throttling experienced by the container during a specified historical period is calculated as the target throttling percentage; wherein, the throttling percentage for the CPU is the ratio of the duration of throttling when using the CPU during the specified period to the duration of the historical period.

[0032] Based on the target restricted ratio, the set expected restricted ratio, and the container's current resource limit for the CPU, the expected resource limit for the CPU when the container runs at the target time is determined.

[0033] Optionally, the target resource includes memory;

[0034] Determining the expected resource limit for the target resource when the container runs at a target time, according to the expected limit determination method matching the target resource, includes:

[0035] Based on one or more of the first determination method, the second determination method, and the third determination method, determine the expected resource limit for the memory when the container runs at the target time;

[0036] The first determination method is: using the method of determining the limit amount of memory usage by the container during simulated runtime;

[0037] The second determination method is: a method of determining the quantity by using the available memory space of the node where the container is located;

[0038] The third determination method is to determine the resource limit by using the frequency of container restarts within a specified historical period.

[0039] Secondly, embodiments of this disclosure provide a container resource adjustment device, the device comprising:

[0040] The acquisition module is used to acquire the evaluation index information corresponding to the container. The evaluation index information includes a first sequence composed of first index data corresponding to each historical time, and / or a second sequence composed of second index data corresponding to each historical time. The first index data corresponding to each historical time is used to characterize the actual use of the target resources by the container when it runs at that historical time, and the second index data corresponding to each historical time is used to characterize the business operation of the container when it runs at that historical time.

[0041] The estimation module is used to estimate the expected resource request volume of the container for the target resource when it runs at a target time, based on the evaluation index information.

[0042] The first adjustment module is used to, when the target time is reached, if it is detected that the container meets the predetermined resource demand adjustment conditions based on the comparison result of the expected resource request amount and the target resource request amount, adjust the first configuration information of the container regarding the target resource according to the expected resource request amount, so that the cloud platform allocates resources for the container regarding the target resource according to the adjusted first configuration information;

[0043] The target resource request amount is the current resource request amount indicated by the first configuration information before the adjustment.

[0044] Thirdly, embodiments of this disclosure provide an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

[0045] Memory, used to store computer programs;

[0046] When the processor executes a program stored in memory, it implements any of the above container resource adjustment method steps.

[0047] Fourthly, embodiments of this disclosure provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements any of the container resource adjustment method steps described above.

[0048] The solution provided in this disclosure estimates the expected resource request volume of a container for a target resource at a target time based on the evaluation index information corresponding to the container. Furthermore, upon reaching the target time, if the container is detected to meet predetermined resource demand adjustment conditions based on the comparison result between the expected and target resource request volumes, the first configuration information of the container's resource request volume for the target resource is adjusted according to the expected resource request volume. This allows the cloud platform to allocate resources for the target resource to the container. Therefore, this solution can estimate the expected resource request volume required by the container based on the actual resource utilization and / or business operation status of the container during historical runtime periods, and allocate resources to the container according to the expected resource request volume. This improves the matching degree between the allocated resources and the required resources of the container, thereby enhancing the rationality of resource allocation.

[0049] Of course, implementing any product or method of this disclosure does not necessarily require achieving all of the advantages described above at the same time. Attached Figure Description

[0050] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this disclosure. For those skilled in the art, other embodiments can be obtained based on these accompanying drawings.

[0051] Figure 1 A flowchart illustrating a container resource adjustment method provided in this embodiment of the disclosure;

[0052] Figure 2 A flowchart illustrating another container resource adjustment method provided in this embodiment of the disclosure;

[0053] Figure 3 A schematic diagram illustrating the working principle of an apparatus for implementing a container resource adjustment method according to an embodiment of this disclosure;

[0054] Figure 4 This is a schematic diagram of the structure of a container resource adjustment device provided in an embodiment of the present disclosure;

[0055] Figure 5 This is a schematic diagram of an electronic device structure provided in an embodiment of the present disclosure. Detailed Implementation

[0056] The technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art based on this disclosure are within the scope of protection of this disclosure.

[0057] To improve the rationality of resource allocation, this disclosure provides a container resource adjustment method, apparatus, electronic device, and storage medium.

[0058] The following section first introduces a container resource adjustment method provided by the disclosed embodiments.

[0059] The container resource adjustment method provided in this disclosure can be applied to a container resource adjustment device in an electronic device. In specific applications, the electronic device can be a terminal device or a server, and this disclosure does not limit the specific form of the electronic device.

[0060] For example, when the method is applied to a terminal device, the container resource adjustment device can be a client running on the terminal device, through which container resource adjustment can be implemented. For example, when the container resource adjustment method is applied to a server, the container resource adjustment device can be a computer program running on the server, which can be used to perform container resource adjustment.

[0061] It should be noted that the application is deployed and runs in a container. The type of application deployed in a container can be varied, such as data storage applications, task processing applications, etc. The type of application is related to the specific cloud environment, and this embodiment does not limit this.

[0062] One method for adjusting container resources may include:

[0063] Obtain evaluation indicator information corresponding to the container, wherein the evaluation indicator information includes a first sequence composed of first indicator data corresponding to each historical time, and / or a second sequence composed of second indicator data corresponding to each historical time. The first indicator data corresponding to each historical time is used to characterize the actual usage of the target resources by the container when it runs at that historical time, and the second indicator data corresponding to each historical time is used to characterize the business operation of the container when it runs at that historical time.

[0064] Based on the evaluation metrics, the expected resource request volume for the target resource when the container runs at the target time is estimated.

[0065] When the target time is reached, if the container is detected to meet the predetermined resource demand adjustment conditions based on the comparison result between the expected resource request amount and the target resource request amount, the first configuration information of the container regarding the target resource is adjusted according to the expected resource request amount, so that the cloud platform allocates resources for the container regarding the target resource according to the adjusted first configuration information;

[0066] The target resource request amount is the current resource request amount indicated by the first configuration information before the adjustment.

[0067] The solution provided in this disclosure estimates the expected resource request volume of a container for a target resource at a target time based on the evaluation index information corresponding to the container. Furthermore, upon reaching the target time, if the container is detected to meet predetermined resource demand adjustment conditions based on the comparison result between the expected and target resource request volumes, the first configuration information of the container's resource request volume for the target resource is adjusted according to the expected resource request volume. This allows the cloud platform to allocate resources for the target resource to the container. Therefore, this solution can estimate the expected resource request volume required by the container based on the actual resource utilization and / or business operation status of the container during historical runtime periods, and allocate resources to the container according to the expected resource request volume. This improves the matching degree between the allocated resources and the required resources of the container, thereby enhancing the rationality of resource allocation.

[0068] The following description, in conjunction with the accompanying drawings, introduces a container resource adjustment method provided by an embodiment of this disclosure.

[0069] like Figure 1 As shown in the embodiments of this disclosure, a container resource adjustment method may include the following steps:

[0070] S101, obtain the evaluation index information corresponding to the container, wherein the evaluation index information includes a first sequence composed of first index data corresponding to each historical time, and / or a second sequence composed of second index data corresponding to each historical time, the first index data corresponding to each historical time is used to characterize the actual use of the target resources by the container when it runs at that historical time, and the second index data corresponding to each historical time is used to characterize the business operation of the container when it runs at that historical time.

[0071] The container has been deployed in a cloud environment. When deploying the container, a resource request amount for the target resource can be set for the container. The cloud platform can then schedule the container to a cluster node with sufficient resources based on the resource request amount.

[0072] It should be noted that the target resource can be CPU, memory, etc. If the target resource is CPU, the first indicator data can be CPU usage time information, or CPU utilization rate, etc., to characterize the actual CPU usage. If the target resource is memory, the first indicator data can be memory utilization rate, or memory space usage, etc., to characterize the actual internal usage. Additionally, the second indicator data can be the number of business requests, or the number of user logins, etc., to characterize business operation. It is understood that there can be one or more types of target resources. For example, if there are two types of target resources, these two types of target resources can include CPU and memory. In this case, each type of target resource can have its own corresponding first indicator data, thus forming two first sequences. Each sequence is used to estimate the expected resource request volume for the corresponding target resource. For clarity, the following description focuses on a single type of target resource, where the target resource can be CPU or memory, but is not limited to these.

[0073] Optionally, in one implementation, each historical time is the same specified time within at least one predetermined runtime cycle corresponding to the container; the target time is the specified time in a future runtime cycle. For example: with one day as a cycle, each historical time can be 9:00 AM on each historical date; or a morning time period; with a 7-day week as a cycle, the specified time within each historical time can be Monday or Tuesday of each historical week, etc. It should be noted that the predetermined runtime cycle can be obtained based on the actual operating patterns of the applications deployed in the container.

[0074] Alternatively, in other implementations, each historical time can be a time with the same time granularity, which can be an hour, day, week, etc., and the number of historical times is not limited.

[0075] There are several ways to obtain the evaluation metric information for containers. Optionally, the evaluation metric information can be collected by monitoring systems, cluster APIs (Application Programming Interfaces), or pre-deployed collectors, so that the container resource adjustment device can obtain the evaluation metric information for containers from the collection devices.

[0076] For example, the monitoring system could be Prometheus (an open-source monitoring solution for collecting and aggregating metrics as time-series data), Zabbix (an enterprise-grade open-source solution that provides distributed system and network monitoring via a web interface; Zabbix can monitor various network parameters to ensure the secure operation of server systems), or Nagios (a free open-source network monitoring tool that can effectively monitor host status, network devices such as switches and routers).

[0077] For example, the cluster API can be a dedicated API provided by the machine cluster where the container is deployed, through which evaluation metric information corresponding to the container can be obtained. Taking a Kubernetes cluster as an example, the cluster API can be a metric API (metric interface).

[0078] To reduce the query pressure on the monitoring system, the corresponding evaluation metric information of the container can be obtained by connecting to the hot backup system of the monitoring system backend, such as the remote PostgreSQL repository of Prometheus (a feature-rich free software object-relational database management system).

[0079] For example, in a scenario where containers are deployed on nodes of a virtual machine cluster, the collector can be a cadvisor collector deployed in the virtual machine cluster; where cadvisor is a container monitoring tool.

[0080] It should be noted that specific business data can also be obtained through log systems and tracing systems, but it is not limited to these.

[0081] S102, Based on the evaluation index information, estimate the expected resource request amount of the container for the target resource when it runs at the target time;

[0082] Since the evaluation metrics can characterize the actual resource utilization and / or business operation of the container during historical runtime periods, they can be used to estimate the expected resource request volume of the container for the target resource at a target time, thereby providing a basis for providing reasonable resources to the container. It should be noted that if the evaluation metrics only include a first sequence composed of first metric data corresponding to each historical time, then by using the first sequence to estimate the resource requirement of the container for the target resource at the target time, the expected resource request volume of the container for the target resource at the target time can be obtained. Similarly, if the evaluation metrics only include a second sequence composed of second metric data corresponding to each historical time, then by using the second sequence to estimate the resource requirement of the container for the target resource at the target time, the expected resource request volume of the container for the target resource at the target time can be obtained. If the evaluation index information includes a first sequence consisting of first index data corresponding to each historical time and a second sequence consisting of second index data corresponding to each historical time, then, firstly, the resource requirements of the container for the target resource when running at the target time can be estimated using the first sequence, and secondly, the resource requirements of the container for the target resource when running at the target time can be estimated using the second sequence. Then, the resource requirements obtained from the two methods are processed by taking a weighted sum and calculating the average value to obtain the expected resource request amount of the container for the target resource when running at the target time.

[0083] To ensure clarity and a well-defined structure, the following sections will exemplify the estimation method for expected resource request volume by using the following examples: the evaluation index information includes a first sequence composed of first index data corresponding to each historical time period, and the evaluation index information includes a second sequence composed of second index data corresponding to each historical time period.

[0084] S103, when the target time is reached, if based on the comparison result of the expected resource request amount and the target resource request amount, it is detected that the container meets the predetermined resource demand adjustment conditions, the first configuration information of the container regarding the target resource is adjusted according to the expected resource request amount, so that the cloud platform allocates resources for the container regarding the target resource according to the adjusted first configuration information; wherein, the target resource request amount is the current resource request amount indicated by the first configuration information before the adjustment.

[0085] It is understandable that if the target resource is CPU, the target resource request amount is the container's current resource request amount for CPU; or, if the target resource is memory, the target resource request amount is the container's current resource request amount for memory.

[0086] The method of detecting whether the container meets the predetermined resource demand adjustment conditions based on the comparison result of the expected resource request amount and the target resource request amount may include steps A1-A2:

[0087] Step A1: Determine whether the comparison result between the expected resource request amount and the target resource request amount indicates that the target resource request amount and the expected resource request amount do not match.

[0088] Wherein, if the expected resource request amount is a single value, the mismatch between the target resource request amount and the expected resource request amount includes: the target resource request amount and the expected resource request amount are different, or the target resource request amount and the expected resource request amount are different and the difference exceeds a predetermined threshold;

[0089] For example, if the expected resource request is 10GB of memory and the target resource request is 5GB of memory, the difference between the target resource request and the expected resource request indicates that the target resource request and the expected resource request are not matched. If the expected resource request of 10GB of memory is different from the target resource request of 5GB of memory, then this situation indicates that the target resource request and the expected resource request are not matched.

[0090] If the target resource request amount is different from the expected resource request amount and the difference exceeds a predetermined threshold, it indicates that the two are not matched. The threshold is 2GB. If the expected resource request amount of 10GB memory is different from the target resource request amount of 5GB memory, and the difference between the two is 5GB, which is greater than the threshold of 2GB, then this situation indicates that the target resource request amount and the expected resource request amount are not matched.

[0091] If the expected resource request amount is a range value, then the mismatch between the target resource request amount and the expected resource request amount includes: the target resource request amount is not included in the expected resource request amount.

[0092] The amount of CPU resources a container expects can be represented by time slices. A time slice is a micro-level segment of CPU time allocated to each running process by the time-sharing operating system. The unit is m. It can be represented by dividing one CPU into 1000 parts. Then, 100m can be characterized as using 0.1 CPUs per second.

[0093] For example, if the expected resource request amount is 50-100m and the target resource request amount is 30m, the target resource request amount is not included in the expected resource request amount, indicating that the target resource request amount and the expected resource request amount do not match.

[0094] If the target resource request amount is 90m, then the target resource request amount is included in the expected resource request amount, indicating that the target resource request amount matches the expected resource request amount.

[0095] Step A2, if yes, then it is detected that the container meets the predetermined resource requirement adjustment conditions;

[0096] If the target resource request volume does not match the expected resource request volume, it is detected that the container meets the predetermined resource demand adjustment conditions.

[0097] For example, if the expected resource request is 50-100m and the target resource request is 30m, and the target resource request is not included in the expected resource request, it indicates that the target resource request does not match the expected resource request. In this case, the container is detected to meet the conditions for adjusting CPU resource requirements.

[0098] The method for adjusting the first configuration information of the container regarding the resource request amount of the target resource includes steps B1-B2:

[0099] Step B1: Determine the target deployment method for the container;

[0100] Step B2: Adjust the first configuration information of the container's resource request amount for the target resource according to the adjustment method corresponding to the target deployment method;

[0101] The adjustment methods include: passing files to the resource configuration tool corresponding to the container, or passing parameters to the resource configuration tool corresponding to the container.

[0102] For example, deployment methods for any container can include deployment via Helm, Kustomize, Ansible, Docker, or CI / CD. Helm and Kustomize are tools for deploying services in a Kubernetes cluster, Ansible is a newly emerging automated operations and maintenance tool, Docker is an open-source application container engine tool, and CI / CD is a method for frequently delivering applications to customers by introducing automation during the application development phase. Additionally, the resource configuration tools mentioned above can be the various tools used when deploying containers.

[0103] Each deployment method can have corresponding adjustment methods pre-set. After determining the target deployment method, the corresponding adjustment methods can be determined. The adjustment methods corresponding to each deployment method can be set according to the actual situation, and this embodiment does not limit this.

[0104] For example, for containers deployed using tools like Helm and Kustomize, you can modify the request and execute the command `helm upgrade application1 –set values.resource.request=100Mi -fvalues.yaml` to pass the file to the container's resource configuration tool, thereby adjusting the container. For Ansible-based clusters, updates can be deployed by modifying parameters in the playbook configuration file (a playbook is a file consisting of one or more plays, where a play is a set of ordered tasks executed on a specific host or group of hosts) or by passing environment variables, thus adjusting the containers. CI / CD typically uses a pipelined approach; configuration parameters can be obtained and modified during the configuration fetching stage of the pipeline, or parameters can be passed simultaneously when the CI / CD pipeline is invoked at a change time, thereby adjusting the containers.

[0105] Additionally, the parameters or files passed may include instructions on whether to interrupt the service. If the service is not interrupted, an update process of "starting a new instance, switching services, and deleting the old instance" is required, which means stopping the current container and redeploying a new container, whose resources are the expected resource request volume. If the service can be interrupted, the configuration information of the container regarding the target resource can be directly modified.

[0106] For example, a Kubernetes cluster can achieve this process by passing the configuration parameter updateStrategy=rollingUpgrade.

[0107] In other implementations, the cloud platform's allocation of resources for the container regarding the target resource according to the adjusted first configuration information may include: if it is detected that the target resource of the node where the container is located is insufficient, that is, the available amount of the target resource is lower than the resource request amount of the target resource in the first configuration information, the container may be rescheduled to a cluster node with sufficient resources according to the resource request amount of the target resource in the first configuration information; otherwise, the target resource of the node where the container is located may be directly reallocated to the container according to the resource request amount of the target resource in the first configuration information.

[0108] It is understandable that when deploying containers, a reasonable resource request volume needs to be set for the containers. The cloud platform needs corresponding monitoring and intervention methods to ensure the operation and management utilization of the cluster, thereby achieving refined operation and intelligent maintenance. This solution can allocate reasonable resources to containers by estimating container resources, thereby enabling the cloud platform to guarantee the operation and management utilization of the cluster, achieving the goal of refined operation and intelligent maintenance. The solution provided in this disclosure, based on the evaluation index information corresponding to the container, estimates the expected resource request volume of the container for the target resource when it runs at the target time; and, when the target time is reached, if it is detected that the container meets the predetermined resource demand adjustment conditions based on the comparison result of the expected resource request volume and the target resource request volume, then the first configuration information of the container's resource request volume for the target resource is adjusted according to the expected resource request volume, thereby enabling the cloud platform to allocate resources for the target resource for the container. As can be seen, this solution can estimate the expected resource request amount required by the container based on the actual resource utilization and / or business operation status of the container in the historical runtime, and allocate resources to the container according to the expected resource request amount. In this way, the matching degree between the allocated resource amount and the required resource amount of the container is improved, thereby improving the rationality of resource allocation.

[0109] Optionally, in one implementation, a linear regression algorithm is used for fitting to obtain the expected resource request amount. The following is an example illustrating the specific process of determining the expected resource request amount of the target resource based on this implementation method.

[0110] When the evaluation metric information includes a first sequence, estimating the expected resource request volume of the container for the target resource at the target time based on the evaluation metric information may include steps C1-C3:

[0111] Step C1: Perform at least one specified mathematical operation on the elements in the first sequence to obtain at least one operation result;

[0112] Among them, at least one specified mathematical operation may include calculating the average; or calculating the average and variance; or calculating the median, etc.

[0113] For example, a container with application A deployed has a scheduled runtime of 24 hours. In the past three scheduled runtimes, the CPU utilization at 9 AM each day has fluctuated between 40% and 60%. Then, based on mathematical operations, one or more of the following runtime results can be obtained: the average CPU utilization is 50%, the variance of CPU utilization is 5%, the maximum CPU utilization is 60%, the minimum CPU utilization is 40%, and the median CPU utilization is 50%.

[0114] Step C2: Based on the calculation results, determine the actual demand for the target resource when the container is running for a specified time period in any running cycle;

[0115] If the first indicator data is data representing utilization, such as CPU utilization or memory utilization, then if the calculation result is single, the result can be multiplied by the current resource request amount indicated by the first configuration information before adjustment to obtain the actual demand of the container for the target resource during the specified time period of any running cycle. If there are multiple results, the multiple results can be summed, and then the sum can be multiplied by the current resource request amount indicated by the first configuration information before adjustment to obtain the actual demand of the container for the target resource during the specified time period of any running cycle. If the first indicator data is data representing resource quantity, such as CPU usage time or memory usage, then if the calculation result is single, the result can be used as the actual demand of the container for the target resource during the specified time period of any running cycle. If there are two results, the sum of the results can be used as the actual demand of the container for the target resource during the specified time period of any running cycle.

[0116] For example, a container deploying application A has a scheduled runtime of 24 hours. In the past three scheduled runtimes, the CPU utilization at 9 AM each day fluctuated between 40% and 60%. Then, based on mathematical calculations, one or more of the following runtime results can be obtained: the average CPU utilization is 50%, the variance of CPU utilization is 5%, the maximum CPU utilization is 60%, the minimum CPU utilization is 40%, and the median CPU utilization is 50%. Assuming that 100m of CPUs are currently configured, then the actual demand estimated using the average value is 100 * 50 = 50m, and the actual demand estimated using the average value and variance can be 100 * (50% + 5%) = 55m.

[0117] Step C3: Using the actual demand and the predetermined upper and lower limits of expected utilization for the target resource, estimate the expected resource request amount for the target resource when the container runs at the target time.

[0118] The expected utilization rate can be either CPU utilization or memory utilization. It is understood that CPU utilization can exceed 100%, while memory utilization cannot exceed 100%.

[0119] Specifically, step C3 may include steps C31-C33:

[0120] Step C31: Calculate the ratio of the actual demand to the upper limit of the expected utilization rate for the target resource, and use it as the first data quantity;

[0121] For example, a container deploying application A has a scheduled runtime of 24 hours. Over the past three scheduled runtimes, the CPU utilization at 9 AM each day has fluctuated between 40% and 60%. Based on mathematical calculations, one or more of the following runtime results can be obtained: the average CPU utilization is 50%, the variance of CPU utilization is 5%, the maximum CPU utilization is 60%, the minimum CPU utilization is 40%, and the median CPU utilization is 50%. Assuming a current CPU configuration of 100m and an expected utilization of 75%-125%, then estimating by the average, the first data volume is 100*50 / 125% = 40m. Estimating by the average and variance, the first data volume is 100*(50%+5%) / 125% = 44m. Estimating by the median, the first data volume is 100*50% / 125% = 40m.

[0122] Step C32: Calculate the ratio of the actual demand to the lower limit of the expected utilization rate for the target resource, as the second data quantity;

[0123] For example, a container deploying application A has a scheduled runtime of 24 hours. Over the past three scheduled runtimes, the CPU utilization at 9 AM each day has fluctuated between 40% and 60%. Based on mathematical calculations, one or more of the following runtime results can be obtained: the average CPU utilization is 50%, the variance of CPU utilization is 5%, the maximum CPU utilization is 60%, the minimum CPU utilization is 40%, and the median CPU utilization is 50%. Assuming a current CPU configuration of 100m and an expected utilization of 75%-125%, then, estimating by the average, the second data volume is 100*50 / 75% = 66.7m; estimating by the average and variance, the second data volume is 100*(50%+5%) / 75% = 73.3m; and estimating by the median, the second data volume is 100*50% / 75% = 66.7m.

[0124] Step C33: The range of values, with the first data volume and the second data volume as the starting and ending values ​​respectively, is determined as the expected resource request amount for the target resource when the container runs at the target time.

[0125] Based on the above data, the expected resource request volume is estimated to be 40-66.7m using the average value and 44-73.3m using the variance.

[0126] The formula for the expected resource request volume obtained through the above method can include:

[0127] Expected resource request quantity = Actual demand quantity / Expected utilization rate upper limit ~ Actual demand quantity / Expected utilization rate lower limit

[0128] In this embodiment, the expected resource request volume of the container for the target resource at the target time can be estimated through simple mathematical calculations. Therefore, this embodiment provides a convenient and fast method for estimating the expected resource request volume.

[0129] Alternatively, in another implementation, this embodiment uses neural network models, such as RNN (Recurrent Neural Network) and LSTM (Long Short-Term Memory), combined with business data for modeling, to obtain the expected resource request amount for the target resource. The following exemplarily describes the specific process of determining the expected resource request amount for the target resource based on this implementation method.

[0130] The evaluation index information includes a second sequence;

[0131] Accordingly, the step of estimating the expected resource request volume of the container for the target resource at the target time based on the evaluation index information includes step D1:

[0132] Step D1: The second sequence is used as input data and input into the pre-trained resource prediction model to obtain the expected resource request amount of the container for the target resource when it runs at the target time.

[0133] The second sequence consists of the business operation data of the container at various historical times. For example, if the predetermined operating cycle is one week, and each historical time period is Monday in the past three predetermined operating cycles, and the second indicator data is the number of logins, then the second sequence can be (x1, x2, x3), where x1, x2, and x3 are the number of logins generated when the container runs on Monday in the three predetermined operating cycles.

[0134] The resource prediction model is a model trained using sample data and the corresponding ground truth. The sample sequence is a sequence of second indicator data corresponding to the historical time of each sample. The historical time of each sample is the specified time of the same sample in at least one running cycle corresponding to the sample container. The ground truth is the expected resource request amount of the sample container for the target resource when the sample target time is running. The target time is the specified time of the sample in the future running cycle corresponding to the sample container.

[0135] In this embodiment, the input data can be the actual time series of changes in business data, such as the number of logins, clicks, or queries.

[0136] The expected resource request quantity output by the model can be the expected resource request quantity of the target resource.

[0137] Business data can be obtained through log systems, link tracing systems, etc. Understandably, the resource prediction model can be continuously trained. After inputting data into the resource prediction model, the expected resource request volume output by the model is obtained. This expected resource request volume is compared with the true value. If the difference is less than a threshold, the model continues to be trained until the difference between the expected resource request volume output and the true value is less than the threshold each time. If the difference between the expected resource request volume and the true value exceeds the threshold, the resource prediction model needs to be adjusted.

[0138] This embodiment of the disclosure can predict evaluation index information based on a neural network model, rather than relying on experience or stress test results. By inputting business data into a model that has been trained over a long period of time, the expected resource request amount obtained is more accurate. Compared with other embodiments, this embodiment does not require data computation; the expected resource request amount can be obtained simply by inputting business data. Business data can also be obtained in a simple way. It can be seen that this solution, which predicts the expected resource request amount based on a neural network model, is simpler and more accurate than other solutions. Moreover, this solution can also improve the matching degree between the allocated resources and the required resources of the container, thereby improving the rationality of resource allocation.

[0139] The following describes another container resource adjustment method provided by an embodiment of this disclosure, such as... Figure 2 As shown, it may include the following steps:

[0140] S201, obtain the evaluation index information corresponding to the container, wherein the evaluation index information includes a first sequence composed of first index data corresponding to each historical time, and / or a second sequence composed of second index data corresponding to each historical time, the first index data corresponding to each historical time is used to characterize the actual use of the target resources by the container when it runs at that historical time, and the second index data corresponding to each historical time is used to characterize the business operation of the container when it runs at that historical time.

[0141] S202, Based on the evaluation index information, estimate the expected resource request amount of the container for the target resource when it runs at the target time;

[0142] S203, when the target time is reached, if based on the comparison result of the expected resource request amount and the target resource request amount, it is detected that the container meets the predetermined resource demand adjustment conditions, the first configuration information of the container regarding the target resource is adjusted according to the expected resource request amount, so that the cloud platform allocates resources for the container regarding the target resource according to the adjusted first configuration information; wherein, the target resource request amount is the current resource request amount indicated by the first configuration information before the adjustment.

[0143] It should be noted that S201-S203 are the same as S101-S103 in the above embodiments, and will not be described again here.

[0144] S204, if the container is configured with a resource limit for the target resource, then the expected resource limit for the target resource when the container runs at the target time is determined according to the expected limit determination method that matches the target resource;

[0145] Wherein, if the target resource includes a central processing unit (CPU), determining the expected resource limit for the target resource at the target time runtime according to the expected limit determination method matching the target resource may include steps E1-E2:

[0146] Step E1: Calculate the percentage of CPU throttling experienced by the container during a specified historical period, and use this as the target throttling percentage; wherein, the throttling percentage for the CPU is the ratio of the duration of the time the CPU is throttled during the specified period to the duration of the historical period.

[0147] For example, if the CPU usage exceeds the limit 10 times, and 3 of those times are rejected (cannot be executed), then the limitation ratio is 30%, and this limitation ratio is used as the target limitation ratio.

[0148] Step E2: Based on the target restricted ratio, the set expected restricted ratio, and the current resource limit of the container for the CPU, determine the expected resource limit of the container for the CPU when it runs at the target time.

[0149] It should be noted that the expected resource limit for CPU during container runtime = target limited percentage / upper limit of the set expected limited percentage * the container's current resource limit for CPU.

[0150] For example, if the target restricted ratio is 30%, the upper limit of the expected restricted ratio is 10%, and the current resource limit for the CPU of the container is 100m, then the expected resource limit for the CPU of the container at runtime is 300m.

[0151] If the target resource includes memory, determining the expected resource limit for the target resource at the target time runtime according to the expected limit determination method matching the target resource may include:

[0152] Based on one or more of the first determination method, the second determination method, and the third determination method, determine the expected resource limit for the memory when the container runs at the target time;

[0153] The first determination method is: using the container simulation runtime to determine the limit amount of memory usage;

[0154] The first determination method can be specifically applied to performance stress testing. In the test environment, the input of business volume is simulated, and the consumption of container resources is monitored to obtain the corresponding relationship.

[0155] For example, inputting data into a container that has business A deployed will generate business curves. As the input rate increases from 100 to 200 times per second, up to 1000 times per second, the CPU and memory change curves are obtained, and the resources required for a single container to handle business A 500 times can be estimated.

[0156] The second determination method is: a method of determining the quantity by using the available memory space of the node where the container is located;

[0157] The second determination method can be specifically the ratio of the node's available memory to the expected number of containers.

[0158] For example, suppose there are 60GB of memory remaining on a node. If you want to distribute the node's resources equally among two applications wrapped in containers, that is, allocate them to containers, then each container cannot have more than 30GB of memory.

[0159] The third determination method is to determine the resource limit by using the frequency of container restarts within a specified historical period.

[0160] Container restarts indicate memory exhaustion and can be represented by 00M. When containers restart frequently, it's necessary to consider increasing memory allocation. When the restart frequency exceeds a restart threshold, memory should be increased to determine resource limits. Restart frequency can be represented as the ratio of restart counts to the statistical period.

[0161] For example, if a container restarts 10 times in 10 hours, then the restart frequency is 1, the restart threshold is 0.8, the restart frequency is greater than the restart threshold, memory needs to be increased, and the increased memory is added to the current memory resource limit to obtain a new resource limit.

[0162] S205, when the target time is reached, if it is detected that the container meets the predetermined resource limit adjustment conditions based on the comparison result of the expected resource limit and the target resource limit, the second configuration information of the container regarding the target resource is adjusted according to the expected resource limit, so that the cloud platform performs rate limiting processing on the container regarding the target resource according to the adjusted second configuration information; wherein, the target resource limit is the current resource limit indicated by the second configuration information before the adjustment.

[0163] It should be noted that S103 involves detecting whether the container meets the predetermined resource request adjustment conditions, and adjusting the first configuration information of the container's resource request amount regarding the target resource according to the expected resource request amount, so that the cloud platform allocates resources to the container for the target resource according to the adjusted first configuration information. S205 involves detecting whether the container meets the predetermined resource limit adjustment conditions, and adjusting the second configuration information of the container's resource limit regarding the target resource according to the expected resource limit amount, so that the cloud platform performs rate limiting on the container's resources for the target resource according to the adjusted second configuration information. The only difference is the target object; the specific content is largely the same and will not be elaborated upon here.

[0164] The solution provided in this disclosure determines the expected resource limit for a container running at a target time based on an expected limit determination method that matches the target resource. Furthermore, upon reaching the target time, if the container is detected to meet predetermined resource limit adjustment conditions based on a comparison between the expected and target resource limits, then the second configuration information of the container's resource limit related to the target resource is adjusted according to the expected resource limit. This allows the cloud platform to perform rate limiting on the container for the target resource. Therefore, this solution can obtain the expected resource limit based on an expected limit determination method that matches the target resource, and perform rate limiting on the container according to the expected resource limit. This improves the matching degree between the restricted resource amount and the required limit, enhancing the rationality of resource rate limiting and reducing the probability of rate limiting or failure during peak periods.

[0165] The working principle of the apparatus for implementing a container resource adjustment method provided in the embodiments of this disclosure is described below. The apparatus for implementing the container resource adjustment method is logically divided into modules, such as... Figure 3 As shown, it may include:

[0166] Modules A, B, and C are used. Module A is used to obtain evaluation indicator information, Module B is used for modeling and evaluation, and Module C is used to adjust the resource request volume.

[0167] Module A is used to acquire evaluation metric information. Module A can obtain container evaluation metric information from monitoring systems, APIs, and data collectors. Clusters are generally monitored by monitoring systems. Clusters without monitoring systems can connect to APIs to monitor evaluation metric information. Clusters without APIs can deploy data collectors to monitor evaluation metric information.

[0168] Based on the obtained evaluation metric information, module B estimates the expected resource request volume for the target resource when the container runs at the target time. It compares the expected resource request volume with the current resource request volume and determines whether to make adjustments based on the comparison result. If not, no adjustment is made, and the process returns to module A to continue obtaining metrics; if so, the resource request volume is adjusted through module C.

[0169] For example, the output of module B can be found in Table 1:

[0170]

[0171] Table 1

[0172] Here, "current memory" refers to the current resource request amount of memory, and "suggested memory" refers to the expected resource request amount of memory; similarly, "current CPU" refers to the current resource request amount of CPU, and "suggested CPU" refers to the expected resource request amount of CPU.

[0173] As can be seen, the suggested memory is the product of the current memory and the average memory utilization rate, and the suggested CPU is the product of the current CPU and the average CPU utilization rate. However, the resulting suggested values ​​may not be integers and may be rounded up or down. This disclosure does not specifically limit this.

[0174] Module C is used to adjust the resource request volume. If the comparison result between the expected resource request volume and the current resource request volume is positive, the resource request volume can be adjusted. Module C can use tools or methods such as Helm, Docker or CI / CD to adjust the resource request volume. The specific implementation methods have been introduced in the above embodiments and will not be elaborated on here.

[0175] In existing technologies, if a container experiences excessive resource requirements, resources are adjusted by adding new containers. This method involves horizontal scaling of containers, adjusting resources by increasing or decreasing the number of containers. However, this solution adjusts resources by adjusting the amount of resource requests, which is a vertical scaling of containers. Because this solution directly adjusts the amount of resource requests to adjust container resources, it can cover scaling down to the smallest unit, which is impossible with existing technologies. Furthermore, existing technologies lack the means to dynamically evaluate and adjust resource allocation in a timely manner.

[0176] In addition, this solution can estimate the expected resource request amount required by the container based on the actual resource utilization and / or business operation of the container in the historical runtime period. This improves the matching degree between the allocated resources and the required resources of the container, thereby improving the rationality of resource allocation.

[0177] Based on the embodiments of the above methods, this disclosure also provides a container resource adjustment device, such as... Figure 4 As shown, the device includes:

[0178] The acquisition module 410 is used to acquire the evaluation index information corresponding to the container. The evaluation index information includes a first sequence composed of first index data corresponding to each historical time, and / or a second sequence composed of second index data corresponding to each historical time. The first index data corresponding to each historical time is used to characterize the actual use of the target resources by the container when it runs at that historical time, and the second index data corresponding to each historical time is used to characterize the business operation of the container when it runs at that historical time period.

[0179] The estimation module 420 is used to estimate the expected resource request volume of the container for the target resource when it runs at a target time, based on the evaluation index information.

[0180] The first adjustment module 430 is used to, when the target time is reached, if it is detected that the container meets the predetermined resource demand adjustment conditions based on the comparison result of the expected resource request amount and the target resource request amount, adjust the first configuration information of the container regarding the target resource according to the expected resource request amount, so that the cloud platform allocates resources for the container regarding the target resource according to the adjusted first configuration information;

[0181] The target resource request amount is the current resource request amount indicated by the first configuration information before the adjustment.

[0182] Optionally, the method for detecting whether the container meets the predetermined resource demand adjustment conditions based on the comparison result of the expected resource request amount and the target resource request amount includes:

[0183] Determine whether the comparison result between the expected resource request amount and the target resource request amount indicates that the target resource request amount and the expected resource request amount do not match; if so, it is detected that the container meets the predetermined resource demand adjustment conditions.

[0184] Wherein, if the expected resource request amount is a single value, the mismatch between the target resource request amount and the expected resource request amount includes: the target resource request amount and the expected resource request amount are different, or the target resource request amount and the expected resource request amount are different and the difference exceeds a predetermined threshold;

[0185] If the expected resource request amount is a range value, then the mismatch between the target resource request amount and the expected resource request amount includes: the target resource request amount is not included in the expected resource request amount.

[0186] Optionally, each historical time is the same specified time in at least one predetermined operating cycle corresponding to the container; the target time is the specified time in a future operating cycle.

[0187] Optionally, the evaluation index information includes a first sequence;

[0188] The prediction module includes:

[0189] The processing submodule is used to perform at least one specified mathematical operation on the elements in the first sequence to obtain at least one operation result;

[0190] The first determining submodule is used to determine, based on the calculation result, the actual demand of the container for the target resource during the specified time period of any running cycle;

[0191] The estimation submodule is used to estimate the expected resource request amount of the container for the target resource when it runs at a target time, based on the actual demand and the predetermined upper and lower limits of the expected utilization rate for the target resource.

[0192] Optionally, the evaluation index information includes the second sequence;

[0193] The prediction module is used to input the second sequence as input data into a pre-trained resource prediction model to obtain the expected resource request amount of the container for the target resource when it runs at the target time.

[0194] The resource prediction model is a model trained using sample sequences and their corresponding ground truth values. The sample sequence is a sequence of second indicator data corresponding to the historical time of each sample. The historical time of each sample is a specified time of the same sample in at least one running cycle corresponding to the sample container. The ground truth value is the expected resource request amount of the sample container for the target resource when the sample target time is running. The target time is the specified time of the sample in the future running cycle corresponding to the sample container.

[0195] Optionally, the device further includes:

[0196] The determining module is configured to, if the container is configured with a resource limit for the target resource, determine the expected resource limit for the target resource when the container runs at the target time, according to the expected limit determination method that matches the target resource;

[0197] The second adjustment module is used to adjust the second configuration information of the container's resource limit related to the target resource when the target time is reached, based on the comparison result of the expected resource limit and the target resource limit, if it is detected that the container meets the predetermined resource limit adjustment conditions, according to the expected resource limit, so that the cloud platform performs rate limiting processing on the container's resources related to the target resource according to the adjusted second configuration information; wherein, the target resource limit is the current resource limit indicated by the second configuration information before the adjustment.

[0198] Optionally, the target resource includes a central processing unit (CPU);

[0199] The determining module includes:

[0200] The statistics submodule is used to calculate the percentage of CPU throttling experienced by the container during a specified historical period, as the target throttling percentage; wherein, the throttling percentage for the CPU is the ratio of the duration of the CPU throttling during the specified period to the duration of the historical period.

[0201] The second determining submodule is used to determine the expected resource limit of the container for the CPU when the container runs at a target time, based on the target limiting ratio, the set expected limiting ratio, and the container's current resource limit for the CPU.

[0202] Optionally, the target resource includes memory;

[0203] The determining submodule is used to determine the expected resource limit for the memory when the container runs at a target time, based on one or more of the first determining method, the second determining method, and the third determining method.

[0204] The first determination method is: using the container simulation runtime to determine the limit amount of memory usage;

[0205] The second determination method is: a method of determining the quantity by using the available memory space of the node where the container is located;

[0206] The third determination method is to determine the resource limit by using the frequency of container restarts within a specified historical period.

[0207] This disclosure also provides an electronic device, such as... Figure 5 As shown, it includes a processor 501, a communication interface 502, a memory 503, and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 504.

[0208] Memory 503 is used to store computer programs;

[0209] Processor 501, when executing a program stored in memory 503, implements a container resource adjustment method.

[0210] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.

[0211] The communication interface is used for communication between the aforementioned electronic devices and other devices.

[0212] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0213] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0214] In another embodiment provided in this disclosure, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of any of the container resource adjustment methods described above.

[0215] In yet another embodiment provided in this disclosure, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform any of the container resource adjustment methods described above.

[0216] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this disclosure are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., a solid-state disk (SSD)).

[0217] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0218] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0219] The above description is merely a preferred embodiment of this disclosure and is not intended to limit the scope of protection of this disclosure. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this disclosure are included within the scope of protection of this disclosure.

Claims

1. A method for adjusting container resources, characterized in that, Applied to a container resource adjustment device, the method includes: Obtain evaluation indicator information corresponding to the container, wherein the evaluation indicator information includes a first sequence composed of first indicator data corresponding to each historical time, and / or a second sequence composed of second indicator data corresponding to each historical time, wherein the first indicator data corresponding to each historical time is used to characterize the actual usage of the target resources by the container during the operation of the container at that historical time, and the second indicator data corresponding to each historical time is used to characterize the business operation of the container during the operation of the container at that historical time. Based on the evaluation metrics, the expected resource request volume for the target resource when the container runs at the target time is estimated. When the target time is reached, if the container is detected to meet the predetermined resource demand adjustment conditions based on the comparison result between the expected resource request amount and the target resource request amount, the first configuration information of the container regarding the target resource is adjusted according to the expected resource request amount, so that the cloud platform allocates resources for the container regarding the target resource according to the adjusted first configuration information; Wherein, the target resource request amount is the current resource request amount indicated by the first configuration information before adjustment; each historical time is the same specified time in at least one predetermined running cycle corresponding to the container; the target time is the specified time in a future running cycle; when the evaluation index information includes a first sequence, estimating the expected resource request amount of the container for the target resource when running at the target time based on the evaluation index information includes: performing at least one specified mathematical operation on the elements in the first sequence to obtain at least one operation result; determining the actual demand amount of the container for the target resource when running at the specified time in any running cycle based on the operation result; estimating the expected resource request amount of the container for the target resource when running at the target time using the actual demand amount, and the predetermined upper limit and lower limit of expected utilization rate for the target resource; when the evaluation index information includes a second sequence, estimating the expected resource request amount of the container for the target resource when running at the target time based on the evaluation index information includes: inputting the second sequence as input data into a pre-trained resource prediction model to obtain the expected resource request amount of the container for the target resource when running at the target time.

2. The method according to claim 1, characterized in that, The method for detecting whether the container meets the predetermined resource demand adjustment conditions based on the comparison result between the expected resource request amount and the target resource request amount includes: Determine whether the comparison result between the expected resource request amount and the target resource request amount indicates that the target resource request amount and the expected resource request amount do not match; if so, it is detected that the container meets the predetermined resource demand adjustment conditions. Wherein, if the expected resource request amount is a single value, the mismatch between the target resource request amount and the expected resource request amount includes: the target resource request amount and the expected resource request amount are different, or the target resource request amount and the expected resource request amount are different and the difference exceeds a predetermined threshold; If the expected resource request amount is a range value, then the mismatch between the target resource request amount and the expected resource request amount includes: the target resource request amount is not included in the expected resource request amount.

3. The method according to claim 1, characterized in that, The resource prediction model is a model trained using sample sequences and the corresponding ground truth values. The sample sequence is a sequence of second indicator data corresponding to the historical time of each sample. The historical time of each sample is a specified time of the same sample in at least one running cycle corresponding to the sample container. The ground truth value is the expected resource request amount of the sample container for the target resource when the sample target time is running. The target time is the specified time of the sample in the future running cycle corresponding to the sample container.

4. The method according to claim 1, characterized in that, Also includes: If the container is configured with a resource limit for the target resource, then the expected resource limit for the target resource when the container runs at the target time is determined according to the expected limit determination method that matches the target resource. When the target time is reached, if the container is detected to meet the predetermined resource limit adjustment conditions based on the comparison result between the expected resource limit and the target resource limit, the second configuration information of the container's resource limit regarding the target resource is adjusted according to the expected resource limit, so that the cloud platform performs rate limiting on the container's resources regarding the target resource according to the adjusted second configuration information; wherein, the target resource limit is the current resource limit indicated by the second configuration information before the adjustment.

5. The method according to claim 4, characterized in that, The target resource includes a central processing unit (CPU); Determining the expected resource limit for the target resource when the container runs at a target time, according to the expected limit determination method matching the target resource, includes: The percentage of time the container was throttled on the CPU during a specified historical period is calculated as the target throttling percentage; wherein, the throttling percentage on the CPU is the ratio of the duration of the time the CPU was throttled during the specified period to the duration of the historical period. Based on the target restricted ratio, the set expected restricted ratio, and the container's current resource limit for the CPU, the expected resource limit for the CPU when the container runs at the target time is determined.

6. The method according to claim 4, characterized in that, The target resource includes memory; Determining the expected resource limit for the target resource when the container runs at a target time, according to the expected limit determination method matching the target resource, includes: Based on one or more of the first determination method, the second determination method, and the third determination method, determine the expected resource limit for the memory when the container runs at the target time; The first determination method is: using the method of determining the limit amount of memory usage by the container during simulated runtime; The second determination method is: a method of determining the quantity by using the available memory space of the node where the container is located; The third determination method is to determine the resource limit by using the frequency of container restarts within a specified historical period.

7. A container resource adjustment device, characterized in that, The device includes: The acquisition module is used to acquire the evaluation index information corresponding to the container. The evaluation index information includes a first sequence composed of first index data corresponding to each historical time, and / or a second sequence composed of second index data corresponding to each historical time. The first index data corresponding to each historical time is used to characterize the actual usage of the target resources by the container when it runs at that historical time, and the second index data corresponding to each historical time is used to characterize the business operation status of the container when it runs at that historical time. The estimation module is used to estimate the expected resource request volume of the container for the target resource when it runs at a target time, based on the evaluation index information. The first adjustment module is used to, when the target time is reached, if it is detected that the container meets the predetermined resource demand adjustment conditions based on the comparison result of the expected resource request amount and the target resource request amount, adjust the first configuration information of the container regarding the target resource according to the expected resource request amount, so that the cloud platform allocates resources for the container regarding the target resource according to the adjusted first configuration information; Wherein, the target resource request amount is the current resource request amount indicated by the first configuration information before adjustment; each historical time is the same specified time in at least one predetermined running cycle corresponding to the container; the target time is the specified time in a future running cycle; when the evaluation index information includes a first sequence, the estimation module is further configured to perform at least one specified mathematical operation on the elements in the first sequence to obtain at least one operation result; based on the operation result, determine the actual demand amount of the container for the target resource when running in the specified time of any running cycle; using the actual demand amount, and the predetermined upper limit and lower limit of expected utilization rate for the target resource, estimate the expected resource request amount of the container for the target resource when running in the target time; when the evaluation index information includes a second sequence, the estimation module is further configured to input the second sequence as input data into a pre-trained resource prediction model to obtain the expected resource request amount of the container for the target resource when running in the target time.

8. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the steps of the method described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method described in any one of claims 1-6.