Container Group Elastic Expansion Method, System, Medium and Device for Container Cloud Platform
By monitoring the resource utilization rate of container applications, generating container group copies and increasing resource usage, the problem of insufficient container group resources in Kubernetes system is solved, rapid capacity expansion and response are achieved, and system reliability is improved.
Patent Information
- Application Number
- CN202210043329.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-14
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2042-01-14
AI Technical Summary
The resource elastic scaling mechanism of container groups in existing Kubernetes systems cannot achieve rapid expansion when the access traffic suddenly increases, resulting in insufficient container application resources and unable to respond to all access traffic normally.
By monitoring the resource usage of container applications, generating container group replicas and increasing the resource usage of container groups, quickly expanding the usable resources of container applications, solving the problem of cold start of container group replicas.
It realizes rapid resource expansion and response of container applications when access traffic increases, avoids the problem of access traffic pressure being unable to be shared due to cold start of container group replicas, and improves the reliability and response capabilities of the system.
Smart Images

Figure CN114385366B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of container cloud, and particularly to a method, system, computer-readable storage medium, and electronic device for elastic expansion of container groups in a container cloud platform. Background Art
[0002] Kubernetes is a container orchestration engine open-sourced by Google, which supports automated deployment, large-scale scalability, and application containerization management. As a typical container cloud platform, the Kubernetes system can automatically deploy and manage applications containerized and deployed in a Kubernetes cluster.
[0003] Among them, scalability is mainly reflected in automatically increasing the resources available to an application when the access traffic of a certain application increases, and automatically decreasing the resources available to the application when the access traffic of the application decreases. Through elastic scaling resource allocation for each application deployed in the Kubernetes cluster, the hardware resources of the Kubernetes cluster are fully utilized.
[0004] Currently, taking the Kubernetes system as an example, the resource elastic scaling of a container cloud platform mainly relies on the Horizontal Pod Autoscaler (HPA) mechanism to adjust the number of replicas of the container group (Pod) that deploys application instances, and then scale the resources available to the application. Specifically, when the access traffic of an application increases, the HPA mechanism increases the resources available to the application by replicating the Pod that deploys the application. However, it takes a period of time from the start of creating the replicated container group to the completion of startup, that is, from the start of creating the container group replica to the application instance deployed in the container group replica being able to respond to the access traffic, which is the "cold start" problem.
[0005] Therefore, when the access traffic of a certain application suddenly increases within a short period of time, the HPA mechanism cannot achieve rapid expansion of the resources available to the application, resulting in insufficient resources available to the application, and the application cannot normally respond to all access traffic.
[0006] Therefore, an improved technical solution is needed to address the deficiencies of the above-mentioned existing technologies. Summary of the Invention
[0007] The purpose of this application is to provide a method, system, computer-readable storage medium, and electronic device for elastic expansion of container groups in a container cloud platform to solve or alleviate the problems existing in the above-mentioned existing technologies.
[0008] To achieve the above purpose, this application provides the following technical solutions:
[0009] The present application provides a method for elastic expansion of a container group in a container cloud platform, including: monitoring the resource utilization rate of the container group where the container application is located; in response to the increase in the resource utilization rate, replicating the container group where the container application is located to generate at least one container group replica; in response to the growth rate of the resource utilization rate reaching a preset threshold, increasing the resource occupancy of the container group where the container application is located.
[0010] Preferably, the container cloud platform is a Kubernetes system. The monitoring of the resource utilization rate of the container group where the container application is located is specifically: the Kubelet component of the Kubernetes system collects the resource utilization rate of the container group where the container application is located and sends it to the Metrics-Server component of the Kubernetes system, and the Metrics-Server component monitors the resource utilization rate.
[0011] Preferably, in response to the increase in the resource utilization rate, replicating the container group where the container application is located to generate at least one container group replica includes: in response to the increase in the resource utilization rate, calculating the number of container group replicas to be generated according to the preset metrics corresponding to the container application; replicating the container group where the container application is located according to the calculated number of container group replicas.
[0012] Preferably, the calculating the number of container group replicas to be generated according to the preset metrics corresponding to the container application in response to the increase in the resource utilization rate includes: in response to the increase in the resource utilization rate, calculating the difference between the increased resource utilization rate and the preset metrics corresponding to the container application; calculating the number of container group replicas to be generated according to the resource demand corresponding to the difference.
[0013] Preferably, the increasing the resource occupancy of the container group where the container application is located in response to the growth rate of the resource utilization rate reaching a preset threshold is specifically: in response to the growth rate of the resource utilization rate reaching a preset threshold, setting the resource occupancy of the container group where the container application is located to increase by at least one time.
[0014] Preferably, the method for elastic expansion of the container group in the container cloud platform further includes: if the remaining available resources of the node where the container group where the container application is located are less than the resource occupancy of the container group where the container application is located, setting the container group where the container application is located to occupy all the remaining available resources of the node where the container group where the container application is located.
[0015] Preferably, after increasing the resource occupancy of the container where the container application is located, it further includes: after at least one of the container group replicas is started, reducing the resource occupancy of the container group where the container application is located.
[0016] The embodiment of the present application also provides a container group elastic expansion system for a container cloud platform, including: a resource monitoring unit configured to monitor the resource utilization rate of the container group where the container application is located; a replication unit configured to replicate the container group where the container application is located in response to an increase in the resource utilization rate to generate at least one container group replica; an expansion unit configured to increase the resource occupancy of the container group where the container application is located in response to the growth rate of the resource utilization rate reaching a preset threshold.
[0017] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and the computer program is the container group elastic expansion method of any one of the above for the container cloud platform.
[0018] The embodiment of the present application also provides an electronic device, including: a memory, a processor, and a program stored in the memory and executable on the processor, and when the processor executes the program, it implements the container group elastic expansion method of any one of the above for the container cloud platform.
[0019] Beneficial effects:
[0020] In the technical solution provided by the present application, the resource utilization rate of the container group where the container application is located is detected. When the resource utilization rate increases, the container group where the container application is located is replicated to generate at least one container group replica, that is, when the access traffic of the container application increases, the container application can quickly expand the available resources by replicating to generate container group replicas; when the growth rate of the resource utilization rate reaches a preset threshold, the resource occupancy of the container group where the container application is located is increased, that is, when the access traffic of the container application increases too fast, the resource occupancy of the container group where the container application is located is increased to achieve a quick response of the container application to the new access traffic after the available resources are expanded. Thereby, it solves the problem that when the access traffic of the container application increases too fast, the newly generated container group replicas cannot share the access traffic pressure due to the "cold start" problem of the container application instances deployed in the container group replicas, and realizes the quick expansion of the available resources of the container application and the quick response of the container application to the new access traffic after the available resources are expanded. Description of the Drawings
[0021] The specification drawings constituting a part of the present application are used to provide a further understanding of the present application. The schematic embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation to the present application. Among them:
[0022] Figure 1A flowchart of a method for elastic expansion of a container group in a container cloud platform provided according to some embodiments of the present application;
[0023] Figure 2 A technical logic diagram of a method for elastic expansion of a container group in a Kubernetes cluster provided according to some embodiments of the present application;
[0024] Figure 3 A structural diagram of a system for elastic expansion of a container group in a container cloud platform provided according to some embodiments of the present application;
[0025] Figure 4 A structural diagram of an electronic device provided according to some embodiments of the present application;
[0026] Figure 5 The hardware structure of an electronic device provided according to some embodiments of the present application. Detailed implementation manners
[0027] The present application will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments. Each example is provided by way of explanation of the present application rather than a limitation of the present application. In fact, those skilled in the art will clearly understand that modifications and variations can be made to the present application without departing from the scope or spirit of the present application. For example, features shown or described as part of one embodiment can be used in another embodiment to yield yet another embodiment. Therefore, it is desirable that the present application includes such modifications and variations that fall within the scope of the appended claims and their equivalents.
[0028] Exemplary method
[0029] Figure 1 A flowchart of a method for elastic expansion of a container group in a container cloud platform provided according to some embodiments of the present application; As Figure 1 shown, the method for elastic expansion of the container group in the container cloud platform includes:
[0030] Step S101, monitor the resource utilization rate of the container group where the container application is located.
[0031] Among them, a container application refers to an application that can run directly in a container, as distinguished from a traditional application that runs directly in an operating system.
[0032] It should be noted that as a new type of virtualization technology, container technology can divide the resources of a single operating system into isolated containers, but traditional applications cannot run directly in containers. Therefore, container applications can be applications directly developed by application developers that can run directly in containers, or they can be applications generated after application developers perform containerization on the developed traditional applications and can run directly in containers. The implementation of containerization for traditional applications can be achieved through various existing solutions, and the embodiments of this application do not limit this.
[0033] In addition, for a container cloud platform taking the Kubernetes system as an example, a pod is the smallest unit created and managed therein. That is to say, the smallest unit that the container cloud platform can operate on is a pod. Therefore, in the embodiments of this application, the resources available for container applications are also expanded in units of pods.
[0034] In the embodiments of this application, container applications are containerized and deployed in a container cloud platform, specifically deployed in at least one pod in the container cloud platform. The Service component provides a unified access entry for all pods deploying the container application instances, and distributes the access traffic of the container application according to the load conditions of each pod. Therefore, the access traffic requesting to access the container application is first forwarded by the entry component of the container cloud platform to the Service component corresponding to the container application, and then the Service component distributes the access traffic to each pod deploying the container application instances.
[0035] In view of the fact that the Service component distributes access traffic based on load balancing, the resource usage conditions of each pod deploying the same container application instance are basically the same. In addition, considering that the resources used by pods are mainly CPU and memory, therefore, by monitoring the resource utilization rates of resources such as CPU and memory actually used when a certain pod deploying this container application is working, the average resource utilization rate of the pods where the container application is located can be obtained.
[0036] It can be understood that when the access traffic of the container application increases, the actual bearers of processing and responding to the access traffic are all the pods where the container application is located, and the resource utilization rates of all the pods where the container application is located will increase. Therefore, by monitoring the resource utilization rates of the pods where the container application is located, the change situation of the access traffic of the container application can be indirectly monitored.
[0037] Specifically, taking the Kubernetes system as an example, when the container cloud platform is the Kubernetes system, the resource utilization rate of the container group where the container application is located is monitored. Specifically, the Kubelet component of the Kubernetes system collects the resource utilization rate of the container group where the container application is located and sends it to the Metrics-Server component of the Kubernetes system, and the Metrics-Server component monitors the resource utilization rate.
[0038] As Figure 2 shown, the Kubernetes system divides the nodes in the Kubernetes cluster (the node cluster where the Kubernetes system is deployed) into control nodes and worker nodes according to different functions. Cluster management-related processes are run on the control nodes to automatically complete resource management, Pod scheduling, elastic scaling, security control, system monitoring, error correction, and other management capabilities of the entire Kubernetes cluster.
[0039] The Kubernetes system installs the Kubelet component on each node in the cluster to manage the container groups deployed on it. Correspondingly, after the container application is containerized and deployed on the nodes in the Kubernetes cluster, the Kubelet component of the Kubernetes system manages the container group where the container application is located. At the same time, the Kubelet component can also collect the resource utilization rate of the resources such as CPU and memory actually used by the container group where the container application is located and send it to the Metrics-Server component.
[0040] It can be understood that multiple container applications can be deployed on each node, and the Kubernetes cluster includes multiple nodes. As the core component of the Kubernetes system, the Metrics-Server component is used to receive the resource usage conditions of all container groups on the nodes reported by the Kubelet components on each node, and perform summary and processing, and provide them for use by other components in the Kubernetes system.
[0041] The Metrics-Server component monitors the resource utilization rate of the resources such as CPU and memory actually used by any container group where the container application is located. Other components in the Kubernetes system can obtain the average resource utilization rate of any container group where the container application is located by accessing the API interface provided by the Metrics-Server.
[0042] Step S102: In response to the increase in the resource utilization rate, replicate the container group where the container application is located to generate at least one container group replica.
[0043] Based on the foregoing description, it can be known that in the embodiments of the present application, when the access traffic of a container application increases, the increased access traffic is distributed by the service components corresponding to the container application to all container groups where the container application is deployed, so that the resource utilization rate of all container groups where the container application is deployed increases. Correspondingly, the average resource utilization rate will also increase.
[0044] When the container cloud platform monitors that the resource utilization rate of a container group where a certain container application is located increases, it indicates that the access traffic of the container application is increasing, and it is necessary to increase the available resources for the container application. Specifically, the container where the container application is located is replicated to generate at least one container group replica. The container group replica generated is deployed with an instance of the container application and will serve as a new container group where the container application is deployed, receive the access traffic distributed by the service components corresponding to the container application, and respond to the access traffic to share the access traffic pressure of the original container group where the container application is located.
[0045] In some alternative embodiments, in response to an increase in the resource utilization rate, replicating the container group where the container application is located to generate at least one container group replica includes: in response to an increase in the resource utilization rate, calculating the number of container group replicas to be generated according to the preset metrics corresponding to the container application, and replicating the container group where the container application is located according to the calculated number of container group replicas.
[0046] It can be understood that in the embodiments of the present application, when replicating the container group where the container application is located, it is necessary to first calculate the number of container replicas to be generated, and then replicate the container group where the container application is located according to the calculated number of container group replicas.
[0047] The embodiments of this solution allow application administrators to pre-set resource utilization rate metrics for container applications, that is, the preset metrics corresponding to the container applications, including but not limited to CPU utilization rate metrics and memory utilization rate metrics. When the resource utilization rate of the container group where the container application is located increases and exceeds the preset metrics corresponding to the container application, at least one container group replica is generated by replication to share the access traffic pressure of the original container group where the container application is located, so that the resource utilization rate of the container group where the container application is located is consistent with the preset metrics.
[0048] Further, in order to restore the resource utilization rate of the container group where the container application is located to the preset metrics, a possible implementation is that in response to an increase in the resource utilization rate, calculating the number of container group replicas to be generated according to the preset metrics corresponding to the container application includes: in response to an increase in the resource utilization rate, calculating the difference between the increased resource utilization rate and the preset metrics corresponding to the container application, and calculating the number of container group replicas to be generated according to the resource demand corresponding to the difference.
[0049] First, calculate the difference between the resource utilization rate of the container group where the container application is located after the access traffic growth and the preset metrics to determine the increased resource utilization rate of a single container group. Then, based on the resource occupancy of a single container group, determine the increased resource usage of a single container group. Next, based on the number of all container groups where the container application is located, determine the overall increased resource demand of the container application after the access traffic growth. Furthermore, based on the resource demand that can be satisfied by a single container group replica, calculate the number of container group replicas to be generated.
[0050] It should be specifically noted that since the relevant processes for maintaining the normal operation of the container group in a single container group and container group replicas also occupy a certain amount of resources, when calculating the number of container group replicas to be generated, this part of resource occupancy needs to be taken into account.
[0051] In the above embodiment, it is necessary to first calculate the number of container group replicas required according to the preset metrics corresponding to the container application, and then copy the container group where the container application is located. In the embodiments of the present application, it is also possible not to calculate the number of required container replicas, but to dynamically copy container group replicas. In some alternative embodiments, in response to the growth of the resource utilization rate, copy the container group where the container application is located to generate at least one container group replica, including: in response to the growth of the resource utilization rate, copy the container group where the container application is located to generate a single container group replica until the resource utilization rate of the container group where the container application is located returns to the preset metrics.
[0052] It can be understood that in the embodiments of the present application, whenever it is monitored that the resource utilization rate of the container application exceeds the preset metrics of the container application, immediately copy and generate a container group replica to share the access traffic pressure of the container group where the original container application is located, so that the resource utilization rate of the container group where the container application is located decreases. If the resource utilization rate of the container application still exceeds the preset metrics of the container application after one copy, continue to copy and generate a container group replica to continue sharing the access traffic pressure until the resource utilization rate of the container group where the container application is located returns to the preset metrics. That is to say, in the embodiments of the present application, the number of required container group replicas is not calculated first, but the container group where the container application is located is directly copied, and the feedback mechanism is used to determine whether to continue copying the container group where the container application is located. Before the resource utilization rate of the container group where the container application is located returns to the preset metrics, the number of container group replicas to be generated cannot be determined.
[0053] Specifically, the Kubernetes system can be taken as an example for illustration. Based on the foregoing description of the background technology, it can be known that the resource elastic scaling of the container cloud platform taking the Kubernetes system as an example mainly relies on the horizontal pod autoscaler mechanism of the container group to adjust the number of container group replicas for deploying application instances, and then scale the resources available to the application.
[0054] As shown Figure 2 in the figure, the embodiment of the present application expands the function of the horizontal pod autoscaler in the Kubernetes system for implementing the horizontal auto-scaling mechanism of pod groups, which is called the pod replica generator, and together with the pod resource occupancy controller and the global controller, serves as an available resource controller module.
[0055] After the application administrator deploys the container application on the nodes in the Kubernetes cluster, the corresponding preset metrics can be set for the container application. The above-mentioned global controller can obtain the resource utilization rate of the pod group where the container application is located by accessing the API interface provided by the Metrics-Server, calculate the number of pod replicas that need to be added according to the corresponding preset metrics of the container application and the resource utilization rate of the pod group where the container application is located, and instruct the RC / Deployment component to replicate the pod group where the container application is located to generate at least one pod replica.
[0056] After the RC / Deployment component replicates the pod group where the container application is located to generate at least one pod replica, the service component corresponding to the container application distributes part of the access traffic to the newly added pod replicas, and the newly added pod replicas share the access traffic pressure of the original pod group where the container application is located.
[0057] That is to say, the pod replica generator is the component that specifically implements the horizontal auto-scaling mechanism of pod groups in the embodiment of the present application. Specifically, when the access traffic of the container application increases, the increased access traffic is distributed by the service component corresponding to the container application to the pod group where the container application is deployed, so that the resource utilization rate of the pod group where the container application is located increases. The pod replica generator instructs the RC / Deployment component to replicate the pod group where the container application is deployed, and the service component distributes part of the access traffic to the newly added pod replicas, so that the resource utilization rate of the pod group where the container application is deployed is restored to the pre-set resource utilization rate index. Similarly, when the access traffic of the container application decreases, the pod replica generator will instruct the RC / Deployment component to delete at least one replica of the pod group where the container application is located, which will not be elaborated here one by one.
[0058] Step S103: In response to the growth rate of the resource utilization rate reaching a preset threshold, increase the resource occupancy of the pod group where the container application is located.
[0059] Among them, the preset threshold can be manually set by the application administrator, or can be automatically generated and dynamically adjusted after analyzing the historical data of the resource utilization rate. The embodiment of the present application does not limit this.
[0060] It can be understood that based on the description of the background technology, it is known that from the start of creation to the completion of startup of at least one copy of the container group generated by replicating the container group where the container application is located, it takes a period of time to respond to access traffic, that is, there is a "cold start" problem. The container application instances deployed in the container group copies cannot share the access traffic pressure. Before the newly generated container group copies complete startup, the resource utilization rate of the container group where the original container application is located will continuously increase, affecting the processing and response capabilities of the container application to access traffic.
[0061] Therefore, in the case of too rapid growth of access traffic, it is urgent to increase the available resources of the container application in a short period of time to enhance the processing and response capabilities of the container application to access traffic.
[0062] Based on this, when it is monitored that the growth rate of the resource utilization rate of the container group where the container application is located reaches a preset threshold, that is, the access traffic of the container application grows too fast, it is necessary to increase the resource occupancy of the container group where the container application is located to achieve the expansion of the available resources of the existing container group, so as to increase the available resources of the entire container application, thereby enhancing the processing and response capabilities of the container application to access traffic.
[0063] Based on this, the embodiment of the present application realizes the expansion of the available resources of the existing container group by increasing the resource occupancy of the container group where the container application is located. Specifically, a larger resource limit value is set for the container group where the container application is located, so that the existing container group can increase the available resources without restarting.
[0064] In some optional embodiments, in response to the growth rate of the resource utilization rate reaching the preset threshold, increasing the resource occupancy of the container group where the container application is located is specifically: in response to the growth rate of the resource utilization rate reaching the preset threshold, set the resource occupancy of the container group where the container application is located to increase by at least one time.
[0065] In the embodiment of the present application, in the case where the access traffic grows rapidly and the replicated container group copies have not been fully started, by increasing the resource occupancy of the container group where the container application is located, that is, setting a larger resource limit value for the container group where the container application is located. For example, setting the resource limit value of the container group where the container application is located to 2 times the current resource limit value, the rapid expansion of the available resources of the container application is realized, enabling the container application to quickly respond to the new access traffic.
[0066] It should be noted that when the growth rate of the resource utilization rate reaches the preset threshold, it indicates that the expansion of the available resources of the container application is imminent. Therefore, it is necessary to set the resource occupancy of the container group where the container application is located to increase by at least one time, that is, at least become twice the current resource limit value, to prevent the container application from malfunctioning due to insufficient available resources.
[0067] Further, if the remaining available resources of the node where the container group to which the container application belongs are less than the resource occupancy of the container group to which the container application belongs, then set the container group to which the container application belongs to occupy all the remaining available resources of the node where the container group to which the container application belongs.
[0068] In a special case, the remaining available resources of the node where the container group to which the container application belongs are insufficient, that is, the remaining available resources of the node are less than the current resource limit value. At this time, all the remaining available resources of the node can be allocated to the container application for use, but the set resource limit value cannot exceed the sum of the remaining available resources of the node and the current resource limit value, to prevent the container application from being rescheduled to other nodes in the Kubernetes system, resulting in the container application being unavailable for a period of time due to rescheduling.
[0069] In some alternative embodiments, after increasing the resource occupancy of the container group to which the container application belongs, it further includes: when at least one container group replica has been started, reducing the resource occupancy of the container group to which the container application belongs.
[0070] In the embodiments of the present application, the Kubelet component of the Kubernetes system can detect whether the container group replica has been started. When the replicated container group replica has been fully started, the newly generated container group replica can respond to access traffic. At this time, the resource limit value of the original container group to which the container application belongs can be restored, avoiding concentrating the available resources and the failure risk of the entire container application on a single container group, effectively preventing the failure and collapse of the entire container application caused by the failure of a single container group, and reducing the risk factor during the operation of the entire container application.
[0071] Specifically, the Kubernetes system can be used as an example for illustration. As Figure 2 shown, in the embodiments of the present application, a container group resource occupancy controller is added to the Kubernetes system to set the resource occupancy of the container group to which the container application belongs. The container group resource occupancy controller, together with the global controller and the container group replica generator, forms an available resource controller module.
[0072] The global controller obtains the resource usage of the container group to which the container application belongs by accessing the API interface provided by the Metrics-Server, and calculates the resource limit value suitable for the container group to which the container application belongs based on this. The container group resource occupancy controller sets the calculated resource limit value for the container group to which the container application belongs, thereby realizing the elastic scaling of the resources of the container group to which the container application belongs.
[0073] When the access traffic of a container application increases, the container group resource occupancy controller increases the resource limit value of the container group where the container application is located to increase the resources available to the container application. However, when the resource limit value of a single container group is too large, although the purpose of increasing the resources available to the container application can be achieved, the access traffic distributed to this single container group will be very large. Once this single container group fails, the impact on the entire container application's response to access traffic will also be very large. In addition, there are also performance bottlenecks in a single container group itself. When the access traffic of a single container group is too large, the uncertainty and crash risk of the entire system are greatly increased. Therefore, after the container group replicas are started up, it is necessary to reduce the resource limit value of the container group where the container application is located to reduce the aforementioned risks, and specifically, it can be restored to the original value.
[0074] Further, in the embodiments of the present application, the resource limit value of the container group where the container application is located is determined according to the historical resource usage data of the container group where the container application is located. Specifically, the historical data of multiple resource limit value adjustments of the container group where the container application is located is collected, and the optimal resource occupancy (resource limit value) setting of a single container group is determined under the condition of the same total resource amount, so that all container groups can respond to the most access traffic under the condition of a certain total resource amount.
[0075] Based on the foregoing description, it can be known that the resources available for use by the container groups in the embodiments of the present application are mainly CPU and memory. By setting different resource limit values for CPU and memory, the same total resource amount is allocated to different numbers of container groups, and the optimal resource occupancy setting is obtained by combining different resource limit values.
[0076] To more clearly illustrate the container group elastic expansion method of the container cloud platform proposed in the embodiments of the present application, the following takes the Kubernetes system as an example for an overall description.
[0077] As Figure 2 shown, in the Kubernetes system, an available resource controller module is set up to implement the container group elastic expansion method of the container cloud platform proposed in the embodiments of the present application. The available resource controller module includes three components: a global controller, a container group replica generator, and a container group resource occupancy controller. The container group replica generator is used to automatically scale the number of container group replicas that deploy container application instances according to the resource usage of the container group where the container application is located. The container group resource occupancy controller is used to automatically adjust the resource limit value of the container group where the container application is located according to the resource usage of the container group where the container application is located.
[0078] Specifically, after the application is containerized and deployed on the Kubernetes cluster, the application administrator can preset the resource utilization metrics, that is, the preset metrics corresponding to the container application, including but not limited to the CPU utilization metric and the memory utilization metric. The Metrics-Server monitors the resource usage of CPU, memory and other resources actually used by all container groups deploying the application. The global controller indirectly monitors the change of the access traffic of the container application by accessing the API interface provided by the Metrics-Server to obtain the resource usage in the containers where the container application is deployed.
[0079] When the access traffic of the container application increases rapidly, the container group replica generator adjusts the number of container groups where the container application is located to expand the resources available to the container application. The container group resource occupancy controller expands the resources available to the container application by setting the resource limit value for the container group where the container application is located.
[0080] Furthermore, by deploying a global controller in the Kubernetes cluster, collecting the historical data of multiple resource limit value adjustments of the container group where the container application is located by accessing the API interface provided by the Metrics-Server, and calculating the optimal resource limit value of the container group where the container application is located based on this, the container group resource occupancy controller sets the optimal resource limit value for the container group where the container application is located, so as to achieve the optimal utilization of resources of the container group where the container application is located.
[0081] In the embodiment of the present application, global control is performed by deploying a global controller in the Kubernetes cluster to achieve elastic expansion of the resources of the container group where the container application is located, solving the problem that when the access traffic of the container application grows too fast, the newly generated container group replicas cannot share the access traffic pressure due to the "cold start" problem, realizing the rapid expansion of the resources available to the container application and the rapid response of the container application to the new access traffic after the expansion of the available resources, and improving the system reliability.
[0082] In the embodiment of the present application, the Metrics-Server component obtains the resource usage of all container groups of all nodes through the Kubelet component of each node, including but not limited to the real-time usage of CPU and memory resources of the container group. The global controller in the available resource controller module analyzes the resource utilization rate of the container group where the container application is located collected by the Metrics-Server component, determines whether it is necessary to expand the resources available to the container application, and instructs the container group replica generator and the container group resource occupancy controller to perform the expansion operation.
[0083] At this time, the pod group replica generator calculates the number of pod group replicas that need to be added based on the pre-set resource utilization rate metric and the resource utilization rate of the pod group where the container application is located, and instructs the RC / Deployment component to replicate the pod group where the container application is located to generate at least one pod group replica. At the same time, the pod group resource occupancy controller sets the resource limit value of the pod group where the container application is located to increase by at least one time. It should be noted that if the remaining available resources of the node where the pod group where the container application is located are insufficient, that is, the remaining available resources of the node are less than the current resource limit value, the resource limit value is set to the sum of the current resource limit value and the remaining available resources of the node.
[0084] Here it needs to be pointed out that if the global controller in the available resource controller module analyzes the resource utilization rate of the pod group where the container application is located collected by the Metrics-Server component and detects that the resource utilization rate of a certain pod group where the container application is located shows a slow growth situation, only the pod group horizontal auto-scaling mechanism needs to be relied on to expand the resources of this pod group, that is, the pod group replica generator calculates the number of pod group replicas that need to be added according to the pre-set resource utilization rate metric and the resource utilization rate of the pod group where the container application is located, and instructs the RC / Deployment component to replicate the pod group where the container application is located to generate at least one pod group replica. The pod group resource occupancy controller does not need to perform any operations.
[0085] In a specific application scenario, in the Kubernetes cluster, the resources that a single pod group can use are 1 unit of CPU and 1G of memory, and it can respond to 100 units of access traffic. Usually, the access traffic of the container application is 1000 units, and 10 pod groups are required to respond.
[0086] When the access traffic suddenly increases to 10,000 units in a short period of time, if only the pod group horizontal auto-scaling mechanism is used to expand the resources of the pod group where the container application is located, the number of pod groups where the container application is located needs to be increased to 100. The newly added 90 pod group replicas cannot be started immediately due to the "cold start" problem. Before the pod group replicas are started, the container application can only respond normally to 1000 units of access traffic, and the remaining 9000 units of access traffic cannot be responded to normally.
[0087] When the access traffic suddenly increases to 10,000 units in a short period of time, if only the method of increasing the resource occupancy of the pod group is used to expand the resources of the pod group where the container application is located, the resources that the pod group where the container application is located can use need to be increased to 10 units of CPU and 10G of memory. The resources used by a single pod group are too large, and the failure of a single pod group will affect 1000 units of access traffic.
[0088] To overcome the drawbacks of the above two capacity expansion methods, when the access traffic suddenly increases to 10,000 units within a short period of time, while increasing the resources available to the container group where a single container application is located to 10 units of CPU and 10G of memory, 90 replicas of the container group are created and run. When the newly added 90 replicas of the container group are successfully started and can respond to the access traffic, the resources available to the container group where the original 10 container applications are located are reduced to 1 unit of CPU and 1G of memory. Ultimately, all 100 container groups or replicas of the container group with 1 unit of CPU and 1G of memory as the available resources can respond to the access traffic, and the "cold start" problem existing in the horizontal auto-scaling mechanism of the container group is avoided.
[0089] Exemplary system
[0090] Figure 3 FIG. is a schematic structural diagram of a container group elastic capacity expansion system of a container cloud platform according to some embodiments of the present application; as Figure 3 shown, the container group elastic capacity expansion system of the container cloud platform includes: a resource monitoring unit 301 configured to monitor the resource utilization rate of the container where the container application is located; a replication unit 302 configured to replicate the container where the container application is located in response to an increase in the resource utilization rate to generate at least one container replica; an expansion unit 303 configured to increase the resource occupancy of the container where the container application is located in response to the resource utilization rate increase reaching a preset threshold.
[0091] The container group elastic capacity expansion system of the container cloud platform provided by the embodiments of the present application can implement the steps and processes of the container group elastic capacity expansion method of the container cloud platform in any of the above embodiments and achieve the same technical effects, which will not be elaborated here one by one.
[0092] Exemplary device
[0093] Figure 4 FIG. is a schematic structural diagram of an electronic device according to some embodiments of the present application; as Figure 4 shown, the electronic device includes:
[0094] One or more processors 401;
[0095] A computer-readable medium that can be configured to store one or more programs 402. When one or more processors 401 execute the one or more programs 402, the following steps are implemented: monitoring the resource utilization rate of the container where the container application is located; replicating the container where the container application is located in response to an increase in the resource utilization rate to generate at least one container replica; increasing the resource occupancy of the container where the container application is located in response to the growth rate of the resource utilization rate reaching a preset threshold.
[0096] Figure 5 The hardware structure of an electronic device provided according to some embodiments of the present application is as follows Figure 5 As shown, the hardware structure of the electronic device may include: a processor 501, a communication interface 502, a computer-readable medium 503, and a communication bus 504.
[0097] Among them, the processor 501, the communication interface 502, and the computer-readable medium 503 complete communication with each other through the communication bus 504.
[0098] Optionally, the communication interface 502 may be an interface of a communication module, such as an interface of a GSM module.
[0099] Among them, the processor 501 may be specifically configured to: monitor the resource utilization rate of the container where the container application is located; in response to an increase in the resource utilization rate, replicate the container where the container application is located to generate at least one container replica; in response to the growth rate of the resource utilization rate reaching a preset threshold, increase the resource occupancy of the container where the container application is located.
[0100] The processor 501 may be a general-purpose processor, including a central processing unit (CPU for short), a network processor (NP for short), etc. It may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0101] The electronic device in the embodiments of the present application exists in various forms, including but not limited to:
[0102] (1) Mobile communication devices: These devices are characterized by having mobile communication functions and mainly aim to provide voice and data communication. Such terminals include: smart phones (e.g., iPhone), multimedia phones, functional phones, and low-end phones, etc.
[0103] (2) Ultra-mobile personal computer devices: These devices belong to the category of personal computers, have computing and processing functions, and generally also have the characteristic of mobile Internet access. Such terminals include: PDAs, MIDs, and UMPC devices, etc., such as iPad.
[0104] (3) Portable entertainment devices: Such devices can display and play multimedia content. This type of device includes: audio and video players (e.g., iPod), handheld game consoles, e-books, as well as smart toys and portable in-vehicle navigation devices.
[0105] (4) Servers: Devices that provide computing services. The composition of a server includes a processor, hard disk, memory, system bus, etc. Servers are similar to general computer architectures, but due to the need to provide highly reliable services, they have higher requirements in terms of processing power, stability, reliability, security, scalability, manageability, etc.
[0106] (5) Other electronic devices with data interaction functions.
[0107] It should be noted that according to the needs of implementation, each component / step described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present application.
[0108] The methods according to the embodiments of the present application can be implemented in hardware, firmware, or be implemented as software or computer code that can be stored in a recording medium (such as a CD ROM, RAM, floppy disk, hard disk, or magneto-optical disk), or be implemented as computer code that is originally stored in a remote recording medium or a non-transitory machine storage medium and downloaded through a network and will be stored in a local recording medium. Thus, the methods described herein can be stored in such software processing on a recording medium using a general computer, a dedicated processor, or programmable or dedicated hardware (such as an ASIC or FPGA). It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the elastic expansion method of the container group of the container cloud platform described herein is implemented. In addition, when a general computer accesses the code for implementing the method shown herein, the execution of the code converts the general computer into a dedicated computer for executing the method shown herein.
[0109] Those of ordinary skill in the art can realize that the units and method steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application of the technical solution and the involved constraints. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present application.
[0110] It should be noted that the various embodiments in this specification are described in a progressive manner. For the same or similar parts among the various embodiments, reference can be made to each other, and the key point of each embodiment is to illustrate the differences from other embodiments. In particular, for the device and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the corresponding descriptions in the method embodiments. The device and system embodiments described above are only illustrative. The units described as separate components may or may not be physically separated, and the components indicated as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative efforts.
[0111] The above are only the preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the protection scope of the present application.
[0112] The above are only the preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the protection scope of the present application.
Claims
1. A method for elastic expansion of container groups in a container cloud platform, characterized in that, Including: Monitoring the resource utilization rate of the container group where the container application is located; In response to the increase in the resource utilization rate, replicating the container group where the container application is located to generate at least one container group replica; In response to the growth rate of the resource utilization rate reaching a preset threshold, increasing the resource occupancy of the container group where the container application is located by directly increasing the resource occupancy value of the container group where the container application is located. At the same time, creating and running the container group replica; when the container group replica starts up and can respond to access traffic, reducing the resource occupancy of the container group where the container application is located; In response to the growth rate of the resource utilization rate not reaching the preset threshold, relying on the horizontal pod autoscaler mechanism of the container group to expand the resources of the container group.
2. The method for elastic expansion of a container group in the container cloud platform according to claim 1, characterized in that, The container cloud platform is a Kubernetes system. The monitoring of the resource utilization rate of the container group where the container application is located is specifically as follows: The Kubelet component of the Kubernetes system collects the resource utilization rate of the container group where the container application is located and sends it to the Metrics-Server component of the Kubernetes system, and the Metrics-Server component monitors the resource utilization rate.
3. The method for elastic expansion of a container group in a container cloud platform according to claim 1, characterized in that, In response to the increase in the resource utilization rate, replicating the container group where the container application is located to generate at least one container group replica, including: In response to the increase in the resource utilization rate, calculating the number of the container group replicas to be generated according to the preset metrics corresponding to the container application; Replicating the container group where the container application is located according to the calculated number of the container group replicas.
4. The method for elastic expansion of a container group in a container cloud platform according to claim 3, wherein, The calculating the number of the container group replicas to be generated according to the preset metrics corresponding to the container application in response to the increase in the resource utilization rate includes: In response to the increase in the resource utilization rate, calculating the difference between the increased resource utilization rate and the preset metrics corresponding to the container application; Calculating the number of the container group replicas to be generated according to the resource demand corresponding to the difference.
5. The method for elastic expansion of a container group in a container cloud platform according to claim 1, wherein, The increasing the resource occupancy of the container group where the container application is located in response to the growth rate of the resource utilization rate reaching the preset threshold is specifically as follows: In response to the growth rate of the resource utilization rate reaching the preset threshold, setting the resource occupancy of the container group where the container application is located to increase by at least one time.
6. The method for elastic expansion of a container group in a container cloud platform according to claim 5, wherein, The method for elastic expansion of the container group of the container cloud platform further includes: If the remaining available resources of the node where the container group where the container application is located are less than the resource occupancy of the container group where the container application is located, setting the container group where the container application is located to occupy all the remaining available resources of the node where the container group where the container application is located.
7. A container group elastic expansion system for a container cloud platform, characterized in that, Including: A resource monitoring unit configured to monitor the resource utilization rate of the container group where the container application is located; A replication unit configured to replicate the container group where the container application is located in response to the increase in the resource utilization rate to generate at least one container group replica; The expansion unit is configured to, in response to the growth rate of the resource utilization rate reaching a preset threshold, increase the resource occupancy of the container group where the container application is located by directly increasing the resource occupancy value of the container group where the container application is located. At the same time, create and run a replica of the container group; when the startup of the container group replica is completed and it can respond to access traffic, reduce the resource occupancy of the container group where the container application is located. In response to the growth rate of the resource utilization rate not reaching the preset threshold, rely on the horizontal pod autoscaler mechanism of the container group to expand the resources of the container group.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, The computer program is the method for elastic expansion of a container group of the container cloud platform according to any one of claims 1-6.
9. An electronic device, characterized in that, It includes: A memory, a processor, and a program stored in the memory and executable on the processor. When the processor executes the program, it implements the method for elastic expansion of a container group of the container cloud platform according to any one of claims 1-6.
Citation Information
Patent Citations
Container service resource dynamic capacity expansion method, system and device and storage medium
CN113032153A
Computing resource capacity expansion method and device, electronic equipment and readable storage medium
CN113254224A
Container cloud elastic scaling method and device
CN113395178A
Method for balanced scale out of resources in distributed and collaborative container platform environment
US20210149745A1